wicked 0.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of wicked might be problematic. Click here for more details.

Files changed (55) hide show
  1. data/.rvmrc +19 -0
  2. data/Gemfile +19 -0
  3. data/Gemfile.lock +109 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +125 -0
  6. data/Rakefile +50 -0
  7. data/VERSION +1 -0
  8. data/app/controllers/wicked/wizard_controller.rb +57 -0
  9. data/lib/wicked/controller/concerns/path.rb +27 -0
  10. data/lib/wicked/controller/concerns/render_redirect.rb +46 -0
  11. data/lib/wicked/controller/concerns/steps.rb +41 -0
  12. data/lib/wicked/engine.rb +4 -0
  13. data/lib/wicked.rb +11 -0
  14. data/test/dummy/Rakefile +7 -0
  15. data/test/dummy/app/controllers/application_controller.rb +3 -0
  16. data/test/dummy/app/controllers/foo_controller.rb +11 -0
  17. data/test/dummy/app/helpers/application_helper.rb +2 -0
  18. data/test/dummy/app/views/foo/first.html.erb +1 -0
  19. data/test/dummy/app/views/foo/last_step.html.erb +0 -0
  20. data/test/dummy/app/views/foo/second.html.erb +1 -0
  21. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  22. data/test/dummy/config/application.rb +45 -0
  23. data/test/dummy/config/boot.rb +10 -0
  24. data/test/dummy/config/database.yml +22 -0
  25. data/test/dummy/config/environment.rb +5 -0
  26. data/test/dummy/config/environments/development.rb +26 -0
  27. data/test/dummy/config/environments/production.rb +49 -0
  28. data/test/dummy/config/environments/test.rb +35 -0
  29. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  30. data/test/dummy/config/initializers/inflections.rb +10 -0
  31. data/test/dummy/config/initializers/mime_types.rb +5 -0
  32. data/test/dummy/config/initializers/secret_token.rb +7 -0
  33. data/test/dummy/config/initializers/session_store.rb +8 -0
  34. data/test/dummy/config/locales/en.yml +5 -0
  35. data/test/dummy/config/routes.rb +59 -0
  36. data/test/dummy/config.ru +4 -0
  37. data/test/dummy/public/404.html +26 -0
  38. data/test/dummy/public/422.html +26 -0
  39. data/test/dummy/public/500.html +26 -0
  40. data/test/dummy/public/favicon.ico +0 -0
  41. data/test/dummy/public/index.html +1 -0
  42. data/test/dummy/public/javascripts/application.js +2 -0
  43. data/test/dummy/public/javascripts/controls.js +965 -0
  44. data/test/dummy/public/javascripts/dragdrop.js +974 -0
  45. data/test/dummy/public/javascripts/effects.js +1123 -0
  46. data/test/dummy/public/javascripts/prototype.js +6001 -0
  47. data/test/dummy/public/javascripts/rails.js +202 -0
  48. data/test/dummy/public/stylesheets/.gitkeep +0 -0
  49. data/test/dummy/script/rails +6 -0
  50. data/test/integration/navigation_test.rb +36 -0
  51. data/test/support/integration_case.rb +5 -0
  52. data/test/test_helper.rb +30 -0
  53. data/test/wicked_test.rb +7 -0
  54. data/wicked.gemspec +110 -0
  55. metadata +180 -0
