navigator 1.3.0 → 1.4.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: 3e15bc2992a60c176f1fcd90f9318ba639cc5fb5
4
- data.tar.gz: 48f85d17d275ab7e5a6911035d291425cbc298ad
3
+ metadata.gz: 901fe36b917fe74821492def2f73fdd4719be8cb
4
+ data.tar.gz: 00ad7dc0af942727f310e22cfc79a7275c228c53
5
5
  SHA512:
6
- metadata.gz: 697896b1c032cd7e6f00373a5b1932e04a524ca4c7dd863d2bab03f0e6d15d1d801108c87c5e166ea443993b451d49bae8aa34894e6db9928dcd1d27286c09b0
7
- data.tar.gz: cfe21d282623c79f2316444512945a4fc48445cf5ead30884944e462763ac777d302433e32218dd04dd8455116a46caac7424b1544f9b6131329654140472339
6
+ metadata.gz: cdd19345525e161d78c063a0d12ffb090365381ca1982b6e007596d683697f64d195f1461570d59739b8d38ad59a2c8f4932cbf601ff4c26848225dace13108a
7
+ data.tar.gz: 08b0b6426e00689a7479c0ca29ffbb0b01f0134134b1acae72be1a38e68f0ca8daae9a272fb6dc7eb49324f16e234789edcdeb6bec8555dee79263ad6e9ed067
data/README.md CHANGED
@@ -1,14 +1,40 @@
1
- # Overview
1
+ # Navigator
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/navigator.png)](http://badge.fury.io/rb/navigator)
4
- [![Code Climate GPA](https://codeclimate.com/github/bkuhlmann/navigator.png)](https://codeclimate.com/github/bkuhlmann/navigator)
5
- [![Code Climate Coverage](https://codeclimate.com/github/bkuhlmann/navigator/coverage.png)](https://codeclimate.com/github/bkuhlmann/navigator)
6
- [![Gemnasium Status](https://gemnasium.com/bkuhlmann/navigator.png)](https://gemnasium.com/bkuhlmann/navigator)
7
- [![Travis CI Status](https://secure.travis-ci.org/bkuhlmann/navigator.png)](http://travis-ci.org/bkuhlmann/navigator)
8
- [![Gittip](http://img.shields.io/gittip/bkuhlmann.svg)](https://www.gittip.com/bkuhlmann)
3
+ [![Gem Version](https://badge.fury.io/rb/navigator.svg)](http://badge.fury.io/rb/navigator)
4
+ [![Code Climate GPA](https://codeclimate.com/github/bkuhlmann/navigator.svg)](https://codeclimate.com/github/bkuhlmann/navigator)
5
+ [![Code Climate Coverage](https://codeclimate.com/github/bkuhlmann/navigator/coverage.svg)](https://codeclimate.com/github/bkuhlmann/navigator)
6
+ [![Gemnasium Status](https://gemnasium.com/bkuhlmann/navigator.svg)](https://gemnasium.com/bkuhlmann/navigator)
7
+ [![Travis CI Status](https://secure.travis-ci.org/bkuhlmann/navigator.svg)](https://travis-ci.org/bkuhlmann/navigator)
8
+ [![Patreon](https://img.shields.io/badge/patreon-donate-brightgreen.svg)](https://www.patreon.com/bkuhlmann)
9
9
 
10
10
  Enhances Rails with a DSL for menu navigation.
11
11
 
12
+ <!-- Tocer[start]: Auto-generated, don't remove. -->
13
+
14
+ # Table of Contents
15
+
16
+ - [Features](#features)
17
+ - [Requirements](#requirements)
18
+ - [Setup](#setup)
19
+ - [Usage](#usage)
20
+ - [Unordered List (simple)](#unordered-list-simple)
21
+ - [Unordered List (with attributes)](#unordered-list-with-attributes)
22
+ - [Unordered List (with multiple data attributes)](#unordered-list-with-multiple-data-attributes)
23
+ - [Nav (with links)](#nav-with-links)
24
+ - [Foundation Menu](#foundation-menu)
25
+ - [Bootstrap Dropdown](#bootstrap-dropdown)
26
+ - [Menu Helpers](#menu-helpers)
27
+ - [Customization](#customization)
28
+ - [Tests](#tests)
29
+ - [Versioning](#versioning)
30
+ - [Code of Conduct](#code-of-conduct)
31
+ - [Contributions](#contributions)
32
+ - [License](#license)
33
+ - [History](#history)
34
+ - [Credits](#credits)
35
+
36
+ <!-- Tocer[finish]: Auto-generated, don't remove. -->
37
+
12
38
  # Features
13
39
 
14
40
  - Provides a DSL for building navigation menus.
@@ -42,7 +68,7 @@ Enhances Rails with a DSL for menu navigation.
42
68
 
43
69
  # Requirements
44
70
 
45
- 0. [MRI 2.x.x](http://www.ruby-lang.org).
71
+ 0. [MRI 2.x.x](https://www.ruby-lang.org).
46
72
  0. [Ruby on Rails 4.1.x](http://rubyonrails.org).
47
73
 
48
74
  # Setup
@@ -238,13 +264,13 @@ When building links, the default is:
238
264
  When building images, the default is:
239
265
 
240
266
  navigation "nav", activator: activator do
241
- img attributes: {src: "http://placehold.it/50x50", alt: "Example"}
267
+ img attributes: {src: "https://placehold.it/50x50", alt: "Example"}
242
268
  end
243
269
 
244
270
  ...but can be written as:
245
271
 
246
272
  navigation "nav", activator: activator do
247
- image "http://placehold.it/50x50", "Example"
273
+ image "https://placehold.it/50x50", "Example"
248
274
  end
249
275
 
250
276
  When building menu items, the default is:
@@ -351,7 +377,7 @@ regular expression (i.e. `/^profile.+/`) matching one of the the `profile/*` pat
351
377
 
352
378
  To test, run:
353
379
 
354
- bundle exec rspec spec
380
+ bundle exec rake
355
381
 
356
382
  To test the dummy application, run:
357
383
 
@@ -1,4 +1,5 @@
1
1
  module Navigator
2
+ # Navigation helper methods for the view layer.
2
3
  module NavigationHelper
3
4
  def navigation tag = "ul", attributes: {}, activator: navigation_activator, &block
4
5
  raw Navigator::Menu.new(self, tag: tag, attributes: attributes, activator: activator, &block).render
@@ -1,8 +1,9 @@
1
1
  module Navigator
2
+ # The main engine.
2
3
  class Engine < ::Rails::Engine
3
4
  isolate_namespace Navigator
4
5
 
5
- initializer "navigator.action_controller" do |app|
6
+ initializer "navigator.action_controller" do
6
7
  ActiveSupport.on_load :action_controller do
7
8
  helper Navigator::Engine.helpers
8
9
  end
@@ -1,4 +1,5 @@
1
1
  module Navigator
2
+ # Gem identity information.
2
3
  module Identity
3
4
  def self.name
4
5
  "navigator"
@@ -9,11 +10,11 @@ module Navigator
9
10
  end
10
11
 
11
12
  def self.version
12
- "1.3.0"
13
+ "1.4.0"
13
14
  end
14
15
 
15
16
  def self.label_version
16
- [label, version].join " "
17
+ "#{label} #{version}"
17
18
  end
18
19
  end
19
20
  end
@@ -2,7 +2,7 @@ module Navigator
2
2
  # Renders a HTML menu.
3
3
  class Menu
4
4
  def self.allowed_methods
5
- %r(^(div|section|header|h[1-6]|nav|ul|li|a|img|b|em|s|small|span|strong|sub|sup|form|label|select|option|input|button)$)
5
+ /^(div|section|header|h[1-6]|nav|ul|li|a|img|b|em|s|small|span|strong|sub|sup|form|label|select|option|input|button)$/
6
6
  end
7
7
 
8
8
  def initialize template, tag: "ul", attributes: {}, activator: Navigator::TagActivator.new, &block
@@ -15,14 +15,12 @@ module Navigator
15
15
 
16
16
  def add name, content = nil, attributes: {}, activator: menu_activator, &block
17
17
  tag = Navigator::Tag.new name, content, attributes: attributes, activator: activator
18
- if block_given?
19
- items << tag.prefix
20
- items << tag.content
21
- instance_eval(&block)
22
- items << tag.suffix
23
- else
24
- items << tag.render
25
- end
18
+ return items << tag.render unless block_given?
19
+
20
+ items << tag.prefix
21
+ items << tag.content
22
+ instance_eval(&block)
23
+ items << tag.suffix
26
24
  end
27
25
 
28
26
  def link content = nil, url, attributes: {}, activator: menu_activator, &block
@@ -58,7 +56,7 @@ module Navigator
58
56
  end
59
57
 
60
58
  def render
61
- [tag.prefix, tag.content, items.compact.join(''), tag.suffix].compact * ''
59
+ [tag.prefix, tag.content, items.compact.join(""), tag.suffix].compact * ""
62
60
  end
63
61
 
64
62
  private
@@ -71,7 +69,7 @@ module Navigator
71
69
 
72
70
  def activate_item_attributes! attributes, url, activator
73
71
  return unless url == activator.search_value
74
- attributes[activator.target_key] = [attributes[activator.target_key], activator.target_value].compact * ' '
72
+ attributes[activator.target_key] = [attributes[activator.target_key], activator.target_value].compact * " "
75
73
  end
76
74
  end
77
75
  end
@@ -15,7 +15,7 @@ module Navigator
15
15
  end
16
16
 
17
17
  def prefix
18
- ["<#{name}", format_attributes, '>'].compact * ''
18
+ ["<#{name}", format_attributes, ">"].compact * ""
19
19
  end
20
20
 
21
21
  def computed_content
@@ -27,7 +27,7 @@ module Navigator
27
27
  end
28
28
 
29
29
  def render
30
- [prefix, computed_content, suffix].compact * ''
30
+ [prefix, computed_content, suffix].compact * ""
31
31
  end
32
32
 
33
33
  private
@@ -35,13 +35,12 @@ module Navigator
35
35
  attr_reader :attributes, :activator
36
36
 
37
37
  def expand_data_attributes! attrs
38
- if attrs.key? :data
39
- attrs.delete(:data).each { |key, value| attrs["data-#{key}"] = value }
40
- end
38
+ return unless attrs.key? :data
39
+ attrs.delete(:data).each { |key, value| attrs["data-#{key}"] = value }
41
40
  end
42
41
 
43
42
  def concatenate_attributes attrs
44
- activator.activate(attrs).map { |key, value| %(#{key}="#{value}") } * ' '
43
+ activator.activate(attrs).map { |key, value| %(#{key}="#{value}") } * " "
45
44
  end
46
45
 
47
46
  def format_attributes
@@ -25,7 +25,7 @@ module Navigator
25
25
 
26
26
  def activate attributes = {}
27
27
  attributes = attributes.with_indifferent_access
28
- attributes[target_key] = [attributes[target_key], target_value].compact.join(' ') if activatable? attributes
28
+ attributes[target_key] = [attributes[target_key], target_value].compact.join(" ") if activatable? attributes
29
29
  attributes
30
30
  end
31
31
  end
@@ -0,0 +1,6 @@
1
+ begin
2
+ require "rspec/core/rake_task"
3
+ RSpec::Core::RakeTask.new(:spec)
4
+ rescue LoadError => error
5
+ puts error.message
6
+ end
@@ -0,0 +1,6 @@
1
+ begin
2
+ require "rubocop/rake_task"
3
+ RuboCop::RakeTask.new
4
+ rescue LoadError => error
5
+ puts error.message
6
+ end
metadata CHANGED
@@ -1,36 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: navigator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZicm9v
14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Pit3hLH6JFK
30
- aSif+qBc6oHD7EQWPF5cZkzkIURuwNwPBngZGxIKaMAgRhjGFXzUMAaq++r59cS9
31
- xTfQ4k6fglKEgpnLAXiKdo2c8Ym+X4rIKFfedQ==
32
- -----END CERTIFICATE-----
33
- date: 2015-07-05 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2015-12-02 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: rails
@@ -60,6 +38,20 @@ dependencies:
60
38
  - - "~>"
61
39
  - !ruby/object:Gem::Version
62
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: gemsmith
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
63
55
  - !ruby/object:Gem::Dependency
64
56
  name: pry
65
57
  requirement: !ruby/object:Gem::Requirement
@@ -89,7 +81,7 @@ dependencies:
89
81
  - !ruby/object:Gem::Version
90
82
  version: '0'
91
83
  - !ruby/object:Gem::Dependency
92
- name: pry-stack_explorer
84
+ name: pry-remote
93
85
  requirement: !ruby/object:Gem::Requirement
94
86
  requirements:
95
87
  - - ">="
@@ -103,7 +95,7 @@ dependencies:
103
95
  - !ruby/object:Gem::Version
104
96
  version: '0'
105
97
  - !ruby/object:Gem::Dependency
106
- name: pry-remote
98
+ name: pry-state
107
99
  requirement: !ruby/object:Gem::Requirement
108
100
  requirements:
109
101
  - - ">="
@@ -130,6 +122,20 @@ dependencies:
130
122
  - - ">="
131
123
  - !ruby/object:Gem::Version
132
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-stack_explorer
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
133
139
  - !ruby/object:Gem::Dependency
134
140
  name: rspec-rails
135
141
  requirement: !ruby/object:Gem::Requirement
@@ -214,6 +220,20 @@ dependencies:
214
220
  - - ">="
215
221
  - !ruby/object:Gem::Version
216
222
  version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: rubocop
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
217
237
  - !ruby/object:Gem::Dependency
218
238
  name: codeclimate-test-reporter
219
239
  requirement: !ruby/object:Gem::Requirement
@@ -228,8 +248,7 @@ dependencies:
228
248
  - - ">="
229
249
  - !ruby/object:Gem::Version
230
250
  version: '0'
231
- description: Enhances Rails with a DSL for menu navigation complete with sub-menus,
232
- nested tags, HTML attributes, etc.
251
+ description: Enhances Rails with a DSL for menu navigation.
233
252
  email:
234
253
  - brooke@alchemists.io
235
254
  executables: []
@@ -247,6 +266,8 @@ files:
247
266
  - lib/navigator/menu.rb
248
267
  - lib/navigator/tag.rb
249
268
  - lib/navigator/tag_activator.rb
269
+ - lib/tasks/rspec.rake
270
+ - lib/tasks/rubocop.rake
250
271
  homepage: https://github.com/bkuhlmann/navigator
251
272
  licenses:
252
273
  - MIT
@@ -267,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
288
  version: '0'
268
289
  requirements: []
269
290
  rubyforge_project:
270
- rubygems_version: 2.4.8
291
+ rubygems_version: 2.5.0
271
292
  signing_key:
272
293
  specification_version: 4
273
294
  summary: Enhances Rails with a DSL for menu navigation.
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file