simple-navigation 4.0.5 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 517a3078bcdee06d396acd50e301c2d595316ebb
4
- data.tar.gz: b4da0b90ffa1a1996a6ce0ad5af542ae586f3936
3
+ metadata.gz: 80fdb7f2e02862d983ad05c0fdfc0abba3e702e8
4
+ data.tar.gz: 8b61d65bd217b32bea405141a7e5f5e212d79159
5
5
  SHA512:
6
- metadata.gz: a976b0a7c53937f03c25cad0fb84cc004a09e1d5f0f71a23e298cf5c03ed3ffb74600132c46d8eb78de5c1b4266f81f16f83e0b517278aa330cd2db7f64028fd
7
- data.tar.gz: 7a2e60a09ae9126e6a97349e3fe6118744b316acf5d797bb7432ebed49f02b3d326048e788db962988d7dafb8f162d548388c41f25f56e2203d3d2f0f943e38d
6
+ metadata.gz: 8171a0a34b62e9ca31f1c1d7fb6ab9ca838be0d566243cd0d11c106797d8279f2e53aeb634eeae79b01e9007da24b47bb706a776580ec010859bc9b74751d0e5
7
+ data.tar.gz: 9cff271a844731db1151e6031dac06351d8592b3038327e92e0f7b245045f523974c741f9dd33332baeeb492cea9d474fd29f54fe6318517596d02222d5115fc
data/.gitignore CHANGED
@@ -7,3 +7,4 @@ Gemfile.lock
7
7
  capybara-*
8
8
  gemfiles/*.lock
9
9
  log
10
+ spec/fake_app/tmp
@@ -1,11 +1,18 @@
1
1
  before_install:
2
2
  - gem install bundler
3
3
 
4
- rvm:
5
- - 2.2.6
6
- - 2.3.3
7
-
8
- gemfile:
9
- - gemfiles/rails-4-2-stable.gemfile
10
- - gemfiles/rails-4-1-stable.gemfile
11
- - gemfiles/rails-3-2-stable.gemfile
4
+ matrix:
5
+ include:
6
+ - rvm: 2.5.3
7
+ gemfile: gemfiles/rails-6-0-stable.gemfile
8
+ - rvm: 2.6.0
9
+ gemfile: gemfiles/rails-6-0-stable.gemfile
10
+ - rvm: 2.5.1
11
+ gemfile: gemfiles/rails-5-2-stable.gemfile
12
+ - rvm: 2.4.5
13
+ gemfile: gemfiles/rails-4-2-stable.gemfile
14
+ - rvm: 2.3.3
15
+ gemfile: gemfiles/rails-4-1-stable.gemfile
16
+ - rvm: 2.3.3
17
+ gemfile: gemfiles/rails-3-2-stable.gemfile
18
+
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.1.0
4
+
5
+ * Delay rails6 initialization using on_load (getting rid of deprecation warnings in rails 6). Credits to Markus Benning.
6
+ * Fix link to wiki in README. Thanks to Greg Molnar.
7
+ * Fix uninitialized variable `@dom_attributes` warning. Credits to Johan Tell.
8
+ * Fixed tests for rails 5x. Credits to Eugene Gavrilov.
9
+
10
+
3
11
  ## 4.0.5
4
12
 
5
13
  * Fix #188 Blank url and highligh_on_subpath = true causes error. Credits to Tristan Harmer (gondalez) and Ilia Pozhilov (ilyapoz).
data/README.md CHANGED
@@ -9,7 +9,7 @@ Simple Navigation is a ruby library for creating navigations (with multiple leve
9
9
 
10
10
  ## Documentation
11
11
 
12
- For the complete documentation, take a look at the [project's wiki](http://wiki.github.com/codeplant/simple-navigation).
12
+ For the complete documentation, take a look at the [project's wiki](https://github.com/codeplant/simple-navigation/wiki).
13
13
 
14
14
  ## RDoc
15
15
 
@@ -60,4 +60,4 @@ In this situation `/Users/username/.rubies/ruby-2.2.3/bin/rake` is the command y
60
60
 
61
61
  ## License
62
62
 
63
- Copyright (c) 2017 codeplant GmbH, released under the MIT license
63
+ Copyright (c) 2019 codeplant GmbH, released under the MIT license
data/Rakefile CHANGED
@@ -15,6 +15,7 @@ namespace :spec do
15
15
  rails-3-2-stable
16
16
  rails-4-1-stable
17
17
  rails-4-2-stable
18
+ rails-5-2-stable
18
19
  ]
19
20
 
20
21
  mappers.each do |gemfile|
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake', '< 11.0'
4
+ gem 'railties', '~> 5.2.0'
5
+ gem 'rspec-rails', '~> 3.8.2'
6
+
7
+ gemspec path: '../'
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake', '< 11.0'
4
+
5
+ # not yet
6
+ #gem 'railties', '~> 6.0.0'
7
+ gem 'railties', '6.0.0.rc2'
8
+ gem 'rspec-rails', '~> 3.8.2'
9
+
10
+ gemspec path: '../'
@@ -5,6 +5,21 @@ module SimpleNavigation
5
5
 
6
6
  def self.register
7
7
  SimpleNavigation.set_env(::Rails.root, ::Rails.env)
8
+
9
+ # Autoloading in initializers is deprecated on rails 6.0
10
+ # This delays the hook initialization using the on_load
11
+ # hooks, but does not change behaviour for existing
12
+ # rails versions.
13
+ if ::Rails::VERSION::MAJOR >= 6
14
+ ActiveSupport.on_load(:action_controller_base) do
15
+ SimpleNavigation::Adapters::Rails.register_controller_helpers
16
+ end
17
+ else
18
+ register_controller_helpers
19
+ end
20
+ end
21
+
22
+ def self.register_controller_helpers
8
23
  ActionController::Base.send(:include, SimpleNavigation::Helpers)
9
24
  SimpleNavigation::Helpers.instance_methods.each do |m|
10
25
  ActionController::Base.send(:helper_method, m.to_sym)
@@ -16,6 +16,7 @@ module SimpleNavigation
16
16
  @items ||= []
17
17
  @renderer = SimpleNavigation.config.renderer
18
18
  @auto_highlight = true
19
+ @dom_attributes = {}
19
20
  end
20
21
 
21
22
  def dom_attributes
@@ -24,7 +25,8 @@ module SimpleNavigation
24
25
  id: dom_id,
25
26
  class: dom_class
26
27
  }.reject { |_, v| v.nil? }
27
- (@dom_attributes || {}).merge(dom_id_and_class)
28
+
29
+ @dom_attributes.merge(dom_id_and_class)
28
30
  end
29
31
 
30
32
  # Creates a new navigation item.
@@ -1,3 +1,3 @@
1
1
  module SimpleNavigation
2
- VERSION = '4.0.5'
2
+ VERSION = '4.1.0'
3
3
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_runtime_dependency 'activesupport', '>= 2.3.2'
31
31
 
32
- spec.add_development_dependency 'bundler', '~> 1.5'
32
+ spec.add_development_dependency 'bundler'
33
33
  spec.add_development_dependency 'capybara'
34
34
  spec.add_development_dependency 'coveralls', '~> 0.7'
35
35
  spec.add_development_dependency 'guard-rspec', '~> 4.2'
@@ -1,6 +1,7 @@
1
1
  RSpec::Matchers.define :have_css do |expected, times|
2
2
  match do |actual|
3
- selector = HTML::Selector.new(expected).select(actual)
3
+ selector = Nokogiri::HTML(actual).css(expected)
4
+
4
5
  if times
5
6
  expect(selector.size).to eq times
6
7
  else
@@ -5,8 +5,7 @@ module SimpleNavigation
5
5
 
6
6
  let(:item) { nil }
7
7
  let(:options) {{ level: :all }}
8
- let(:output) { HTML::Document.new(raw_output).root }
9
- let(:raw_output) { renderer.render(navigation) }
8
+ let(:output) { renderer.render(navigation) }
10
9
  let(:renderer) { Breadcrumbs.new(options) }
11
10
 
12
11
  before { select_an_item(navigation[item]) if item }
@@ -75,7 +74,7 @@ module SimpleNavigation
75
74
  let(:item) { nil }
76
75
 
77
76
  it "doesn't render the prefix before the breadcrumbs" do
78
- expect(raw_output).not_to match(/^<div.+>You are here: /)
77
+ expect(output).not_to match(/^<div.+>You are here: /)
79
78
  end
80
79
  end
81
80
 
@@ -83,7 +82,7 @@ module SimpleNavigation
83
82
  let(:item) { :invoices }
84
83
 
85
84
  it 'renders the prefix before the breadcrumbs' do
86
- expect(raw_output).to match(/^<div.+>You are here: /)
85
+ expect(output).to match(/^<div.+>You are here: /)
87
86
  end
88
87
  end
89
88
  end
@@ -5,9 +5,8 @@ module SimpleNavigation
5
5
  let!(:navigation) { setup_navigation('nav_id', 'nav_class') }
6
6
 
7
7
  let(:item) { nil }
8
- let(:options) {{ level: :all }}
9
- let(:output) { HTML::Document.new(raw_output).root }
10
- let(:raw_output) { renderer.render(navigation) }
8
+ let(:options) { { level: :all } }
9
+ let(:output) { renderer.render(navigation) }
11
10
  let(:renderer) { Links.new(options) }
12
11
 
13
12
  before { select_an_item(navigation[item]) if item }
@@ -29,7 +28,7 @@ module SimpleNavigation
29
28
  end
30
29
 
31
30
  it "renders the 'a' tags with the corresponding item's :html_options" do
32
- expect(output).to have_css('a[style=float:right]')
31
+ expect(output).to have_css('a[style="float:right"]')
33
32
  end
34
33
 
35
34
  context 'when an item has a specified id' do
@@ -62,7 +61,7 @@ module SimpleNavigation
62
61
  let(:options) {{ level: :all, join_with: ' | ' }}
63
62
 
64
63
  it 'separates the items with the specified separator' do
65
- expect(raw_output.scan(' | ').size).to eq 3
64
+ expect(output.scan(' | ').size).to eq 3
66
65
  end
67
66
  end
68
67
 
@@ -4,9 +4,8 @@ module SimpleNavigation
4
4
  let!(:navigation) { setup_navigation('nav_id', 'nav_class') }
5
5
 
6
6
  let(:item) { nil }
7
- let(:options) {{ level: :all }}
8
- let(:output) { HTML::Document.new(raw_output).root }
9
- let(:raw_output) { renderer.render(navigation) }
7
+ let(:options) { { level: :all } }
8
+ let(:output) { renderer.render(navigation) }
10
9
  let(:renderer) { List.new(options) }
11
10
 
12
11
  before { select_an_item(navigation[item]) if item }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.5
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andi Schacke
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-03-20 00:00:00.000000000 Z
13
+ date: 2019-08-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -30,16 +30,16 @@ dependencies:
30
30
  name: bundler
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - "~>"
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: '1.5'
35
+ version: '0'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - "~>"
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '1.5'
42
+ version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: capybara
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -175,6 +175,8 @@ files:
175
175
  - gemfiles/rails-3-2-stable.gemfile
176
176
  - gemfiles/rails-4-1-stable.gemfile
177
177
  - gemfiles/rails-4-2-stable.gemfile
178
+ - gemfiles/rails-5-2-stable.gemfile
179
+ - gemfiles/rails-6-0-stable.gemfile
178
180
  - generators/navigation_config/USAGE
179
181
  - generators/navigation_config/navigation_config_generator.rb
180
182
  - generators/navigation_config/templates/config/navigation.rb
@@ -257,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
259
  version: '0'
258
260
  requirements: []
259
261
  rubyforge_project:
260
- rubygems_version: 2.2.2
262
+ rubygems_version: 2.6.14
261
263
  signing_key:
262
264
  specification_version: 4
263
265
  summary: simple-navigation is a ruby library for creating navigations (with multiple