code
stringlengths
1
1.73M
language
stringclasses
1 value
# Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
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
module UrlHelper end
Ruby
module AdminHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module LoginHelper end
Ruby
module HostsHelper end
Ruby
require 'rubygems' require 'RMagick' class Category < ActiveRecord::Base include Magick has_and_belongs_to_many :webaddresses, :order => :site validates_presence_of :name validates_presence_of :description validates_uniqueness_of :name validates_length_of :name, :maximum => 64 validates_...
Ruby
require 'expecter' class Host < ActiveRecord::Base validates_presence_of :hostname validates_uniqueness_of :hostname validates_presence_of :username validates_presence_of :password validates_presence_of :enable_password attr_accessor :password_confirmation, :...
Ruby
class Webaddress < ActiveRecord::Base has_and_belongs_to_many :categories, :order => :name belongs_to :user has_many :histories validates_presence_of :site validates_presence_of :path validates_presence_of :reason validates_format_of :site, :with => %r{^[^/\s]...
Ruby
require 'digest/sha1' class User < ActiveRecord::Base has_many :webaddresses has_many :histories validates_presence_of :name validates_uniqueness_of :name attr_accessor :password_confirmation, :old_password validates_confirmation_of :password attr_pr...
Ruby
class UrlController < ApplicationController layout "application" before_filter :authorize, :except => [:downloadurllist]; before_filter :authorize_admin, :only => [:list_orphaned, :purge, :download, :upload] def new @webaddress = Webaddress.new @webaddress.path = "/" @categories = Categor...
Ruby
require 'pp' class AdminController < ApplicationController layout "application" before_filter :authorize_admin, :except => [:category_image] before_filter :authorize, :only => [:category_image] def new @category = Category.new end def create @category = Category.new(params[:category]) ...
Ruby
class HostsController < ApplicationController layout "application" before_filter :authorize_admin, :except => [:deploy, :deploy_to_hosts, :perform_deploy] before_filter :authorize_deploy, :only => [:deploy, :deploy_to_hosts, :perform_deploy] filter_parameter_logging :password, :enable_password def ind...
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 => '_bluecoat_s...
Ruby
class LoginController < ApplicationController layout "application" before_filter :authorize_admin, :except => [:login, :logout, :change_password, :update_password, :blank] before_filter :authorize, :only => [:change_password, :update_password] filter_parameter_logging :password def new @user = ...
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/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/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/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 AddCategoryDescription < ActiveRecord::Migration def self.up add_column :categories, :description, :string end def self.down remove_column :categories, :description 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 AddUserEnabled < ActiveRecord::Migration def self.up add_column :users, :enabled, :boolean, :default => true end def self.down remove_column :users, :enabled end end
Ruby
class AddInitialUser < ActiveRecord::Migration def self.up end def self.down end end
Ruby
class AddUserCanDeploy < ActiveRecord::Migration def self.up add_column :users, :can_deploy, :boolean, :default => true end def self.down remove_column :users, :can_deploy end end
Ruby
class CreateWebaddresses < ActiveRecord::Migration def self.up create_table :webaddresses do |t| t.column :site, :string t.column :path, :string t.column :reason, :string t.column :ticket, :string t.column :user_id, :integer, :null => false t.column :cr...
Ruby
class CreateCategoriesWebaddresses < ActiveRecord::Migration def self.up create_table :categories_webaddresses, :id => false do |t| t.column :category_id, :integer t.column :webaddress_id, :integer end add_index :categories_webaddresses, [:category_id, :webaddress_id], :unique => true ...
Ruby
class CreateHosts < ActiveRecord::Migration def self.up create_table :hosts do |t| t.column :hostname, :string t.column :username, :string t.column :password, :string t.column :enable_password, :string t.column :dirty, :boolean end end def self...
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.column :name, :string t.column :hashed_password, :string t.column :salt, :string t.column :admin, :boolean end end def self.down drop_table :users end end
Ruby
class CreateCategories < ActiveRecord::Migration def self.up create_table :categories do |t| t.column :name, :string end end def self.down drop_table :categories end end
Ruby
class AddCategoryImage < ActiveRecord::Migration def self.up add_column :categories, :image, :binary end def self.down remove_column :categories, :image end end
Ruby
STATS_DIRECTORIES = [ %w(Controllers app/controllers), %w(Helpers app/helpers), %w(Models app/models), %w(Views app/views), %w(APIs app/apis), %w(Components components), %w(Unit\ tests test/unit), %w(Functional\ tests test/functio...
Ruby
class Deployer def self.deploy *hostnames hosts = Host.find(:all) hosts.each do |host| if hostnames.empty? || hostnames.include?(host.hostname) puts "Deploying to: #{host.hostname}" begin if host.dirty res = host.deploy else res = "No update...
Ruby
module Expect require 'timeout' class Expecter attr_accessor :timeout def initialize @connection = nil @timeout = 2 end def spawn(process) end def connect(host, user, passwd) end def ssh_connect(host, user, passwd) @connection = SshConnection.new(host, user, passwd...
Ruby
class CodeStatisticsWithViews #:nodoc: TEST_TYPES = %w(Units Functionals Unit\ tests Functional\ tests Integration\ tests) def initialize(*pairs) @pairs = pairs @statistics = calculate_statistics @total = calculate_total if pairs.length > 1 end def to_s print_header @pairs.each ...
Ruby
#!/usr/bin/env 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 impaire...
Ruby
#!/usr/bin/env 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 impaire...
Ruby
#!/usr/bin/env 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 ...
Ruby
#!/usr/bin/env 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 impaire...
Ruby
#!/usr/bin/env 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 impaire...
Ruby
#!/usr/bin/env 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 ...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class ActiveSupport::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 da...
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
# Be sure to restart your server when you modify this file. # 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. ActiveReco...
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
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. Act...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying do debug a probl...
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 # Full error reports are disabled and caching is turned on config.action_controller.consider_all_reque...
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 # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
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
module UrlHelper end
Ruby
module AdminHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module LoginHelper end
Ruby
module HostsHelper end
Ruby
require 'rubygems' require 'RMagick' class Category < ActiveRecord::Base include Magick has_and_belongs_to_many :webaddresses, :order => :site validates_presence_of :name validates_presence_of :description validates_uniqueness_of :name validates_length_of :name, :maximum => 64 validates_...
Ruby
require 'expecter' class Host < ActiveRecord::Base validates_presence_of :hostname validates_uniqueness_of :hostname validates_presence_of :username validates_presence_of :password validates_presence_of :enable_password attr_accessor :password_confirmation, :...
Ruby
class Webaddress < ActiveRecord::Base has_and_belongs_to_many :categories, :order => :name belongs_to :user has_many :histories validates_presence_of :site validates_presence_of :path validates_presence_of :reason validates_format_of :site, :with => %r{^[^/\s]...
Ruby
require 'digest/sha1' class User < ActiveRecord::Base has_many :webaddresses has_many :histories validates_presence_of :name validates_uniqueness_of :name attr_accessor :password_confirmation, :old_password validates_confirmation_of :password attr_pr...
Ruby
class UrlController < ApplicationController layout "application" before_filter :authorize, :except => [:downloadurllist]; before_filter :authorize_admin, :only => [:list_orphaned, :purge, :download, :upload] def new @webaddress = Webaddress.new @webaddress.path = "/" @categories = Categor...
Ruby
require 'pp' class AdminController < ApplicationController layout "application" before_filter :authorize_admin, :except => [:category_image] before_filter :authorize, :only => [:category_image] def new @category = Category.new end def create @category = Category.new(params[:category]) ...
Ruby
class HostsController < ApplicationController layout "application" before_filter :authorize_admin, :except => [:deploy, :deploy_to_hosts, :perform_deploy] before_filter :authorize_deploy, :only => [:deploy, :deploy_to_hosts, :perform_deploy] filter_parameter_logging :password, :enable_password def ind...
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 => '_bluecoat_s...
Ruby
class LoginController < ApplicationController layout "application" before_filter :authorize_admin, :except => [:login, :logout, :change_password, :update_password, :blank] before_filter :authorize, :only => [:change_password, :update_password] filter_parameter_logging :password def new @user = ...
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/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/plugin'
Ruby