bushido 0.0.35 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. data/.gitignore +6 -0
  2. data/.rspec +4 -0
  3. data/Gemfile +6 -13
  4. data/README.md +3 -0
  5. data/Rakefile +31 -7
  6. data/app/controllers/bushido/data_controller.rb +2 -1
  7. data/app/controllers/bushido/envs_controller.rb +7 -5
  8. data/app/controllers/bushido/mail_controller.rb +37 -0
  9. data/lib/bushido.rb +27 -5
  10. data/lib/bushido/action_mailer.rb +35 -0
  11. data/lib/bushido/app.rb +7 -0
  12. data/lib/bushido/bar.rb +19 -0
  13. data/lib/bushido/base.rb +23 -0
  14. data/lib/bushido/command.rb +17 -15
  15. data/lib/bushido/config.rb +12 -0
  16. data/lib/bushido/data.rb +41 -23
  17. data/lib/bushido/data_helper.rb +1 -0
  18. data/lib/bushido/engine.rb +21 -0
  19. data/lib/bushido/envs_helper.rb +1 -0
  20. data/lib/bushido/event.rb +25 -2
  21. data/lib/bushido/event_observer.rb +20 -0
  22. data/lib/bushido/mail_helper.rb +1 -0
  23. data/lib/bushido/mail_route.rb +186 -0
  24. data/lib/bushido/middleware.rb +9 -16
  25. data/lib/bushido/platform.rb +27 -3
  26. data/lib/bushido/smtp.rb +24 -0
  27. data/lib/bushido/user.rb +39 -9
  28. data/lib/bushido/user_helper.rb +7 -0
  29. data/lib/bushido/utils.rb +44 -0
  30. data/lib/bushido/version.rb +1 -1
  31. data/lib/generators/bushido/auth_migration_generator.rb +46 -0
  32. data/lib/generators/bushido/hooks_generator.rb +43 -0
  33. data/lib/generators/bushido/mail_routes_generator.rb +45 -0
  34. data/lib/generators/bushido/routes_generator.rb +22 -0
  35. data/lib/{bushido/hooks.rb → hooks.rb} +0 -0
  36. data/lib/rails/routes.rb +36 -8
  37. data/lib/tasks/bushido.rake +6 -0
  38. data/{test_app/spec → spec/app_spec}/controllers/envs_controller_spec.rb +0 -0
  39. data/spec/app_spec/controllers/mail_controller_spec.rb +28 -0
  40. data/{test_app/spec → spec/app_spec}/integration/app_claim_spec.rb +4 -6
  41. data/spec/gem_spec/base_spec.rb +24 -0
  42. data/spec/gem_spec/command_spec.rb +181 -0
  43. data/spec/gem_spec/config_spec.rb +9 -0
  44. data/spec/gem_spec/data_spec.rb +13 -0
  45. data/spec/gem_spec/hooks_spec.rb +5 -0
  46. data/spec/gem_spec/mail_route_spec.rb +168 -0
  47. data/spec/gem_spec/platform_spec.rb +9 -0
  48. data/spec/gem_spec/user_spec.rb +45 -0
  49. data/spec/spec_helper.rb +21 -0
  50. data/spec/test_apps/rails-2.3/.gitignore +13 -0
  51. data/spec/test_apps/rails-2.3/Gemfile +13 -0
  52. data/spec/test_apps/rails-2.3/README +243 -0
  53. data/spec/test_apps/rails-2.3/Rakefile +10 -0
  54. data/spec/test_apps/rails-2.3/app/controllers/application_controller.rb +10 -0
  55. data/spec/test_apps/rails-2.3/app/helpers/application_helper.rb +3 -0
  56. data/spec/test_apps/rails-2.3/config/boot.rb +114 -0
  57. data/spec/test_apps/rails-2.3/config/environment.rb +41 -0
  58. data/spec/test_apps/rails-2.3/config/environments/development.rb +17 -0
  59. data/spec/test_apps/rails-2.3/config/environments/production.rb +28 -0
  60. data/spec/test_apps/rails-2.3/config/environments/test.rb +30 -0
  61. data/spec/test_apps/rails-2.3/config/initializers/backtrace_silencers.rb +7 -0
  62. data/spec/test_apps/rails-2.3/config/initializers/cookie_verification_secret.rb +7 -0
  63. data/spec/test_apps/rails-2.3/config/initializers/inflections.rb +10 -0
  64. data/{test_app → spec/test_apps/rails-2.3}/config/initializers/mime_types.rb +0 -0
  65. data/spec/test_apps/rails-2.3/config/initializers/new_rails_defaults.rb +21 -0
  66. data/spec/test_apps/rails-2.3/config/initializers/session_store.rb +15 -0
  67. data/spec/test_apps/rails-2.3/config/locales/en.yml +5 -0
  68. data/spec/test_apps/rails-2.3/config/routes.rb +43 -0
  69. data/spec/test_apps/rails-2.3/db/seeds.rb +7 -0
  70. data/{test_app → spec/test_apps/rails-2.3}/doc/README_FOR_APP +0 -0
  71. data/spec/test_apps/rails-2.3/lib/tasks/rspec.rake +144 -0
  72. data/spec/test_apps/rails-2.3/public/404.html +30 -0
  73. data/spec/test_apps/rails-2.3/public/422.html +30 -0
  74. data/spec/test_apps/rails-2.3/public/500.html +30 -0
  75. data/{test_app → spec/test_apps/rails-2.3}/public/favicon.ico +0 -0
  76. data/{test_app → spec/test_apps/rails-2.3}/public/images/rails.png +0 -0
  77. data/{test_app → spec/test_apps/rails-2.3}/public/javascripts/application.js +0 -0
  78. data/spec/test_apps/rails-2.3/public/javascripts/controls.js +963 -0
  79. data/spec/test_apps/rails-2.3/public/javascripts/dragdrop.js +973 -0
  80. data/spec/test_apps/rails-2.3/public/javascripts/effects.js +1128 -0
  81. data/spec/test_apps/rails-2.3/public/javascripts/prototype.js +4320 -0
  82. data/{test_app → spec/test_apps/rails-2.3}/public/robots.txt +0 -0
  83. data/spec/test_apps/rails-2.3/script/about +4 -0
  84. data/spec/test_apps/rails-2.3/script/autospec +6 -0
  85. data/spec/test_apps/rails-2.3/script/console +3 -0
  86. data/spec/test_apps/rails-2.3/script/dbconsole +3 -0
  87. data/spec/test_apps/rails-2.3/script/destroy +3 -0
  88. data/spec/test_apps/rails-2.3/script/generate +3 -0
  89. data/spec/test_apps/rails-2.3/script/performance/benchmarker +3 -0
  90. data/spec/test_apps/rails-2.3/script/performance/profiler +3 -0
  91. data/spec/test_apps/rails-2.3/script/plugin +3 -0
  92. data/spec/test_apps/rails-2.3/script/runner +3 -0
  93. data/spec/test_apps/rails-2.3/script/server +3 -0
  94. data/spec/test_apps/rails-2.3/script/spec +10 -0
  95. data/spec/test_apps/rails-2.3/spec/all_spec.rb +5 -0
  96. data/spec/test_apps/rails-2.3/spec/rcov.opts +2 -0
  97. data/spec/test_apps/rails-2.3/spec/spec.opts +4 -0
  98. data/spec/test_apps/rails-2.3/spec/spec_helper.rb +83 -0
  99. data/spec/test_apps/rails-2.3/test/performance/browsing_test.rb +9 -0
  100. data/spec/test_apps/rails-2.3/test/test_helper.rb +38 -0
  101. data/{test_app → spec/test_apps/rails-3.0}/.gitignore +0 -0
  102. data/spec/test_apps/rails-3.0/.rspec +2 -0
  103. data/spec/test_apps/rails-3.0/Gemfile +10 -0
  104. data/{test_app → spec/test_apps/rails-3.0}/README +0 -0
  105. data/{test_app → spec/test_apps/rails-3.0}/Rakefile +0 -0
  106. data/{test_app → spec/test_apps/rails-3.0}/app/controllers/application_controller.rb +0 -0
  107. data/{test_app → spec/test_apps/rails-3.0}/app/controllers/static_controller.rb +0 -0
  108. data/{test_app → spec/test_apps/rails-3.0}/app/helpers/application_helper.rb +0 -0
  109. data/{test_app → spec/test_apps/rails-3.0}/app/helpers/static_helper.rb +0 -0
  110. data/{test_app → spec/test_apps/rails-3.0}/app/views/layouts/application.html.erb +0 -0
  111. data/{test_app → spec/test_apps/rails-3.0}/app/views/static/home.html.erb +0 -0
  112. data/{test_app → spec/test_apps/rails-3.0}/config.ru +0 -0
  113. data/{test_app → spec/test_apps/rails-3.0}/config/application.rb +2 -0
  114. data/{test_app → spec/test_apps/rails-3.0}/config/boot.rb +0 -0
  115. data/{test_app → spec/test_apps/rails-3.0}/config/environment.rb +0 -0
  116. data/{test_app → spec/test_apps/rails-3.0}/config/environments/development.rb +0 -0
  117. data/{test_app → spec/test_apps/rails-3.0}/config/environments/production.rb +0 -0
  118. data/{test_app → spec/test_apps/rails-3.0}/config/environments/test.rb +0 -0
  119. data/{test_app → spec/test_apps/rails-3.0}/config/initializers/backtrace_silencers.rb +0 -0
  120. data/{test_app → spec/test_apps/rails-3.0}/config/initializers/inflections.rb +0 -0
  121. data/spec/test_apps/rails-3.0/config/initializers/mime_types.rb +5 -0
  122. data/{test_app → spec/test_apps/rails-3.0}/config/initializers/secret_token.rb +0 -0
  123. data/{test_app → spec/test_apps/rails-3.0}/config/initializers/session_store.rb +0 -0
  124. data/{test_app → spec/test_apps/rails-3.0}/config/locales/en.yml +0 -0
  125. data/{test_app → spec/test_apps/rails-3.0}/config/routes.rb +0 -0
  126. data/{test_app → spec/test_apps/rails-3.0}/db/schema.rb +0 -0
  127. data/{test_app → spec/test_apps/rails-3.0}/db/seeds.rb +0 -0
  128. data/spec/test_apps/rails-3.0/doc/README_FOR_APP +2 -0
  129. data/{test_app → spec/test_apps/rails-3.0}/lib/tasks/.gitkeep +0 -0
  130. data/{test_app → spec/test_apps/rails-3.0}/public/404.html +0 -0
  131. data/{test_app → spec/test_apps/rails-3.0}/public/422.html +0 -0
  132. data/{test_app → spec/test_apps/rails-3.0}/public/500.html +0 -0
  133. data/{test_app/public/stylesheets/.gitkeep → spec/test_apps/rails-3.0/public/favicon.ico} +0 -0
  134. data/spec/test_apps/rails-3.0/public/images/rails.png +0 -0
  135. data/{test_app → spec/test_apps/rails-3.0}/public/index.html +0 -0
  136. data/spec/test_apps/rails-3.0/public/javascripts/application.js +2 -0
  137. data/{test_app → spec/test_apps/rails-3.0}/public/javascripts/controls.js +0 -0
  138. data/{test_app → spec/test_apps/rails-3.0}/public/javascripts/dragdrop.js +0 -0
  139. data/{test_app → spec/test_apps/rails-3.0}/public/javascripts/effects.js +0 -0
  140. data/{test_app → spec/test_apps/rails-3.0}/public/javascripts/prototype.js +0 -0
  141. data/{test_app → spec/test_apps/rails-3.0}/public/javascripts/rails.js +0 -0
  142. data/spec/test_apps/rails-3.0/public/robots.txt +5 -0
  143. data/{test_app/vendor/plugins → spec/test_apps/rails-3.0/public/stylesheets}/.gitkeep +0 -0
  144. data/{test_app → spec/test_apps/rails-3.0}/script/rails +0 -0
  145. data/spec/test_apps/rails-3.0/spec/all_spec.rb +5 -0
  146. data/{test_app → spec/test_apps/rails-3.0}/spec/spec_helper.rb +13 -1
  147. data/{test_app → spec/test_apps/rails-3.0}/test/performance/browsing_test.rb +0 -0
  148. data/{test_app → spec/test_apps/rails-3.0}/test/test_helper.rb +0 -0
  149. data/spec/test_apps/rails-3.0/vendor/plugins/.gitkeep +0 -0
  150. data/tasks/cover_me.rake +11 -0
  151. metadata +249 -117
  152. data/lib/engine.rb +0 -16
  153. data/test/executable_test.rb +0 -10
  154. data/test/routes_test.rb +0 -12
  155. data/test/test_helper.rb +0 -8
  156. data/test_app/.rspec +0 -1
  157. data/test_app/Gemfile +0 -7
  158. data/test_app/config/database.yml +0 -22
  159. data/test_app/spec/helpers/static_helper_spec.rb +0 -14
  160. data/test_app/spec/support/integration_example_group.rb +0 -35
@@ -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 'rdoc/task'
9
+
10
+ require 'tasks/rails'
@@ -0,0 +1,10 @@
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
+ protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
+
8
+ # Scrub sensitive parameters from your log
9
+ # filter_parameter_logging :password
10
+ end
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,114 @@
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/rails")
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/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ if load_error.message =~ /Could not find RubyGem rails/
66
+ STDERR.puts %(Missing the 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.)
67
+ exit 1
68
+ else
69
+ raise
70
+ end
71
+ end
72
+
73
+ class << self
74
+ def rubygems_version
75
+ Gem::RubyGemsVersion rescue nil
76
+ end
77
+
78
+ def gem_version
79
+ if defined? RAILS_GEM_VERSION
80
+ RAILS_GEM_VERSION
81
+ elsif ENV.include?('RAILS_GEM_VERSION')
82
+ ENV['RAILS_GEM_VERSION']
83
+ else
84
+ parse_gem_version(read_environment_rb)
85
+ end
86
+ end
87
+
88
+ def load_rubygems
89
+ min_version = '1.3.2'
90
+ require 'rubygems'
91
+ unless rubygems_version >= min_version
92
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
93
+ exit 1
94
+ end
95
+
96
+ rescue LoadError
97
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
98
+ exit 1
99
+ end
100
+
101
+ def parse_gem_version(text)
102
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
103
+ end
104
+
105
+ private
106
+ def read_environment_rb
107
+ File.read("#{RAILS_ROOT}/config/environment.rb")
108
+ end
109
+ end
110
+ end
111
+ end
112
+
113
+ # All that for this:
114
+ Rails.boot!
@@ -0,0 +1,41 @@
1
+ # Be sure to restart your server when you modify this file
2
+
3
+ # Specifies gem version of Rails to use when vendor/rails is not present
4
+ RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION
5
+
6
+ # Bootstrap the Rails environment, frameworks, and default configuration
7
+ require File.join(File.dirname(__FILE__), 'boot')
8
+
9
+ Rails::Initializer.run do |config|
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Add additional load paths for your own custom dirs
15
+ # config.autoload_paths += %W( #{RAILS_ROOT}/extras )
16
+
17
+ # Specify gems that this application depends on and have them installed with rake gems:install
18
+ # config.gem "bj"
19
+ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
20
+ # config.gem "sqlite3-ruby", :lib => "sqlite3"
21
+ # config.gem "aws-s3", :lib => "aws/s3"
22
+
23
+ # Only load the plugins named here, in the order given (default is alphabetical).
24
+ # :all can be used as a placeholder for all plugins not explicitly named
25
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
26
+
27
+ # Skip frameworks you're not going to use. To use Rails without a database,
28
+ # you must remove the Active Record framework.
29
+ # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
30
+
31
+ # Activate observers that should always be running
32
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
33
+
34
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
35
+ # Run "rake -D time" for a list of tasks for finding time zone names.
36
+ config.time_zone = 'UTC'
37
+
38
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
40
+ # config.i18n.default_locale = :de
41
+ end
@@ -0,0 +1,17 @@
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_view.debug_rjs = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,28 @@
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
+ # Full error reports are disabled and caching is turned on
8
+ config.action_controller.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+ config.action_view.cache_template_loading = true
11
+
12
+ # See everything in the log (default is :info)
13
+ # config.log_level = :debug
14
+
15
+ # Use a different logger for distributed setups
16
+ # config.logger = SyslogLogger.new
17
+
18
+ # Use a different cache store in production
19
+ # config.cache_store = :mem_cache_store
20
+
21
+ # Enable serving of images, stylesheets, and javascripts from an asset server
22
+ # config.action_controller.asset_host = "http://assets.example.com"
23
+
24
+ # Disable delivery errors, bad email addresses will be ignored
25
+ # config.action_mailer.raise_delivery_errors = false
26
+
27
+ # Enable threaded mode
28
+ # config.threadsafe!
@@ -0,0 +1,30 @@
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
+ config.action_view.cache_template_loading = true
16
+
17
+ # Disable request forgery protection in test environment
18
+ config.action_controller.allow_forgery_protection = false
19
+
20
+ # Tell Action Mailer not to deliver emails to the real world.
21
+ # The :test delivery method accumulates sent emails in the
22
+ # ActionMailer::Base.deliveries array.
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
26
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
27
+ # like if you have constraints or database-specific column types
28
+ # config.active_record.schema_format = :sql
29
+
30
+ config.gem 'rspec-rails', :version => '>= 1.3.4', :lib => false unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ActionController::Base.cookie_verifier_secret = 'afdf35e987a40f4eaa4373a26e77d9c8e768ac9f11d992b66036da43775489072ea1b1d3a803b7098965dd82df74cfeeea0db4414bc37bae13495035c92a9653';
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,21 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # These settings change the behavior of Rails 2 apps and will be defaults
4
+ # for Rails 3. You can remove this initializer when Rails 3 is released.
5
+
6
+ if defined?(ActiveRecord)
7
+ # Include Active Record class name as root for JSON serialized output.
8
+ ActiveRecord::Base.include_root_in_json = true
9
+
10
+ # Store the full class name (including module namespace) in STI type column.
11
+ ActiveRecord::Base.store_full_sti_class = true
12
+ end
13
+
14
+ ActionController::Routing.generate_best_match = false
15
+
16
+ # Use ISO 8601 format for JSON serialized times and dates.
17
+ ActiveSupport.use_standard_json_time_format = true
18
+
19
+ # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
20
+ # if you're including raw json in an HTML page.
21
+ ActiveSupport.escape_html_entities_in_json = false
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying cookie session data integrity.
4
+ # If you change this key, all old sessions will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ActionController::Base.session = {
8
+ :key => '_rails-2.3.x-test_app_session',
9
+ :secret => '2c71ec9162c2052dd3de58ff375a05d46a13224a28aa5f30a8f25757ec15bda2d101ab6a9e72cb9daa575e1638d94f7c9284afd18833b0dbfef81c5b48eb65a3'
10
+ }
11
+
12
+ # Use the database for sessions instead of the cookie-based default,
13
+ # which shouldn't be used to store highly confidential information
14
+ # (create the session table with "rake db:sessions:create")
15
+ # ActionController::Base.session_store = :active_record_store
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,43 @@
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
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
13
+ # map.resources :products
14
+
15
+ # Sample resource route with options:
16
+ # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
17
+
18
+ # Sample resource route with sub-resources:
19
+ # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
20
+
21
+ # Sample resource route with more complex sub-resources
22
+ # map.resources :products do |products|
23
+ # products.resources :comments
24
+ # products.resources :sales, :collection => { :recent => :get }
25
+ # end
26
+
27
+ # Sample resource route within a namespace:
28
+ # map.namespace :admin do |admin|
29
+ # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
30
+ # admin.resources :products
31
+ # end
32
+
33
+ # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
34
+ # map.root :controller => "welcome"
35
+
36
+ # See how all your routes lay out with "rake routes"
37
+
38
+ # Install the default routes as the lowest priority.
39
+ # Note: These default routes make all actions in every controller accessible via GET requests. You should
40
+ # consider removing or commenting them out if you're using named routes and resources.
41
+ map.connect ':controller/:action/:id'
42
+ map.connect ':controller/:action/:id.:format'
43
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
+ # Major.create(:name => 'Daley', :city => cities.first)
@@ -0,0 +1,144 @@
1
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
2
+ rspec_gem_dir = nil
3
+ Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
4
+ rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
5
+ end
6
+ rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
7
+
8
+ if rspec_gem_dir && (test ?d, rspec_plugin_dir)
9
+ raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
10
+ end
11
+
12
+ if rspec_gem_dir
13
+ $LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
14
+ elsif File.exist?(rspec_plugin_dir)
15
+ $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
16
+ end
17
+
18
+ # Don't load rspec if running "rake gems:*"
19
+ unless ARGV.any? {|a| a =~ /^gems/}
20
+
21
+ begin
22
+ require 'spec/rake/spectask'
23
+ rescue MissingSourceFile
24
+ module Spec
25
+ module Rake
26
+ class SpecTask
27
+ def initialize(name)
28
+ task name do
29
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
30
+ require File.expand_path(File.join(File.dirname(__FILE__),"..","..","config","environment"))
31
+
32
+ # ... otherwise, do this:
33
+ raise <<-MSG
34
+
35
+ #{"*" * 80}
36
+ * You are trying to run an rspec rake task defined in
37
+ * #{__FILE__},
38
+ * but rspec can not be found in vendor/gems, vendor/plugins or system gems.
39
+ #{"*" * 80}
40
+ MSG
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ Rake.application.instance_variable_get('@tasks').delete('default')
49
+
50
+ spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
51
+ task :noop do
52
+ end
53
+
54
+ task :default => :spec
55
+ task :stats => "spec:statsetup"
56
+
57
+ desc "Run all specs in spec directory (excluding plugin specs)"
58
+ Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
59
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
60
+ t.spec_files = FileList['spec/**/*_spec.rb']
61
+ end
62
+
63
+ namespace :spec do
64
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
65
+ Spec::Rake::SpecTask.new(:rcov) do |t|
66
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
67
+ t.spec_files = FileList['spec/**/*_spec.rb']
68
+ t.rcov = true
69
+ t.rcov_opts = lambda do
70
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
71
+ end
72
+ end
73
+
74
+ desc "Print Specdoc for all specs (excluding plugin specs)"
75
+ Spec::Rake::SpecTask.new(:doc) do |t|
76
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
77
+ t.spec_files = FileList['spec/**/*_spec.rb']
78
+ end
79
+
80
+ desc "Print Specdoc for all plugin examples"
81
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
82
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
83
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*')
84
+ end
85
+
86
+ [:models, :controllers, :views, :helpers, :lib, :integration].each do |sub|
87
+ desc "Run the code examples in spec/#{sub}"
88
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
89
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
90
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
91
+ end
92
+ end
93
+
94
+ desc "Run the code examples in vendor/plugins (except RSpec's own)"
95
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
96
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
97
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
98
+ end
99
+
100
+ namespace :plugins do
101
+ desc "Runs the examples for rspec_on_rails"
102
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
103
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
104
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
105
+ end
106
+ end
107
+
108
+ # Setup specs for stats
109
+ task :statsetup do
110
+ require 'code_statistics'
111
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
112
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
113
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
114
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
115
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
116
+ ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
117
+ ::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration')
118
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
119
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
120
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
121
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
122
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
123
+ ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
124
+ ::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?('spec/integration')
125
+ end
126
+
127
+ namespace :db do
128
+ namespace :fixtures do
129
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
130
+ task :load => :environment do
131
+ ActiveRecord::Base.establish_connection(Rails.env)
132
+ base_dir = File.join(Rails.root, 'spec', 'fixtures')
133
+ fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
134
+
135
+ require 'active_record/fixtures'
136
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
137
+ Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ end