code
stringlengths
1
1.73M
language
stringclasses
1 value
# 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. # 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
# 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 Mime::Type.register_alias "text/html", :print
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
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
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb require 'thread' RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end ...
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.5' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
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
# 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 'rdoc/task' require 'tasks/rails'
Ruby
namespace :db do namespace :init do desc "init_data" task :data => :environment do # work_item_type ['住宅','公建','别墅','多层','高层','普通','高层一类','高层二类','宾馆','中央空调','星级宾馆'].each_with_index do |name,index| WorkItemType.new( :name => name, :position => index ).save ...
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
# 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
# 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. # Include Active Record class name as root for JSON serialized output. ActiveRecord::Base.include_root_in_json = true # Store the full class name (including module namespa...
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'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.1...
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 :pages # 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 :cont...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module MainHelper end
Ruby
module PagesHelper end
Ruby
class Page < ActiveRecord::Base validates_presence_of :body, :on => :create, :message => "can't be blank" validates_length_of :title, :within => 3..255, :on => :create, :message => "must be present" validates_length_of :author, :within => 3..255, :on => :create, :message => "must be present" end
Ruby
class MainController < ApplicationController end
Ruby
class PagesController < ApplicationController # GET /pages # GET /pages.xml def index @pages = Page.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @pages } end end # GET /pages/1 # GET /pages/1.xml def show @page = Page.find(params[:id]) respond_to ...
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 # See ActionController::RequestForgeryProtection for details...
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/dbconsole'
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/dbconsole'
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/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 CreatePages < ActiveRecord::Migration def self.up create_table :pages do |t| t.string :title t.string :author t.text :body t.integer :permission t.timestamps end end def self.down drop_table :pages end end
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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 Fast...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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 Fast...
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/bin/ruby # # Copyright 2009 Matthew Eernisse (mde@fleegix.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
Ruby
#!/usr/bin/ruby # # Copyright 2009 Matthew Eernisse (mde@fleegix.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
Ruby
require 'rubygems' Gem::manage_gems require 'rake/gempackagetask' require 'rake/rdoctask' spec = Gem::Specification.new do |s| s.name = 'crackup' s.version = '1.0.1' s.author = 'Ryan Grove' s.email = 'ryan@wonko.com' s.homepage = 'http://wonko.com/software/crackup' s.platform = Gem...
Ruby
module Crackup class Error < StandardError; end class CompressionError < Crackup::Error; end class EncryptionError < Crackup::Error; end class IndexError < Crackup::Error; end class StorageError < Crackup::Error; end end
Ruby
require 'crackup/fs_object' require 'fileutils' module Crackup # Represents a symbolic link on the local filesystem. class SymlinkObject include FileSystemObject attr_reader :file_hash, :target, :url #-- # Public Instance Methods #++ def initialize(linkname) unle...
Ruby
require 'crackup/fs_object' require 'digest/sha2' require 'fileutils' module Crackup # Represents a file on the local filesystem. class FileObject include FileSystemObject attr_reader :file_hash, :url def initialize(filename) unless File.file?(filename) raise ArgumentEr...
Ruby
require 'crackup/fs_object' module Crackup # Represents a directory on the local filesystem. Can contain any number of # Crackup::FileSystemObjects as children. class DirectoryObject include Enumerable include FileSystemObject attr_reader :children #-- # Public Instance Method...
Ruby
require 'digest/sha2' module Crackup # Represents a filesystem object on the local filesystem. module FileSystemObject attr_reader :name, :name_hash #-- # Public Class Methods #++ # Returns an instance of the appropriate FileSystemObject subclass to # represent _pa...
Ruby
require 'crackup/driver' require 'fileutils' require 'uri' module Crackup; module Driver # Filesystem storage driver for Crackup. # # Author:: Ryan Grove (mailto:ryan@wonko.com) # Copyright:: Copyright (c) 2006 Ryan Grove. All rights reserved. # License:: New BSD License (http://opensource.o...
Ruby
require 'crackup/driver' require 'net/ftp' require 'uri' module Crackup; module Driver # FTP storage driver for Crackup. # # Author:: Ryan Grove (mailto:ryan@wonko.com) # Copyright:: Copyright (c) 2006 Ryan Grove. All rights reserved. # License:: New BSD License (http://opensource.org/licens...
Ruby
require 'uri' module Crackup # Base storage driver module for Crackup. # # To write a Crackup storage driver: # # - Create a class in Crackup::Driver named "FooDriver", where "Foo" is the # capitalized version of the URI scheme your driver will handle (e.g., # "Ftp", "Sftp", etc.). # ...
Ruby
require 'crackup/errors' require 'crackup/directory_object' require 'crackup/driver' require 'crackup/file_object' require 'crackup/symlink_object' require 'find' require 'tmpdir' require 'zlib' module Crackup GPG_DECRYPT = 'echo :passphrase | :gpg --batch --quiet --no-tty --no-secmem-warning --cipher-al...
Ruby
require 'rubygems' Gem::manage_gems require 'rake/gempackagetask' require 'rake/rdoctask' spec = Gem::Specification.new do |s| s.name = 'crackup' s.version = '1.0.0' s.author = 'Ryan Grove' s.email = 'ryan@wonko.com' s.homepage = 'http://wonko.com/software/crackup' s.platform = Gem...
Ruby
module Crackup class Error < StandardError; end class CompressionError < Crackup::Error; end class EncryptionError < Crackup::Error; end class IndexError < Crackup::Error; end class StorageError < Crackup::Error; end end
Ruby
require 'crackup/fsobject' module Crackup # Represents a directory on the local filesystem. Can contain any number of # Crackup::FileSystemObjects as children. class DirectoryObject include FileSystemObject attr_reader :children #-- # Public Class Methods #++ def in...
Ruby
require 'crackup/fsobject' require 'digest/sha2' require 'fileutils' module Crackup # Represents a file on the local filesystem. class FileObject include FileSystemObject attr_reader :file_hash, :url def initialize(filename) unless File.file?(filename) raise ArgumentErr...
Ruby
require 'crackup/driver' require 'fileutils' require 'uri' module Crackup; module Driver # Filesystem storage driver for Crackup. # # Author:: Ryan Grove (mailto:ryan@wonko.com) # Copyright:: Copyright (c) 2006 Ryan Grove. All rights reserved. # License:: New BSD License (http://opensource.o...
Ruby
require 'crackup/driver' require 'net/ftp' require 'uri' module Crackup; module Driver # FTP storage driver for Crackup. # # Author:: Ryan Grove (mailto:ryan@wonko.com) # Copyright:: Copyright (c) 2006 Ryan Grove. All rights reserved. # License:: New BSD License (http://opensource.org/licens...
Ruby
require 'uri' module Crackup # Base storage driver module for Crackup. # # To write a Crackup storage driver: # # - Create a class in Crackup::Driver named "FooDriver", where "Foo" is the # capitalized version of the URI scheme your driver will handle (e.g., # "Ftp", "Sftp", etc.). # ...
Ruby
require 'digest/sha2' module Crackup # Represents a filesystem object on the local filesystem. module FileSystemObject attr_reader :name, :name_hash def initialize(name) @name = name.chomp('/') @name_hash = Digest::SHA256.hexdigest(name) end def remove; en...
Ruby
ENV['PATH'] = "#{File.dirname(__FILE__)};#{ENV['PATH']}" require 'crackup/errors' require 'crackup/dirobject' require 'crackup/driver' require 'crackup/fileobject' require 'tempfile' require 'zlib' module Crackup GPG_DECRYPT = 'echo :passphrase | gpg --batch --quiet --no-tty --no-secmem-warning --cipher...
Ruby
require 'rubygems' Gem::manage_gems require 'rake/gempackagetask' require 'rake/rdoctask' spec = Gem::Specification.new do |s| s.name = 'Crackup' s.version = '1.0.0' s.author = 'Ryan Grove' s.email = 'ryan@wonko.com' s.homepage = 'http://wonko.c...
Ruby
module Crackup class Error < StandardError; end class CompressionError < Crackup::Error; end class EncryptionError < Crackup::Error; end class IndexError < Crackup::Error; end class StorageError < Crackup::Error; end end
Ruby
require 'crackup/fsobject' module Crackup # Represents a directory on the local filesystem. Can contain any number of # CrackupFileSystemObjects as children. class DirectoryObject include FileSystemObject attr_reader :children, :parent_path, :timestamp #-- # Public Class Methods ...
Ruby
require 'crackup/fsobject' require 'digest/sha2' require 'fileutils' require 'time' module Crackup # Represents a file on the local filesystem. class FileObject include FileSystemObject attr_reader :path, :dir_path, :ctime, :mtime, :inode, :size, :timestamp, :url #-- ...
Ruby
require 'crackup/driver' require 'fileutils' require 'uri' module Crackup; module Driver # Filesystem storage driver for Crackup. # # Author:: Ryan Grove (mailto:ryan@wonko.com) # Copyright:: Copyright (c) 2006 Ryan Grove. All rights reserved. # License:: New BSD License (http://opensource.o...
Ruby
require 'crackup/driver' require 'net/ftp' require 'uri' module Crackup; module Driver # FTP storage driver for Crackup. # # Author:: Ryan Grove (mailto:ryan@wonko.com) # Copyright:: Copyright (c) 2006 Ryan Grove. All rights reserved. # License:: New BSD License (http://opensource.org/licens...
Ruby
require 'uri' module Crackup # Base storage driver module for Crackup. # # To write a Crackup storage driver: # # - Create a class in Crackup::Driver named "FooDriver", where "Foo" is the # capitalized version of the URI scheme your driver will handle (e.g., # "Ftp", "Sftp", etc.). # ...
Ruby
require 'sqlite3' require 'yaml' module Crackup # Represents a Crackup index database (essentially a friendly interface to an # SQLite3 database file). class Index include Enumerable attr_reader :db, :filename, :sql #-- # Public Class Methods #++ # Returns ...
Ruby
require 'digest/sha2' module Crackup # Represents a filesystem object on the local filesystem. module FileSystemObject attr_reader :name, :path_hash, :path #-- # Class Methods #++ def initialize(path) @path = path.chomp('/') @name = File.basename...
Ruby
ENV['PATH'] = "#{File.dirname(__FILE__)};#{ENV['PATH']}" require 'crackup/errors' require 'crackup/dirobject' require 'crackup/driver' require 'crackup/fileobject' require 'crackup/index' require 'tempfile' require 'yaml' require 'zlib' module Crackup GPG_DECRYPT = 'echo :passphrase | gpg --batch --qu...
Ruby
require 'rubygems' Gem::manage_gems require 'rake/gempackagetask' require 'rake/rdoctask' spec = Gem::Specification.new do |s| s.name = 'crackup-sftp' s.version = '1.0.0' s.author = 'Brett Stimmerman' s.email = 'brettstimmerman@gmail.com' s.homepage = 'http://wonko.com/software/cracku...
Ruby
require 'rubygems' require 'net/ssh' require 'net/sftp' require 'uri' module Crackup; module Driver # SFTP storage driver for Crackup # # sftp://<username>:<password>@<hostname>[:<port>][/<path>] # # Author:: Brett Stimmerman (mailto:brettstimmerman@gmail.com) # Version:: 1.0.0 # Copy...
Ruby