gretel 3.0.7 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +11 -7
  3. data/.travis.yml +9 -7
  4. data/CHANGELOG.md +29 -1
  5. data/Gemfile +2 -13
  6. data/LICENSE.txt +2 -2
  7. data/README.md +36 -84
  8. data/Rakefile +3 -7
  9. data/coverage/coverage.txt +5 -0
  10. data/gretel.gemspec +12 -11
  11. data/lib/gretel.rb +2 -23
  12. data/lib/gretel/crumb.rb +9 -0
  13. data/lib/gretel/renderer.rb +43 -27
  14. data/lib/gretel/version.rb +2 -2
  15. data/lib/gretel/view_helpers.rb +0 -4
  16. metadata +63 -116
  17. data/gemfiles/Gemfile-rails.3.2.x +0 -17
  18. data/gemfiles/Gemfile-rails.4.0.x +0 -17
  19. data/gemfiles/Gemfile-rails.4.1.x +0 -17
  20. data/lib/gretel/deprecated.rb +0 -1
  21. data/lib/gretel/deprecated/default_style_key.rb +0 -11
  22. data/lib/gretel/deprecated/layout.rb +0 -15
  23. data/lib/gretel/deprecated/show_root_alone.rb +0 -12
  24. data/lib/gretel/deprecated/yield_links.rb +0 -20
  25. data/test/deprecated_test.rb +0 -45
  26. data/test/dummy/Rakefile +0 -7
  27. data/test/dummy/app/assets/javascripts/application.js +0 -15
  28. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  29. data/test/dummy/app/controllers/application_controller.rb +0 -3
  30. data/test/dummy/app/helpers/application_helper.rb +0 -5
  31. data/test/dummy/app/mailers/.gitkeep +0 -0
  32. data/test/dummy/app/models/.gitkeep +0 -0
  33. data/test/dummy/app/models/issue.rb +0 -3
  34. data/test/dummy/app/models/project.rb +0 -3
  35. data/test/dummy/app/views/breadcrumbs/site.rb +0 -3
  36. data/test/dummy/config.ru +0 -4
  37. data/test/dummy/config/application.rb +0 -14
  38. data/test/dummy/config/boot.rb +0 -10
  39. data/test/dummy/config/breadcrumbs.rb +0 -3
  40. data/test/dummy/config/breadcrumbs/test_crumbs.rb +0 -80
  41. data/test/dummy/config/database.yml +0 -25
  42. data/test/dummy/config/environment.rb +0 -5
  43. data/test/dummy/config/environments/development.rb +0 -2
  44. data/test/dummy/config/environments/production.rb +0 -2
  45. data/test/dummy/config/environments/test.rb +0 -2
  46. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  47. data/test/dummy/config/initializers/inflections.rb +0 -15
  48. data/test/dummy/config/initializers/mime_types.rb +0 -5
  49. data/test/dummy/config/initializers/secret_token.rb +0 -7
  50. data/test/dummy/config/initializers/session_store.rb +0 -8
  51. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  52. data/test/dummy/config/locales/en.yml +0 -5
  53. data/test/dummy/config/routes.rb +0 -11
  54. data/test/dummy/db/migrate/20130122163007_create_projects.rb +0 -9
  55. data/test/dummy/db/migrate/20130122163051_create_issues.rb +0 -10
  56. data/test/dummy/db/schema.rb +0 -29
  57. data/test/dummy/lib/assets/.gitkeep +0 -0
  58. data/test/dummy/log/.gitkeep +0 -0
  59. data/test/dummy/public/404.html +0 -26
  60. data/test/dummy/public/422.html +0 -26
  61. data/test/dummy/public/500.html +0 -25
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/dummy/script/rails +0 -6
  64. data/test/fixtures/issues.yml +0 -4
  65. data/test/fixtures/projects.yml +0 -3
  66. data/test/gretel_test.rb +0 -24
  67. data/test/helper_methods_test.rb +0 -532
  68. data/test/test_helper.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c41db63d201de11de1dbc6d9b9c2a172418ffa20
4
- data.tar.gz: 48db9abfdc31f7900b0f32afdc9536fd2839efdf
2
+ SHA256:
3
+ metadata.gz: 7c9acb3e1bababfdec129ddf28041956e1d9cedab4168612403bc45e6f6be2ce
4
+ data.tar.gz: 5d8a64b3af412616443a6f2fae688b3cff882cd4e39aebeb071c551a573fc2ca
5
5
  SHA512:
