bootstrap-navbar 1.0.1 → 1.0.2
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 +4 -4
- data/bootstrap-navbar.gemspec +1 -0
- data/lib/bootstrap-navbar.rb +2 -3
- data/lib/bootstrap-navbar/helpers.rb +9 -1
- data/lib/bootstrap-navbar/version.rb +1 -1
- data/spec/bootstrap-navbar/helpers_spec.rb +55 -0
- data/spec/spec_helper.rb +3 -2
- data/spec/{helpers.rb → support/helpers.rb} +0 -0
- metadata +20 -5
- data/lib/bootstrap-navbar/railtie.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4fc1d1d81a16651072e930c183d430d1eb262e7
|
4
|
+
data.tar.gz: 7257a1c996bc8c11274f73893dcfbad43e4c0b24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d84f575dcaf1bc3a9929bffd6a82951b0737aaf91b71ee23ee664d4f46431d00e1bc52f1eb5bf0f995602c9fd591f764ceaa8a4d4846125dd0652d4696d8828
|
7
|
+
data.tar.gz: f36eead4d4ed5cd0d320eaf0c73f501ad126035682c502de6a55c548a2504a3503a89bcf3d811db8e1b39a7d8cf9502c534c64822eff77415475b96f4165a456
|
data/bootstrap-navbar.gemspec
CHANGED
@@ -28,5 +28,6 @@ Gem::Specification.new do |gem|
|
|
28
28
|
gem.add_development_dependency 'padrino-helpers', '~> 0.11.2'
|
29
29
|
# Listen >= 2.0.0 only works with Ruby >= 1.9.3
|
30
30
|
gem.add_development_dependency 'listen', '< 2.0.0' if RUBY_VERSION < '1.9.3'
|
31
|
+
gem.add_development_dependency 'bootstrap-sass', '3.0.2.0'
|
31
32
|
gem.add_runtime_dependency 'gem_config', '~> 0.2.4'
|
32
33
|
end
|
data/lib/bootstrap-navbar.rb
CHANGED
@@ -3,10 +3,10 @@ require 'gem_config'
|
|
3
3
|
module BootstrapNavbar
|
4
4
|
include GemConfig::Base
|
5
5
|
|
6
|
-
BOOTSTRAP_VERSIONS = %w(3.0.2 3.0.1 3.0.0 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0)
|
6
|
+
BOOTSTRAP_VERSIONS = %w(3.0.3 3.0.2 3.0.1 3.0.0 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0)
|
7
7
|
|
8
8
|
with_configuration do
|
9
|
-
has :bootstrap_version, classes: String, values: BOOTSTRAP_VERSIONS
|
9
|
+
has :bootstrap_version, classes: [String, NilClass], values: BOOTSTRAP_VERSIONS.unshift(nil)
|
10
10
|
has :current_url_method, classes: String
|
11
11
|
end
|
12
12
|
end
|
@@ -15,4 +15,3 @@ require_relative 'bootstrap-navbar/version'
|
|
15
15
|
require_relative 'bootstrap-navbar/helpers'
|
16
16
|
require_relative 'bootstrap-navbar/helpers/bootstrap2'
|
17
17
|
require_relative 'bootstrap-navbar/helpers/bootstrap3'
|
18
|
-
require_relative 'bootstrap-navbar/railtie' if defined?(Rails)
|
@@ -1,6 +1,14 @@
|
|
1
1
|
module BootstrapNavbar::Helpers
|
2
2
|
def self.included(base)
|
3
|
-
|
3
|
+
if BootstrapNavbar.configuration.bootstrap_version.nil?
|
4
|
+
if Gem.loaded_specs.keys.include?('bootstrap-sass')
|
5
|
+
bootstrap_sass_version = Gem.loaded_specs['bootstrap-sass'].version
|
6
|
+
bootstrap_version = bootstrap_sass_version.segments.take(3).join('.')
|
7
|
+
BootstrapNavbar.configuration.bootstrap_version = bootstrap_version
|
8
|
+
else
|
9
|
+
raise 'Bootstrap version is not configured.'
|
10
|
+
end
|
11
|
+
end
|
4
12
|
helper_version = BootstrapNavbar.configuration.bootstrap_version[0]
|
5
13
|
base.send :include, const_get("Bootstrap#{helper_version}")
|
6
14
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BootstrapNavbar::Helpers do
|
4
|
+
describe 'including' do
|
5
|
+
context 'when Bootstrap version is set' do
|
6
|
+
before do
|
7
|
+
BootstrapNavbar.configuration.bootstrap_version = '3.0.2'
|
8
|
+
end
|
9
|
+
|
10
|
+
it "doesn't raise an exception" do
|
11
|
+
expect do
|
12
|
+
Class.new do
|
13
|
+
include BootstrapNavbar::Helpers
|
14
|
+
end
|
15
|
+
end.to_not raise_exception
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when Bootstrap version is not set' do
|
20
|
+
before do
|
21
|
+
BootstrapNavbar.configuration.bootstrap_version = nil
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when bootstrap-sass gem is not loaded' do
|
25
|
+
before do
|
26
|
+
# Remove bootstrap-sass from loaded specs
|
27
|
+
loaded_specs = Gem.loaded_specs.dup
|
28
|
+
loaded_specs.delete('bootstrap-sass')
|
29
|
+
Gem.stub(:loaded_specs).and_return(loaded_specs)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'raises an exception' do
|
33
|
+
expect(Gem.loaded_specs.keys).to_not include('bootstrap-sass')
|
34
|
+
expect do
|
35
|
+
Class.new do
|
36
|
+
include BootstrapNavbar::Helpers
|
37
|
+
end
|
38
|
+
end.to raise_exception('Bootstrap version is not configured.')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'when bootstrap-sass gem is loaded' do
|
43
|
+
it 'sniffs the Bootstrap version from bootstrap-sass' do
|
44
|
+
expect(Gem.loaded_specs.keys).to include('bootstrap-sass')
|
45
|
+
expect do
|
46
|
+
Class.new do
|
47
|
+
include BootstrapNavbar::Helpers
|
48
|
+
end
|
49
|
+
end.to_not raise_exception
|
50
|
+
expect(BootstrapNavbar.configuration.bootstrap_version).to eq('3.0.2')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'bootstrap-navbar'
|
2
2
|
require 'rspec-html-matchers'
|
3
|
-
|
3
|
+
|
4
|
+
Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f }
|
4
5
|
|
5
6
|
RSpec.configure do |config|
|
6
7
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
7
8
|
config.run_all_when_everything_filtered = true
|
8
9
|
config.filter_run :focus
|
9
10
|
config.order = 'random'
|
10
|
-
config.include Helpers
|
11
|
+
config.include ::Helpers
|
11
12
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-navbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Meurer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.11.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bootstrap-sass
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.0.2.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.0.2.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: gem_config
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,12 +125,12 @@ files:
|
|
111
125
|
- lib/bootstrap-navbar/helpers.rb
|
112
126
|
- lib/bootstrap-navbar/helpers/bootstrap2.rb
|
113
127
|
- lib/bootstrap-navbar/helpers/bootstrap3.rb
|
114
|
-
- lib/bootstrap-navbar/railtie.rb
|
115
128
|
- lib/bootstrap-navbar/version.rb
|
116
129
|
- spec/bootstrap-navbar/helpers/bootstrap2_spec.rb
|
117
130
|
- spec/bootstrap-navbar/helpers/bootstrap3_spec.rb
|
118
|
-
- spec/
|
131
|
+
- spec/bootstrap-navbar/helpers_spec.rb
|
119
132
|
- spec/spec_helper.rb
|
133
|
+
- spec/support/helpers.rb
|
120
134
|
homepage: https://github.com/krautcomputing/bootstrap-navbar
|
121
135
|
licenses:
|
122
136
|
- MIT
|
@@ -144,6 +158,7 @@ summary: Helpers to generate a Twitter Bootstrap style navbar
|
|
144
158
|
test_files:
|
145
159
|
- spec/bootstrap-navbar/helpers/bootstrap2_spec.rb
|
146
160
|
- spec/bootstrap-navbar/helpers/bootstrap3_spec.rb
|
147
|
-
- spec/
|
161
|
+
- spec/bootstrap-navbar/helpers_spec.rb
|
148
162
|
- spec/spec_helper.rb
|
163
|
+
- spec/support/helpers.rb
|
149
164
|
has_rdoc:
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'bootstrap-navbar'
|
2
|
-
|
3
|
-
module BootstrapNavbar
|
4
|
-
class Railtie < Rails::Railtie
|
5
|
-
config.after_initialize do
|
6
|
-
# If Bootstrap version isn't set yet and the gem bootstrap-sass is loaded, sniff the Bootstrap version from it
|
7
|
-
if BootstrapNavbar.configuration.bootstrap_version.nil? && Gem.loaded_specs.keys.include?('bootstrap-sass')
|
8
|
-
bootstrap_sass_version = Gem.loaded_specs['bootstrap-sass'].version
|
9
|
-
bootstrap_version = bootstrap_sass_version.segments.take(3).join('.')
|
10
|
-
BootstrapNavbar.configure do |config|
|
11
|
-
config.bootstrap_version = bootstrap_version
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|