gretel 3.0.9 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +11 -7
  3. data/.travis.yml +11 -10
  4. data/CHANGELOG.md +27 -0
  5. data/Gemfile +2 -19
  6. data/LICENSE.txt +1 -1
  7. data/README.md +43 -62
  8. data/Rakefile +3 -7
  9. data/coverage/coverage.txt +5 -0
  10. data/gretel.gemspec +12 -10
  11. data/lib/gretel.rb +2 -29
  12. data/lib/gretel/crumb.rb +5 -2
  13. data/lib/gretel/crumbs.rb +26 -7
  14. data/lib/gretel/railtie.rb +11 -0
  15. data/lib/gretel/renderer.rb +62 -30
  16. data/lib/gretel/version.rb +1 -1
  17. data/lib/gretel/view_helpers.rb +2 -0
  18. metadata +83 -110
  19. data/gemfiles/Gemfile-rails.3.1.x +0 -19
  20. data/gemfiles/Gemfile-rails.3.2.x +0 -19
  21. data/gemfiles/Gemfile-rails.4.0.x +0 -19
  22. data/gemfiles/Gemfile-rails.4.1.x +0 -19
  23. data/lib/gretel/deprecated.rb +0 -1
  24. data/lib/gretel/deprecated/default_style_key.rb +0 -25
  25. data/lib/gretel/deprecated/layout.rb +0 -15
  26. data/lib/gretel/deprecated/show_root_alone.rb +0 -27
  27. data/lib/gretel/deprecated/yield_links.rb +0 -44
  28. data/test/deprecated_test.rb +0 -45
  29. data/test/dummy/Rakefile +0 -7
  30. data/test/dummy/app/assets/javascripts/application.js +0 -15
  31. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  32. data/test/dummy/app/controllers/application_controller.rb +0 -3
  33. data/test/dummy/app/helpers/application_helper.rb +0 -5
  34. data/test/dummy/app/mailers/.gitkeep +0 -0
  35. data/test/dummy/app/models/.gitkeep +0 -0
  36. data/test/dummy/app/models/issue.rb +0 -3
  37. data/test/dummy/app/models/project.rb +0 -3
  38. data/test/dummy/app/views/breadcrumbs/site.rb +0 -3
  39. data/test/dummy/config.ru +0 -4
  40. data/test/dummy/config/application.rb +0 -14
  41. data/test/dummy/config/boot.rb +0 -10
  42. data/test/dummy/config/breadcrumbs.rb +0 -3
  43. data/test/dummy/config/breadcrumbs/test_crumbs.rb +0 -85
  44. data/test/dummy/config/database.yml +0 -25
  45. data/test/dummy/config/environment.rb +0 -5
  46. data/test/dummy/config/environments/development.rb +0 -2
  47. data/test/dummy/config/environments/production.rb +0 -2
  48. data/test/dummy/config/environments/test.rb +0 -2
  49. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  50. data/test/dummy/config/initializers/inflections.rb +0 -15
  51. data/test/dummy/config/initializers/mime_types.rb +0 -5
  52. data/test/dummy/config/initializers/secret_token.rb +0 -7
  53. data/test/dummy/config/initializers/session_store.rb +0 -8
  54. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  55. data/test/dummy/config/locales/en.yml +0 -5
  56. data/test/dummy/config/routes.rb +0 -11
  57. data/test/dummy/db/migrate/20130122163007_create_projects.rb +0 -9
  58. data/test/dummy/db/migrate/20130122163051_create_issues.rb +0 -10
  59. data/test/dummy/db/schema.rb +0 -29
  60. data/test/dummy/lib/assets/.gitkeep +0 -0
  61. data/test/dummy/log/.gitkeep +0 -0
  62. data/test/dummy/public/404.html +0 -26
  63. data/test/dummy/public/422.html +0 -26
  64. data/test/dummy/public/500.html +0 -25
  65. data/test/dummy/public/favicon.ico +0 -0
  66. data/test/dummy/script/rails +0 -6
  67. data/test/fixtures/issues.yml +0 -4
  68. data/test/fixtures/projects.yml +0 -3
  69. data/test/gretel_test.rb +0 -24
  70. data/test/helper_methods_test.rb +0 -546
  71. data/test/test_helper.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0080b505b59c5b36fb677893d4eb7eb423653392
