gretel 4.0.2 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -3
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/gretel.gemspec +2 -1
- data/lib/gretel.rb +1 -7
- 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 +3 -0
- data/lib/gretel/version.rb +1 -1
- data/lib/gretel/view_helpers.rb +2 -0
- metadata +30 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
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/.travis.yml
CHANGED
@@ -5,10 +5,13 @@ rvm:
|
|
5
5
|
- 2.6
|
6
6
|
- 2.5
|
7
7
|
env:
|
8
|
-
-
|
9
|
-
-
|
10
|
-
-
|
8
|
+
- RAILS_VERSION="~> 5.1.0"
|
9
|
+
- RAILS_VERSION="~> 5.2.0"
|
10
|
+
- RAILS_VERSION="~> 6.0.0"
|
11
|
+
- RAILS_VERSION="master"
|
11
12
|
before_script:
|
12
13
|
- "cd spec/dummy; rake db:migrate; rake db:test:prepare; cd ../.."
|
14
|
+
after_script:
|
15
|
+
- "cat coverage/coverage.txt"
|
13
16
|
notifications:
|
14
17
|
email: false
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
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
|
+
|
3
10
|
## Version 4.0.2
|
4
11
|
* The return value of `breadcrumbs` is `html_safe` now (via #22)
|
5
12
|
* For the slim template engine users: You don't need to use `==` instead of `=` for `breadcrumbs`
|
data/Gemfile
CHANGED
data/gretel.gemspec
CHANGED
@@ -15,7 +15,8 @@ Gem::Specification.new do |gem|
|
|
15
15
|
end
|
16
16
|
gem.require_paths = ["lib"]
|
17
17
|
|
18
|
-
gem.add_dependency "
|
18
|
+
gem.add_dependency "railties", [">= 5.1", "< 7.0"]
|
19
|
+
gem.add_dependency "actionview", [">= 5.1", "< 7.0"]
|
19
20
|
gem.add_development_dependency "sqlite3"
|
20
21
|
gem.add_development_dependency "rspec-rails"
|
21
22
|
gem.add_development_dependency "simplecov"
|
data/lib/gretel.rb
CHANGED
@@ -1,10 +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'
|
3
|
+
require 'gretel/railtie'
|
8
4
|
|
9
5
|
module Gretel
|
10
6
|
class << self
|
@@ -57,5 +53,3 @@ module Gretel
|
|
57
53
|
end
|
58
54
|
end
|
59
55
|
end
|
60
|
-
|
61
|
-
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
|
data/lib/gretel/crumbs.rb
CHANGED
@@ -3,11 +3,6 @@ module Gretel
|
|
3
3
|
class << self
|
4
4
|
include Resettable
|
5
5
|
|
6
|
-
# Stores the supplied block for later use.
|
7
|
-
def crumb(key, &block)
|
8
|
-
crumbs[key] = block
|
9
|
-
end
|
10
|
-
|
11
6
|
# Returns a hash of all stored crumb blocks.
|
12
7
|
def crumbs
|
13
8
|
@crumbs ||= {}
|
@@ -20,14 +15,15 @@ module Gretel
|
|
20
15
|
|
21
16
|
# Loads the breadcrumb configuration files.
|
22
17
|
def load_breadcrumbs
|
23
|
-
|
18
|
+
builder = Builder.new
|
24
19
|
|
25
20
|
loaded_file_mtimes.clear
|
26
21
|
breadcrumb_files.each do |file|
|
27
|
-
instance_eval open(file).read, file
|
22
|
+
builder.instance_eval open(file).read, file
|
28
23
|
loaded_file_mtimes << File.mtime(file)
|
29
24
|
end
|
30
25
|
|
26
|
+
@crumbs = builder.crumbs
|
31
27
|
@loaded = true
|
32
28
|
end
|
33
29
|
|
@@ -59,6 +55,29 @@ module Gretel
|
|
59
55
|
def loaded_file_mtimes
|
60
56
|
@loaded_file_mtimes ||= []
|
61
57
|
end
|
58
|
+
|
59
|
+
class Builder
|
60
|
+
attr_reader :crumbs
|
61
|
+
|
62
|
+
def initialize
|
63
|
+
@crumbs = {}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Stores the supplied block for later use.
|
67
|
+
def crumb(key, &block)
|
68
|
+
crumbs[key] = block
|
69
|
+
end
|
70
|
+
|
71
|
+
# Returns a hash of all stored crumb blocks.
|
72
|
+
def crumbs
|
73
|
+
@crumbs ||= {}
|
74
|
+
end
|
75
|
+
|
76
|
+
# Returns true if a crumb with the given key has been set.
|
77
|
+
def crumb_defined?(key)
|
78
|
+
crumbs.has_key?(key)
|
79
|
+
end
|
80
|
+
end
|
62
81
|
end
|
63
82
|
end
|
64
83
|
end
|
data/lib/gretel/renderer.rb
CHANGED
data/lib/gretel/version.rb
CHANGED
data/lib/gretel/view_helpers.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gretel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lasse Bunk
|
@@ -9,15 +9,18 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: railties
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '5.1'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '7.0'
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -25,6 +28,29 @@ dependencies:
|
|
25
28
|
- - ">="
|
26
29
|
- !ruby/object:Gem::Version
|
27
30
|
version: '5.1'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '7.0'
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: actionview
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.1'
|
41
|
+
- - "<"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '7.0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '5.1'
|
51
|
+
- - "<"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '7.0'
|
28
54
|
- !ruby/object:Gem::Dependency
|
29
55
|
name: sqlite3
|
30
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,6 +131,7 @@ files:
|
|
105
131
|
- lib/gretel/crumb.rb
|
106
132
|
- lib/gretel/crumbs.rb
|
107
133
|
- lib/gretel/link.rb
|
134
|
+
- lib/gretel/railtie.rb
|
108
135
|
- lib/gretel/renderer.rb
|
109
136
|
- lib/gretel/resettable.rb
|
110
137
|
- lib/gretel/version.rb
|