data/.rvmrc ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ruby_string="ruby-1.9.2-p290"
4
+ gemset_name="wicked"
5
+
6
+ if rvm list strings | grep -q "${ruby_string}" ; then
7
+
8
+ rvm use "${ruby_string}@${gemset_name}" --create
9
+
10
+ # Complain if bundler isn't installed
11
+ if [[ -z "`gem which bundler 2>&1 | grep -v ERROR`" ]]; then
12
+ echo "You need bundler:"
13
+ echo ""
14
+ echo " gem install bundler"
15
+ echo ""
16
+ fi
17
+ else
18
+ echo "${ruby_string} was not found, please run 'rvm install ${ruby_string}' and then cd back into the project directory."
19
+ fi
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "activesupport" , ">= 3.0.7"
4
+ gem "rails" , ">= 3.0.7"
5
+
6
+
7
+
8
+ group :development do
9
+ gem 'jeweler', "~> 1.6.4"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "rcov", ">= 0"
12
+ gem "capybara", ">= 0.4.0"
13
+ gem "sqlite3"
14
+ end
15
+
16
+
17
+ # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
18
+ # gem 'ruby-debug'
19
+ # gem 'ruby-debug19'
data/Gemfile.lock ADDED
@@ -0,0 +1,109 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ abstract (1.0.0)
5
+ actionmailer (3.0.11)
6
+ actionpack (= 3.0.11)
7
+ mail (~> 2.2.19)
8
+ actionpack (3.0.11)
9
+ activemodel (= 3.0.11)
10
+ activesupport (= 3.0.11)
11
+ builder (~> 2.1.2)
12
+ erubis (~> 2.6.6)
13
+ i18n (~> 0.5.0)
14
+ rack (~> 1.2.1)
15
+ rack-mount (~> 0.6.14)
16
+ rack-test (~> 0.5.7)
17
+ tzinfo (~> 0.3.23)
18
+ activemodel (3.0.11)
19
+ activesupport (= 3.0.11)
20
+ builder (~> 2.1.2)
21
+ i18n (~> 0.5.0)
22
+ activerecord (3.0.11)
23
+ activemodel (= 3.0.11)
24
+ activesupport (= 3.0.11)
25
+ arel (~> 2.0.10)
26
+ tzinfo (~> 0.3.23)
27
+ activeresource (3.0.11)
28
+ activemodel (= 3.0.11)
29
+ activesupport (= 3.0.11)
30
+ activesupport (3.0.11)
31
+ arel (2.0.10)
32
+ builder (2.1.2)
33
+ capybara (1.1.2)
34
+ mime-types (>= 1.16)
35
+ nokogiri (>= 1.3.3)
36
+ rack (>= 1.0.0)
37
+ rack-test (>= 0.5.4)
38
+ selenium-webdriver (~> 2.0)
39
+ xpath (~> 0.1.4)
40
+ childprocess (0.2.4)
41
+ ffi (~> 1.0.6)
42
+ erubis (2.6.6)
43
+ abstract (>= 1.0.0)
44
+ ffi (1.0.11)
45
+ git (1.2.5)
46
+ i18n (0.5.0)
47
+ jeweler (1.6.4)
48
+ bundler (~> 1.0)
49
+ git (>= 1.2.5)
50
+ rake
51
+ json (1.6.4)
52
+ mail (2.2.19)
53
+ activesupport (>= 2.3.6)
54
+ i18n (>= 0.4.0)
55
+ mime-types (~> 1.16)
56
+ treetop (~> 1.4.8)
57
+ mime-types (1.17.2)
58
+ multi_json (1.0.4)
59
+ nokogiri (1.5.0)
60
+ polyglot (0.3.3)
61
+ rack (1.2.4)
62
+ rack-mount (0.6.14)
63
+ rack (>= 1.0.0)
64
+ rack-test (0.5.7)
65
+ rack (>= 1.0)
66
+ rails (3.0.11)
67
+ actionmailer (= 3.0.11)
68
+ actionpack (= 3.0.11)
69
+ activerecord (= 3.0.11)
70
+ activeresource (= 3.0.11)
71
+ activesupport (= 3.0.11)
72
+ bundler (~> 1.0)
73
+ railties (= 3.0.11)
74
+ railties (3.0.11)
75
+ actionpack (= 3.0.11)
76
+ activesupport (= 3.0.11)
77
+ rake (>= 0.8.7)
78
+ rdoc (~> 3.4)
79
+ thor (~> 0.14.4)
80
+ rake (0.9.2.2)
81
+ rcov (0.9.11)
82
+ rdoc (3.12)
83
+ json (~> 1.4)
84
+ rubyzip (0.9.5)
85
+ selenium-webdriver (2.15.0)
86
+ childprocess (>= 0.2.1)
87
+ ffi (~> 1.0.9)
88
+ multi_json (~> 1.0.4)
89
+ rubyzip
90
+ sqlite3 (1.3.5)
91
+ thor (0.14.6)
92
+ treetop (1.4.10)
93
+ polyglot
94
+ polyglot (>= 0.3.1)
95
+ tzinfo (0.3.31)
96
+ xpath (0.1.4)
97
+ nokogiri (~> 1.3)
98
+
99
+ PLATFORMS
100
+ ruby
101
+
102
+ DEPENDENCIES
103
+ activesupport (>= 3.0.7)
104
+ bundler (~> 1.0.0)
105
+ capybara (>= 0.4.0)
106
+ jeweler (~> 1.6.4)
107
+ rails (>= 3.0.7)
108
+ rcov
109
+ sqlite3
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2011 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # Wicked
2
+
3
+ Use wicked to make your Rails controllers into step-by-step wizards.
4
+
5
+ ## Why
6
+
7
+ Many times I'm left wanting a restful way to display a step by step process that may or not be associated with a resource. Wicked gives the flexibility to do what I want while hiding all the really scary stuff you shouldn't do in a controller to make this possible.
8
+
9
+ ## Install
10
+
11
+ Wicked is still in development, and I haven't cut a gem yet, in the mean time you can add this to your Gemfile
12
+
13
+ ```ruby
14
+
15
+ gem 'wicked', :git => 'git://github.com/schneems/wicked.git'
16
+
17
+ ```
18
+
19
+
20
+ ## How
21
+
22
+ Simply inherit from Wicked::WizardController and you can specify a set of steps. Here we have a controller called Users::AfterSignupController with existing routes.
23
+
24
+ ```ruby
25
+ class Users::AfterSignupController < Wicked::WizardController
26
+
27
+ steps :confirm_password, :confirm_profile :find_friends
28
+ # ...
29
+ ```
30
+
31
+ The wizard is set to call steps in order in the show action, you can specify custom logic in your show using a case statement like this:
32
+
33
+ ```ruby
34
+ class Users::AfterSignupController < Wicked::WizardController
35
+ def show
36
+ @user = current_user
37
+ case step
38
+ when :find_friends
39
+ @friends = @user.find_friends
40
+ end
41
+ render_wizard
42
+ end
43
+ end
44
+ ```
45
+
46
+ Note: you'll need to call `render_wizard` at the end of your action to get the correct views to show up.
47
+
48
+ By default the wizard will render a view with the same name as the step. So for our controller `Users::AfterSignupController` with a view path of `/views/users/after_signup/` if call the :confirm_password step, our wizard will render `/views/users/after_signup/confirm_password.html.erb`
49
+
50
+ Then in your view you can use the helpers to get to the next step.
51
+
52
+ ```ruby
53
+ <%= link_to 'skip', next_wizard_path %>
54
+ ```
55
+
56
+ You can manually specify which wizard action you want to link to by using the wizard_path helper.
57
+
58
+ ```ruby
59
+ <%= link_to 'skip', wizard_path(:find_friends) %>
60
+ ```
61
+
62
+ In addition to showing sequential views we can update elements in our controller.
63
+
64
+
65
+ ```ruby
66
+ class Users::AfterSignupController < Wicked::WizardController
67
+
68
+ def update
69
+ @user = current_user
70
+ case step
71
+ when :confirm_password
72
+ @user.update_attributes(params[:user])
73
+ end
74
+ sign_in(@user, :bypass => true) # needed for devise
75
+ render_wizard @user
76
+ end
77
+ end
78
+ ```
79
+
80
+ Note we're passing `render_wizard` our `@user` object here. If you pass an object into `render_wizard` it will show the next step if the object saves or re-render the previous view if it does not save.
81
+
82
+
83
+ To get to this update action, you simply need to submit a form that PUT's to the same url
84
+
85
+ ```ruby
86
+
87
+ <%= form_for @user, :url => wizard_path, :method => :put do |f| %>
88
+ <%= f.password_field :password %>
89
+ <%= f.password_field :password_confirmation %>
90
+
91
+ <%= f.submit "Change Password" %>
92
+ <% end %>
93
+
94
+ ```
95
+
96
+ Note: we explicitly tell the form to PUT above
97
+
98
+
99
+ In the controller if you find that you want to skip a step, you can do it simply by calling `skip_step`
100
+
101
+ ```ruby
102
+
103
+ def show
104
+ @user = current_user
105
+ case step
106
+ when :find_friends
107
+ if @user.has_facebook_access_token?
108
+ @friends = @user.find_friends
109
+ else
110
+ skip_step
111
+ end
112
+ end
113
+ render_wizard
114
+ end
115
+
116
+ ```
117
+
118
+
119
+ ## About
120
+
121
+ Please poke around the source code, if you see easier ways to get a Rails controller do do what I want, let me know.
122
+
123
+ If you have a question file an issue or, find me on the Twitters [@schneems](http://twitter.com/schneems).
124
+
125
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+ require 'bundler'
4
+
5
+ begin
6
+ Bundler.setup(:default, :development, :test)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+
13
+ require 'rake'
14
+ require 'rdoc/task'
15
+
16
+ require 'rake/testtask'
17
+
18
+ Rake::TestTask.new(:test) do |t|
19
+ t.libs << 'lib'
20
+ t.libs << 'test'
21
+ t.pattern = 'test/**/*_test.rb'
22
+ t.verbose = false
23
+ end
24
+
25
+ task :default => :test
26
+
27
+ Rake::RDocTask.new(:rdoc) do |rdoc|
28
+ rdoc.rdoc_dir = 'rdoc'
29
+ rdoc.title = 'Wicked'
30
+ rdoc.options << '--line-numbers' << '--inline-source'
31
+ rdoc.rdoc_files.include('README.rdoc')
32
+ rdoc.rdoc_files.include('lib/**/*.rb')
33
+ end
34
+
35
+
36
+ require 'jeweler'
37
+ Jeweler::Tasks.new do |gem|
38
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
39
+ gem.name = "wicked"
40
+ gem.homepage = "http://github.com/schneems/wicked"
41
+ gem.license = "MIT"
42
+ gem.summary = %Q{Use Wicked to turn your controller into a wizard}
43
+ gem.description = %Q{Wicked is a Rails engine for producing easy wizard controllers}
44
+ gem.email = "richard.schneeman@gmail.com"
45
+ gem.authors = ["schneems"]
46
+ # dependencies defined in Gemfile
47
+ end
48
+ Jeweler::RubygemsDotOrgTasks.new
49
+
50
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,57 @@
1
+ # Please don't re-use any patterns found in this controller,
2
+ # they work, but are not very good practices.
3
+ # If you have a better way to do this, please let me know
4
+
5
+ class Wicked::WizardController < ApplicationController
6
+ include Wicked::Controller::Concerns::Path
7
+ include Wicked::Controller::Concerns::RenderRedirect
8
+ include Wicked::Controller::Concerns::Steps
9
+
10
+
11
+ helper_method :wizard_path, :next_wizard_path
12
+
13
+ before_filter :setup_wizard
14
+
15
+ def index
16
+ # redirect_to_first_step
17
+ end
18
+
19
+ # steps :confirm_password, :invite_fb
20
+
21
+ # @example show action
22
+ # def show
23
+ # case step
24
+ # when :confirm_password
25
+ # redirect_to_next(@next_step) and return nil unless @user.facebook?
26
+ # when :invite_fb
27
+ # redirect_to_next(@next_step) and return nil unless @user.facebook?
28
+ # end
29
+ # render_wizard
30
+ # end
31
+
32
+
33
+ # @example update action
34
+ # def update
35
+ # case step
36
+ # when :confirm_password
37
+ # @user.update_attributes(params[:user])
38
+ # when :confirm_profile
39
+ # @user.update_attributes(params[:user])
40
+ # end
41
+ # sign_in(@user, :bypass => true) # needed for devise
42
+ # render_wizard
43
+ # end
44
+
45
+ private
46
+
47
+
48
+ def setup_wizard
49
+ @step = params[:id].try(:to_sym) || steps.first
50
+ @next_step = next_step(@step)
51
+ end
52
+
53
+ end
54
+
55
+ module Wicked
56
+ Wizard = Wicked::WizardController
57
+ end
@@ -0,0 +1,27 @@
1
+ module Wicked::Controller::Concerns::Path
2
+ extend ActiveSupport::Concern
3
+
4
+
5
+ def next_wizard_path
6
+ wizard_path(@next_step)
7
+ end
8
+
9
+ def controller
10
+ params[:controller]
11
+ end
12
+
13
+ def action
14
+ params[:action]
15
+ end
16
+
17
+
18
+ def wizard_path(goto_step = nil, options = {})
19
+ options = {
20
+ :controller => controller,
21
+ :action => 'show',
22
+ :id => goto_step || action,
23
+ :only_path => true
24
+ }.merge options
25
+ url_for(options)
26
+ end
27
+ end
@@ -0,0 +1,46 @@
1
+ module Wicked::Controller::Concerns::RenderRedirect
2
+ extend ActiveSupport::Concern
3
+
4
+
5
+ # scary and gross, allows for double render
6
+ def _reset_invocation_response
7
+ self.instance_variable_set(:@_response_body, nil)
8
+ response.instance_variable_set :@header, Rack::Utils::HeaderHash.new("cookie" => [], 'Content-Type' => 'text/html')
9
+ end
10
+
11
+
12
+ def render_wizard(resource = nil)
13
+ _reset_invocation_response
14
+ @skip_to = @next_step if resource && resource.save
15
+ if @skip_to.present?
16
+ redirect_to wizard_path @skip_to
17
+ else
18
+ render_step @step
19
+ end
20
+ end
21
+
22
+ def render_step(the_step)
23
+ if the_step.nil? || the_step == :finish
24
+ redirect_to_finish_wizard
25
+ else
26
+ render the_step
27
+ end
28
+ end
29
+
30
+ def redirect_to_next(next_step)
31
+ if next_step.nil?
32
+ redirect_to_finish_wizard
33
+ else
34
+ redirect_to wizard_path(next_step)
35
+ end
36
+ end
37
+
38
+ def finish_wizard_path
39
+ '/'
40
+ end
41
+
42
+ def redirect_to_finish_wizard
43
+ redirect_to finish_wizard_path
44
+ end
45
+
46
+ end
@@ -0,0 +1,41 @@
1
+ module Wicked::Controller::Concerns::Steps
2
+ extend ActiveSupport::Concern
3
+
4
+
5
+ def jump_to(goto_step)
6
+ @skip_to = goto_step
7
+ end
8
+
9
+ def skip_step
10
+ @skip_to = @next_step
11
+ end
12
+
13
+ def step
14
+ @step
15
+ end
16
+
17
+ module ClassMethods
18
+ def steps=(steps)
19
+ @wizard_steps = steps
20
+ end
21
+
22
+ def steps(*steps_to_set)
23
+ @wizard_steps = steps_to_set unless steps_to_set.blank?
24
+ @wizard_steps
25
+ end
26
+ end
27
+
28
+ def steps
29
+ self.class.steps
30
+ end
31
+
32
+
33
+ def next_step(current_step)
34
+ index = steps.index(current_step)
35
+ step = steps.at(index + 1) if index.present?
36
+ step ||= :finish
37
+ step
38
+ end
39
+
40
+
41
+ end
@@ -0,0 +1,4 @@
1
+ module Wicked
2
+ class Engine < Rails::Engine
3
+ end
4
+ end
data/lib/wicked.rb ADDED
@@ -0,0 +1,11 @@
1
+ module Wicked
2
+ module Controller
3
+ module Concerns
4
+ end
5
+ end
6
+ end
7
+
8
+ require 'wicked/controller/concerns/render_redirect'
9
+ require 'wicked/controller/concerns/steps'
10
+ require 'wicked/controller/concerns/path'
11
+ require 'wicked/engine'
@@ -0,0 +1,7 @@
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.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,11 @@
1
+ class FooController < Wicked::WizardController
2
+ steps :first, :second, :last_step
3
+
4
+ def show
5
+ skip_step if params[:skip_step]
6
+ render_wizard
7
+ end
8
+
9
+ def update
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1 @@
1
+ first
File without changes
@@ -0,0 +1 @@
1
+ second
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,45 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "active_model/railtie"
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_view/railtie"
7
+ require "action_mailer/railtie"
8
+
9
+ Bundler.require
10
+ require "wicked"
11
+
12
+ module Dummy
13
+ class Application < Rails::Application
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
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ # config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # JavaScript files you want as :defaults (application.js is always included).
37
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
38
+
39
+ # Configure the default encoding used in templates for Ruby 1.9.
40
+ config.encoding = "utf-8"
41
+
42
+ # Configure sensitive parameters which will be filtered from the log file.
43
+ config.filter_parameters += [:password]
44
+ end
45
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!