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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82f905717d06763bf475faebe14ef2ee7ee5890e
4
- data.tar.gz: b172f6203247356d87854c481a76685e42e47742
3
+ metadata.gz: 91cfd4a3627443e9244d089d713946a5e526d9fa
4
+ data.tar.gz: 2c519f7541e3ece7b0b0610459f992687cd32759
5
5
  SHA512:
6
- metadata.gz: 8b192b39ce8639f9c26b67f1b7bd0c6e81040def64645404e46fea05b825b712f082aeef071d3f58604c636af9bcf1702fa152099090514a56c15a7eb4979042
7
- data.tar.gz: c003689979884e8a37d3a67240e751d6b687071d5f976f2db6eaed18eae28811f9ed8d52bab30e20cc2abd9c6dbab12597662ea0e07db8bcb5c5fc9efa6c21cb
6
+ metadata.gz: 7a95f3e6439c69f5bd0315f2ad1141cfc66e95ae9bd8c581fdc407b48260b7fd37b5626edc954dd2c8fb534fb9545775fc79e7d259ef372fadda39bd52cf0b13
7
+ data.tar.gz: 34af90429178f5832ef5eaa74531a19a809a353a6eada0e6da695bb1314d182a1b9b83ebf0b6acc897861ee40f2082b6abe6107807a05986328ff1f3d5164480
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2015 Mathías Montossi
1
+ Copyright 2016 Mathías Montossi
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -5,7 +5,14 @@
5
5
 
6
6
  # Crumbs
7
7
 
8
- Adds a handy crumbs variable available in your views in rails.
8
+ Handy crumbs variable for rails views.
9
+
10
+ ## Why
11
+
12
+ I did this gem to:
13
+
14
+ - Have a dsl separate from the controllers to define crumbs.
15
+ - Make crumbs remember query parameters from previous requests.
9
16
 
10
17
  ## Install
11
18
 
@@ -19,89 +26,72 @@ Then bundle:
19
26
  $ bundle
20
27
  ```
21
28
 
29
+ NOTE: Because this gem stores queries in session, you may need a gem like redis-store to prevent cookies overflow.
30
+
22
31
  ## Configuration
23
32
 
24
- Generate the initialization and definition files:
33
+ Generate the configuration file:
25
34
  ```
26
- rails g crumbs:install
35
+ $ bundle exec rails g crumbs:install
27
36
  ```
28
37
 
29
- The defaults configuration values are:
30
- ```ruby
31
- Crumbs.configure do |config|
32
- config.show_last = false
33
- end
34
- ```
38
+ ## Usage
35
39
 
36
- ## DSL
40
+ ### Definitions
37
41
 
38
- In your config/crumbs.rb file add crumbs referencing the controller and action with the dsl:
42
+ Use the crumb method to define a crumb:
39
43
  ```ruby
40
44
  Crumbs.define do
41
- controller :site do
42
- action :index, 'Home'
43
- end
45
+ crumb 'pages#index', 'Home'
44
46
  end
45
47
  ```
46
48
 
47
- To translate names you can use the t method (keys starting with dot are prepended with 'crumbs.'):
49
+ To translate the name you can use the t shortcut method, will prepend "crumbs" to the key:
48
50
  ```ruby
49
51
  Crumbs.define do
50
- controller :site do
51
- action :index, t('.home')
52
- end
52
+ crumb 'pages#index', t('.home')
53
53
  end
54
54
  ```
55
55
 
56
- If you don't like to prepend the namespace of the controller:
56
+ For dynamic names you can use a block, will receive the corresponding parameters:
57
57
  ```ruby
58
58
  Crumbs.define do
59
- namespace :admin do
60
- controller :products do
61
- action :index, 'Products'
62
- end
59
+ crumb 'products#show' do |params|
60
+ Product.find(params[:id]).name
63
61
  end
64
62
  end
65
63
  ```
66
64
 
67
- You can use a block for dynamic names, will receive the corresponding url parameters:
65
+ If you need to add multiple crumbs to the same controller:
68
66
  ```ruby
69
67
  Crumbs.define do
70
- controller :products do
71
- action :show do |params|
72
- Product.find(params[:id]).name
68
+ namespace :admin do
69
+ controller :users do
70
+ crumb :index, 'Users'
71
+ crumb :edit, 'Edit user'
73
72
  end
74
73
  end
75
74
  end
