code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/usr/local/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.lo...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/local/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.lo...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
module DefaultMapping include Hobo::DefineTags mapping_tags do panel.advert >> panel.green end end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def site_title if info = Info.find(:first) info.site_title else "Change Me" end end def site_header if info = Info.find(:first) info.site_header end end end
Ruby
module TaskKindsHelper end
Ruby
module InfosHelper end
Ruby
module LogsHelper end
Ruby
module RolesHelper end
Ruby
module UsersHelper end
Ruby
module TaskStatusesHelper end
Ruby
module RoleRightsHelper end
Ruby
module TasksHelper end
Ruby
module ProjectsHelper end
Ruby
module AssignmentsHelper end
Ruby
module UserRolesHelper end
Ruby
module RightsHelper end
Ruby
module FrontHelper end
Ruby
class Info < ActiveRecord::Base hobo_model # --- Hobo Permissions --- # def creatable_by?(creator) false end def updatable_by?(updater, new) false end def deletable_by?(deleter) false end def viewable_by?(viewer, field) true end end
Ruby
class UserRole < ActiveRecord::Base hobo_model belongs_to :user belongs_to :role # --- Hobo Permissions --- # def creatable_by?(creator) false end def updatable_by?(updater, new) false end def deletable_by?(deleter) false end def viewable_by?(viewer, field) true end en...
Ruby
class RoleRight < ActiveRecord::Base hobo_model belongs_to :role belongs_to :right # --- Hobo Permissions --- # def creatable_by?(creator) false end def updatable_by?(updater, new) false end def deletable_by?(deleter) false end def viewable_by?(viewer, field) true end ...
Ruby
class Right < ActiveRecord::Base hobo_model has_many :role_rights has_many :roles, :through => :role_rights # --- Hobo Permissions --- # def creatable_by?(creator) false end def updatable_by?(updater, new) false end def deletable_by?(deleter) false end def viewable_by?(viewer...
Ruby
class TaskKind < ActiveRecord::Base hobo_model has_many :tasks # --- Hobo Permissions --- # def creatable_by?(creator) false end def updatable_by?(updater, new) false end def deletable_by?(deleter) false end def viewable_by?(viewer, field) true end end
Ruby
class Log < ActiveRecord::Base hobo_model belongs_to :user belongs_to :task # --- Hobo Permissions --- # def creatable_by?(creator) true end def updatable_by?(updater, new) true end def deletable_by?(deleter) false end def viewable_by?(viewer, field) true end end
Ruby
class Assignment < ActiveRecord::Base hobo_model belongs_to :user belongs_to :task validates_presence_of :user validates_presence_of :task # --- Hobo Permissions --- # def creatable_by?(creator) true end def updatable_by?(updater, new) true end def deletable_by?(deleter) fal...
Ruby
class Guest def display_name "Guest" end def guest? true end def super_user? false end def administrator? false end def can_update?(obj, field) false end def can_delete?(obj) false end def can_create?(obj) false end def can_view?(obj, field) true ...
Ruby
class User < ActiveRecord::Base hobo_model include Hobo::AuthenticatedUser has_many :assignments has_many :tasks, :through => :assignments has_many :logs has_many :user_roles has_many :roles, :through => :user_roles set_login_attr :username alias_attribute :display_name, :username # --- ...
Ruby
class Project < ActiveRecord::Base hobo_model has_many :tasks belongs_to :user belongs_to :owner, :class_name => "User", :foreign_key => "owner_id" set_creator_attr :user # --- Hobo Permissions --- # def creatable_by?(creator) creator == user and creator.administrator? end def updatab...
Ruby
class Task < ActiveRecord::Base after_save :add_log hobo_model has_many :assignments has_many :users, :through => :assignments has_many :logs belongs_to :project belongs_to :task_kind belongs_to :task_status belongs_to :owner, :class_name => "User", :foreign_key => "owner_id" belongs_to :use...
Ruby
class Role < ActiveRecord::Base hobo_model has_many :user_roles has_many :users, :through => :user_roles has_many :role_rights has_many :rights, :through => :role_rights # --- Hobo Permissions --- # def creatable_by?(creator) false end def updatable_by?(updater, new) false end def...
Ruby
class TaskStatus < ActiveRecord::Base hobo_model has_many :tasks # --- Hobo Permissions --- # def creatable_by?(creator) false end def updatable_by?(updater, new) false end def deletable_by?(deleter) false end def viewable_by?(viewer, field) true end end
Ruby
class RoleRightsController < ApplicationController hobo_model_controller end
Ruby
class RightsController < ApplicationController hobo_model_controller end
Ruby
class TaskStatusesController < ApplicationController hobo_model_controller end
Ruby
class LogsController < ApplicationController hobo_model_controller def create @this = Log.create(params[:log]) respond_to do |format| format.html { redirect_to log_path(@this)} format.js do render :update do |page| page.insert_html :bottom, 'log_holder', "<div class='log_...
Ruby
class ProjectsController < ApplicationController hobo_model_controller def show @this = Project.find(params[:id]) @dates = Array.new for date in @this.tasks.find(:all) @dates << date.due_date.day if date.due_date end end end
Ruby
class FrontController < ApplicationController hobo_controller filter_parameter_logging "password" def index @projects = Project.find(:all) end def search if request.post? site_search(params[:query]) end end def login return unless request.post? user = Hobo.user_model.aut...
Ruby
class RolesController < ApplicationController hobo_model_controller end
Ruby
class TasksController < ApplicationController hobo_model_controller def create @this = Task.create(params[:task]) respond_to do |format| format.html { redirect_to task_path(@this)} format.js do render :update do |page| page.insert_html :bottom, 'task_rows', "<tr class='list...
Ruby
class AssignmentsController < ApplicationController hobo_model_controller end
Ruby
class UsersController < ApplicationController hobo_model_controller end
Ruby
class InfosController < ApplicationController hobo_model_controller end
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base # Pick a unique cookie name to distinguish our session data from others' session :session_key => '_communicat...
Ruby
class UserRolesController < ApplicationController hobo_model_controller end
Ruby
class TaskKindsController < ApplicationController hobo_model_controller end
Ruby
ActionController::Routing::Routes.draw do |map| map.search 'search', :controller => 'front', :action => 'search' map.homepage '', :controller => 'front', :action => 'index' map.login 'login', :controller => 'front', :action => 'login' map.logout 'logout', :controller => 'front', :action => 'logout' map...
Ruby
# This defines a deployment "recipe" that you can feed to capistrano # (http://manuals.rubyonrails.com/read/book/17). It allows you to automate # (among other things) the deployment of your application. require 'mongrel_cluster/recipes' # ============================================================================= #...
Ruby
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb unless defined?(RAILS_ROOT) root_path = File.join(File.dirname(__FILE__), '..') unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end ...
Ruby
# Be sure to restart your web server when you modify this file. # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present #RAILS_GEM_VERSION...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Use a different logger for distributed setups # config.logger = SyslogLogger.new # Full error repor...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.ca...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between...
Ruby
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails'
Ruby
# ============================================================================= # A set of rake tasks for invoking the Capistrano automation utility. # ============================================================================= # Invoke the given actions via Capistrano def cap(*parameters) begin require 'rubyg...
Ruby
class CreateProjects < ActiveRecord::Migration def self.up create_table :projects do |t| t.string :name t.datetime :time t.auto_dates t.string :location t.text :description t.text :details t.integer :user_id t.integer :owner_id end end def self.down dro...
Ruby
class CreateTaskStatuses < ActiveRecord::Migration def self.up create_table :task_statuses do |t| t.string :name t.text :description end end def self.down drop_table :task_statuses end end
Ruby
class AddAdministratorFlag < ActiveRecord::Migration def self.up add_column "users", :administrator, :boolean end def self.down remove_column "users", :administrator end end
Ruby
class CreateAssignments < ActiveRecord::Migration def self.up create_table :assignments do |t| t.integer :task_id t.integer :user_id end end def self.down drop_table :assignments end end
Ruby
class AddSessions < ActiveRecord::Migration def self.up create_table :sessions do |t| t.column :session_id, :string t.column :data, :text t.column :updated_at, :datetime end add_index :sessions, :session_id add_index :sessions, :updated_at end def self.down drop_table :sess...
Ruby
class CreateTaskKinds < ActiveRecord::Migration def self.up create_table :task_kinds do |t| t.string :name end end def self.down drop_table :task_kinds end end
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :username t.string :crypted_password, :salt, :limit => 40 t.string :remember_token t.datetime :remember_token_expires_at t.auto_dates end end def self.down drop_table :users...
Ruby
class CreateTasks < ActiveRecord::Migration def self.up create_table :tasks do |t| t.integer :owner_id t.string :name t.text :instructions t.datetime :run_through t.datetime :due_date t.auto_dates t.integer :task_status_id t.integer :task_kind_id t.integer :user_id t.intege...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class Test::Unit::TestCase # Transactional fixtures accelerate your tests by wrapping each test method # in a transaction that's rolled back on completion. This ensures that the # test datab...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/local/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.lo...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/local/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.lo...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby