jasmine 3.0.0 → 3.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: c18046172c97ada9097c6529f12e5f221e633f67
4
- data.tar.gz: 1927874c49d3ecfcdec802f008852e972f2196d4
3
+ metadata.gz: 4ee18d86d8b3bb06460519fe027eb50064fcac2d
4
+ data.tar.gz: 98da9a88d5ee9e93a6703797a57ebee17825efa2
5
5
  SHA512:
6
- metadata.gz: 2e2e1330b623fb13f52b1244147e238a05992b6df30924672c159de4ab7680b32f64de3d8d515714b40ecb54fa985a2d1dea5ab52ff5f2a01e331fd021ab1261
7
- data.tar.gz: a02891ef5cfcdd7f06d287dcc85fa33b480aa0fb864cb67f6e4e46da03a5999937c9dbf70118d05f76585e12c56e09f1fc5dc0e790e51047ae024f7d42b009ff
6
+ metadata.gz: 8d9ae229a737da548b810cd2ac167e3678c10c5569551fc346817e9c143826a6eb4dbd98e161a4f757eaa5d7a8d11ec41d0436cc9160693f9db87c5cfab45442
7
+ data.tar.gz: 89ad800ae3f1752f93f1df68311715ff1e2429e17ea0f5fa9a3114b23f3d002b9c32fbbb7aa0fb20614ce37348ffb0acc033719d7b4b48b256380be85d33d72d
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ gem 'anchorman', :platform => :mri
6
6
 
7
7
  # during development, do not release
8
8
  if ENV['TRAVIS']
9
- gem 'jasmine-core', :git => 'http://github.com/jasmine/jasmine.git', :branch => '3.0-features'
9
+ gem 'jasmine-core', :git => 'http://github.com/jasmine/jasmine.git'
10
10
  else
11
11
  gem 'jasmine-core', :path => '../jasmine'
12
12
  end
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
35
35
  s.add_development_dependency 'rspec', '>= 2.5.0'
36
36
  s.add_development_dependency 'nokogiri'
37
37
 
38
- s.add_dependency 'jasmine-core', '3.0.0'
38
+ s.add_dependency 'jasmine-core', '3.1.0'
39
39
  s.add_dependency 'rack', '>= 1.2.1'
40
40
  s.add_dependency 'rake'
41
41
  s.add_dependency 'phantomjs'
@@ -1,10 +1,10 @@
1
1
  module Jasmine
2
2
  class AssetExpander
3
3
  def expand(src_dir, src_path)
