statemachine 1.2.0 → 2.0.0
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/.gitignore +12 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +12 -0
- data/Rakefile +21 -20
- data/doc/website/README +6 -0
- data/doc/website/config.yaml +2 -0
- data/doc/website/index.html +39 -0
- data/doc/website/src/default.css +110 -0
- data/doc/website/src/default.template +41 -0
- data/doc/website/src/documentation.page +45 -0
- data/doc/website/src/example.page +13 -0
- data/doc/website/src/example1.page +59 -0
- data/doc/website/src/example2.page +96 -0
- data/doc/website/src/example3.page +76 -0
- data/doc/website/src/example4.page +65 -0
- data/doc/website/src/images/8l_star.png +0 -0
- data/doc/website/src/images/bg.png +0 -0
- data/doc/website/src/images/bottom_border.png +0 -0
- data/doc/website/src/images/bottom_edge.png +0 -0
- data/doc/website/src/images/examples/vending_machine.png +0 -0
- data/doc/website/src/images/examples/vending_machine2.png +0 -0
- data/doc/website/src/images/examples/vending_machine3.png +0 -0
- data/doc/website/src/images/examples/vending_machine4a.png +0 -0
- data/doc/website/src/images/examples/vending_machine4b.png +0 -0
- data/doc/website/src/images/left_edge.png +0 -0
- data/doc/website/src/images/logo.png +0 -0
- data/doc/website/src/images/right_edge.png +0 -0
- data/doc/website/src/images/side_borders.png +0 -0
- data/doc/website/src/index.page +20 -0
- data/generate_tests/dot_graph/turnstile.rb +29 -0
- data/generate_tests/dot_graph/turnstile2.rb +48 -0
- data/generate_tests/java/turnstile.rb +54 -0
- data/generate_tests/java/turnstile2.rb +72 -0
- data/lib/statemachine/action_invokation.rb +0 -19
- data/lib/statemachine/version.rb +2 -2
- data/rails_plugin/README +183 -0
- data/rails_plugin/Rakefile +11 -0
- data/rails_plugin/app/controllers/admin_controller.rb +43 -0
- data/rails_plugin/app/controllers/application.rb +7 -0
- data/rails_plugin/app/controllers/main_controller.rb +34 -0
- data/rails_plugin/app/helpers/admin_helper.rb +2 -0
- data/rails_plugin/app/helpers/application_helper.rb +3 -0
- data/rails_plugin/app/helpers/main_helper.rb +7 -0
- data/rails_plugin/app/models/product.rb +21 -0
- data/rails_plugin/app/models/vending_machine.rb +36 -0
- data/rails_plugin/app/models/vending_machine_interface.rb +101 -0
- data/rails_plugin/app/models/vending_statemachine.rb +41 -0
- data/rails_plugin/app/views/admin/index.rhtml +45 -0
- data/rails_plugin/app/views/layouts/main.rhtml +12 -0
- data/rails_plugin/app/views/main/_info.rhtml +13 -0
- data/rails_plugin/app/views/main/event.rjs +27 -0
- data/rails_plugin/app/views/main/index.rhtml +38 -0
- data/rails_plugin/config/boot.rb +45 -0
- data/rails_plugin/config/database.yml +21 -0
- data/rails_plugin/config/environment.rb +60 -0
- data/rails_plugin/config/environments/development.rb +21 -0
- data/rails_plugin/config/environments/production.rb +18 -0
- data/rails_plugin/config/environments/test.rb +19 -0
- data/rails_plugin/config/routes.rb +23 -0
- data/rails_plugin/db/migrate/001_create_vending_machines.rb +12 -0
- data/rails_plugin/db/migrate/002_create_products.rb +14 -0
- data/rails_plugin/db/migrate/003_add_position_to_products.rb +9 -0
- data/rails_plugin/db/schema.rb +20 -0
- data/rails_plugin/doc/README_FOR_APP +2 -0
- data/rails_plugin/lib/tasks/base.rake +5 -0
- data/rails_plugin/public/.htaccess +40 -0
- data/rails_plugin/public/404.html +30 -0
- data/rails_plugin/public/500.html +30 -0
- data/rails_plugin/public/dispatch.cgi +10 -0
- data/rails_plugin/public/dispatch.fcgi +24 -0
- data/rails_plugin/public/dispatch.rb +10 -0
- data/rails_plugin/public/favicon.ico +0 -0
- data/rails_plugin/public/images/bricks.jpg +0 -0
- data/rails_plugin/public/images/cash_release_button.png +0 -0
- data/rails_plugin/public/images/change.png +0 -0
- data/rails_plugin/public/images/dime.png +0 -0
- data/rails_plugin/public/images/dollar.png +0 -0
- data/rails_plugin/public/images/money_panel.png +0 -0
- data/rails_plugin/public/images/nickel.png +0 -0
- data/rails_plugin/public/images/quarter.png +0 -0
- data/rails_plugin/public/images/rails.png +0 -0
- data/rails_plugin/public/images/vending_machine_body.png +0 -0
- data/rails_plugin/public/index.html +277 -0
- data/rails_plugin/public/javascripts/application.js +2 -0
- data/rails_plugin/public/javascripts/controls.js +833 -0
- data/rails_plugin/public/javascripts/dragdrop.js +942 -0
- data/rails_plugin/public/javascripts/effects.js +1088 -0
- data/rails_plugin/public/javascripts/prototype.js +2515 -0
- data/rails_plugin/public/robots.txt +1 -0
- data/rails_plugin/public/stylesheets/layout.css +163 -0
- data/rails_plugin/script/about +3 -0
- data/rails_plugin/script/breakpointer +3 -0
- data/rails_plugin/script/console +3 -0
- data/rails_plugin/script/destroy +3 -0
- data/rails_plugin/script/generate +3 -0
- data/rails_plugin/script/performance/benchmarker +3 -0
- data/rails_plugin/script/performance/profiler +3 -0
- data/rails_plugin/script/plugin +3 -0
- data/rails_plugin/script/process/inspector +3 -0
- data/rails_plugin/script/process/reaper +3 -0
- data/rails_plugin/script/process/spawner +3 -0
- data/rails_plugin/script/rails_spec +11 -0
- data/rails_plugin/script/rails_spec_server +43 -0
- data/rails_plugin/script/runner +3 -0
- data/rails_plugin/script/server +3 -0
- data/rails_plugin/spec/controllers/admin_controller_spec.rb +7 -0
- data/rails_plugin/spec/controllers/main_controller_spec.rb +38 -0
- data/rails_plugin/spec/fixtures/products.yml +2 -0
- data/rails_plugin/spec/fixtures/vending_machines.yml +2 -0
- data/rails_plugin/spec/helpers/admin_helper_spec.rb +5 -0
- data/rails_plugin/spec/helpers/main_helper_spec.rb +5 -0
- data/rails_plugin/spec/models/product_spec.rb +16 -0
- data/rails_plugin/spec/models/vending_machine_interface_spec.rb +168 -0
- data/rails_plugin/spec/models/vending_machine_spec.rb +30 -0
- data/rails_plugin/spec/models/vending_statemachine_spec.rb +130 -0
- data/rails_plugin/spec/plugins/context_support_spec.rb +28 -0
- data/rails_plugin/spec/plugins/controller_support_spec.rb +98 -0
- data/rails_plugin/spec/spec.opts +1 -0
- data/rails_plugin/spec/spec_helper.rb +28 -0
- data/rails_plugin/spec/views/main/event_spec.rb +61 -0
- data/rails_plugin/vendor/plugins/statemachine/README +4 -0
- data/rails_plugin/vendor/plugins/statemachine/Rakefile +22 -0
- data/rails_plugin/vendor/plugins/statemachine/init.rb +2 -0
- data/rails_plugin/vendor/plugins/statemachine/install.rb +1 -0
- data/rails_plugin/vendor/plugins/statemachine/lib/context_support.rb +22 -0
- data/rails_plugin/vendor/plugins/statemachine/lib/controller_support.rb +85 -0
- data/rails_plugin/vendor/plugins/statemachine/lib/statemachine_on_rails.rb +11 -0
- data/rails_plugin/vendor/plugins/statemachine/tasks/statemachine_tasks.rake +4 -0
- data/spec/action_invokation_spec.rb +1 -1
- data/spec/builder_spec.rb +1 -1
- data/spec/default_transition_spec.rb +1 -1
- data/spec/generate/dot_graph/dot_graph_stagemachine_spec.rb +1 -1
- data/spec/history_spec.rb +1 -1
- data/spec/sm_action_parameterization_spec.rb +1 -1
- data/spec/sm_entry_exit_actions_spec.rb +1 -1
- data/spec/sm_odds_n_ends_spec.rb +1 -1
- data/spec/sm_simple_spec.rb +1 -1
- data/spec/sm_super_state_spec.rb +1 -1
- data/spec/sm_turnstile_spec.rb +1 -1
- data/spec/transition_spec.rb +1 -1
- metadata +162 -46
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
|
|
2
|
+
|
|
3
|
+
unless defined?(RAILS_ROOT)
|
|
4
|
+
root_path = File.join(File.dirname(__FILE__), '..')
|
|
5
|
+
|
|
6
|
+
unless RUBY_PLATFORM =~ /mswin32/
|
|
7
|
+
require 'pathname'
|
|
8
|
+
root_path = Pathname.new(root_path).cleanpath(true).to_s
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
RAILS_ROOT = root_path
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
unless defined?(Rails::Initializer)
|
|
15
|
+
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
|
16
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
|
17
|
+
else
|
|
18
|
+
require 'rubygems'
|
|
19
|
+
|
|
20
|
+
environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
|
|
21
|
+
environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
|
|
22
|
+
rails_gem_version = $1
|
|
23
|
+
|
|
24
|
+
if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
|
|
25
|
+
# Asking for 1.1.6 will give you 1.1.6.5206, if available -- makes it easier to use beta gems
|
|
26
|
+
rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last
|
|
27
|
+
|
|
28
|
+
if rails_gem
|
|
29
|
+
gem "rails", "=#{rails_gem.version.version}"
|
|
30
|
+
require rails_gem.full_gem_path + '/lib/initializer'
|
|
31
|
+
else
|
|
32
|
+
STDERR.puts %(Cannot find gem for Rails ~>#{version}.0:
|
|
33
|
+
Install the missing gem with 'gem install -v=#{version} rails', or
|
|
34
|
+
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
|
35
|
+
)
|
|
36
|
+
exit 1
|
|
37
|
+
end
|
|
38
|
+
else
|
|
39
|
+
gem "rails"
|
|
40
|
+
require 'initializer'
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
Rails::Initializer.run(:set_load_path)
|
|
45
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
development:
|
|
3
|
+
adapter: postgresql
|
|
4
|
+
database: Vending_dev
|
|
5
|
+
username: rails
|
|
6
|
+
password:
|
|
7
|
+
host: localhost
|
|
8
|
+
|
|
9
|
+
test:
|
|
10
|
+
adapter: postgresql
|
|
11
|
+
database: Vending_test
|
|
12
|
+
username: rails
|
|
13
|
+
password:
|
|
14
|
+
host: localhost
|
|
15
|
+
|
|
16
|
+
production:
|
|
17
|
+
adapter: postgresql
|
|
18
|
+
database: Vending
|
|
19
|
+
username: rails
|
|
20
|
+
password:
|
|
21
|
+
host: localhost
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Be sure to restart your web 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
|
+
RAILS_GEM_VERSION = '1.2.2' 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
|
+
|
|
16
|
+
# Skip frameworks you're not going to use (only works if using vendor/rails)
|
|
17
|
+
# config.frameworks -= [ :action_web_service, :action_mailer ]
|
|
18
|
+
|
|
19
|
+
# Only load the plugins named here, by default all plugins in vendor/plugins are loaded
|
|
20
|
+
# config.plugins = %W( exception_notification ssl_requirement )
|
|
21
|
+
|
|
22
|
+
# Add additional load paths for your own custom dirs
|
|
23
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
|
24
|
+
|
|
25
|
+
# Force all environments to use the same logger level
|
|
26
|
+
# (by default production uses :info, the others :debug)
|
|
27
|
+
# config.log_level = :debug
|
|
28
|
+
|
|
29
|
+
# Use the database for sessions instead of the file system
|
|
30
|
+
# (create the session table with 'rake db:sessions:create')
|
|
31
|
+
# config.action_controller.session_store = :active_record_store
|
|
32
|
+
|
|
33
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
|
34
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
35
|
+
# like if you have constraints or database-specific column types
|
|
36
|
+
# config.active_record.schema_format = :sql
|
|
37
|
+
|
|
38
|
+
# Activate observers that should always be running
|
|
39
|
+
# config.active_record.observers = :cacher, :garbage_collector
|
|
40
|
+
|
|
41
|
+
# Make Active Record use UTC-base instead of local time
|
|
42
|
+
# config.active_record.default_timezone = :utc
|
|
43
|
+
|
|
44
|
+
# See Rails::Configuration for more options
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Add new inflection rules using the following format
|
|
48
|
+
# (all these examples are active by default):
|
|
49
|
+
# Inflector.inflections do |inflect|
|
|
50
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
|
51
|
+
# inflect.singular /^(ox)en/i, '\1'
|
|
52
|
+
# inflect.irregular 'person', 'people'
|
|
53
|
+
# inflect.uncountable %w( fish sheep )
|
|
54
|
+
# end
|
|
55
|
+
|
|
56
|
+
# Add new mime types for use in respond_to blocks:
|
|
57
|
+
# Mime::Type.register "text/richtext", :rtf
|
|
58
|
+
# Mime::Type.register "application/x-mobile", :mobile
|
|
59
|
+
|
|
60
|
+
# Include your application configuration below
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
# Enable the breakpoint server that script/breakpointer connects to
|
|
12
|
+
config.breakpoint_server = true
|
|
13
|
+
|
|
14
|
+
# Show full error reports and disable caching
|
|
15
|
+
config.action_controller.consider_all_requests_local = true
|
|
16
|
+
config.action_controller.perform_caching = false
|
|
17
|
+
config.action_view.cache_template_extensions = false
|
|
18
|
+
config.action_view.debug_rjs = true
|
|
19
|
+
|
|
20
|
+
# Don't care if the mailer can't send
|
|
21
|
+
config.action_mailer.raise_delivery_errors = false
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
|
|
14
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
|
15
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
|
16
|
+
|
|
17
|
+
# Disable delivery errors, bad email addresses will be ignored
|
|
18
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
# Tell ActionMailer not to deliver emails to the real world.
|
|
17
|
+
# The :test delivery method accumulates sent emails in the
|
|
18
|
+
# ActionMailer::Base.deliveries array.
|
|
19
|
+
config.action_mailer.delivery_method = :test
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
|
3
|
+
|
|
4
|
+
# Sample of regular route:
|
|
5
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
|
6
|
+
# Keep in mind you can assign values other than :controller and :action
|
|
7
|
+
|
|
8
|
+
# Sample of named route:
|
|
9
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
|
10
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
|
11
|
+
|
|
12
|
+
# You can have the root of your site routed by hooking up ''
|
|
13
|
+
# -- just remember to delete public/index.html.
|
|
14
|
+
# map.connect '', :controller => "welcome"
|
|
15
|
+
|
|
16
|
+
# Allow downloading Web Service WSDL as a file with an extension
|
|
17
|
+
# instead of a file named 'wsdl'
|
|
18
|
+
map.connect ':controller/service.wsdl', :action => 'wsdl'
|
|
19
|
+
|
|
20
|
+
# Install the default route as the lowest priority.
|
|
21
|
+
map.connect ':controller/:action/:id.:format'
|
|
22
|
+
map.connect ':controller/:action/:id'
|
|
23
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class CreateProducts < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :products do |t|
|
|
4
|
+
t.column :vending_machine_id, :integer
|
|
5
|
+
t.column :name, :string
|
|
6
|
+
t.column :price, :integer
|
|
7
|
+
t.column :inventory, :integer
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.down
|
|
12
|
+
drop_table :products
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# This file is autogenerated. Instead of editing this file, please use the
|
|
2
|
+
# migrations feature of ActiveRecord to incrementally modify your database, and
|
|
3
|
+
# then regenerate this schema definition.
|
|
4
|
+
|
|
5
|
+
ActiveRecord::Schema.define(:version => 3) do
|
|
6
|
+
|
|
7
|
+
create_table "products", :force => true do |t|
|
|
8
|
+
t.column "vending_machine_id", :integer
|
|
9
|
+
t.column "name", :string
|
|
10
|
+
t.column "price", :integer
|
|
11
|
+
t.column "inventory", :integer
|
|
12
|
+
t.column "position", :integer
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
create_table "vending_machines", :force => true do |t|
|
|
16
|
+
t.column "location", :string
|
|
17
|
+
t.column "cash", :integer
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# General Apache options
|
|
2
|
+
AddHandler fastcgi-script .fcgi
|
|
3
|
+
AddHandler cgi-script .cgi
|
|
4
|
+
Options +FollowSymLinks +ExecCGI
|
|
5
|
+
|
|
6
|
+
# If you don't want Rails to look in certain directories,
|
|
7
|
+
# use the following rewrite rules so that Apache won't rewrite certain requests
|
|
8
|
+
#
|
|
9
|
+
# Example:
|
|
10
|
+
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
|
11
|
+
# RewriteRule .* - [L]
|
|
12
|
+
|
|
13
|
+
# Redirect all requests not available on the filesystem to Rails
|
|
14
|
+
# By default the cgi dispatcher is used which is very slow
|
|
15
|
+
#
|
|
16
|
+
# For better performance replace the dispatcher with the fastcgi one
|
|
17
|
+
#
|
|
18
|
+
# Example:
|
|
19
|
+
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
|
20
|
+
RewriteEngine On
|
|
21
|
+
|
|
22
|
+
# If your Rails application is accessed via an Alias directive,
|
|
23
|
+
# then you MUST also set the RewriteBase in this htaccess file.
|
|
24
|
+
#
|
|
25
|
+
# Example:
|
|
26
|
+
# Alias /myrailsapp /path/to/myrailsapp/public
|
|
27
|
+
# RewriteBase /myrailsapp
|
|
28
|
+
|
|
29
|
+
RewriteRule ^$ index.html [QSA]
|
|
30
|
+
RewriteRule ^([^.]+)$ $1.html [QSA]
|
|
31
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
|
32
|
+
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
|
33
|
+
|
|
34
|
+
# In case Rails experiences terminal errors
|
|
35
|
+
# Instead of displaying this message you can supply a file here which will be rendered instead
|
|
36
|
+
#
|
|
37
|
+
# Example:
|
|
38
|
+
# ErrorDocument 500 /500.html
|
|
39
|
+
|
|
40
|
+
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
|
|
@@ -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>
|
|
@@ -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</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>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/opt/local/bin/ruby
|
|
2
|
+
|
|
3
|
+
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
|
4
|
+
|
|
5
|
+
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
|
|
6
|
+
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
|
|
7
|
+
require "dispatcher"
|
|
8
|
+
|
|
9
|
+
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
|
10
|
+
Dispatcher.dispatch
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/opt/local/bin/ruby
|
|
2
|
+
#
|
|
3
|
+
# You may specify the path to the FastCGI crash log (a log of unhandled
|
|
4
|
+
# exceptions which forced the FastCGI instance to exit, great for debugging)
|
|
5
|
+
# and the number of requests to process before running garbage collection.
|
|
6
|
+
#
|
|
7
|
+
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
|
|
8
|
+
# and the GC period is nil (turned off). A reasonable number of requests
|
|
9
|
+
# could range from 10-100 depending on the memory footprint of your app.
|
|
10
|
+
#
|
|
11
|
+
# Example:
|
|
12
|
+
# # Default log path, normal GC behavior.
|
|
13
|
+
# RailsFCGIHandler.process!
|
|
14
|
+
#
|
|
15
|
+
# # Default log path, 50 requests between GC.
|
|
16
|
+
# RailsFCGIHandler.process! nil, 50
|
|
17
|
+
#
|
|
18
|
+
# # Custom log path, normal GC behavior.
|
|
19
|
+
# RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
|
|
20
|
+
#
|
|
21
|
+
require File.dirname(__FILE__) + "/../config/environment"
|
|
22
|
+
require 'fcgi_handler'
|
|
23
|
+
|
|
24
|
+
RailsFCGIHandler.process!
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/opt/local/bin/ruby
|
|
2
|
+
|
|
3
|
+
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
|
4
|
+
|
|
5
|
+
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
|
|
6
|
+
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
|
|
7
|
+
require "dispatcher"
|
|
8
|
+
|
|
9
|
+
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
|
10
|
+
Dispatcher.dispatch
|
|
File without changes
|