code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/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/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 CreateFeedbacks < ActiveRecord::Migration def self.up create_table :feedbacks do |t| t.column "name", :string t.column "email", :string t.column "text", :text t.timestamps end end def self.down drop_table :feedbacks end end
Ruby
#!C:/Srdjan/ruby/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 i...
Ruby
#!C:/Srdjan/ruby/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 i...
Ruby
#!C:/Srdjan/ruby/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.cras...
Ruby
#!C:/Srdjan/ruby/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 i...
Ruby
#!C:/Srdjan/ruby/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 i...
Ruby
#!C:/Srdjan/ruby/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.cras...
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
# 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 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' ENV['GEM_PATH'] = '/home/amtranss/gems_2:/usr/lib/ruby/gems/1.8' # Specifies gem version of Ra...
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| # 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 assign values other than :controller and :action # ...
Ruby
load 'deploy' if respond_to?(:namespace) # cap2 differentiator Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } load 'config/deploy'
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module FourOhFoursHelper end
Ruby
module PageHelper end
Ruby
class Page < ActiveRecord::Base end
Ruby
class FeedbackMailer < ActionMailer::Base def feedback_mail(feedback) recipients ["amtpts@yahoo.com, spejic@gmail.com"] from "inquiry@amtransservices.com" subject "Feedback received" headers = {"Reply-to" => "#{feedback.email}"} @content_type = "text/html" body :feedback => feedba...
Ruby
class Reservation < ActiveRecord::Base validates_presence_of :name, :pickup_location, :dropoff_location validates_numericality_of :guests validates_format_of :email, :with => /\A[\w\.%\+\-]+@(?:[A-Z0-9\-]+\.)+(?:[A-Z]{2}|com|ca|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)\z/i validates_format_of...
Ruby
class Feedback < ActiveRecord::Base end
Ruby
class ReservationMailer < ActionMailer::Base def reservation_mail(reservation) recipients ["amtpts@yahoo.com, spejic@gmail.com"] from "inquiry@amtransservices.com" subject "New reservation" headers = {"Reply-to" => "#{reservation.email}"} @content_type = "text/html" ...
Ruby
class FourOhFour < ActiveRecord::Base def self.add_request(host, path, referer) request = find_or_initialize_by_host_and_path_and_referer(host, path, referer) request.count += 1 request.save end end
Ruby
class FourOhFoursController < ApplicationController def index FourOhFour.add_request(request.host, request.path, request.env['HTTP_REFERER'] || '') respond_to do |format| format.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found" } format.all { render :nothing => tru...
Ruby
class PageController < ApplicationController caches_page :home, :about, :rates, :points, :policies def home #present_page "home" end def fleet #present_page "fleet" end def rates #present_page "rates" end def points #render that page end def policies #render that page 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 => '_amtranspor...
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/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/runner'
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/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
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/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
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/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/breakpointer'
Ruby
#!/usr/bin/ruby ENV['RAILS_ENV'] ||= 'production' Dir.chdir(File.expand_path(File.dirname(__FILE__) + "/..")) #Change current directory to RAILS_ROOT require "config/environment" include ActionController::UrlWriter default_url_options[:host] = 'www.amtransservices.com' filename = "#{RAILS_ROOT}/public/sitemap.xml" Fi...
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/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
#!/usr/bin/ruby ENV['RAILS_ENV'] ||= 'production' Dir.chdir(File.expand_path(File.dirname(__FILE__) + "/..")) #Change current directory to RAILS_ROOT require "config/environment" include ActionController::UrlWriter default_url_options[:host] = 'www.amtransservices.com' filename = "#{RAILS_ROOT}/public/sitemap.xml" Fi...
Ruby
#!/usr/bin/ruby ##Rail's Analyzer With Klass #run the following to view help: #ruby rawk.rb -? class Stat def initialize(key) @key=key @min = nil @max = nil @sum = 0 @sum_squares = 0 @count = 0 @values = [] end def add(value) value=1.0*value @count+=1 @min = value unless @m...
Ruby
#!/usr/bin/ruby ##Rail's Analyzer With Klass #run the following to view help: #ruby rawk.rb -? class Stat def initialize(key) @key=key @min = nil @max = nil @sum = 0 @sum_squares = 0 @count = 0 @values = [] end def add(value) value=1.0*value @count+=1 @min = value unless @m...
Ruby
class AddSpecialRequest < ActiveRecord::Migration def self.up add_column :reservations, :special_requests, :text end def self.down remove_column :reservations, :special_requests end end
Ruby
class AddIndexes < ActiveRecord::Migration def self.up add_index :reservations, [:id], :name => "idxReservationID", :unique => true add_index :feedbacks, [:id], :name => "idxFeedbackID", :unique => true end def self.down remove_index :reservations, :name => :idxReservationID remove_index :feedbac...
Ruby
class CreateFourOhFours < ActiveRecord::Migration def self.up create_table :four_oh_fours do |t| t.column "host", :string t.column "path", :string t.column "referer", :string t.column "count", :integer, :default => 0 t.timestamps end add_index :four_oh_fours, [:host, :path, :...
Ruby
class CreateFeedbacks < ActiveRecord::Migration def self.up create_table :feedbacks do |t| t.column :name, :string t.column :email, :string t.column :feedback, :text t.column :created_on, :datetime t.column :updated_on, :datetime end end def self.down drop_table :feedbac...
Ruby
class AddNeededColumnsToReservations < ActiveRecord::Migration def self.up remove_column :reservations, :duration remove_column :reservations, :vehicle_type_id add_column :reservations, :vehicle_type, :string, :limit =>100 add_column :reservations, :round_trip, :boolean, :default => 0 add_column :...
Ruby
class CreateReservations < ActiveRecord::Migration def self.up create_table :reservations do |t| t.column :name, :string t.column :phone_number, :string t.column :email, :string t.column :guests, :integer t.column :reserve_for, :datetime t.column :duration, :integer t.col...
Ruby
class CreatePages < ActiveRecord::Migration def self.up create_table :pages do |t| t.column :name, :string t.column :title, :string t.column :content_id, :integer end end def self.down drop_table :pages end end
Ruby
namespace :tmp do namespace :assets do desc "Clears javascripts/cache and cached Rails actions" task :clear => :environment do FileUtils.rm(Dir['public/javascripts/cache/[^.]*']) FileUtils.rm(Dir['public/[a-z]*.html']) end 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
# 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): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person',...
Ruby
# These settings change the behavior of Rails 2 apps and will be defaults # for Rails 3. You can remove this initializer when Rails 3 is released. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveRecord::Base.include_root_in_json = true # Store the full clas...
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
# Necessary to run on Site5 set :use_sudo, false set :group_writable, false # Less releases, less space wasted set :keep_releases, 2 # The mandatory stuff set :application, "pilarvillegasnd" set :user, "drpilarv" set :repository, "https://cms-on-rails.googlecode.com/svn/branches/pv" # SCM information ...
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 # Enable threaded mode # config.threadsafe! # Use a different logger for distributed setups # config....
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'] ||= 'production' ENV['GEM_PATH'] = '/home/drpilarv/gems:/usr/lib/ruby/gems/1.8' # Specifies gem version of Rails to ...
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.resources :profiles #map.resources :articles, :requirements => {:id => /(([a-z]+)\-([a-z]+))+/} #map.current_article 'articles/:permalink', :controller => 'articles', :action => 'show' map.root :controller => "pages" map.with_options :controller => "page...
Ruby
# Set the host name for URL creation SitemapGenerator::Sitemap.default_host = "http://localhost:3000" #"http://www.pilarvillegasnd.com" SitemapGenerator::Sitemap.add_links do |sitemap| # Put links creation logic here. # # The root path '/' and sitemap index file are added automatically. # Links are add...
Ruby