erails 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/MIT-LICENSE +20 -0
- data/README +309 -0
- data/Rakefile +339 -0
- data/bin/about +4 -0
- data/bin/console +3 -0
- data/bin/dbconsole +3 -0
- data/bin/destroy +3 -0
- data/bin/erails +19 -0
- data/bin/generate +3 -0
- data/bin/performance/benchmarker +3 -0
- data/bin/performance/profiler +3 -0
- data/bin/performance/request +3 -0
- data/bin/plugin +3 -0
- data/bin/process/inspector +3 -0
- data/bin/process/reaper +3 -0
- data/bin/process/spawner +3 -0
- data/bin/runner +3 -0
- data/bin/server +3 -0
- data/builtin/rails_info/rails/info.rb +125 -0
- data/builtin/rails_info/rails/info_controller.rb +9 -0
- data/builtin/rails_info/rails/info_helper.rb +2 -0
- data/builtin/rails_info/rails_info_controller.rb +2 -0
- data/configs/apache.conf +40 -0
- data/configs/databases/frontbase.yml +28 -0
- data/configs/databases/mysql.yml +54 -0
- data/configs/databases/oracle.yml +39 -0
- data/configs/databases/postgresql.yml +48 -0
- data/configs/databases/sqlite2.yml +16 -0
- data/configs/databases/sqlite3.yml +19 -0
- data/configs/empty.log +0 -0
- data/configs/initializers/inflections.rb +10 -0
- data/configs/initializers/mime_types.rb +5 -0
- data/configs/initializers/new_rails_defaults.rb +17 -0
- data/configs/lighttpd.conf +54 -0
- data/configs/routes.rb +43 -0
- data/dispatches/dispatch.fcgi +24 -0
- data/dispatches/dispatch.rb +10 -0
- data/dispatches/gateway.cgi +97 -0
- data/doc/README_FOR_APP +2 -0
- data/environments/boot.rb +109 -0
- data/environments/development.rb +16 -0
- data/environments/environment.rb +71 -0
- data/environments/production.rb +22 -0
- data/environments/test.rb +22 -0
- data/fresh_rakefile +10 -0
- data/helpers/application.rb +15 -0
- data/helpers/application_helper.rb +3 -0
- data/helpers/test_helper.rb +38 -0
- data/html/404.html +30 -0
- data/html/422.html +30 -0
- data/html/500.html +30 -0
- data/html/favicon.ico +0 -0
- data/html/images/rails.png +0 -0
- data/html/index.html +274 -0
- data/html/javascripts/application.js +2 -0
- data/html/robots.txt +5 -0
- data/lib/code_statistics.rb +107 -0
- data/lib/commands/about.rb +3 -0
- data/lib/commands/console.rb +32 -0
- data/lib/commands/dbconsole.rb +67 -0
- data/lib/commands/destroy.rb +6 -0
- data/lib/commands/generate.rb +6 -0
- data/lib/commands/ncgi/listener +86 -0
- data/lib/commands/ncgi/tracker +69 -0
- data/lib/commands/performance/benchmarker.rb +24 -0
- data/lib/commands/performance/profiler.rb +50 -0
- data/lib/commands/performance/request.rb +6 -0
- data/lib/commands/plugin.rb +950 -0
- data/lib/commands/process/inspector.rb +68 -0
- data/lib/commands/process/reaper.rb +149 -0
- data/lib/commands/process/spawner.rb +219 -0
- data/lib/commands/process/spinner.rb +57 -0
- data/lib/commands/runner.rb +48 -0
- data/lib/commands/server.rb +39 -0
- data/lib/commands/servers/base.rb +31 -0
- data/lib/commands/servers/lighttpd.rb +94 -0
- data/lib/commands/servers/mongrel.rb +69 -0
- data/lib/commands/servers/new_mongrel.rb +16 -0
- data/lib/commands/servers/webrick.rb +66 -0
- data/lib/commands/update.rb +4 -0
- data/lib/commands.rb +17 -0
- data/lib/console_app.rb +30 -0
- data/lib/console_sandbox.rb +6 -0
- data/lib/console_with_helpers.rb +26 -0
- data/lib/dispatcher.rb +24 -0
- data/lib/fcgi_handler.rb +239 -0
- data/lib/initializer.rb +926 -0
- data/lib/rails/gem_builder.rb +21 -0
- data/lib/rails/gem_dependency.rb +129 -0
- data/lib/rails/mongrel_server/commands.rb +342 -0
- data/lib/rails/mongrel_server/handler.rb +55 -0
- data/lib/rails/plugin/loader.rb +152 -0
- data/lib/rails/plugin/locator.rb +100 -0
- data/lib/rails/plugin.rb +116 -0
- data/lib/rails/version.rb +9 -0
- data/lib/rails_generator/base.rb +263 -0
- data/lib/rails_generator/commands.rb +622 -0
- data/lib/rails_generator/generated_attribute.rb +42 -0
- data/lib/rails_generator/generators/applications/app/USAGE +9 -0
- data/lib/rails_generator/generators/applications/app/app_generator.rb +174 -0
- data/lib/rails_generator/generators/components/controller/USAGE +29 -0
- data/lib/rails_generator/generators/components/controller/controller_generator.rb +37 -0
- data/lib/rails_generator/generators/components/controller/templates/controller.rb +7 -0
- data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +8 -0
- data/lib/rails_generator/generators/components/controller/templates/helper.rb +2 -0
- data/lib/rails_generator/generators/components/controller/templates/view.html.erb +2 -0
- data/lib/rails_generator/generators/components/integration_test/USAGE +8 -0
- data/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +16 -0
- data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +10 -0
- data/lib/rails_generator/generators/components/mailer/USAGE +16 -0
- data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +30 -0
- data/lib/rails_generator/generators/components/mailer/templates/fixture.erb +3 -0
- data/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +0 -0
- data/lib/rails_generator/generators/components/mailer/templates/mailer.rb +15 -0
- data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +21 -0
- data/lib/rails_generator/generators/components/mailer/templates/view.erb +3 -0
- data/lib/rails_generator/generators/components/mailer/templates/view.rhtml +0 -0
- data/lib/rails_generator/generators/components/migration/USAGE +29 -0
- data/lib/rails_generator/generators/components/migration/migration_generator.rb +20 -0
- data/lib/rails_generator/generators/components/migration/templates/migration.rb +11 -0
- data/lib/rails_generator/generators/components/model/USAGE +27 -0
- data/lib/rails_generator/generators/components/model/model_generator.rb +45 -0
- data/lib/rails_generator/generators/components/model/templates/fixtures.yml +19 -0
- data/lib/rails_generator/generators/components/model/templates/migration.rb +16 -0
- data/lib/rails_generator/generators/components/model/templates/model.rb +2 -0
- data/lib/rails_generator/generators/components/model/templates/unit_test.rb +8 -0
- data/lib/rails_generator/generators/components/observer/USAGE +13 -0
- data/lib/rails_generator/generators/components/observer/observer_generator.rb +16 -0
- data/lib/rails_generator/generators/components/observer/templates/observer.rb +2 -0
- data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +8 -0
- data/lib/rails_generator/generators/components/plugin/USAGE +25 -0
- data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +39 -0
- data/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE +20 -0
- data/lib/rails_generator/generators/components/plugin/templates/README +13 -0
- data/lib/rails_generator/generators/components/plugin/templates/Rakefile +22 -0
- data/lib/rails_generator/generators/components/plugin/templates/USAGE +8 -0
- data/lib/rails_generator/generators/components/plugin/templates/generator.rb +8 -0
- data/lib/rails_generator/generators/components/plugin/templates/init.rb +1 -0
- data/lib/rails_generator/generators/components/plugin/templates/install.rb +1 -0
- data/lib/rails_generator/generators/components/plugin/templates/plugin.rb +1 -0
- data/lib/rails_generator/generators/components/plugin/templates/tasks.rake +4 -0
- data/lib/rails_generator/generators/components/plugin/templates/uninstall.rb +1 -0
- data/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +8 -0
- data/lib/rails_generator/generators/components/resource/USAGE +23 -0
- data/lib/rails_generator/generators/components/resource/resource_generator.rb +74 -0
- data/lib/rails_generator/generators/components/resource/templates/controller.rb +2 -0
- data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +8 -0
- data/lib/rails_generator/generators/components/resource/templates/helper.rb +2 -0
- data/lib/rails_generator/generators/components/scaffold/USAGE +25 -0
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +93 -0
- data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +85 -0
- data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +45 -0
- data/lib/rails_generator/generators/components/scaffold/templates/helper.rb +2 -0
- data/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb +17 -0
- data/lib/rails_generator/generators/components/scaffold/templates/style.css +54 -0
- data/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb +18 -0
- data/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb +24 -0
- data/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb +17 -0
- data/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb +10 -0
- data/lib/rails_generator/generators/components/session_migration/USAGE +10 -0
- data/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb +18 -0
- data/lib/rails_generator/generators/components/session_migration/templates/migration.rb +16 -0
- data/lib/rails_generator/lookup.rb +249 -0
- data/lib/rails_generator/manifest.rb +53 -0
- data/lib/rails_generator/options.rb +150 -0
- data/lib/rails_generator/scripts/destroy.rb +30 -0
- data/lib/rails_generator/scripts/generate.rb +7 -0
- data/lib/rails_generator/scripts/update.rb +12 -0
- data/lib/rails_generator/scripts.rb +89 -0
- data/lib/rails_generator/secret_key_generator.rb +164 -0
- data/lib/rails_generator/simple_logger.rb +46 -0
- data/lib/rails_generator/spec.rb +44 -0
- data/lib/rails_generator.rb +43 -0
- data/lib/railties_path.rb +1 -0
- data/lib/ruby_version_check.rb +17 -0
- data/lib/rubyprof_ext.rb +35 -0
- data/lib/source_annotation_extractor.rb +102 -0
- data/lib/tasks/annotations.rake +23 -0
- data/lib/tasks/databases.rake +389 -0
- data/lib/tasks/documentation.rake +80 -0
- data/lib/tasks/framework.rake +105 -0
- data/lib/tasks/gems.rake +64 -0
- data/lib/tasks/log.rake +9 -0
- data/lib/tasks/misc.rake +57 -0
- data/lib/tasks/rails.rb +8 -0
- data/lib/tasks/routes.rake +17 -0
- data/lib/tasks/statistics.rake +18 -0
- data/lib/tasks/testing.rake +118 -0
- data/lib/tasks/tmp.rake +37 -0
- data/lib/test_help.rb +28 -0
- data/lib/webrick_server.rb +165 -0
- metadata +356 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/local/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'drb'
|
|
4
|
+
|
|
5
|
+
# This file includes an experimental gateway CGI implementation. It will work
|
|
6
|
+
# only on platforms which support both fork and sockets.
|
|
7
|
+
#
|
|
8
|
+
# To enable it edit public/.htaccess and replace dispatch.cgi with gateway.cgi.
|
|
9
|
+
#
|
|
10
|
+
# Next, create the directory log/drb_gateway and grant the apache user rw access
|
|
11
|
+
# to said directory.
|
|
12
|
+
#
|
|
13
|
+
# On the next request to your server, the gateway tracker should start up, along
|
|
14
|
+
# with a few listener processes. This setup should provide you with much better
|
|
15
|
+
# speeds than dispatch.cgi.
|
|
16
|
+
#
|
|
17
|
+
# Keep in mind that the first request made to the server will be slow, as the
|
|
18
|
+
# tracker and listeners will have to load. Also, the tracker and listeners will
|
|
19
|
+
# shutdown after a period if inactivity. You can set this value below -- the
|
|
20
|
+
# default is 90 seconds.
|
|
21
|
+
|
|
22
|
+
TrackerSocket = File.expand_path(File.join(File.dirname(__FILE__), '../log/drb_gateway/tracker.sock'))
|
|
23
|
+
DieAfter = 90 # Seconds
|
|
24
|
+
Listeners = 3
|
|
25
|
+
|
|
26
|
+
def message(s)
|
|
27
|
+
$stderr.puts "gateway.cgi: #{s}" if ENV && ENV["DEBUG_GATEWAY"]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def listener_socket(number)
|
|
31
|
+
File.expand_path(File.join(File.dirname(__FILE__), "../log/drb_gateway/listener_#{number}.sock"))
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
unless File.exist? TrackerSocket
|
|
35
|
+
message "Starting tracker and #{Listeners} listeners"
|
|
36
|
+
fork do
|
|
37
|
+
Process.setsid
|
|
38
|
+
STDIN.reopen "/dev/null"
|
|
39
|
+
STDOUT.reopen "/dev/null", "a"
|
|
40
|
+
|
|
41
|
+
root = File.expand_path(File.dirname(__FILE__) + '/..')
|
|
42
|
+
|
|
43
|
+
message "starting tracker"
|
|
44
|
+
fork do
|
|
45
|
+
ARGV.clear
|
|
46
|
+
ARGV << TrackerSocket << Listeners.to_s << DieAfter.to_s
|
|
47
|
+
load File.join(root, 'script', 'tracker')
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
message "starting listeners"
|
|
51
|
+
require File.join(root, 'config/environment.rb')
|
|
52
|
+
Listeners.times do |number|
|
|
53
|
+
fork do
|
|
54
|
+
ARGV.clear
|
|
55
|
+
ARGV << listener_socket(number) << DieAfter.to_s
|
|
56
|
+
load File.join(root, 'script', 'listener')
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
message "waiting for tracker and listener to arise..."
|
|
62
|
+
ready = false
|
|
63
|
+
10.times do
|
|
64
|
+
sleep 0.5
|
|
65
|
+
break if (ready = File.exist?(TrackerSocket) && File.exist?(listener_socket(0)))
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if ready
|
|
69
|
+
message "tracker and listener are ready"
|
|
70
|
+
else
|
|
71
|
+
message "Waited 5 seconds, listener and tracker not ready... dropping request"
|
|
72
|
+
Kernel.exit 1
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
DRb.start_service
|
|
77
|
+
|
|
78
|
+
message "connecting to tracker"
|
|
79
|
+
tracker = DRbObject.new_with_uri("drbunix:#{TrackerSocket}")
|
|
80
|
+
|
|
81
|
+
input = $stdin.read
|
|
82
|
+
$stdin.close
|
|
83
|
+
|
|
84
|
+
env = ENV.inspect
|
|
85
|
+
|
|
86
|
+
output = nil
|
|
87
|
+
tracker.with_listener do |number|
|
|
88
|
+
message "connecting to listener #{number}"
|
|
89
|
+
socket = listener_socket(number)
|
|
90
|
+
listener = DRbObject.new_with_uri("drbunix:#{socket}")
|
|
91
|
+
output = listener.process(env, input)
|
|
92
|
+
message "listener #{number} has finished, writing output"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
$stdout.write output
|
|
96
|
+
$stdout.flush
|
|
97
|
+
$stdout.close
|
data/doc/README_FOR_APP
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Don't change this file!
|
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
|
3
|
+
|
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
|
5
|
+
|
|
6
|
+
module Rails
|
|
7
|
+
class << self
|
|
8
|
+
def boot!
|
|
9
|
+
unless booted?
|
|
10
|
+
preinitialize
|
|
11
|
+
pick_boot.run
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def booted?
|
|
16
|
+
defined? Rails::Initializer
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def pick_boot
|
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def vendor_rails?
|
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/erails")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def preinitialize
|
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def preinitializer_path
|
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class Boot
|
|
37
|
+
def run
|
|
38
|
+
load_initializer
|
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class VendorBoot < Boot
|
|
44
|
+
def load_initializer
|
|
45
|
+
require "#{RAILS_ROOT}/vendor/erails/erailties/lib/initializer"
|
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
class GemBoot < Boot
|
|
51
|
+
def load_initializer
|
|
52
|
+
self.class.load_rubygems
|
|
53
|
+
load_rails_gem
|
|
54
|
+
require 'initializer'
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def load_rails_gem
|
|
58
|
+
if version = self.class.gem_version
|
|
59
|
+
gem 'erails', version
|
|
60
|
+
else
|
|
61
|
+
gem 'erails'
|
|
62
|
+
end
|
|
63
|
+
rescue Gem::LoadError => load_error
|
|
64
|
+
$stderr.puts %(Missing the Enhanced Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
|
65
|
+
exit 1
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class << self
|
|
69
|
+
def rubygems_version
|
|
70
|
+
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def gem_version
|
|
74
|
+
if defined? RAILS_GEM_VERSION
|
|
75
|
+
RAILS_GEM_VERSION
|
|
76
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
|
77
|
+
ENV['RAILS_GEM_VERSION']
|
|
78
|
+
else
|
|
79
|
+
parse_gem_version(read_environment_rb)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def load_rubygems
|
|
84
|
+
require 'rubygems'
|
|
85
|
+
min_version = '1.1.1'
|
|
86
|
+
unless rubygems_version >= min_version
|
|
87
|
+
$stderr.puts %Q(Enhanced Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
|
88
|
+
exit 1
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
rescue LoadError
|
|
92
|
+
$stderr.puts %Q(Enhanced Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
|
93
|
+
exit 1
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def parse_gem_version(text)
|
|
97
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
private
|
|
101
|
+
def read_environment_rb
|
|
102
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# All that for this:
|
|
109
|
+
Rails.boot!
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
|
2
|
+
|
|
3
|
+
# In the development environment your application's code is reloaded on
|
|
4
|
+
# every request. This slows down response time but is perfect for development
|
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
|
6
|
+
config.cache_classes = false
|
|
7
|
+
|
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
|
9
|
+
config.whiny_nils = true
|
|
10
|
+
|
|
11
|
+
# Show full error reports and disable caching
|
|
12
|
+
config.action_controller.consider_all_requests_local = true
|
|
13
|
+
config.action_controller.perform_caching = false
|
|
14
|
+
|
|
15
|
+
# Don't care if the mailer can't send
|
|
16
|
+
config.action_mailer.raise_delivery_errors = false
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file
|
|
2
|
+
|
|
3
|
+
# Uncomment below to force Rails into production mode when
|
|
4
|
+
# you don't control web/app server and can't set it the proper way
|
|
5
|
+
# ENV['RAILS_ENV'] ||= 'production'
|
|
6
|
+
|
|
7
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
|
8
|
+
<%= '# ' if freeze %>RAILS_GEM_VERSION = '<%= Rails::VERSION::STRING %>' unless defined? RAILS_GEM_VERSION
|
|
9
|
+
|
|
10
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
|
11
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
|
12
|
+
|
|
13
|
+
Rails::Initializer.run do |config|
|
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
15
|
+
# Application configuration should go into files in config/initializers
|
|
16
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
17
|
+
# See Rails::Configuration for more options.
|
|
18
|
+
|
|
19
|
+
# Template Engine to use erb or haml
|
|
20
|
+
# If you use haml, will be added a gem dependency
|
|
21
|
+
config.template_engine = :erb
|
|
22
|
+
|
|
23
|
+
# Skip frameworks you're not going to use. To use Rails without a database
|
|
24
|
+
# you must remove the Active Record framework.
|
|
25
|
+
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
|
26
|
+
|
|
27
|
+
# Specify gems that this application depends on.
|
|
28
|
+
# They can then be installed with "rake gems:install" on new installations.
|
|
29
|
+
# config.gem "bj"
|
|
30
|
+
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
|
31
|
+
# config.gem "aws-s3", :lib => "aws/s3"
|
|
32
|
+
|
|
33
|
+
# Only load the plugins named here, in the order given. By default, all plugins
|
|
34
|
+
# in vendor/plugins are loaded in alphabetical order.
|
|
35
|
+
# :all can be used as a placeholder for all plugins not explicitly named
|
|
36
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
37
|
+
|
|
38
|
+
# Add additional load paths for your own custom dirs
|
|
39
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
|
40
|
+
|
|
41
|
+
# Force all environments to use the same logger level
|
|
42
|
+
# (by default production uses :info, the others :debug)
|
|
43
|
+
# config.log_level = :debug
|
|
44
|
+
|
|
45
|
+
# Make Time.zone default to the specified zone, and make Active Record store time values
|
|
46
|
+
# in the database in UTC, and return them converted to the specified local zone.
|
|
47
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
|
|
48
|
+
config.time_zone = 'UTC'
|
|
49
|
+
|
|
50
|
+
# Your secret key for verifying cookie session data integrity.
|
|
51
|
+
# If you change this key, all old sessions will become invalid!
|
|
52
|
+
# Make sure the secret is at least 30 characters and all random,
|
|
53
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
|
54
|
+
config.action_controller.session = {
|
|
55
|
+
:session_key => '_<%= app_name %>_session',
|
|
56
|
+
:secret => '<%= app_secret %>'
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# Use the database for sessions instead of the cookie-based default,
|
|
60
|
+
# which shouldn't be used to store highly confidential information
|
|
61
|
+
# (create the session table with "rake db:sessions:create")
|
|
62
|
+
# config.action_controller.session_store = :active_record_store
|
|
63
|
+
|
|
64
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
|
65
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
66
|
+
# like if you have constraints or database-specific column types
|
|
67
|
+
# config.active_record.schema_format = :sql
|
|
68
|
+
|
|
69
|
+
# Activate observers that should always be running
|
|
70
|
+
# config.active_record.observers = :cacher, :garbage_collector
|
|
71
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
|
2
|
+
|
|
3
|
+
# The production environment is meant for finished, "live" apps.
|
|
4
|
+
# Code is not reloaded between requests
|
|
5
|
+
config.cache_classes = true
|
|
6
|
+
|
|
7
|
+
# Use a different logger for distributed setups
|
|
8
|
+
# config.logger = SyslogLogger.new
|
|
9
|
+
|
|
10
|
+
# Full error reports are disabled and caching is turned on
|
|
11
|
+
config.action_controller.consider_all_requests_local = false
|
|
12
|
+
config.action_controller.perform_caching = true
|
|
13
|
+
config.action_view.cache_template_loading = true
|
|
14
|
+
|
|
15
|
+
# Use a different cache store in production
|
|
16
|
+
# config.cache_store = :mem_cache_store
|
|
17
|
+
|
|
18
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
|
19
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
|
20
|
+
|
|
21
|
+
# Disable delivery errors, bad email addresses will be ignored
|
|
22
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
|
2
|
+
|
|
3
|
+
# The test environment is used exclusively to run your application's
|
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
7
|
+
config.cache_classes = true
|
|
8
|
+
|
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
|
10
|
+
config.whiny_nils = true
|
|
11
|
+
|
|
12
|
+
# Show full error reports and disable caching
|
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
|
14
|
+
config.action_controller.perform_caching = false
|
|
15
|
+
|
|
16
|
+
# Disable request forgery protection in test environment
|
|
17
|
+
config.action_controller.allow_forgery_protection = false
|
|
18
|
+
|
|
19
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
|
20
|
+
# The :test delivery method accumulates sent emails in the
|
|
21
|
+
# ActionMailer::Base.deliveries array.
|
|
22
|
+
config.action_mailer.delivery_method = :test
|
data/fresh_rakefile
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
3
|
+
|
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
|
5
|
+
|
|
6
|
+
require 'rake'
|
|
7
|
+
require 'rake/testtask'
|
|
8
|
+
require 'rake/rdoctask'
|
|
9
|
+
|
|
10
|
+
require 'tasks/rails'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
|
3
|
+
|
|
4
|
+
class ApplicationController < ActionController::Base
|
|
5
|
+
helper :all # include all helpers, all the time
|
|
6
|
+
|
|
7
|
+
# See ActionController::RequestForgeryProtection for details
|
|
8
|
+
# Uncomment the :secret if you're not using the cookie session store
|
|
9
|
+
protect_from_forgery # :secret => '<%= app_secret %>'
|
|
10
|
+
|
|
11
|
+
# See ActionController::Base for details
|
|
12
|
+
# Uncomment this to filter the contents of submitted sensitive data parameters
|
|
13
|
+
# from your application log (in this case, all fields with names like "password").
|
|
14
|
+
# filter_parameter_logging :password
|
|
15
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
|
3
|
+
require 'test_help'
|
|
4
|
+
|
|
5
|
+
class Test::Unit::TestCase
|
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
|
10
|
+
#
|
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
|
13
|
+
#
|
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
|
17
|
+
# is recommended.
|
|
18
|
+
#
|
|
19
|
+
# The only drawback to using transactional fixtures is when you actually
|
|
20
|
+
# need to test transactions. Since your test is bracketed by a transaction,
|
|
21
|
+
# any transactions started in your code will be automatically rolled back.
|
|
22
|
+
self.use_transactional_fixtures = true
|
|
23
|
+
|
|
24
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
|
25
|
+
# would need people(:david). If you don't want to migrate your existing
|
|
26
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
|
27
|
+
# instantiated fixtures translates to a database query per test method),
|
|
28
|
+
# then set this back to true.
|
|
29
|
+
self.use_instantiated_fixtures = false
|
|
30
|
+
|
|
31
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
|
32
|
+
#
|
|
33
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
|
34
|
+
# -- they do not yet inherit this setting
|
|
35
|
+
fixtures :all
|
|
36
|
+
|
|
37
|
+
# Add more helper methods to be used by all tests here...
|
|
38
|
+
end
|
data/html/404.html
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
|
|
6
|
+
<head>
|
|
7
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
8
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
9
|
+
<style type="text/css">
|
|
10
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
11
|
+
div.dialog {
|
|
12
|
+
width: 25em;
|
|
13
|
+
padding: 0 4em;
|
|
14
|
+
margin: 4em auto 0 auto;
|
|
15
|
+
border: 1px solid #ccc;
|
|
16
|
+
border-right-color: #999;
|
|
17
|
+
border-bottom-color: #999;
|
|
18
|
+
}
|
|
19
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
20
|
+
</style>
|
|
21
|
+
</head>
|
|
22
|
+
|
|
23
|
+
<body>
|
|
24
|
+
<!-- This file lives in public/404.html -->
|
|
25
|
+
<div class="dialog">
|
|
26
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
27
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
28
|
+
</div>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
data/html/422.html
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
|
|
6
|
+
<head>
|
|
7
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
8
|
+
<title>The change you wanted was rejected (422)</title>
|
|
9
|
+
<style type="text/css">
|
|
10
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
11
|
+
div.dialog {
|
|
12
|
+
width: 25em;
|
|
13
|
+
padding: 0 4em;
|
|
14
|
+
margin: 4em auto 0 auto;
|
|
15
|
+
border: 1px solid #ccc;
|
|
16
|
+
border-right-color: #999;
|
|
17
|
+
border-bottom-color: #999;
|
|
18
|
+
}
|
|
19
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
20
|
+
</style>
|
|
21
|
+
</head>
|
|
22
|
+
|
|
23
|
+
<body>
|
|
24
|
+
<!-- This file lives in public/422.html -->
|
|
25
|
+
<div class="dialog">
|
|
26
|
+
<h1>The change you wanted was rejected.</h1>
|
|
27
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
28
|
+
</div>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
data/html/500.html
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
|
|
6
|
+
<head>
|
|
7
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
8
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
9
|
+
<style type="text/css">
|
|
10
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
11
|
+
div.dialog {
|
|
12
|
+
width: 25em;
|
|
13
|
+
padding: 0 4em;
|
|
14
|
+
margin: 4em auto 0 auto;
|
|
15
|
+
border: 1px solid #ccc;
|
|
16
|
+
border-right-color: #999;
|
|
17
|
+
border-bottom-color: #999;
|
|
18
|
+
}
|
|
19
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
20
|
+
</style>
|
|
21
|
+
</head>
|
|
22
|
+
|
|
23
|
+
<body>
|
|
24
|
+
<!-- This file lives in public/500.html -->
|
|
25
|
+
<div class="dialog">
|
|
26
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
27
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
|
28
|
+
</div>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
data/html/favicon.ico
ADDED
|
File without changes
|
|
Binary file
|