crumbs 2.1.2 → 4.0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +31 -41
  4. data/Rakefile +1 -14
  5. data/lib/crumbs/definitions.rb +26 -0
  6. data/lib/crumbs/dsl/controller.rb +7 -11
  7. data/lib/crumbs/dsl/namespace.rb +8 -4
  8. data/lib/crumbs/extensions/action_controller/base.rb +43 -0
  9. data/lib/crumbs/proxy.rb +10 -7
  10. data/lib/crumbs/railtie.rb +4 -2
  11. data/lib/crumbs/version.rb +1 -1
  12. data/lib/crumbs.rb +7 -38
  13. data/lib/generators/crumbs/install/install_generator.rb +15 -0
  14. data/test/dummy/Rakefile +1 -2
  15. data/test/dummy/app/assets/javascripts/application.js +2 -2
  16. data/test/dummy/app/assets/stylesheets/application.css +6 -4
  17. data/test/dummy/app/controllers/admin/reports/deliveries_controller.rb +6 -0
  18. data/test/dummy/app/controllers/admin/users_controller.rb +9 -0
  19. data/test/dummy/app/controllers/pages_controller.rb +0 -21
  20. data/test/dummy/app/views/application/_crumbs.html.erb +3 -0
  21. data/test/dummy/app/views/application/index.html.erb +1 -0
  22. data/test/dummy/app/views/application/show.html.erb +1 -0
  23. data/test/dummy/app/views/layouts/application.html.erb +9 -11
  24. data/test/dummy/bin/bundle +1 -0
  25. data/test/dummy/bin/rails +2 -1
  26. data/test/dummy/bin/rake +1 -0
  27. data/test/dummy/bin/setup +30 -0
  28. data/test/dummy/config/application.rb +6 -1
  29. data/test/dummy/config/boot.rb +1 -1
  30. data/test/dummy/config/crumbs.rb +15 -12
  31. data/test/dummy/config/environment.rb +1 -1
  32. data/test/dummy/config/environments/development.rb +14 -5
  33. data/test/dummy/config/environments/production.rb +18 -26
  34. data/test/dummy/config/environments/test.rb +10 -12
  35. data/test/dummy/config/initializers/assets.rb +11 -0
  36. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  37. data/test/dummy/config/initializers/mime_types.rb +1 -2
  38. data/test/dummy/config/initializers/session_store.rb +1 -1
  39. data/test/dummy/config/locales/en.yml +1 -23
  40. data/test/dummy/config/routes.rb +9 -70
  41. data/test/dummy/config/secrets.yml +22 -0
  42. data/test/dummy/config.ru +1 -1
  43. data/test/dummy/log/development.log +0 -0
  44. data/test/dummy/log/test.log +1050 -0
  45. data/test/dummy/public/404.html +58 -55
  46. data/test/dummy/public/422.html +58 -55
  47. data/test/dummy/public/500.html +57 -54
  48. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  49. data/test/dummy/tmp/cache/assets/sprockets/v3.0/8e/8eFn-IE_QAK9wkb3vBoqeyKxaN7o1hbJQnrz-uVvvQA.cache +0 -0
  50. data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  51. data/test/dummy/tmp/cache/assets/sprockets/v3.0/RP/RPShcX3Jre4zxu1UEaxs1Tw4slXRjICXTyfQvtEWC7M.cache +0 -0
  52. data/test/dummy/tmp/cache/assets/sprockets/v3.0/SG/SGNGr7AZfBE1q7ev2-YM1G-o0XAZ0pKqbsS3NvHtRcA.cache +1 -0
  53. data/test/dummy/tmp/cache/assets/sprockets/v3.0/fG/fG_uaNK13wisQiji91xNsGecGxX9QhMCF2eSX_aR0G0.cache +1 -0
  54. data/test/dummy/tmp/cache/assets/sprockets/v3.0/gb/gbunrAFVOHPwl2npUgKv_C3f_qiJnZDd9zG5-h3jrpo.cache +1 -0
  55. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
  56. data/test/dummy/tmp/cache/assets/sprockets/v3.0/mv/mvqN6PphkrOOC8zbUEhpC_9E_4ybdO25MRy_gG6dq3Y.cache +1 -0
  57. data/test/dummy/tmp/cache/assets/sprockets/v3.0/nm/nmcUZlKAIwyJ_35Nm9P8pukLeRX5aApP6NFj5MpNPgc.cache +1 -0
  58. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  59. data/test/dummy/tmp/cache/assets/sprockets/v3.0/sB/sB6xWxBmgzVC0Co9__ANYrE58lr4WPwiwFa9mswooWM.cache +0 -0
  60. data/test/dummy/tmp/cache/assets/sprockets/v3.0/va/vaNrIny9hchHD9eIJxAicyYLC7qeV4PTh4Nh40_Y6Vg.cache +1 -0
  61. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xd/xdBKQyhEAlDIstGvXw945PWJoEWi23rKuY7elOcWqHc.cache +1 -0
  62. data/test/dummy/tmp/cache/assets/sprockets/v3.0/yv/yv8GQNKBriraHQF7esI3Zifw_OgHI0-bFlUD2nbZ3fw.cache +0 -0
  63. data/test/dummy/tmp/cache/assets/sprockets/v3.0/zn/znrkcru9CbH2razkpdTQATvom11yKHllvnOQyyPSJAo.cache +0 -0
  64. data/test/generator_test.rb +5 -6
  65. data/test/test_helper.rb +4 -13
  66. data/test/view_test.rb +40 -0
  67. metadata +71 -31
  68. data/lib/crumbs/action_controller/base.rb +0 -47
  69. data/lib/generators/crumbs/install_generator.rb +0 -14
  70. data/lib/generators/crumbs/templates/configure.rb +0 -2
  71. data/test/dummy/README.rdoc +0 -28
  72. data/test/dummy/app/controllers/namespace/pages_controller.rb +0 -8
  73. data/test/dummy/app/views/pages/crumbs.html.erb +0 -3
  74. data/test/dummy/config/database.yml +0 -25
  75. data/test/dummy/config/initializers/secret_token.rb +0 -13
  76. data/test/dummy/db/schema.rb +0 -16
  77. data/test/with_last_test.rb +0 -553
  78. data/test/without_last_test.rb +0 -495
  79. /data/lib/generators/crumbs/{templates/define.rb → install/templates/configuration.rb} +0 -0
@@ -2,4 +2,4 @@
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
4
  # Initialize the Rails application.
5
- Dummy::Application.initialize!
5
+ Rails.application.initialize!
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # In the development environment your application's code is reloaded on
@@ -10,7 +10,7 @@ Dummy::Application.configure do
10
10
  config.eager_load = false
11
11
 
12
12
  # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
13
+ config.consider_all_requests_local = true
14
14
  config.action_controller.perform_caching = false
15
15
 
16
16
  # Don't care if the mailer can't send.
@@ -19,11 +19,20 @@ Dummy::Application.configure do
19
19
  # Print deprecation notices to the Rails logger.
20
20
  config.active_support.deprecation = :log
21
21
 
22
- # Raise an error on page load if there are pending migrations
23
- config.active_record.migration_error = :page_load
24
-
25
22
  # Debug mode disables concatenation and preprocessing of assets.
26
23
  # This option may cause significant delays in view rendering with a large
27
24
  # number of complex assets.
28
25
  config.assets.debug = true
26
+
27
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
28
+ # yet still be able to expire them through the digest params.
29
+ config.assets.digest = true
30
+
31
+ # Adds additional error checking when serving assets at runtime.
32
+ # Checks for improperly declared sprockets dependencies.
33
+ # Raises helpful error messages.
34
+ config.assets.raise_runtime_errors = true
35
+
36
+ # Raises error for missing translations
37
+ # config.action_view.raise_on_missing_translations = true
29
38
  end
@@ -1,30 +1,28 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # Code is not reloaded between requests.
5
5
  config.cache_classes = true
6
6
 
7
7
  # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both thread web servers