76
75
  ```
77
76
 
78
- ## Performance
77
+ ### Performance
79
78
 
80
- To disable crumbs for any controller or action:
79
+ To disable crums in some controller:
81
80
  ```ruby
82
81
  class Api::BaseController < ApplicationController
83
82
  skip_before_action :set_crumbs
84
83
  end
85
84
  ```
86
85
 
87
- ## Views
86
+ ### Views
88
87
 
89
- In your views would be available a crumbs variable:
88
+ Crumbs variable will be available in your views:
90
89
  ```erb
91
90
  <% @crumbs.each do |crumb| %>
92
- &gt; <%= link_to crumb[:name], crumb[:path] %>
91
+ &gt; <%= link_to crumb[:name], crumb[:url] %>
93
92
  <% end %>
94
93
  ```
95
94
 
96
- ## Last crumb
97
-
98
- If you want to show the last crumb, change the default in your config/initializers/crumbs.rb:
99
- ```ruby
100
- Crumbs.configure do |config|
101
- config.crumbs.show_last = true
102
- end
103
- ```
104
-
105
95
  ## Credits
106
96
 
107
97
  This gem is maintained and funded by [mmontossi](https://github.com/mmontossi).
data/Rakefile CHANGED
@@ -4,19 +4,6 @@ rescue LoadError
4
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
5
  end
6
6
 
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'Crumbs'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
-
18
-
19
-
20
7
  Bundler::GemHelper.install_tasks
21
8
 
22
9
  require 'rake/testtask'
@@ -26,7 +13,7 @@ Rake::TestTask.new(:test) do |t|
26
13
  t.libs << 'test'
27
14
  t.pattern = 'test/**/*_test.rb'
28
15
  t.verbose = false
16
+ t.warning = false
29
17
  end
30
18
 
31
-
32
19
  task default: :test
@@ -0,0 +1,26 @@
1
+ module Crumbs
2
+ class Definitions
3
+
4
+ def find(id, params)
5
+ if registry.has_key?(id)
6
+ name = registry[id]
7
+ if name.is_a?(Proc)
8
+ name.call params
9
+ else
10
+ name
11
+ end
12
+ end
13
+ end
14
+
15
+ def add(id, name)
16
+ registry[id] = name
17
+ end
18
+
19
+ private
20
+
21
+ def registry
22
+ @registry ||= {}
23
+ end
24
+
25
+ end
26
+ end
@@ -1,25 +1,21 @@
1
1
  module Crumbs
2
- module DSL
2
+ module Dsl
3
3
  class Controller
4
4
 
5
- def initialize(controller, &block)
6
- @controller = controller
5
+ def initialize(prefix, &block)
6
+ @prefix = prefix
7
7
  instance_eval &block
8
8
  end
9
9
 
10
- def action(action, name=nil, &block)
11
- Crumbs.add(
12
- @controller.to_s,
13
- action.to_s,
14
- (block_given? ? block : name)
15
- )
10
+ def crumb(action, name=nil, &block)
11
+ Crumbs.definitions.add "#{@prefix}##{action}", (block_given? ? block : name)
16
12
  end
17
13
 
18
14
  def t(key)
19
- if key.starts_with? '.'
15
+ if key.starts_with?('.')
20
16
  key.prepend 'crumbs'
21
17
  end
22
- I18n.t(key)
18
+ I18n.t key
23
19
  end
24
20
 
25
21
  end
@@ -1,14 +1,18 @@
1
1
  module Crumbs
2
- module DSL
2
+ module Dsl
3
3
  class Namespace
4
4
 
5
- def initialize(namespace, &block)
6
- @namespace = namespace
5
+ def initialize(prefix, &block)
6
+ @prefix = prefix
7
7
  instance_eval &block
8
8
  end
9
9
 
10
10
  def controller(name, &block)
11
- Controller.new("#{@namespace}/#{name}", &block)
11
+ Controller.new "#{@prefix}/#{name}", &block
12
+ end
13
+
14
+ def namespace(name, &block)
15
+ Namespace.new "#{@prefix}/#{name}", &block
12
16
  end
13
17
 
14
18
  end
@@ -0,0 +1,43 @@
1
+ module Crumbs
2
+ module Extensions
3
+ module ActionController
4
+ module Base
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ before_action :set_crumbs
9
+ end
10
+
11
+ private
12
+
13
+ def set_crumbs
14
+ paths = [request.path]
15
+ until paths.first == '/'
16
+ paths.prepend File.dirname(paths.first)
17
+ end
18
+ session[:referers] ||= {}
19
+ url, query = request.url.split(/\/?\?/)
20
+ if query
21
+ session[:referers][url] = query
22
+ end
23
+ @crumbs = []
24
+ paths.each do |path|
25
+ url = "#{request.base_url}#{path}".remove(/\/$/)
26
+ begin
27
+ params = Rails.application.routes.recognize_path(url)
28
+ rescue
29
+ next
30
+ end
31
+ if name = Crumbs.definitions.find("#{params[:controller]}##{params[:action]}", params)
32
+ if query = session[:referers][url]
33
+ url << "?#{query}"
34
+ end
35
+ @crumbs << { name: name, url: url }
36
+ end
37
+ end
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
data/lib/crumbs/proxy.rb CHANGED
@@ -5,13 +5,16 @@ module Crumbs
5
5
  instance_eval &block
6
6
  end
7
7
 
8
- %w(
9
- namespace
10
- controller
11
- ).each do |name|
12
- define_method name do |*args, &block|
13
- DSL.const_get(name.to_s.classify).new(*args, &block)
14
- end
8
+ def namespace(*args, &block)
9
+ Dsl::Namespace.new *args, &block
10
+ end
11
+
12
+ def controller(*args, &block)
13
+ Dsl::Controller.new *args, &block
14
+ end
15
+
16
+ def crumb(action, name=nil, &block)
17
+ Crumbs.definitions.add action, (block_given? ? block : name)
15
18
  end
16
19
 
17
20
  end
@@ -1,8 +1,10 @@
1
1
  module Crumbs
2
2
  class Railtie < Rails::Railtie
3
3
 
4
- initializer 'crumbs' do
5
- ::ActionController::Base.send :include, Crumbs::ActionController::Base
4
+ initializer 'crumbs.extensions' do
5
+ ::ActionController::Base.include(
6
+ Crumbs::Extensions::ActionController::Base
7
+ )
6
8
  end
7
9
 
8
10
  config.after_initialize do
@@ -1,5 +1,5 @@
1
1
  module Crumbs
2
2
 
3
- VERSION = '2.1.2'
3
+ VERSION = '4.0.0.0'
4
4
 
5
5
  end
data/lib/crumbs.rb CHANGED
@@ -1,51 +1,20 @@
1
- require 'crumbs/action_controller/base'
2
- require 'crumbs/proxy'
3
1
  require 'crumbs/dsl/namespace'
4
2
  require 'crumbs/dsl/controller'
3
+ require 'crumbs/extensions/action_controller/base'
4
+ require 'crumbs/definitions'
5
+ require 'crumbs/proxy'
5
6
  require 'crumbs/railtie'
7
+ require 'crumbs/version'
6
8
 
7
9
  module Crumbs
8
10
  class << self
9
11
 
10
- def configure
11
- yield config
12
- end
13
-
14
- def config
15
- @config ||= begin
16
- ActiveSupport::OrderedOptions.new.tap do |config|
17
- config.show_last = false
18
- end
19
- end
20
- end
21
-
22
12
  def define(&block)
23
- Proxy.new(&block)
13
+ Proxy.new &block
24
14
  end
25
15
 
26
- def find(controller, action, params)
27
- if registry.has_key? controller and registry[controller].has_key? action
28
- name = registry[controller][action]
29
- if name.is_a? Proc
30
- name.call params
31
- else
32
- name
33
- end
34
- end
35
- end
36
-
37
- def add(controller, action, name)
38
- if registry.has_key? controller
39
- registry[controller][action] = name
40
- else
41
- registry[controller] = { action => name }
42
- end
43
- end
44
-
45
- protected
46
-
47
- def registry
48
- @registry ||= {}
16
+ def definitions
17
+ @definitions ||= Definitions.new
49
18
  end
50
19
 
51
20
  end
@@ -0,0 +1,15 @@
1
+ require 'rails/generators'
2
+
3
+ module Crumbs
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def create_configuration_file
10
+ copy_file 'configuration.rb', 'config/crumbs.rb'
11
+ end
12
+
13
+ end
14
+ end
15
+ end
data/test/dummy/Rakefile CHANGED
@@ -2,5 +2,4 @@
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
4
  require File.expand_path('../config/application', __FILE__)
5
-
6
- Dummy::Application.load_tasks
5
+ Rails.application.load_tasks
@@ -2,12 +2,12 @@
2
2
  // listed below.
3
3
  //
4
4
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
8
  // compiled file.
9
9
  //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
13
  //= require_tree .
@@ -3,11 +3,13 @@
3
3
  * listed below.
4
4
  *
5
5
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
10
12
  *
11
- *= require_self
12
13
  *= require_tree .
14
+ *= require_self
13
15
  */
@@ -0,0 +1,6 @@
1
+ class Admin::Reports::DeliveriesController < ApplicationController
2
+
3
+ def index
4
+ end
5
+
6
+ end
@@ -0,0 +1,9 @@
1
+ class Admin::UsersController < ApplicationController
2
+
3
+ def index
4
+ end
5
+
6
+ def show
7
+ end
8
+
9
+ end
@@ -1,27 +1,6 @@
1
1
  class PagesController < ApplicationController
2
2
 
3
3
  def index
4
- render :crumbs
5
- end
6
-
7
- def static
8
- render :crumbs
9
- end
10
-
11
- def i18n
12
- render :crumbs
13
- end
14
-
15
- def nested
16
- render :crumbs
17
- end
18
-
19
- def param
20
- render :crumbs
21
- end
22
-
23
- def empty
24
- render :crumbs
25
4
  end
26
5
 
27
6
  end
@@ -0,0 +1,3 @@
1
+ <% @crumbs.each do |crumb| %>
2
+ <%= link_to crumb[:name], crumb[:url] %>
3
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render 'crumbs' %>
@@ -0,0 +1 @@
1
+ <%= render 'crumbs' %>
@@ -1,14 +1,12 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
- <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+ <%= yield %>
11
+ </body>
14
12
  </html>
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
4
  load Gem.bin_path('bundler', 'bundle')
data/test/dummy/bin/rails CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+
3
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
4
  require_relative '../config/boot'
4
5
  require 'rails/commands'
data/test/dummy/bin/rake CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  require_relative '../config/boot'
3
4
  require 'rake'
4
5
  Rake.application.run
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+
5
+ # path to your application root.
6
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
7
+
8
+ Dir.chdir APP_ROOT do
9
+ # This script is a starting point to setup your application.
10
+ # Add necessary setup steps to this file:
11
+
12
+ puts '== Installing dependencies =='
13
+ system 'gem install bundler --conservative'
14
+ system 'bundle check || bundle install'
15
+
16
+ # puts "\n== Copying sample files =="
17
+ # unless File.exist?('config/database.yml')
18
+ # system 'cp config/database.yml.sample config/database.yml'
19
+ # end
20
+
21
+ puts "\n== Preparing database =="
22
+ system 'bin/rake db:setup'
23
+
24
+ puts "\n== Removing old logs and tempfiles =="
25
+ system 'rm -f log/*'
26
+ system 'rm -rf tmp/cache'
27
+
28
+ puts "\n== Restarting application server =="
29
+ system 'touch tmp/restart.txt'
30
+ end
@@ -1,6 +1,11 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require 'rails/all'
3
+ require 'active_model/railtie'
4
+ require 'action_controller/railtie'
5
+ require 'action_mailer/railtie'
6
+ require 'action_view/railtie'
7
+ require 'sprockets/railtie'
8
+ require 'rails/test_unit/railtie'
4
9
 
5
10
  Bundler.require(*Rails.groups)
6
11
  require 'crumbs'
@@ -1,5 +1,5 @@
1
1
  # Set up gems listed in the Gemfile.
2
2
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
3
 
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
5
  $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,21 +1,24 @@
1
1
  Crumbs.define do
2
2
 
3
- namespace :namespace do
4
- controller :pages do
5
- action :index, 'Namespaced Home'
3
+ namespace :admin do
4
+ namespace :reports do
5
+ controller :deliveries do
6
+ crumb :index do
7
+ 'deliveries'
8
+ end
9
+ end
6
10
  end
11
+ controller :users do
12
+ crumb :index, 'users'
13
+ end
14
+ end
15
+
16
+ crumb 'admin/users#show' do |params|
17
+ "user #{params[:id]}"
7
18
  end
8
19
 
9
20
  controller :pages do
10
- action :index, 'Home'
11
- action :nested, 'Nested'
12
- action :i18n, t('.hello')
13
- action :static do
14
- t('.static')
15
- end
16
- action :param do |params|
17
- "Param#{params[:param]}"
18
- end
21
+ crumb :index, t('.home')
19
22
  end
20
23
 
21
24
  end