4
- data.tar.gz: 6cab21d17741ad215d56a26f7d12c20c833bcc9d
2
+ SHA256:
3
+ metadata.gz: b80e71f865388974401274f84159318e012a5e9e40800888549453e301881bec
4
+ data.tar.gz: 06d1a078802e9b8d175f17376c7534ba8004c15327e2fc75b0e01e9386653cb8
5
5
  SHA512:
6
- metadata.gz: a39a87e3267b845a254a72a1d7478d987cff71d6484de22326aa28c7eb8476d22d6500df7c376fa5407ba9d65ad82d6f975fa2d70916e2169954c9bbbd7b7938
7
- data.tar.gz: d02a3bc7312ab98ad6b0b6adc68c38454e655c5bb29db4fbf140871cec41c8eb59dabc09170b9d94b8f9c9b24c64a4db659e27f32ac3d04411f9ad136df2cdd5
6
+ metadata.gz: 3b8c092e5e04c48099f0fcad18230b89a6f4c11e760d59f89f629792cb4225eb5db1cf4648c8a6145c6be99bcf104b0d08ee0b74b82d39d1e7b9e366fda6ea37
7
+ data.tar.gz: 582e6471d0fa5fb59d490bee9a41b1cdd7b0f419b107c9acb56914832ad5b3a5dfc5c4590918dcb38ea46495a0df2578ceeb5e6384e57c0ed7e37ab8e39ea3e7
data/.gitignore CHANGED
@@ -7,18 +7,22 @@ Gemfile.lock
7
7
  gemfiles/*.lock
8
8
  InstalledFiles
9
9
  _yardoc
10
- coverage
11
10
  doc/
12
11
  lib/bundler/man
13
12
  pkg
14
13
  rdoc
15
14
  spec/reports
16
- test/tmp
17
- test/version_tmp
15
+ spec/tmp
16
+ spec/version_tmp
18
17
  tmp
19
18
  log/*.log
20
- test/dummy/db/*.sqlite3
21
- test/dummy/log/*.log
22
- test/dummy/tmp/
23
- test/dummy/.sass-cache
19
+ spec/dummy/db/*.sqlite3
20
+ spec/dummy/log/*.log
21
+ spec/dummy/tmp/
22
+ spec/dummy/.sass-cache
24
23
  .DS_Store
24
+
25
+ /coverage/index.html
26
+ /coverage/assets
27
+ /coverage/*.json
28
+ /coverage/*.json.lock
@@ -1,16 +1,17 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 2.2.0
5
- - 2.1.0
6
- - 2.0.0
7
- - 1.9.3
8
- gemfile:
9
- - gemfiles/Gemfile-rails.3.1.x
10
- - gemfiles/Gemfile-rails.3.2.x
11
- - gemfiles/Gemfile-rails.4.0.x
12
- - gemfiles/Gemfile-rails.4.1.x
4
+ - 2.7
5
+ - 2.6
6
+ - 2.5
7
+ env:
8
+ - RAILS_VERSION="~> 5.1.0"
9
+ - RAILS_VERSION="~> 5.2.0"
10
+ - RAILS_VERSION="~> 6.0.0"
11
+ - RAILS_VERSION="master"
13
12
  before_script:
14
- - "cd test/dummy; rake db:migrate; rake db:test:prepare; cd ../.."
13
+ - "cd spec/dummy; rake db:migrate; rake db:test:prepare; cd ../.."
14
+ after_script:
15
+ - "cat coverage/coverage.txt"
15
16
  notifications:
16
17
  email: false
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 4.2.0
4
+ * Support generating JSON-LD structured data. See the readme for more info (via #26, thanks @dkniffin)
5
+
6
+ ## Version 4.1.0
7
+ * Depends only `railties` and `actionview`, not `rails` (via #7)
8
+ * Include `Gretel::ViewHelpers` module in `ActiveSupport.on_load(:action_view)` block
9
+ * Fix ruby 2.7 keywords warning (via #24, thanks @aki77)
10
+ * Fix multithreaded environment issue (via #13)
11
+ * `breadcrumbs.rb` is now evaluated in a instance of `Gretel::Crumbs::Builder`. If you want to call methods from `breadcrumbs.rb` other than `crumb`, `crumbs` and `crumb_defined?`, you need to call it via full reference like `Gretel::Crumbs.xxxx`
12
+
13
+ ## Version 4.0.2
14
+ * The return value of `breadcrumbs` is `html_safe` now (via #22)
15
+ * For the slim template engine users: You don't need to use `==` instead of `=` for `breadcrumbs`
16
+
17
+ ## Version 4.0.1
18
+ * Replaces data-vocabulary markup as google doesn't support it and now uses schema.org markup (via #17)
19
+
20
+ ## Version 4.0.0
21
+ * Support Bootstrap 4. See the `:style` option in the readme for more info
22
+ * CSS class for fragment link or span is now customizable. See the `:fragment_class` option in the readme for more info
23
+ * Drop support Ruby < 2.5
24
+ * Drop support Rails < 5.1
25
+ * Deprecated codes have been removed:
26
+ * `breadcrumbs` is no longer accept block, use `tap` instead
27
+ * `breadcrumbs` is no longer accept `style: :default`, use `style: :inline` instead
28
+ * `breadcrumbs` is no longer accept `:show_root_alone` option, use `:display_single_fragment` option instead
29
+
3
30
  ## Version 3.0.9
4
31
  * Adds breadcrumbs option `link_current_to_request_path` to link the current breadcrumb to the request path(#28 via #29)
5
32
  * Fixes semantic breadcrumbs when the last item has no link (via #55)
data/Gemfile CHANGED
@@ -1,23 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Declare your gem's dependencies in gretel.gemspec.
4
- # Bundler will treat runtime dependencies like base dependencies, and
5
- # development dependencies will be added by default to the :development group.
6
3
  gemspec
7
4
 
8
- # Declare any dependencies that are still in development here instead of in
9
- # your gemspec. These might include edge Rails or gems from your path or
10
- # Git. Remember to move these dependencies to your gemspec before releasing
11
- # your gem to rubygems.org.
12
-
13
- # To use debugger
14
- # gem 'debugger'
15
-
16
- group :development do
17
- # jquery-rails is used by the dummy application
18
- gem "jquery-rails"
19
- end
20
-
21
- group :test do
22
- gem 'test-unit', '~> 3.0' if RUBY_VERSION >= "2.2"
23
- end
5
+ rails_version = ENV['RAILS_VERSION'] || '>= 0'
6
+ gem 'rails', rails_version == 'master' ? { github: 'rails/rails' } : rails_version
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2016 Lasse Bunk
1
+ Copyright (c) 2010-2020 Lasse Bunk
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,12 +1,13 @@
1
- <a href="http://travis-ci.org/lassebunk/gretel"><img src="https://secure.travis-ci.org/lassebunk/gretel.png" alt="Build Status" /></a>
1
+ [![Gem Version](https://badge.fury.io/rb/gretel.svg)](http://badge.fury.io/rb/gretel)
2
+ [![Build Status](https://travis-ci.org/kzkn/gretel.svg?branch=master)](https://travis-ci.org/kzkn/gretel)
2
3
 
3
4
  <img src="http://i.imgur.com/CAKEaBM.png" alt="Handle breadcrumb trails... like a boss :)" />
4
5
 
5
6
  ([TL;DR](http://i.imgur.com/nH25yiH.png)) Gretel is a [Ruby on Rails](http://rubyonrails.org) plugin that makes it easy yet flexible to create breadcrumbs.
6
7
  It is based around the idea that breadcrumbs are a concern of the view, so you define a set of breadcrumbs in *config/breadcrumbs.rb* (or multiple files; see below) and specify in the view which breadcrumb to use.
7
- Gretel also supports [semantic breadcrumbs](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=185417) (those used in Google results).
8
+ Gretel also supports [semantic breadcrumbs](https://developers.google.com/search/docs/data-types/breadcrumb) (those used in Google results).
8
9
 
9
- Have fun! And please do write, if you (dis)like it – [lassebunk@gmail.com](mailto:lassebunk@gmail.com).
10
+ Have fun!
10
11
 
11
12
  ## Installation
12
13
 
@@ -88,9 +89,10 @@ Option | Description
88
89
  :display_single_fragment | Whether it should display the breadcrumb if it includes only one link. | False
89
90
  :link_current | Whether the current crumb should be linked to. | False
90
91
  :link_current_to_request_path | Whether the current crumb should always link to the current request path. *Note:* This option will have no effect unless `:link_current` is set to `true`. | True
91
- :semantic | Whether it should generate [semantic breadcrumbs](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=185417). | False
92
+ :semantic | Whether it should generate [semantic breadcrumbs](https://developers.google.com/search/docs/data-types/breadcrumb). | False
92
93
  :id | ID for the breadcrumbs container. | None
93
94
  :class | CSS class for the breadcrumbs container. Can be set to `nil` for no class. | `"breadcrumbs"`
95
+ :fragment_class | CSS class for the fragment link or span. Can be set to `nil` for no class. | None
94
96
  :current_class | CSS class for the current link or span. Can be set to `nil` for no class. | `"current"`
95
97
  :pretext_class | CSS class for the pretext, if given. Can be set to `nil` for no class. | `"pretext"`
96
98
  :posttext_class | CSS class for the posttext, if given. Can be set to `nil` for no class. | `"posttext"`
@@ -103,15 +105,16 @@ These are the styles you can use with `breadcrumbs style: :xx`.
103
105
 
104
106
  Style | Description
105
107
  -------------- | -----------
106
- `:inline` | Renders each link by itself with `&rsaquo;` as the seperator.
108
+ `:inline` | Default. Renders each link by itself with `&rsaquo;` as the seperator.
107
109
  `:ol` | Renders the links in `<li>` elements contained in an outer `<ol>`.
108
110
  `:ul` | Renders the links in `<li>` elements contained in an outer `<ul>`.
109
- `:bootstrap` | Renders the links for use in [Twitter Bootstrap](http://getbootstrap.com/).
110
- `:foundation5` | Renders the links for use in [Foundation 5](http://foundation.zurb.com/).
111
+ `:bootstrap` | Renders the links for use in [Bootstrap v3](https://getbootstrap.com/docs/3.4/).
112
+ `:bootstrap4` | Renders the links for use in [Bootstrap v4](https://getbootstrap.com/).
113
+ `:foundation5` | Renders the links for use in [Foundation 5](https://get.foundation/).
111
114
 
112
115
  Or you can build the breadcrumbs manually for full customization; see below.
113
116
 
114
- If you add other widely used styles, please submit a [Pull Request](https://github.com/lassebunk/gretel/pulls) so others can use them too.
117
+ If you add other widely used styles, please submit a [Pull Request](https://github.com/kzkn/gretel/pulls) so others can use them too.
115
118
 
116
119
  ## More examples
117
120
 
@@ -203,10 +206,10 @@ end
203
206
 
204
207
  ## Building the breadcrumbs manually
205
208
 
206
- If you supply a block to the `breadcrumbs` method, it will yield an array with the breadcrumb links so you can build the breadcrumbs HTML manually:
209
+ You can use the `breadcrumbs` method directly as an array. It will return an array with the breadcrumb links so you can build the breadcrumbs HTML manually:
207
210
 
208
211
  ```erb
209
- <% breadcrumbs do |links| %>
212
+ <% breadcrumbs.tap do |links| %>
210
213
  <% if links.any? %>
211
214
  You are here:
212
215
  <% links.each do |link| %>
@@ -216,6 +219,23 @@ If you supply a block to the `breadcrumbs` method, it will yield an array with t
216
219
  <% end %>
217
220
  ```
218
221
 
222
+ If you use this approach, you lose the built-in semantic breadcrumb functionality. One way to
223
+ add them back is to use JSON-LD structured data:
224
+
225
+ ```erb
226
+ <script type="application/ld+json">
227
+ <%= breadcrumbs.structured_data(url_base: "https://example.com")) %>
228
+ </script>
229
+ ```
230
+
231
+ Or, you can infer `url_base` from `request`:
232
+
233
+ ```erb
234
+ <script type="application/ld+json">
235
+ <%= breadcrumbs.structured_data(url_base: "#{request.protocol}#{request.host_with_port}")) %>
236
+ </script>
237
+ ```
238
+
219
239
  ## Getting the parent breadcrumb
220
240
 
221
241
  If you want to add a link to the parent breadcrumb, you can use the `parent_breadcrumb` view helper.
@@ -289,56 +309,15 @@ breadcrumbs do |links|
289
309
  end
290
310
  ```
291
311
 
292
- ### Automatic reloading of breadcrumb configuration files
293
-
294
- Since Gretel version 2.1.0, the breadcrumb configuration files are now reloaded in the Rails development environment if they change. In other environments, like production, the files are loaded once, when first needed.
295
-
296
- ### Setting breadcrumb trails
297
-
298
- The [gretel-trails](https://github.com/lassebunk/gretel-trails) gem can handle adding and hiding trails from the URL automatically. This makes it possible to link back to a different breadcrumb trail than the one specified in your breadcrumb, for example if you have a
299
- store with products that have a default parent to the category breadcrumb, but when visiting from the reviews section, you want to link back to the reviews instead.
300
-
301
- You can apply trails to select links by adding a simple JS selector (`js-append-trail` or another you choose), and after each page load it hides the trail from the URL, so the server sees it but the users don't.
302
-
303
- Check out the gem [here](https://github.com/lassebunk/gretel-trails).
304
-
305
-
306
- ## Upgrading from version 2.0 or below
307
-
308
- Instead of using the initializer that in Gretel version 2.0 and below required restarting the application after breadcrumb configuration changes, the configuration of the breadcrumbs is now loaded from `config/breadcrumbs.rb` (and `config/breadcrumbs/*.rb` if you want to split your breadcrumbs configuration across multiple files).
309
- In the Rails development environment, these files are automatically reloaded when changed.
310
-
311
- Using the initializer (e.g. `config/initializers/breadcrumbs.rb`) was deprecated in Gretel version 2.1.0 and removed in version 3.0. It raises an error if you try to use it.
312
-
313
- To update to the latest version of Gretel, use `bundle update gretel`. Then remove the `Gretel::Crumbs.layout do ... end` block, so instead of:
314
-
315
- ```ruby
316
- Gretel::Crumbs.layout do
317
- crumb :root do
318
- link "Home", root_path
319
- end
320
- end
321
- ```
322
-
323
- in the initializer, you write:
324
-
325
- ```ruby
326
- crumb :root do
327
- link "Home", root_path
328
- end
329
- ```
330
-
331
- in `config/breadcrumbs.rb`.
332
-
333
312
  ## Documentation
334
313
 
335
- * [Full documentation](http://rubydoc.info/gems/gretel)
336
- * [Changelog](https://github.com/lassebunk/gretel/blob/master/CHANGELOG.md)
337
- * [Tutorial on using Gretel](http://www.sitepoint.com/breadcrumbs-rails-gretel/) (Sitepoint)
314
+ * [Full documentation](https://rubydoc.info/gems/gretel)
315
+ * [Changelog](https://github.com/kzkn/gretel/blob/master/CHANGELOG.md)
316
+ * [Tutorial on using Gretel](https://www.sitepoint.com/breadcrumbs-rails-gretel/) (Sitepoint)
338
317
 
339
318
  ## Versioning
340
319
 
341
- Follows [semantic versioning](http://semver.org/).
320
+ Follows [semantic versioning](https://semver.org/).
342
321
 
343
322
  ## Contributing
344
323
 
@@ -350,19 +329,21 @@ To contribute:
350
329
  2. Create your feature branch (`git checkout -b my-new-feature`)
351
330
  3. Make your changes
352
331
  4. Add/Fix tests
353
- 5. Prepare database for testing: `cd test/dummy; rake db:migrate; rake db:test:prepare; cd ../..`
332
+ 5. Prepare database for testing: `cd spec/dummy; rake db:migrate; rake db:test:prepare; cd ../..`
354
333
  6. Run `rake` to make sure all tests pass
355
- 7. Commit your changes (`git commit -am 'Add new feature'`)
356
- 8. Push to the branch (`git push origin my-new-feature`)
357
- 9. Create new pull request
334
+ 7. Be sure to check in the changes to `coverage/coverage.txt`
335
+ 8. Commit your changes (`git commit -am 'Add new feature'`)
336
+ 9. Push to the branch (`git push origin my-new-feature`)
337
+ 10. Create new pull request
358
338
 
359
339
  Thanks.
360
340
 
361
341
  ## Contributors
362
342
 
363
- Gretel was created by [@lassebunk](https://github.com/lassebunk) and is maintained by [@WilHall](https://github.com/WilHall).
343
+ Gretel was created by [@lassebunk](https://github.com/lassebunk) and was maintained by [@WilHall](https://github.com/WilHall).
344
+ And it is maintained by [@kzkn](https://github.com/kzkn).
364
345
 
365
- [See the list of contributors](https://github.com/lassebunk/gretel/graphs/contributors)
346
+ [See the list of contributors](https://github.com/kzkn/gretel/graphs/contributors)
366
347
 
367
348
  ## And then
368
349
 
@@ -370,4 +351,4 @@ Gretel was created by [@lassebunk](https://github.com/lassebunk) and is maintain
370
351
 
371
352
  Have fun!
372
353
 
373
- Copyright (c) 2010-2016 [Lasse Bunk](http://lassebunk.dk), released under the MIT license
354
+ Copyright (c) 2010-2020 [Lasse Bunk](http://lassebunk.dk), released under the MIT license
data/Rakefile CHANGED
@@ -1,10 +1,6 @@
1
- require 'rake/testtask'
2
1
  require 'bundler/gem_tasks'
2
+ require "rspec/core/rake_task"
3
3
 
4
- Rake::TestTask.new do |t|
5
- t.libs << "test"
6
- t.test_files = FileList['test/**/*_test.rb']
7
- t.verbose = true
8
- end
4
+ RSpec::Core::RakeTask.new(:spec)
9
5
 