8
+ # your application in memory, allowing both threaded web servers
9
9
  # and those relying on copy on write to perform better.
10
10
  # Rake tasks automatically ignore this option for performance.
11
11
  config.eager_load = true
12
12
 
13
13
  # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
14
+ config.consider_all_requests_local = false
15
15
  config.action_controller.perform_caching = true
16
16
 
17
17
  # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
18
  # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
20
21
  # config.action_dispatch.rack_cache = true
21
22
 
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
24
- config.serve_static_files = false
25
- else
26
- config.serve_static_assets = false
27
- end
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
28
26
 
29
27
  # Compress JavaScripts and CSS.
30
28
  config.assets.js_compressor = :uglifier
@@ -33,21 +31,22 @@ Dummy::Application.configure do
33
31
  # Do not fallback to assets pipeline if a precompiled asset is missed.
34
32
  config.assets.compile = false
35
33
 
36
- # Generate digests for assets URLs.
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
37
36
  config.assets.digest = true
38
37
 
39
- # Version of your assets, change this if you want to expire all your assets.
40
- config.assets.version = '1.0'
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
41
39
 
42
40
  # Specifies the header that your server uses for sending files.
43
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
44
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
45
43
 
46
44
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
47
45
  # config.force_ssl = true
48
46
 
49
- # Set to :debug to see everything in the log.
50
- config.log_level = :info
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
51
50
 
52
51
  # Prepend all log lines with the following tags.
53
52
  # config.log_tags = [ :subdomain, :uuid ]
@@ -59,26 +58,19 @@ Dummy::Application.configure do
59
58
  # config.cache_store = :mem_cache_store
60
59
 
61
60
  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
62
- # config.action_controller.asset_host = "http://assets.example.com"
63
-
64
- # Precompile additional assets.
65
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
66
- # config.assets.precompile += %w( search.js )
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
67
62
 
68
63
  # Ignore bad email addresses and do not raise email delivery errors.
69
64
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
70
65
  # config.action_mailer.raise_delivery_errors = false
71
66
 
72
67
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
73
- # the I18n.default_locale when a translation can not be found).
68
+ # the I18n.default_locale when a translation cannot be found).
74
69
  config.i18n.fallbacks = true
75
70
 
76
71
  # Send deprecation notices to registered listeners.
77
72
  config.active_support.deprecation = :notify
78
73
 
79
- # Disable automatic flushing of the log to improve performance.
80
- # config.autoflush_log = false
81
-
82
74
  # Use default logging formatter so that PID and timestamp are not suppressed.
83
75
  config.log_formatter = ::Logger::Formatter.new
84
76
  end
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # The test environment is used exclusively to run your application's
@@ -12,16 +12,12 @@ Dummy::Application.configure do
12
12
  # preloads Rails for running tests, you may have to set it to true.
13
13
  config.eager_load = false
14
14
 
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
17
- config.serve_static_files = false
18
- else
19
- config.serve_static_assets = false
20
- end
21
- config.static_cache_control = "public, max-age=3600"
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
22
18
 
23
19
  # Show full error reports and disable caching.
24
- config.consider_all_requests_local = true
20
+ config.consider_all_requests_local = true
25
21
  config.action_controller.perform_caching = false
26
22
 
27
23
  # Raise exceptions instead of rendering exception templates.
@@ -35,10 +31,12 @@ Dummy::Application.configure do
35
31
  # ActionMailer::Base.deliveries array.
36
32
  config.action_mailer.delivery_method = :test
37
33
 
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
+
38
37
  # Print deprecation notices to the stderr.
39
38
  config.active_support.deprecation = :stderr
40
39
 
41
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
42
- config.active_support.test_order = :random
43
- end
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
44
42
  end
@@ -0,0 +1,11 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
+ # Rails.application.config.assets.precompile += %w( search.js )
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,5 +1,4 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
3
  # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