6
- metadata.gz: aa877e11f8c2037c68f9f01c9722101161163747e017e7be78606b56e7504d2a6bcbc253bb97144ab77c0d5ccd70a81a4323fe82ee2f0d4bc2b5d32ba79e21bb
7
- data.tar.gz: 4e6d5c1f40b484fe1ac448fda62654756b17efbc1bb7a262a69229571de91a86512104e9aeec70a0f655259e2ba61e2971fcd0fb8f17f0672c10a04bfae08182
6
+ metadata.gz: dfd59117fcad2e1459647cbf42bb52fb063fc49b49070ae5a8f7372b58f4f95317036597ca474f7c00fb17dcbd1809f9d503066495cd8d52d510342db6ad95a0
7
+ data.tar.gz: 4466f946506b36678860eb17b922243fbcd4bc848f6c8fcd93ebb588dae02df4f9a78c934aa884d9a1dedf586fbc721128591696f887bafa9c88372859eb2877
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,12 +1,14 @@
1
1
  language: ruby
2
+ sudo: false
2
3
  rvm:
3
- - 2.0.0
4
- - 1.9.3
5
- gemfile:
6
- - gemfiles/Gemfile-rails.3.2.x
7
- - gemfiles/Gemfile-rails.4.0.x
8
- - gemfiles/Gemfile-rails.4.1.x
4
+ - 2.7
5
+ - 2.6
6
+ - 2.5
7
+ env:
8
+ - RAILS="~> '5.1.0'"
9
+ - RAILS="~> '5.2.0'"
10
+ - RAILS="~> '6.0.0'"
9
11
  before_script:
10
- - "cd test/dummy; rake db:migrate; rake db:test:prepare; cd ../.."
12
+ - "cd spec/dummy; rake db:migrate; rake db:test:prepare; cd ../.."
11
13
  notifications:
12
14
  email: false
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 4.0.2
4
+ * The return value of `breadcrumbs` is `html_safe` now (via #22)
5
+ * For the slim template engine users: You don't need to use `==` instead of `=` for `breadcrumbs`
6
+
7
+ ## Version 4.0.1
8
+ * Replaces data-vocabulary markup as google doesn't support it and now uses schema.org markup (via #17)
9
+
10
+ ## Version 4.0.0
11
+ * Support Bootstrap 4. See the `:style` option in the readme for more info
12
+ * CSS class for fragment link or span is now customizable. See the `:fragment_class` option in the readme for more info
13
+ * Drop support Ruby < 2.5
14
+ * Drop support Rails < 5.1
15
+ * Deprecated codes have been removed:
16
+ * `breadcrumbs` is no longer accept block, use `tap` instead
17
+ * `breadcrumbs` is no longer accept `style: :default`, use `style: :inline` instead
18
+ * `breadcrumbs` is no longer accept `:show_root_alone` option, use `:display_single_fragment` option instead
19
+
20
+ ## Version 3.0.9
21
+ * Adds breadcrumbs option `link_current_to_request_path` to link the current breadcrumb to the request path(#28 via #29)
22
+ * Fixes semantic breadcrumbs when the last item has no link (via #55)
23
+ * Downgrades Rails dependency to 3.1 (via #56)
24
+ * Fixes jRuby issue with `Rails::Application` constant (via #50)
25
+ * Fixes deprecation warnings for `alias_method_chain` (via #66)
26
+ * Updated coprights (via #63)
27
+
28
+ ## Version 3.0.8
29
+ * Parent breadcrumbs can now also be inferred from models responding to `model_name`.
30
+
3
31
  ## Version 3.0.7
4
32
  * Pretext and posttext classes are now customizable with `<%= breadcrumbs pretext_class: "some-class" %>` and `<%= breadcrumbs posttext_class: "some-other-class" %>`.
5
33
 
@@ -42,4 +70,4 @@
42
70
  * No longer supports procs for link text or URL as this is unnecessary when you can pass arguments to the block anyway.
43
71
  * It now accepts multiple arguments for `crumb` and `parent` (see the readme).
44
72
  * Breadcrumbs are now rendered with `<%= breadcrumbs %>`, although you can still use the old `<%= breadcrumb %>` (without *s*).
45
- * You can now access view helpers from inside `Gretel::Crumbs.layout do .. end`.
73
+ * 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
- # jquery-rails is used by the dummy application
9
- gem "jquery-rails"
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
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2013 Lasse Bunk
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,29 +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
-
11
- ## New in version 3.0
12
-
13
- * Breadcrumbs can now be rendered in different styles like ul- and ol lists, and for use with the [Twitter Bootstrap](http://getbootstrap.com/) framework. See the `:style` option below for more info.
14
- * Defining breadcrumbs using `Gretel::Crumbs.layout do ... end` in an initializer has been removed. See below for details on how to upgrade.
15
- * The `:show_root_alone` option is now called `:display_single_fragment` and can be used to hide the breadcrumbs when there is only one link, also if it is not the root breadcrumb.
16
- The old `:show_root_alone` option is still supported until Gretel version 4.0 and will show a deprecation warning when it's used.
17
- * Links yielded from `<%= breadcrumbs do |links| %>` now have a `current?` helper that returns true if the link is the last in the trail.
18
- * New view helper: `parent_breadcrumb` returns the parent breadcrumb link (with `#key`, `#text`, and `#url`). This can for example be used to create a dynamic back link.
19
- You can supply options like `:autoroot` etc.
20
- If you supply a block, it will yield the parent breadcrumb if it is present.
21
- * Breadcrumbs can now be inferred if you pass in an instance of an object that responds to `model_name` (like an ActiveRecord model instance). E.g. `breadcrumb @product` is short for `breadcrumb :product, @product`.
22
-
23
-
24
- I hope you find these changes as useful as I did – if you have more suggestions, please create an [Issue](https://github.com/lassebunk/gretel/issues) or [Pull Request](https://github.com/lassebunk/gretel/pulls).
25
-
26
- See below for more info or the [changelog](https://github.com/lassebunk/gretel/blob/master/CHANGELOG.md) for less significant changes.
10
+ Have fun!
27
11
 
28
12
  ## Installation
29
13
 
@@ -84,7 +68,7 @@ This will generate the following HTML (indented for readability):
84
68
 
85
69
  ```html
86
70
  <div class="breadcrumbs">
87
- You are here:
71
+ <span class="pretext">You are here:</span>
88
72
  <a href="/">Home</a> &rsaquo;
89
73
  <a href="/issues">All issues</a> &rsaquo;
90
74
  <span class="current">My Issue</span>
@@ -104,9 +88,11 @@ Option | Description
104
88
  :autoroot | Whether it should automatically link to the `:root` crumb if no parent is given. | True
105
89
  :display_single_fragment | Whether it should display the breadcrumb if it includes only one link. | False
106
90
  :link_current | Whether the current crumb should be linked to. | False
107
- :semantic | Whether it should generate [semantic breadcrumbs](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=185417). | False
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
108
93
  :id | ID for the breadcrumbs container. | None
109
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
110
96
  :current_class | CSS class for the current link or span. Can be set to `nil` for no class. | `"current"`
111
97
  :pretext_class | CSS class for the pretext, if given. Can be set to `nil` for no class. | `"pretext"`
112
98
  :posttext_class | CSS class for the posttext, if given. Can be set to `nil` for no class. | `"posttext"`
@@ -119,15 +105,16 @@ These are the styles you can use with `breadcrumbs style: :xx`.
119
105
 
120
106
  Style | Description
121
107
  -------------- | -----------
122
- `:inline` | Renders each link by itself with `&rsaquo;` as the seperator.
108
+ `:inline` | Default. Renders each link by itself with `&rsaquo;` as the seperator.
123
109
  `:ol` | Renders the links in `<li>` elements contained in an outer `<ol>`.
124
110
  `:ul` | Renders the links in `<li>` elements contained in an outer `<ul>`.
125
- `:bootstrap` | Renders the links for use in [Twitter Bootstrap](http://getbootstrap.com/).
126
- `: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/).
127
114
 
128
115
  Or you can build the breadcrumbs manually for full customization; see below.
129
116
 
130
- 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.
131
118
 
132
119
  ## More examples
133
120
 
@@ -147,10 +134,10 @@ end
147
134
  # Parent crumbs
148
135
  crumb :project_issues do |project|
149
136
  link "Issues", project_issues_path(project)
150
- parent :project, project
137
+ parent project # inferred to :project
151
138
  end
152
139
 
153
- # Child
140
+ # Child
154
141
  crumb :issue do |issue|
155
142
  link issue.name, issue_path(issue)
156
143
  parent :project_issues, issue.project
@@ -160,7 +147,7 @@ end
160
147
  crumb :category do |category|
161
148
  link category.name, category
162
149
  if category.parent
163
- parent :category, category.parent
150
+ parent category.parent # inferred to :category
164
151
  else
165
152
  parent :categories
166
153
  end
@@ -169,7 +156,7 @@ end
169
156
  # Product crumb with recursive parent categories (as defined above)
170
157
  crumb :product do |product|
171
158
  link product.name, product
172
- parent :category, product.category
159
+ parent product.category # inferred to :category
173
160
  end
174
161
 
175
162
  # Crumb with multiple links
@@ -190,7 +177,7 @@ crumb :product do |product|
190
177
  if keyword = params[:q].presence
191
178
  parent :search, keyword
192
179
  else # default
193
- parent :category, product.category
180
+ parent product.category # inferred to :category
194
181
  end
195
182
  end
196
183
 
@@ -219,10 +206,10 @@ end
219
206
 
220
207
  ## Building the breadcrumbs manually
221
208
 
222
- 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:
223
210
 
224
211
  ```erb
225
- <% breadcrumbs do |links| %>
212
+ <% breadcrumbs.tap do |links| %>
226
213
  <% if links.any? %>
227
214
  You are here:
228
215
  <% links.each do |link| %>
@@ -305,55 +292,15 @@ breadcrumbs do |links|
305
292
  end
306
293
  ```
307
294
 
308
- ### Automatic reloading of breadcrumb configuration files
309
-
310
- 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.
311
-
312
- ### Setting breadcrumb trails
313
-
314
- 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
315
- 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.
316
-
317
- 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.
318
-
319
- Check out the gem [here](https://github.com/lassebunk/gretel-trails).
320
-
321
-
322
- ## Upgrading from version 2.0 or below
323
-
324
- 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).
325
- In the Rails development environment, these files are automatically reloaded when changed.
326
-
327
- 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.
328
-
329
- To update to the latest version of Gretel, use `bundle update gretel`. Then remove the `Gretel::Crumbs.layout do ... end` block, so instead of:
330
-
331
- ```ruby
332
- Gretel::Crumbs.layout do
333
- crumb :root do
334
- link "Home", root_path
335
- end
336
- end
337
- ```
338
-
339
- in the initializer, you write:
340
-
341
- ```ruby
342
- crumb :root do
343
- link "Home", root_path
344
- end
345
- ```
346
-
347
- in `config/breadcrumbs.rb`.
348
-
349
295
  ## Documentation
350
296
 
351
- * [Full documentation](http://rubydoc.info/gems/gretel)
352
- * [Changelog](https://github.com/lassebunk/gretel/blob/master/CHANGELOG.md)
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)
353
300
 
354
301
  ## Versioning
355
302
 
356
- Follows [semantic versioning](http://semver.org/).
303
+ Follows [semantic versioning](https://semver.org/).
357
304
 
358
305
  ## Contributing
359
306
 
@@ -364,17 +311,22 @@ To contribute:
364
311
  1. Fork the project
365
312
  2. Create your feature branch (`git checkout -b my-new-feature`)
366
313
  3. Make your changes
367
- 4. Add tests
368
- 5. Run `rake` to make sure all tests pass
369
- 6. Commit your changes (`git commit -am 'Add new feature'`)
370
- 7. Push to the branch (`git push origin my-new-feature`)
371
- 8. Create new pull request
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
372
321
 
373
322
  Thanks.
374
323
 
375
324
  ## Contributors
376
325
 
377
- * [See the list of contributors](https://github.com/lassebunk/gretel/graphs/contributors)
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)
378
330
 
379
331
  ## And then
380
332
 
@@ -382,4 +334,4 @@ Thanks.
382
334
 
383
335
  Have fun!
384
336
 
385
- Copyright (c) 2010-2013 [Lasse Bunk](http://lassebunk.dk), released under the MIT license
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
- 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,23 @@
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.2.0"
18
+ gem.add_dependency "rails", ">= 5.1"
21
19
  gem.add_development_dependency "sqlite3"
22
- end
20
+ gem.add_development_dependency "rspec-rails"
21
+ gem.add_development_dependency "simplecov"
22
+ gem.add_development_dependency "simplecov-erb"
23
+ end
@@ -5,7 +5,6 @@ require 'gretel/crumb'
5
5
  require 'gretel/link'
6
6
  require 'gretel/renderer'
7
7
  require 'gretel/view_helpers'
8
- require 'gretel/deprecated'
9
8
 
10
9
  module Gretel
11
10
  class << self
@@ -16,9 +15,7 @@ module Gretel
16
15
  # breadcrumbs set in engines.
17
16
  def breadcrumb_paths
18
17
  @breadcrumb_paths ||= begin
19
- engines = Rails::Application::Railties.respond_to?(:engines) ?
20
- Rails::Application::Railties.engines :
21
- Rails::Engine.subclasses.map(&:instance)
18
+ engines = Rails::Engine.subclasses.map(&:instance)
22
19
 
23
20
  engine_roots = engines.map { |e| e.config.root }
24
21
 
@@ -35,24 +32,6 @@ module Gretel
35
32
  @breadcrumb_paths = paths
36
33
  end
37
34
 
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
35
  # Array of Rails environment names with automatic configuration reload. Default is +["development"]+.
57
36
  def reload_environments
58
37
  @reload_environments ||= ["development"]
@@ -79,4 +58,4 @@ module Gretel
79
58
  end
80
59
  end
81
60
 
82
- ActionView::Base.send :include, Gretel::ViewHelpers
61
+ ActionView::Base.send :include, Gretel::ViewHelpers