10
- task default: :test
6
+ task default: :spec
@@ -0,0 +1,5 @@
1
+ --------------------------------------------------------------------------------
2
+ Incomplete test coverage
3
+ --------------------------------------------------------------------------------
4
+
5
+ 100% test coverage. You're all set, friend!
@@ -1,22 +1,24 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'gretel/version'
1
+ require_relative 'lib/gretel/version'
5
2
 
6
3
  Gem::Specification.new do |gem|
7
4
  gem.name = "gretel"
8
5
  gem.version = Gretel::VERSION
9
- gem.authors = ["Lasse Bunk"]
10
- gem.email = ["lassebunk@gmail.com"]
6
+ gem.authors = ["Lasse Bunk", "Kazuki Nishikawa"]
7
+ gem.email = ["kzkn@users.noreply.github.com"]
11
8
  gem.description = %q{Gretel is a Ruby on Rails plugin that makes it easy yet flexible to create breadcrumbs.}
12
9
  gem.summary = %q{Flexible Ruby on Rails breadcrumbs plugin.}
13
- gem.homepage = "http://github.com/lassebunk/gretel"
10
+ gem.homepage = "http://github.com/kzkn/gretel"
14
11
  gem.license = "MIT"
15
12
 
16
- gem.files = `git ls-files`.split($/)
17
- gem.test_files = gem.files.grep(%r{^test/})
13
+ gem.files = Dir.chdir(File.expand_path('..', __FILE__)) do
14
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
+ end
18
16
  gem.require_paths = ["lib"]
