cdn_tags 0.3.1 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6295746e2100de02393b968bfbaec0d5d4e4e93
4
- data.tar.gz: ca61f272f61afb358e276765d7dd36d727bdadc7
3
+ metadata.gz: b08d1bf4fdac615d3bf56d4d708f7e885451fcf1
4
+ data.tar.gz: e074ba62a0343638ef4fea402c8aa62177333a53
5
5
  SHA512:
6
- metadata.gz: 9261210eb9243fcc32251dd17c6b3b70e2a42a221b7dc5cd935d8e9f7641a06c4da9f8c2d3a6fe275e9a698933a2de7373bd17fff6612482c29b872987945fe0
7
- data.tar.gz: 8e1a96c244311684d952dbf6a8b5ea861dec7c12986c697fa4fe6a9702df843c39972c43aae9d020c07ee55e24d0f575d5e0e1504f764aae5bc5c6619715ae06
6
+ metadata.gz: a981efba3956b43b400daddd93a7fe10e104ceea6e3eedbba61ae14e1b06efb6fc1307e7ebfd8b0b632a4bfab9db3ca31b56b77879b72d48b606ca78f77e96bb
7
+ data.tar.gz: f652f86948afcad7c90e63f5cbeba33d19a0e63dc6a73a5f9071bac916e6ffc40d1f8f6228d7d9ec831b3243067a1e895d746967c2beb9927bdf93f7c429e717
data/README.md CHANGED
@@ -59,7 +59,7 @@ becomes
59
59
  <%= stylesheet_cdn_link_tag '/path/to/bootstrap' %>
