gretel 3.0.8 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +11 -7
- data/.travis.yml +12 -8
- data/CHANGELOG.md +33 -1
- data/Gemfile +2 -13
- data/LICENSE.txt +2 -2
- data/README.md +31 -62
- data/Rakefile +3 -7
- data/coverage/coverage.txt +5 -0
- data/gretel.gemspec +13 -11
- data/lib/gretel.rb +2 -29
- data/lib/gretel/crumb.rb +5 -2
- data/lib/gretel/crumbs.rb +26 -7
- data/lib/gretel/railtie.rb +11 -0
- data/lib/gretel/renderer.rb +46 -27
- data/lib/gretel/version.rb +2 -2
- data/lib/gretel/view_helpers.rb +2 -0
- metadata +83 -109
- data/gemfiles/Gemfile-rails.3.2.x +0 -17
- data/gemfiles/Gemfile-rails.4.0.x +0 -17
- data/gemfiles/Gemfile-rails.4.1.x +0 -17
- data/lib/gretel/deprecated.rb +0 -1
- data/lib/gretel/deprecated/default_style_key.rb +0 -11
- data/lib/gretel/deprecated/layout.rb +0 -15
- data/lib/gretel/deprecated/show_root_alone.rb +0 -12
- data/lib/gretel/deprecated/yield_links.rb +0 -20
- data/test/deprecated_test.rb +0 -45
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -5
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/models/issue.rb +0 -3
- data/test/dummy/app/models/project.rb +0 -3
- data/test/dummy/app/views/breadcrumbs/site.rb +0 -3
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -14
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/breadcrumbs.rb +0 -3
- data/test/dummy/config/breadcrumbs/test_crumbs.rb +0 -85
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -2
- data/test/dummy/config/environments/production.rb +0 -2
- data/test/dummy/config/environments/test.rb +0 -2
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -11
- data/test/dummy/db/migrate/20130122163007_create_projects.rb +0 -9
- data/test/dummy/db/migrate/20130122163051_create_issues.rb +0 -10
- data/test/dummy/db/schema.rb +0 -29
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/fixtures/issues.yml +0 -4
- data/test/fixtures/projects.yml +0 -3
- data/test/gretel_test.rb +0 -24
- data/test/helper_methods_test.rb +0 -539
- data/test/test_helper.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d28cb34acf4eef47659c295f4dfd63b442fa7181552de3716015eb4f2d070c8f
|
4
|
+
data.tar.gz: e8cb450b18ea1f00dffc6e580655931109ddd1389cafce109b1ab597e832761a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7b13ae376b35bfc5508472752bfac4cd98022a19d7e00e0c8535ba1aa7c44e07a5f5068d98c2ca364ad6d1f25adc8671090ef9ac7f2879328273c94a8ac4e1b
|
7
|
+
data.tar.gz: 0e1451f51c1c2742c339a0b08489b2b503c3c751402eb432d0498b1b9ad2b44a1be2abf568c5f7387fed67aca07d959eb5bf9a41eb90d25f7b50beea3b6e09b4
|
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
|
-
|
17
|
-
|
15
|
+
spec/tmp
|
16
|
+
spec/version_tmp
|
18
17
|
tmp
|
19
18
|
log/*.log
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
data/.travis.yml
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
language: ruby
|
2
|
+
sudo: false
|
2
3
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
-
|
6
|
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
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"
|
10
12
|
before_script:
|
11
|
-
- "cd
|
13
|
+
- "cd spec/dummy; rake db:migrate; rake db:test:prepare; cd ../.."
|
14
|
+
after_script:
|
15
|
+
- "cat coverage/coverage.txt"
|
12
16
|
notifications:
|
13
17
|
email: false
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Version 4.1.0
|
4
|
+
* Depends only `railties` and `actionview`, not `rails` (via #7)
|
5
|
+
* Include `Gretel::ViewHelpers` module in `ActiveSupport.on_load(:action_view)` block
|
6
|
+
* Fix ruby 2.7 keywords warning (via #24, thanks @aki77)
|
7
|
+
* Fix multithreaded environment issue (via #13)
|
8
|
+
* `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`
|
9
|
+
|
10
|
+
## Version 4.0.2
|
11
|
+
* The return value of `breadcrumbs` is `html_safe` now (via #22)
|
12
|
+
* For the slim template engine users: You don't need to use `==` instead of `=` for `breadcrumbs`
|
13
|
+
|
14
|
+
## Version 4.0.1
|
15
|
+
* Replaces data-vocabulary markup as google doesn't support it and now uses schema.org markup (via #17)
|
16
|
+
|
17
|
+
## Version 4.0.0
|
18
|
+
* Support Bootstrap 4. See the `:style` option in the readme for more info
|
19
|
+
* CSS class for fragment link or span is now customizable. See the `:fragment_class` option in the readme for more info
|
20
|
+
* Drop support Ruby < 2.5
|
21
|
+
* Drop support Rails < 5.1
|
22
|
+
* Deprecated codes have been removed:
|
23
|
+
* `breadcrumbs` is no longer accept block, use `tap` instead
|
24
|
+
* `breadcrumbs` is no longer accept `style: :default`, use `style: :inline` instead
|
25
|
+
* `breadcrumbs` is no longer accept `:show_root_alone` option, use `:display_single_fragment` option instead
|
26
|
+
|
27
|
+
## Version 3.0.9
|
28
|
+
* Adds breadcrumbs option `link_current_to_request_path` to link the current breadcrumb to the request path(#28 via #29)
|
29
|
+
* Fixes semantic breadcrumbs when the last item has no link (via #55)
|
30
|
+
* Downgrades Rails dependency to 3.1 (via #56)
|
31
|
+
* Fixes jRuby issue with `Rails::Application` constant (via #50)
|
32
|
+
* Fixes deprecation warnings for `alias_method_chain` (via #66)
|
33
|
+
* Updated coprights (via #63)
|
34
|
+
|
3
35
|
## Version 3.0.8
|
4
36
|
* Parent breadcrumbs can now also be inferred from models responding to `model_name`.
|
5
37
|
|
@@ -45,4 +77,4 @@
|
|
45
77
|
* No longer supports procs for link text or URL as this is unnecessary when you can pass arguments to the block anyway.
|
46
78
|
* It now accepts multiple arguments for `crumb` and `parent` (see the readme).
|
47
79
|
* Breadcrumbs are now rendered with `<%= breadcrumbs %>`, although you can still use the old `<%= breadcrumb %>` (without *s*).
|
48
|
-
* You can now access view helpers from inside `Gretel::Crumbs.layout do .. end`.
|
80
|
+
* You can now access view helpers from inside `Gretel::Crumbs.layout do .. end`.
|
data/Gemfile
CHANGED
@@ -1,17 +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
|
-
|
9
|
-
gem
|
10
|
-
|
11
|
-
# Declare any dependencies that are still in development here instead of in
|
12
|
-
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
-
# your gem to rubygems.org.
|
15
|
-
|
16
|
-
# To use debugger
|
17
|
-
# gem 'debugger'
|
5
|
+
rails_version = ENV['RAILS_VERSION'] || '>= 0'
|
6
|
+
gem 'rails', rails_version == 'master' ? { github: 'rails/rails' } : rails_version
|
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2010-
|
1
|
+
Copyright (c) 2010-2020 Lasse Bunk
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
|
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](
|
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!
|
10
|
+
Have fun!
|
10
11
|
|
11
12
|
## Installation
|
12
13
|
|
@@ -87,9 +88,11 @@ Option | Description
|
|
87
88
|
:autoroot | Whether it should automatically link to the `:root` crumb if no parent is given. | True
|
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
|
92
|
+
:semantic | Whether it should generate [semantic breadcrumbs](https://developers.google.com/search/docs/data-types/breadcrumb). | False
|
91
93
|
:id | ID for the breadcrumbs container. | None
|
92
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
|
93
96
|
:current_class | CSS class for the current link or span. Can be set to `nil` for no class. | `"current"`
|
94
97
|
:pretext_class | CSS class for the pretext, if given. Can be set to `nil` for no class. | `"pretext"`
|
95
98
|
:posttext_class | CSS class for the posttext, if given. Can be set to `nil` for no class. | `"posttext"`
|
@@ -102,15 +105,16 @@ These are the styles you can use with `breadcrumbs style: :xx`.
|
|
102
105
|
|
103
106
|
Style | Description
|
104
107
|
-------------- | -----------
|
105
|
-
`:inline` | Renders each link by itself with `›` as the seperator.
|
108
|
+
`:inline` | Default. Renders each link by itself with `›` as the seperator.
|
106
109
|
`:ol` | Renders the links in `<li>` elements contained in an outer `<ol>`.
|
107
110
|
`:ul` | Renders the links in `<li>` elements contained in an outer `<ul>`.
|
108
|
-
`:bootstrap` | Renders the links for use in [
|
109
|
-
`:
|
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/).
|
110
114
|
|
111
115
|
Or you can build the breadcrumbs manually for full customization; see below.
|
112
116
|
|
113
|
-
If you add other widely used styles, please submit a [Pull Request](https://github.com/
|
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.
|
114
118
|
|
115
119
|
## More examples
|
116
120
|
|
@@ -133,7 +137,7 @@ crumb :project_issues do |project|
|
|
133
137
|
parent project # inferred to :project
|
134
138
|
end
|
135
139
|
|
136
|
-
# Child
|
140
|
+
# Child
|
137
141
|
crumb :issue do |issue|
|
138
142
|
link issue.name, issue_path(issue)
|
139
143
|
parent :project_issues, issue.project
|
@@ -202,10 +206,10 @@ end
|
|
202
206
|
|
203
207
|
## Building the breadcrumbs manually
|
204
208
|
|
205
|
-
|
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:
|
206
210
|
|
207
211
|
```erb
|
208
|
-
<% breadcrumbs do |links| %>
|
212
|
+
<% breadcrumbs.tap do |links| %>
|
209
213
|
<% if links.any? %>
|
210
214
|
You are here:
|
211
215
|
<% links.each do |link| %>
|
@@ -288,55 +292,15 @@ breadcrumbs do |links|
|
|
288
292
|
end
|
289
293
|
```
|
290
294
|
|
291
|
-
### Automatic reloading of breadcrumb configuration files
|
292
|
-
|
293
|
-
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.
|
294
|
-
|
295
|
-
### Setting breadcrumb trails
|
296
|
-
|
297
|
-
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
|
298
|
-
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.
|
299
|
-
|
300
|
-
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.
|
301
|
-
|
302
|
-
Check out the gem [here](https://github.com/lassebunk/gretel-trails).
|
303
|
-
|
304
|
-
|
305
|
-
## Upgrading from version 2.0 or below
|
306
|
-
|
307
|
-
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).
|
308
|
-
In the Rails development environment, these files are automatically reloaded when changed.
|
309
|
-
|
310
|
-
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.
|
311
|
-
|
312
|
-
To update to the latest version of Gretel, use `bundle update gretel`. Then remove the `Gretel::Crumbs.layout do ... end` block, so instead of:
|
313
|
-
|
314
|
-
```ruby
|
315
|
-
Gretel::Crumbs.layout do
|
316
|
-
crumb :root do
|
317
|
-
link "Home", root_path
|
318
|
-
end
|
319
|
-
end
|
320
|
-
```
|
321
|
-
|
322
|
-
in the initializer, you write:
|
323
|
-
|
324
|
-
```ruby
|
325
|
-
crumb :root do
|
326
|
-
link "Home", root_path
|
327
|
-
end
|
328
|
-
```
|
329
|
-
|
330
|
-
in `config/breadcrumbs.rb`.
|
331
|
-
|
332
295
|
## Documentation
|
333
296
|
|
334
|
-
* [Full documentation](
|
335
|
-
* [Changelog](https://github.com/
|
297
|
+
* [Full documentation](https://rubydoc.info/gems/gretel)
|
298
|
+
* [Changelog](https://github.com/kzkn/gretel/blob/master/CHANGELOG.md)
|
299
|
+
* [Tutorial on using Gretel](https://www.sitepoint.com/breadcrumbs-rails-gretel/) (Sitepoint)
|
336
300
|
|
337
301
|
## Versioning
|
338
302
|
|
339
|
-
Follows [semantic versioning](
|
303
|
+
Follows [semantic versioning](https://semver.org/).
|
340
304
|
|
341
305
|
## Contributing
|
342
306
|
|
@@ -347,17 +311,22 @@ To contribute:
|
|
347
311
|
1. Fork the project
|
348
312
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
349
313
|
3. Make your changes
|
350
|
-
4. Add tests
|
351
|
-
5.
|
352
|
-
6.
|
353
|
-
7.
|
354
|
-
8.
|
314
|
+
4. Add/Fix tests
|
315
|
+
5. Prepare database for testing: `cd spec/dummy; rake db:migrate; rake db:test:prepare; cd ../..`
|
316
|
+
6. Run `rake` to make sure all tests pass
|
317
|
+
7. Be sure to check in the changes to `coverage/coverage.txt`
|
318
|
+
8. Commit your changes (`git commit -am 'Add new feature'`)
|
319
|
+
9. Push to the branch (`git push origin my-new-feature`)
|
320
|
+
10. Create new pull request
|
355
321
|
|
356
322
|
Thanks.
|
357
323
|
|
358
324
|
## Contributors
|
359
325
|
|
360
|
-
|
326
|
+
Gretel was created by [@lassebunk](https://github.com/lassebunk) and was maintained by [@WilHall](https://github.com/WilHall).
|
327
|
+
And it is maintained by [@kzkn](https://github.com/kzkn).
|
328
|
+
|
329
|
+
[See the list of contributors](https://github.com/kzkn/gretel/graphs/contributors)
|
361
330
|
|
362
331
|
## And then
|
363
332
|
|
@@ -365,4 +334,4 @@ Thanks.
|
|
365
334
|
|
366
335
|
Have fun!
|
367
336
|
|
368
|
-
Copyright (c) 2010-
|
337
|
+
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
|
-
|
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: :
|
6
|
+
task default: :spec
|
data/gretel.gemspec
CHANGED
@@ -1,22 +1,24 @@
|
|
1
|
-
|
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 = ["
|
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/
|
10
|
+
gem.homepage = "http://github.com/kzkn/gretel"
|
14
11
|
gem.license = "MIT"
|
15
12
|
|
16
|
-
gem.files =
|
17
|
-
|
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 "
|
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"
|
22
|
-
|
21
|
+
gem.add_development_dependency "rspec-rails"
|
22
|
+
gem.add_development_dependency "simplecov"
|
23
|
+
gem.add_development_dependency "simplecov-erb"
|
24
|
+
end
|
data/lib/gretel.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
require 'gretel/version'
|
2
2
|
require 'gretel/resettable'
|
3
|
-
require 'gretel/
|
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::
|
20
|
-
Rails::Application::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
|
data/lib/gretel/crumb.rb
CHANGED
@@ -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
|
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
|