19
17
 
20
- gem.add_dependency "rails", ">= 3.1.0"
18
+ gem.add_dependency "railties", [">= 5.1", "< 7.0"]
19
+ gem.add_dependency "actionview", [">= 5.1", "< 7.0"]
21
20
  gem.add_development_dependency "sqlite3"
21
+ gem.add_development_dependency "rspec-rails"
22
+ gem.add_development_dependency "simplecov"
23
+ gem.add_development_dependency "simplecov-erb"
22
24
  end
@@ -1,11 +1,6 @@
1
1
  require 'gretel/version'
2
2
  require 'gretel/resettable'
3
- require 'gretel/crumbs'
4
- require 'gretel/crumb'
5
- require 'gretel/link'
6
- require 'gretel/renderer'
7
- require 'gretel/view_helpers'
8
- require 'gretel/deprecated'
3
+ require 'gretel/railtie'
9
4
 
10
5
  module Gretel
11
6
  class << self
@@ -16,9 +11,7 @@ module Gretel
16
11
  # breadcrumbs set in engines.
17
12
  def breadcrumb_paths
18
13
  @breadcrumb_paths ||= begin
19
- engines = Rails::Engine::Railties.respond_to?(:engines) ?
20
- Rails::Engine::Railties.engines :
21
- Rails::Engine.subclasses.map(&:instance)
14
+ engines = Rails::Engine.subclasses.map(&:instance)
22
15
 