60
60
  ```
61
61
 
62
- This will result in the following output.
62
+ This will result in the following HTML output.
63
63
 
64
64
  * In development and test environments:
65
65
 
data/Rakefile CHANGED
@@ -10,23 +10,14 @@ RDoc::Task.new(:rdoc) do |rdoc|
10
10
  rdoc.rdoc_dir = 'rdoc'
11
11
  rdoc.title = 'CdnTags'
12
12
  rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
13
+ rdoc.rdoc_files.include('README.md')
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
-
18
-
19
-
20
17
  Bundler::GemHelper.install_tasks
21
18
 
22
- require 'rake/testtask'
23
-
24
- Rake::TestTask.new(:test) do |t|
25
- t.libs << 'lib'
26
- t.libs << 'test'
27
- t.pattern = 'test/**/*_test.rb'
28
- t.verbose = false
29
- end
19
+ require 'rspec/core/rake_task'
30
20
 
21
+ RSpec::Core::RakeTask.new(:spec)
31
22
 
32
- task default: :test
23
+ task :default => :spec
@@ -1,3 +1,3 @@
1
1
  module CdnTags
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cdn_tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Perez
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.7'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rails
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -69,8 +83,6 @@ files:
69
83
  - lib/cdn_tags/version.rb
70
84
  - lib/generators/cdn_tags/install/install_generator.rb
71
85
  - lib/generators/cdn_tags/install/templates/cdn_tags.rb
72
- - specs/cdn_tags_spec.rb
73
- - specs/spec_helper.rb
74
86
  homepage: https://github.com/claude-tech/cdn-tags-rails
75
87
  licenses:
76
88
  - MIT
@@ -95,7 +107,5 @@ rubygems_version: 2.2.0
95
107
  signing_key:
96
108
  specification_version: 4
97
109
  summary: Helpers to use CDN scripts in Rails production.
98
- test_files:
99
- - specs/cdn_tags_spec.rb
100
- - specs/spec_helper.rb
110
+ test_files: []
101
111
  has_rdoc:
@@ -1,118 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
- require 'cdn_tags'
3
-
4
- def script_src(html)
5
- doc = Nokogiri::HTML(html)
6
- doc.xpath('//script')[0].attr('src')
7
- end
8
-
9
- def link_href(html)
10
- doc = Nokogiri::HTML(html)
11
- doc.xpath('//link')[0].attr('href')
12
- end
13
-
14
- describe CdnTags do
15
- describe CdnTags::Configuration do
16
- it 'should have default values' do
17
- expect(CdnTags.configuration.stylesheets_urls).to eq({})
18
- expect(CdnTags.configuration.scripts_urls).to eq({})
19
- end
20
-
21
- it 'should bet settable' do
22
- CdnTags.configure do |c|
23
- c.scripts_urls["foo"] = "bar"
24
- end
25
- expect(CdnTags.configuration.scripts_urls["foo"]).to eq("bar")
26
- end
27
-
28
- it 'should update Rails assets precompile' do
29
- expect(Rails.application.config.assets.precompile).not_to include('jquery-1.9.1.js')
30
- expect(Rails.application.config.assets.precompile).not_to include('bootstrap.css')
31
- CdnTags.configure do |c|
32
- c.scripts_urls["jquery-1.9.1"] = "foobar"
33
- c.stylesheets_urls["bootstrap"] = "foobar"
34
- end
35
- expect(Rails.application.config.assets.precompile).to include('jquery-1.9.1.js')
36
- expect(Rails.application.config.assets.precompile).to include('bootstrap.css')
37
- end
38
-
39
- it 'should not update Rails assets precompile if disabled' do
40
- expect(Rails.application.config.assets.precompile).not_to include('angular.js')
41
- CdnTags.configure do |c|
42
- c.scripts_urls["angular"] = "foobar"
43
- c.add_to_precompile = false
44
- end
45
- expect(Rails.application.config.assets.precompile).not_to include('angular.js')
46
- end
47
- end
48
-
49
- describe CdnTags::Helpers do
50
- view = ActionView::Base.new
51
- subject { view }
52
-
53
- before(:each) do
54
- CdnTags.configure do |c|
55
- c.scripts_urls = {
56
- 'jquery' => '//code.jquery.com/jquery-2.1.1.min.js',
57
- }
58
- c.stylesheets_urls = {
59
- 'bootstrap' => '//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'
60
- }
61
- c.raise_on_missing = false
62
- end
63
- end
64
-
65
- tests = [
66
- {
67
- method: 'javascript_cdn_include_tag',
68
- path_helper: 'javascript_path',
69
- extracter: 'script_src',
70
- asset: 'jquery',
71
- config_key: 'scripts_urls'
72
- },
73
- {
74
- method: 'stylesheet_cdn_link_tag',
75
- path_helper: 'stylesheet_path',
76
- extracter: 'link_href',
77
- asset: 'bootstrap',
78
- config_key: 'stylesheets_urls'
79
- }
80
- ]
81
-
82
- tests.each do |t|
83
- it { should respond_to(t[:method]) }
84
-
85
- describe "##{t[:method]}" do
86
- it 'should not replace sources in development and test envs' do
87
- CdnTags.configuration.environment = "development"
88
- tag = view.send(t[:method], "foo")
89
- expected = view.send(t[:path_helper], "foo")
90
- expect(send(t[:extracter], tag)).to eq(expected)
91
- end
92
-
93
- it 'should replace sources in production' do
94
- CdnTags.configuration.environment = "production"
95
- tag = view.send(t[:method], t[:asset])
96
- urls = CdnTags.configuration.send(t[:config_key])
97
- expected = urls[t[:asset]]
98
- expect(send(t[:extracter], tag)).to eq(expected)
99
- end
100
-
101
- it 'should ignore unconfigured sources' do
102
- CdnTags.configuration.environment = "production"
103
- tag = view.send(t[:method], "foo")
104
- expected = view.send(t[:path_helper], "foo")
105
- expect(send(t[:extracter], tag)).to eq(expected)
106
- end
107
-
108
- it 'should raise error when configured' do
109
- CdnTags.configure do |c|
110
- c.raise_on_missing = true
111
- end
112
- CdnTags.configuration.environment = "production"
113
- expect { view.send(t[:method], "foo") }.to raise_error(CdnTags::Error)
114
- end
115
- end
116
- end
117
- end
118
- end
@@ -1,15 +0,0 @@
1
- require 'action_view'
2
- require 'nokogiri'
3
- require 'rails'
4
-
5
- RSpec.configure do |config|
6
- config.color = true
7
- config.formatter = 'documentation'
8
- end
9
-
10
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
11
-
12
- class DummyApp < Rails::Application
13
- end
14
-
15
- Rails.application = DummyApp.new