code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# 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 |
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 |
# 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 |
# 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
# 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.3... | 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 |
#!/usr/bin/ruby1.8
#
# 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/ruby1.8
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... | Ruby |
#!/usr/bin/env ruby
require 'load_path'
require 'wpspider/webservice/search_cgi'
WPSpider::WebService::SearchCGI::start()
| Ruby |
#!/usr/bin/env ruby
require 'load_path'
require 'wpspider/webservice/search_cgi'
WPSpider::WebService::SearchCGI::start()
| Ruby |
require 'rexml/document'
require 'wpspider/common/db_connector'
require 'wpspider/common/wppage'
module WPSpider
module WebService
#
# Search Command class.
#
class SearchCommand
# Page name.
attr_accessor :name
#
attr_accessor :type
#
# Constructor.
#
... | Ruby |
require 'wpspider/common/cgi'
require 'wpspider/webservice/search_command'
module WPSpider
module WebService
class SearchCGI
def SearchCGI::start()
Common::CGI::start() do |http_req, http_res|
http_res.set_content_type('text/xml')
http_res.set_charset('UTF-8')
name = h... | Ruby |
#!/usr/env/env ruby
require 'wpspider/importer/import_cui'
cui = WPSpider::Importer::ImportCUI.new()
cui.parse(ARGV)
cui.start()
| Ruby |
#!/usr/env/env ruby
require 'wpspider/importer/import_cui'
cui = WPSpider::Importer::ImportCUI.new()
cui.parse(ARGV)
cui.start()
| Ruby |
#!/usr/env/env ruby
require 'logger'
require 'wpspider/common/db_connector'
require 'wpspider/common/wppage'
require 'wpspider/importer/wppage_vo'
require 'wpspider/importer/xml_parser'
$KCODE = 'u'
$logger = Logger.new('import_log.txt')
$logger.level = Logger::DEBUG
module WPSpider
module Importer
#
# Im... | Ruby |
#!/usr/env/env ruby
require 'logger'
require 'wpspider/common/db_connector'
require 'wpspider/common/wppage'
require 'wpspider/importer/wppage_vo'
require 'wpspider/importer/xml_parser'
$KCODE = 'u'
$logger = Logger.new('import_log.txt')
$logger.level = Logger::DEBUG
module WPSpider
module Importer
#
# Im... | Ruby |
module WPSpider
module Importer
#
# WPPageVO cass.
#
class WPPageVO
# Page name.
attr_reader :name
# Page size.
attr_reader :size
#
# Constructor.
# - name: Page name.
# - size: Page size.
# - words: Words included by page.
#
def i... | Ruby |
require 'wpspider/importer/wppage_vo'
module WPSpider
module Importer
#
# XMLParser class.
#
class XMLParser
#
# Constructor.
# - xml_file: XML file name.
#
def initialize(xml_file)
@xml_file = xml_file
end
#
# Parses XML.
#
def p... | Ruby |
require 'optparse'
require 'wpspider/importer/import_command'
module WPSpider
module Importer
#
# Commandline interface for ImportCommand.
#
class ImportCUI
#
# Constructor.
#
def initialize()
@command = ImportCommand.new()
@option_parser = OptionParser.new()... | Ruby |
require 'cgi'
module WPSpider
module Common
#
# HTTP Response class.
#
class HttpResponse
#
# Constructor.
#
def initialize(cgi)
@cgi = cgi
@headers = Hash.new()
@headers['cookie'] = Hash.new()
@body = String.new()
end
#
# S... | Ruby |
require 'cgi'
module WPSpider
module Common
#
# HTTP Request class.
#
class HttpRequest
#
# Constructor.
# - cgi
#
def initialize(cgi)
@cgi = cgi
@params = cgi.params
@cookies = cgi.cookies
end
#
# Gets request parameter.
... | Ruby |
require 'yaml'
require 'active_record'
module WPSpider
module Common
#
# DBConnector class.
# Connects DB using ActiveRecord.
#
class DBConnector
# Hash map of DB configuration.
attr_accessor :conf
#
# Constructor.
#
def initialize()
@conf = Hash.new(... | Ruby |
require 'cgi'
require 'wpspider/common/http_request'
require 'wpspider/common/http_response'
module WPSpider
module Common
#
# CGI class.
#
class CGI
# Constructor is private.
private_class_method :new
#
# Starts CGI.
#
def CGI::start()
cgi = ::CGI.new()
... | Ruby |
require 'active_record'
module WPSpider
module Common
class WPPage < ActiveRecord::Base
end
end
end
| 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 |
# 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 :lines
map.resources :comments
map.resources :stories
map.resources :users
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalo... | Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module LinesHelper
end
| Ruby |
module UsersHelper
end
| Ruby |
module StoriesHelper
end
| Ruby |
module CommentsHelper
end
| Ruby |
class Line < ActiveRecord::Base
end
| Ruby |
class Story < ActiveRecord::Base
end
| Ruby |
class User < ActiveRecord::Base
end
| Ruby |
class Comment < ActiveRecord::Base
end
| Ruby |
class StoriesController < ApplicationController
# GET /stories
# GET /stories.xml
def index
@stories = Story.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @stories }
end
end
# GET /stories/1
# GET /stories/1.xml
def show
@story = ... | Ruby |
class LinesController < ApplicationController
# GET /lines
# GET /lines.xml
def index
@lines = Line.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @lines }
end
end
# GET /lines/1
# GET /lines/1.xml
def show
@line = Line.find(params... | Ruby |
class CommentsController < ApplicationController
# GET /comments
# GET /comments.xml
def index
@comments = Comment.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @comments }
end
end
# GET /comments/1
# GET /comments/1.xml
def show
... | 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 |
class UsersController < ApplicationController
# GET /users
# GET /users.xml
def index
@users = User.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
end
end
# GET /users/1
# GET /users/1.xml
def show
@user = User.find(params... | 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'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib"))
require 'rubygems'
require 'spec'
exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT))
| Ruby |
#!/usr/bin/env ruby
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
require 'rubygems'
require 'drb/drb'
require 'rbconfig'
require 'spec'
require 'optparse'
# This is based on Florian Weber's TDDMate
module Spec
module Runner
class RailsSpecServer
... | 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
ENV['RSPEC'] = 'true' # allows autotest to discover rspec
ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
$stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
| Ruby |
#!/usr/bin/env ruby
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
require 'rubygems'
require 'drb/drb'
require 'rbconfig'
require 'spec'
require 'optparse'
# This is based on Florian Weber's TDDMate
module Spec
module Runner
class RailsSpecServer
... | 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
ENV['RSPEC'] = 'true' # allows autotest to discover rspec
ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
$stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib"))
require 'rubygems'
require 'spec'
exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT))
| Ruby |
class CreateStories < ActiveRecord::Migration
def self.up
create_table :stories do |t|
t.string :title
t.timestamps
end
end
def self.down
drop_table :stories
end
end
| Ruby |
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.timestamps
end
end
def self.down
drop_table :comments
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :username
t.string :password
t.timestamps
end
end
def self.down
drop_table :users
end
end
| Ruby |
class CreateLines < ActiveRecord::Migration
def self.up
create_table :lines do |t|
t.text :line
t.timestamps
end
end
def self.down
drop_table :lines
end
end
| Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'spec/rails/story_adapter' | Ruby |
dir = File.dirname(__FILE__)
Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file|
require file
end | Ruby |
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'spec'
require 'spec/rails'
Spec::Runner.configure do |config|
# If you're not using ActiveRecord ... | Ruby |
raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec" if File.directory?(File.join(File.dirname(__FILE__), *%w[.. .. vendor plugins rspec pkg]))
raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec-rails" if File.directory?(File.join(File.dirname(__FIL... | 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 |
# 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.