23
16
  engine_roots = engines.map { |e| e.config.root }
24
17
 
@@ -35,24 +28,6 @@ module Gretel
35
28
  @breadcrumb_paths = paths
36
29
  end
37
30
 
38
- # Whether to suppress deprecation warnings.
39
- def suppress_deprecation_warnings?
40
- !!@suppress_deprecation_warnings
41
- end
42
-
43
- # Sets whether to suppress deprecation warnings.
44
- def suppress_deprecation_warnings=(value)
45
- @suppress_deprecation_warnings = value
46
- end
47
-
48
- # Shows a deprecation warning.
49
- def show_deprecation_warning(message)
50
- return if suppress_deprecation_warnings?
51
- message = "[Gretel] #{message}"
52
- puts message
53
- Rails.logger.warn message
54
- end
55
-
56
31
  # Array of Rails environment names with automatic configuration reload. Default is +["development"]+.
57
32
  def reload_environments
58
33
  @reload_environments ||= ["development"]
@@ -78,5 +53,3 @@ module Gretel
78
53
  end
79
54
  end
80
55
  end
81
-
82
- ActionView::Base.send :include, Gretel::ViewHelpers
@@ -1,3 +1,5 @@
1
+ require 'gretel/link'
2
+
1
3
  module Gretel
2
4
  class Crumb
3
5
  # Initializes a new crumb from the given +key+.
@@ -13,7 +15,7 @@ module Gretel
13
15
  raise ArgumentError, "Breadcrumb :#{key} not found." unless block
14
16
  @key = key
15
17
  @context = context
16
- instance_exec *args, &block
18
+ instance_exec(*args, &block)
17
19
  end
18
20
 
19
21
  # Sets link of the breadcrumb.
@@ -29,7 +31,7 @@ module Gretel
29
31
 
30
32
  # Transform objects to real paths.
31
33
  url = url_for(url) if url
32
-
34
+
33
35
  links << Gretel::Link.new(key, text, url, options)
34
36
  end
35
37
 
@@ -64,5 +66,6 @@ module Gretel
64
66
  def method_missing(method, *args, &block)
65
67
  context.send(method, *args, &block)
66
68
  end
69
+ ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
67
70
  end
68
71
  end