code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/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/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/process/inspector'
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/reaper'
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/destroy'
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/server'
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/plugin'
Ruby
class CreateEvents < ActiveRecord::Migration def self.up create_table :events do |t| t.string :event_type, :name, :description, :meeting_place, :contact, :contact_phone, :address, :city, :state, :zip t.integer :approved, :max_attendees t.float :hours t.datetime :date t.references :mi...
Ruby
class RedoMemberFields < ActiveRecord::Migration def self.up remove_column :members, :branch remove_column :members, :stored_committees remove_column :members, :stored_potential_committees remove_column :members, :stored_flex_points remove_column :members, :stored_potential_flex_points add_col...
Ruby
class AddToAttendanceRecord < ActiveRecord::Migration def self.up add_column :attendance_records, :driver, :boolean, :default => false add_column :attendance_records, :family, :boolean, :default => false add_column :events, :approved, :boolean, :default => false end def self.down remove_colu...
Ruby
class WaitList < ActiveRecord::Migration def self.up add_column :attendance_records, :waitlist, :integer, :default => 0 end def self.down remove_column :attendance_records, :waitlist end end
Ruby
class MembersPotentialCache < ActiveRecord::Migration def self.up add_column :members, :stored_potential_service_hours, :float, :default => 0 add_column :members, :stored_potential_fellowships, :integer, :default => 0 add_column :members, :stored_potential_leaderships, :integer, :default => 0 add_colu...
Ruby
class CreateTopics < ActiveRecord::Migration def self.up create_table :forum_topics do |t| t.string :name t.timestamps end end def self.down drop_table :forum_topics end end
Ruby
class CreatePositions < ActiveRecord::Migration def self.up create_table :positions do |t| t.string :name, :description t.datetime :semester t.references :member t.timestamps end end def self.down drop_table :positions end end
Ruby
class RequireDriver < ActiveRecord::Migration def self.up add_column :events, :drivers, :integer, :default => 0 end def self.down remove_column :events, :drivers end end
Ruby
class Branch < ActiveRecord::Migration def self.up add_column :events, :branch_points, :integer, :default => 0 end def self.down remove_column :events, :branch_points end end
Ruby
class RedoPositionsFields < ActiveRecord::Migration def self.up remove_column :positions, :semester remove_column :positions, :description remove_column :positions, :name add_column :positions, :semester_index, :integer add_column :positions, :position, :integer end def self.down remove_c...
Ruby
class RemoveBranch < ActiveRecord::Migration def self.up remove_column :events, :branch_points end def self.down add_column :events, :branch_points, :integer, :default => 0 end end
Ruby
class Src < ActiveRecord::Migration def self.up add_column :members, :signed_src, :boolean, :default => false end def self.down remove_column :members, :signed_src end end
Ruby
class MembersCache < ActiveRecord::Migration def self.up add_column :members, :stored_service_hours, :float, :default => 0 add_column :members, :stored_fellowships, :integer, :default => 0 add_column :members, :stored_leaderships, :integer, :default => 0 add_column :members, :stored_fundraisers, :inte...
Ruby
class ServiceBackToInt < ActiveRecord::Migration def self.up remove_column :members, :service_back_completed add_column :members, :service_back_completed, :integer, :default => 0 end def self.down remove_column :members, :service_back_completed add_column :members, :service_back_completed, :boole...
Ruby
class ServiceBackTotal < ActiveRecord::Migration def self.up add_column :members, :service_back_total, :integer, :default => 0 end def self.down remove_column :members, :service_back_total end end
Ruby
class UpdateAttendance < ActiveRecord::Migration def self.up remove_column :attendance_records, :family add_column :attendance_records, :attended, :boolean, :default => true end def self.down add_column :attendance_records, :family, :boolean, :default => false remove_column :attendance_records, :...
Ruby
class Announcements < ActiveRecord::Migration def self.up create_table :announcements do |t| t.string :message, :name t.integer :type t.datetime :date t.timestamps end end def self.down drop_table :announcements end end
Ruby
class StoredBranchPoints < ActiveRecord::Migration def self.up create_table :branch_points do |t| t.integer :alpha, :phi, :omega, :semester end end def self.down drop_table :branch_points end end
Ruby
class PercentDoneMigration < ActiveRecord::Migration def self.up add_column :members, :stored_percent_done, :float, :default => 0 end def self.down remove_column :members, :stored_percent_done end end
Ruby
class TotalHoursToFloat < ActiveRecord::Migration def self.up remove_column :members, :stored_total_hours add_column :members, :stored_total_hours, :float, :default => 0 end def self.down remove_column :members, :stored_total_hours add_column :members, :stored_total_hours, :tinyint, :default => 0...
Ruby
class CreateMembers < ActiveRecord::Migration def self.up create_table :members do |t| t.string :first_name, :last_name, :username, :password, :email, :phone_number t.string :permanent_address_one, :permanent_address_two, :permanent_city, :permanent_state, :permanent_zip t.string :school_address...
Ruby
class Tokens < ActiveRecord::Migration def self.up create_table :tokens do |t| t.string :category, :data t.timestamps end end def self.down drop_table :tokens end end
Ruby
class EventFull < ActiveRecord::Migration def self.up add_column :events, :full, :boolean, :default => false end def self.down remove_column :events, :full end end
Ruby
class DropBranch < ActiveRecord::Migration def self.up drop_table :branch_points end def self.down create_table :branch_points do |t| t.integer :alpha, :phi, :omega, :semester end end end
Ruby
class RemovePerfectAttendance < ActiveRecord::Migration def self.up remove_column :members, :dues_on_time remove_column :members, :perfect_attendance end def self.down add_column :members, :dues_on_time, :tinyint, :default => 0 add_column :members, :perfect_attendance, :boolean, :default => false...
Ruby
class RedoAnnouncements < ActiveRecord::Migration def self.up drop_table :announcements create_table :announcements do |t| t.string :message t.boolean :admin t.references :member t.timestamps end end def self.down drop_table :announcements end end
Ruby
class DeleteFix < ActiveRecord::Migration def self.up add_column :events, :deleted, :boolean, :default => false add_column :members, :deleted, :boolean, :default => false add_column :attendance_records, :deleted, :boolean, :default => false end def self.down remove_column :events, :deleted re...
Ruby
class BranchPoints < ActiveRecord::Migration def self.up create_table :branch_points do |t| t.integer :alpha, :phi, :omega, :semester end add_column :events, :branch_points, :integer, :default => 0 add_column :members, :branch, :integer end def self.down remove_column :events, :branch_p...
Ruby
class CreatePledgeClasses < ActiveRecord::Migration def self.up create_table :pledge_classes do |t| t.string :name t.datetime :semester t.timestamps end end def self.down drop_table :pledge_classes end end
Ruby
class CreateThreads < ActiveRecord::Migration def self.up create_table :forum_threads do |t| t.string :subject t.references :topic, :author t.timestamps end end def self.down drop_table :forum_threads end end
Ruby
class PositionCompletion < ActiveRecord::Migration def self.up add_column :positions, :completed, :boolean, :default => 0 end def self.down remove_column :positions, :name, :boolean end end
Ruby
class CreateAwards < ActiveRecord::Migration def self.up create_table :awards do |t| t.string :name, :description t.datetime :semester t.references :member t.timestamps end end def self.down drop_table :awards end end
Ruby
class CreatePosts < ActiveRecord::Migration def self.up create_table :forum_posts do |t| t.text :body t.references :thread, :author, :topic t.timestamps end end def self.down drop_table :forum_posts end end
Ruby
class LengthenDescription < ActiveRecord::Migration def self.up change_column :events, :description, :string, :limit => 1200 end def self.down change_column :events, :description, :string end end
Ruby
class PotentialServiceBack < ActiveRecord::Migration def self.up remove_column :members, :service_back_total add_column :members, :potential_service_back_completed, :tinyint, :default => 0 add_column :members, :service_back_total, :tinyint, :default => 0 end def self.down remove_column :members, ...
Ruby
class EventCategoryAdditions < ActiveRecord::Migration def self.up add_column :events, :additional_service_hours, :float, :default => 0 add_column :events, :additional_fundraisers, :float, :default => 0 add_column :events, :additional_flex_points, :float, :default => 0 add_column :events, :additional_...
Ruby
class FourCStatus < ActiveRecord::Migration def self.up add_column :members, :four_c, :tinyint, :default => 0 add_column :events, :four_c, :tinyint, :default => 0 end def self.down remove_column :members, :four_c remove_column :events, :four_c end end
Ruby
class AdminToggles < ActiveRecord::Migration def self.up create_table :toggles do |t| t.string :name t.boolean :enabled t.timestamps end end def self.down drop_table :toggles end end
Ruby
class CreateAttendanceRecords < ActiveRecord::Migration def self.up create_table :attendance_records do |t| t.float :adjustment_hours t.references :member, :event, :creator t.timestamps end end def self.down drop_table :attendance_records end end
Ruby
class SemesterForEvents < ActiveRecord::Migration def self.up add_column :events, :semester_index, :integer, :default => 1 end def self.down remove_column :events, :semester_index end end
Ruby
#!/usr/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 impaired re...
Ruby
#!/usr/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 impaired re...
Ruby
#!/usr/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.log # an...
Ruby
#!/usr/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 impaired re...
Ruby
#!/usr/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 impaired re...
Ruby
#!/usr/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.log # an...
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
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
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # i...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
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
# Be sure to restart your 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'] ||= 'development' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2....
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
ActionController::Routing::Routes.draw do |map| map.root :controller => "apo", :action => "login" # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can a...
Ruby
class EventsSweeper < ActionController::Caching::Sweeper observe Event def after_update(event) expire_cache_for(event) end def after_destroy(event) expire_cache_for(event) end def after_events_add_attendee expire_cache_for(assigns(:event)) end def after_events_update_attendees expire_c...
Ruby
class AnnouncementsSweeper < ActionController::Caching::Sweeper observe Announcement # This sweeper is going to keep an eye on the Announcement model def after_save(announcement) expire_cache_for(announcement) end def after_destroy(announcement) expire_cache_for(announcement) end def after_apo_...
Ruby
class MembersSweeper < ActionController::Caching::Sweeper observe Member # This sweeper is going to keep an eye on the Member model # If our sweeper detects that a Member was saved call this def after_save(member) expire_cache_for(member) end # If our sweeper detects that a Member was deleted call this ...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module EmailerHelper end
Ruby
module DocumentsHelper end
Ruby
module ApoHelper def delay page.delay(20) do page.visual_effect :fade, 'notice' end end end
Ruby
class Award < ActiveRecord::Base belongs_to :member end
Ruby
class Announcement < ActiveRecord::Base belongs_to :member validates_presence_of :message, :member_id def self.find_announcements find_all_by_admin true, :order => "created_at DESC", :limit => 15 end def self.find_shoutouts find_all_by_admin false, :order => "created_at DESC", :limit => 15 en...
Ruby
class MemberEvent < ActiveRecord::Base belongs_to :acting_member, :class_name => "Member" belongs_to :target_member, :class_name => "Member" belongs_to :other_target_member, :class_name => "Member" belongs_to :event def replaced_member(actor, target, replacement, event) self.acting_member = actor sel...
Ruby
class Event < ActiveRecord::Base belongs_to :mic, :class_name => "Member" has_many :attendance_records has_many :members, :through => :attendance_records validates_presence_of :event_type, :hours, :max_attendees, :name, :date, :additional_service_hours, :additional_leaderships, :additional_fellowships, :...
Ruby
class ForumTopic < ActiveRecord::Base has_many :forum_threads has_many :forum_posts, :through => :forum_threads validates_presence_of :name end
Ruby
class AttendanceRecord < ActiveRecord::Base belongs_to :member belongs_to :event belongs_to :creator, :class_name => "Member" validates_presence_of :member_id, :event_id end
Ruby
class Position < ActiveRecord::Base belongs_to :member validates_presence_of :position, :member_id def self.getPosition(index) case index #Exec when 0 "President" when 1 "1st VP (Service)" when 2 "2nd VP (Pledge Trainer)" when 3 "3rd VP (Administ...
Ruby
class PledgeClass < ActiveRecord::Base end
Ruby
class ForumPost < ActiveRecord::Base belongs_to :author, :class_name => "Member" belongs_to :forum_thread belongs_to :forum_topic validates_presence_of :forum_topic_id, :member_id, :forum_thread_id, :body end
Ruby
class Member < ActiveRecord::Base has_many :attendance_records, :conditions => {:waitlist => false} has_many :events, :through => :attendance_records has_many :positions has_many :announcements validates_presence_of :first_name validates_presence_of :last_name validates_presence_of :username validates...
Ruby
class Token < ActiveRecord::Base end
Ruby
class Toggle < ActiveRecord::Base end
Ruby
class Emailer < ActionMailer::Base def password(password, email, name) @recipients = email @from = "APO Website <internet@apouiuc.com>" @subject = "Your password was reset" @sent_on = Time.now @body["message"] = "Hi #{name}, your new password is #{password} \nBe sure to chan...
Ruby
class ForumThread < ActiveRecord::Base belongs_to :forum_topic has_many :forum_posts validates_presence_of :forum_topic_id, :subject end
Ruby
class Document < ActiveRecord::Base def self.save(upload) name = Document.sanitize_filename(upload['title']) filetype = upload['datafile'].original_filename filetype = filetype.split(".") filetype = filetype[filetype.length-1] if upload['date'][5] == " " and upload['date'][...
Ruby
class ApoController < ApplicationController def login if request.post? @member = Member.authenticate(params[:username], params[:password]) if @member.nil? flash[:warning] = "Invalid username or password" redirect_to :action => "login" elsif @member.deleted? ...
Ruby
class PositionsController < ApplicationController def create @position = Position.new render :action => "edit" end def edit @position = Position.find(params[:id]) end def save if params[:id].nil? @position = Position.new else @position = Position.find(params[:id]) end ...
Ruby
class DocumentsController < ApplicationController def uploadFile Document.save(params[:upload]) redirect_to :action => :done end def download send_file "#{RAILS_ROOT}/Documents/#{params[:file]}", :type => "application/msword", :disposition => "attachment" end def fetch token = Toke...
Ruby
class EventsController < ApplicationController def list if (params[:sort_by] != nil) if (params[:filter] != nil and params[:filter][:type] != "") if params[:filter][:type] == "Dues" @events = Event.find(:all, :select => "events.*", :conditions => ["(events.event_type = \"Dues\" OR events....
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 helper :all # include all helpers, all the time before_filter :require_login, :except => [:login, :logout, :f...
Ruby
class MembersController < ApplicationController skip_before_filter :verify_authenticity_token before_filter :require_login def list @filter = params[:filter].nil? ? nil : params[:filter][:type] @sort_by = params[:sort_by] @display = params[:display] @offset = params[:offset] @member = sessi...
Ruby
class EmailerController < ApplicationController def sendmail message = params[:message] recipient = params[:recipient] Emailer.deliver_sent(message, session[:user], recipient) render :inline => "<body bgcolor=#ffd700>Your message has been sent!</body>" end end
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
#!/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/runner'
Ruby