4
+ # Mime::Type.register 'text/richtext', :rtf
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -1,25 +1,3 @@
1
- # Files in the config/locales directory are used for internationalization
2
- # and are automatically loaded by Rails. If you want to use locales other
3
- # than English, add the necessary files in this directory.
4
- #
5
- # To use the locales, use `I18n.t`:
6
- #
7
- # I18n.t 'hello'
8
- #
9
- # In views, this is aliased to just `t`:
10
- #
11
- # <%= t('hello') %>
12
- #
13
- # To use a different locale, set it with `I18n.locale`:
14
- #
15
- # I18n.locale = :es
16
- #
17
- # This would use the information in config/locales/es.yml.
18
- #
19
- # To learn more, please read the Rails Internationalization guide
20
- # available at http://guides.rubyonrails.org/i18n.html.
21
-
22
1
  en:
23
2
  crumbs:
24
- hello: "Hello world"
25
- static: "Static"
3
+ home: "home"
@@ -1,74 +1,13 @@
1
- Dummy::Application.routes.draw do
2
-
3
- root to: 'pages#index'
4
-
5
- get 'static', to: 'pages#static'
6
- get 'static/nested', to: 'pages#nested'
7
-
8
- get 'empty', to: 'pages#empty'
9
- get 'empty/nested', to: 'pages#nested'
10
-
11
- get 'param', to: 'pages#param'
12
- get 'param/:param', to: 'pages#param'
13
- get 'param/:param/nested', to: 'pages#nested'
14
-
15
- get 'i18n', to: 'pages#i18n'
16
- get 'i18n/nested', to: 'pages#nested'
17
-
18
- get 'namespaced', to: 'namespace/pages#index'
19
-
20
- # The priority is based upon order of creation: first created -> highest priority.
21
- # See how all your routes lay out with "rake routes".
1
+ Rails.application.routes.draw do
22
2
 
23
- # You can have the root of your site routed with "root"
24
- # root 'welcome#index'
3
+ namespace :admin do
4
+ namespace :reports do
5
+ get 'deliveries' => 'deliveries#index'
6
+ end
7
+ get 'users' => 'users#index'
8
+ get 'users/:id' => 'users#show'
9
+ end
25
10
 
26
- # Example of regular route:
27
- # get 'products/:id' => 'catalog#view'
28
-
29
- # Example of named route that can be invoked with purchase_url(id: product.id)
30
- # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
31
-
32
- # Example resource route (maps HTTP verbs to controller actions automatically):
33
- # resources :products
34
-
35
- # Example resource route with options:
36
- # resources :products do
37
- # member do
38
- # get 'short'
39
- # post 'toggle'
40
- # end
41
- #
42
- # collection do
43
- # get 'sold'
44
- # end
45
- # end
46
-
47
- # Example resource route with sub-resources:
48
- # resources :products do
49
- # resources :comments, :sales
50
- # resource :seller
51
- # end
52
-
53
- # Example resource route with more complex sub-resources:
54
- # resources :products do
55
- # resources :comments
56
- # resources :sales do
57
- # get 'recent', on: :collection
58
- # end
59
- # end
60
-
61
- # Example resource route with concerns:
62
- # concern :toggleable do
63
- # post 'toggle'
64
- # end
65
- # resources :posts, concerns: :toggleable
66
- # resources :photos, concerns: :toggleable
11
+ root to: 'pages#index'
67
12
 
68
- # Example resource route within a namespace:
69
- # namespace :admin do
70
- # # Directs /admin/products/* to Admin::ProductsController
71
- # # (app/controllers/admin/products_controller.rb)
72
- # resources :products
73
- # end
74
13
  end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 2c1c8d4cbaa726b21aa6483b7d556125f4897508e2b94f8b3ddaec675168382c9b3b6eb5a9359d2fade03f539c16ac1ef905891c2410f2fd00b83b76c1666feb
15
+
16
+ test:
17
+ secret_key_base: 9dd531171128e7c3d11dd2c5c18c84ba43d29b677043002634a6f4d58bf2687a283b7b6dc6af741d63c3824f11fa1f858010d7c2509a932023f2ece0d3bfe6cf
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV['SECRET_KEY_BASE'] %>
data/test/dummy/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
4
  run Rails.application
File without changes