4
- pathname = src_path.gsub(/^\/?assets\//, '').gsub(/\.js$/, '')
4
+ pathname = src_path.gsub(/^\/?assets\//, '')
5
5
 
6
6
  asset_bundle.assets(pathname).flat_map { |asset|
7
- "/#{asset.gsub(/^\//, '')}?body=true"
7
+ "/#{asset.gsub(/^\//, '')}"
8
8
  }
9
9
  end
10
10
 
@@ -14,12 +14,16 @@ module Jasmine
14
14
 
15
15
  def asset_bundle
16
16
  return Rails4Or5AssetBundle.new if Jasmine::Dependencies.rails4? || Jasmine::Dependencies.rails5?
17
- raise UnsupportedRailsVersion, "Jasmine only supports the asset pipeline for Rails 4 - 5"
17
+ raise UnsupportedRailsVersion, "Jasmine only supports the asset pipeline for Rails 4. - 5"
18
18
  end
19
19
 
20
20
  class Rails4Or5AssetBundle
21
21
  def assets(pathname)
22
- context.get_original_assets(pathname)
22
+ if pathname =~ /\.css$/
23
+ context.get_stylesheet_assets(pathname.gsub(/\.css$/, ''))
24
+ else
25
+ context.get_javascript_assets(pathname.gsub(/\.js$/, ''))
26
+ end
23
27
  end
24
28
 
25
29
  private
@@ -29,14 +33,31 @@ module Jasmine
29
33
  end
30
34
 
31
35
  module GetOriginalAssetsHelper
32
- def get_original_assets(pathname)
33
- Array(assets_environment.find_asset(pathname)).map do |processed_asset|
34
- case processed_asset.content_type
35
- when "text/css"
36
- path_to_stylesheet(processed_asset.logical_path, debug: true)
37
- when "application/javascript"
38
- path_to_javascript(processed_asset.logical_path, debug: true)
36
+ def get_javascript_assets(pathname)
37
+ if asset = lookup_debug_asset(pathname, type: :javascript)
38
+ if asset.respond_to?(:to_a)
39
+ asset.to_a.map do |a|
40
+ path_to_javascript(a.logical_path, debug: true)
41
+ end
42
+ else
43
+ Array(path_to_javascript(asset.logical_path, debug: true))
44
+ end
45
+ else
46
+ []
47
+ end
48
+ end
49
+
50
+ def get_stylesheet_assets(pathname)
51
+ if asset = lookup_debug_asset(pathname, type: :stylesheet)
52
+ if asset.respond_to?(:to_a)
53
+ asset.to_a.map do |a|
54
+ path_to_stylesheet(a.logical_path, debug: true)
55
+ end
56
+ else
57
+ Array(path_to_stylesheet(asset.logical_path, debug: true))
39
58
  end
59
+ else
60
+ []
40
61
  end
41
62
  end
42
63
  end
@@ -1,3 +1,3 @@
1
1
  module Jasmine
2
- VERSION = "3.0.0"
2
+ VERSION = "3.1.0"
3
3
  end
@@ -0,0 +1,18 @@
1
+ # Jasmine Gem 3.1 Release Notes
2
+
3
+ ## Summary
4
+
5
+ This release updates the jasmine-core dependency to 3.1.0. See the
6
+ [jasmine-core release notes](https://github.com/jasmine/jasmine/blob/master/release_notes/3.1.0.md)
7
+ for more information
8
+
9
+ ## Changes
10
+
11
+ * Add support for sprockets 4 and source maps
12
+ - Merges [#296](https://github.com/jasmine/jasmine-gem/issues/296) from @mgodwin
13
+ - Fixes [#295](https://github.com/jasmine/jasmine-gem/issues/295)
14
+
15
+
16
+ ------
17
+
18
+ _Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
@@ -26,7 +26,7 @@ if rails_available?
26
26
 
27
27
  open('Gemfile', 'a') { |f|
28
28
  f.puts "gem 'jasmine', :path => '#{base}'"
29
- f.puts "gem 'jasmine-core', :git => 'http://github.com/jasmine/jasmine.git', :branch => '3.0-features'"
29
+ f.puts "gem 'jasmine-core', :git => 'http://github.com/jasmine/jasmine.git'"
30
30
  if RUBY_PLATFORM != 'java' && ENV['RAILS_VERSION'] != 'rails5'
31
31
  f.puts "gem 'thin'"
32
32
  end
@@ -124,11 +124,11 @@ if rails_available?
124
124
 
125
125
  run_jasmine_server("JASMINE_CONFIG_PATH=#{css_yaml}") do
126
126
  output = Net::HTTP.get(URI.parse('http://localhost:8888/'))
127
- expect(output).to match(%r{script src.*/assets/jasmine_examples/Player\.js})
127
+ expect(output).to match(%r{script src.*/assets/jasmine_examples/Player(\.self-[^\.]+)?\.js})
128
128
  expect(output).to match(%r{script src=['"]http://ajax\.googleapis\.com/ajax/libs/jquery/1\.11\.0/jquery\.min\.js})
129
- expect(output).to match(%r{script src.*/assets/jasmine_examples/Song\.js})
129
+ expect(output).to match(%r{script src.*/assets/jasmine_examples/Song(\.self-[^\.]+)?\.js})
130
130
  expect(output).to match(%r{script src.*angular_helper\.js})
131
- expect(output).to match(%r{<link rel=.stylesheet.*?href=./assets/foo\.css\?.*?>})
131
+ expect(output).to match(%r{<link rel=.stylesheet.*?href=./assets/foo(\.self-[^\.]+)?\.css\?.*?>})
132
132
 
133
133
  output = Net::HTTP.get(URI.parse('http://localhost:8888/__spec__/helpers/angular_helper.js'))
134
134
  expect(output).to match(/angular\.mock/)
@@ -181,6 +181,53 @@ if rails_available?
181
181
  end
182
182
  end
183
183
 
184
+ describe 'using sprockets 4' do
185
+ before :all do
186
+ FileUtils.cp('Gemfile', 'Gemfile-old')
187
+ FileUtils.rm 'Gemfile.lock'
188
+
189
+ open('Gemfile', 'a') { |f|
190
+ f.puts "gem 'sprockets', '~> 4.0.0.beta6'"
191
+ f.flush
192
+ }
193
+ Bundler.with_clean_env do
194
+ bundle_install
195
+ end
196
+
197
+ FileUtils.mkdir_p('app/assets/config')
198
+
199
+ open('app/assets/config/manifest.js', 'w') { |f|
200
+ f.puts "//= link application.js"
201
+ f.puts "//= link application.css"
202
+ f.flush
203
+ }
204
+ end
205
+
206
+ after :all do
207
+ FileUtils.mv 'Gemfile-old', 'Gemfile'
208
+ FileUtils.rm 'Gemfile.lock'
209
+ FileUtils.rm 'app/assets/config/manifest.js'
210
+ Bundler.with_clean_env do
211
+ bundle_install
212
+ end
213
+ end
214
+
215
+ it "serves source mapped assets" do
216
+ run_jasmine_server do
217
+ output = Net::HTTP.get(URI.parse('http://localhost:8888/'))
218
+
219
+ js_match = output.match %r{script src.*/(assets/application.debug-[^\.]+\.js)}
220
+
221
+ expect(js_match).to_not be_nil
222
+ expect(output).to match(%r{<link rel=.stylesheet.*?href=.*/assets/application.debug-[^\.]+\.css})
223
+
224
+ js_path = js_match[1]
225
+ output = Net::HTTP.get(URI.parse("http://localhost:8888/#{js_path}"))
226
+ expect(output).to match(%r{//# sourceMappingURL=.*\.map})
227
+ end
228
+ end
229
+ end
230
+
184
231
  def run_jasmine_server(options = "")
185
232
  Bundler.with_clean_env do
186
233
  begin
@@ -196,6 +243,7 @@ if rails_available?
196
243
  puts "someone else is running a server on port 8888"
197
244
  expect($?).to be_success
198
245
  end
246
+ yield
199
247
  ensure
200
248
  Process.kill(:SIGINT, pid)
201
249
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Van Hove
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-06 00:00:00.000000000 Z
11
+ date: 2018-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 3.0.0
89
+ version: 3.1.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 3.0.0
96
+ version: 3.1.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rack
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -201,6 +201,7 @@ files:
201
201
  - lib/rack/jasmine/focused_suite.rb
202
202
  - lib/rack/jasmine/runner.rb
203
203
  - release_notes/3.0.md
204
+ - release_notes/3.1.0.md
204
205
  - release_notes/v1.2.1.md
205
206
  - release_notes/v1.3.2.md
206
207
  - release_notes/v2.0.0.md