jasmine-headless-webkit 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,26 +10,34 @@ module Jasmine::Headless
10
10
  include FileChecker
11
11
 
12
12
  class << self
13
- def vendor_asset_paths
14
- return @vendor_asset_paths if @vendor_asset_paths
13
+ def asset_paths
14
+ return @asset_paths if @asset_paths
15
15
 
16
16
  require 'rubygems'
17
17
 
18
18
  raise StandardError.new("A newer version of Rubygems is required to use vendored assets. Please upgrade.") if !Gem::Specification.respond_to?(:each)
19
19
 
20
- @vendor_asset_paths = []
20
+ @asset_paths = []
21
21
 
22
- Gem::Specification.each do |spec|
23
- path = File.join(spec.gem_dir, 'vendor/assets/javascripts')
22
+ Gem::Specification.each { |gemspec| @asset_paths += get_paths_from_gemspec(gemspec) }
24
23
 
25
- @vendor_asset_paths << path if File.directory?(path) && !@vendor_asset_paths.include?(path)
26
- end
24
+ @asset_paths
25
+ end
27
26
 
28
- @vendor_asset_paths
27
+ def get_paths_from_gemspec(gemspec)
28
+ %w{vendor lib app}.collect do |dir|
29
+ path = File.join(gemspec.gem_dir, dir, "assets/javascripts")
30
+
31
+ if File.directory?(path) && !@asset_paths.include?(path)
32
+ path
33
+ else
34
+ nil
35
+ end
36
+ end.compact
29
37
  end
30
38
 
31
39
  def reset!
32
- @vendor_asset_paths = nil
40
+ @asset_paths = nil
33
41
 
34
42
  # register haml-sprockets if it's available...
35
43
  %w{haml-sprockets}.each do |library|
@@ -104,7 +112,7 @@ module Jasmine::Headless
104
112
  return @search_paths if @search_paths
105
113
 
106
114
  @search_paths = [ Jasmine::Core.path, Jasmine::Headless.root.join('vendor/assets/javascripts').to_s ]
107
- @search_paths += self.class.vendor_asset_paths
115
+ @search_paths += self.class.asset_paths
108
116
  @search_paths += src_dir.collect { |dir| File.expand_path(dir) }
109
117
  @search_paths += asset_paths.collect { |dir| File.expand_path(dir) }
110
118
  @search_paths += spec_dir.collect { |dir| File.expand_path(dir) }
@@ -1,5 +1,5 @@
1
1
  module Jasmine
2
2
  module Headless
3
- VERSION = "0.8.3"
3
+ VERSION = "0.8.4"
4
4
  end
5
5
  end
@@ -49,6 +49,29 @@ describe Jasmine::Headless::FilesList do
49
49
  end
50
50
  end
51
51
 
52
+ describe '.get_paths_from_gemspec' do
53
+ include FakeFS::SpecHelpers
54
+
55
+ let(:gem_dir) { "dir" }
56
+ let(:gemspec) { stub(:gem_dir => gem_dir) }
57
+
58
+ let(:paths) do
59
+ %w{vendor lib app}.collect do |dir|
60
+ File.join(gem_dir, dir, 'assets/javascripts')
61
+ end
62
+ end
63
+
64
+ before do
65
+ paths.each { |path| FileUtils.mkdir_p path }
66
+
67
+ described_class.instance_variable_set(:@asset_paths, [])
68
+ end
69
+
70
+ subject { described_class.get_paths_from_gemspec(gemspec) }
71
+
72
+ it { should =~ paths }
73
+ end
74
+
52
75
  describe '#search_paths' do
53
76
  no_default_files!
54
77
 
@@ -66,7 +89,7 @@ describe Jasmine::Headless::FilesList do
66
89
  let(:path) { 'path' }
67
90
 
68
91
  before do
69
- Jasmine::Headless::FilesList.stubs(:vendor_asset_paths).returns([])
92
+ Jasmine::Headless::FilesList.stubs(:asset_paths).returns([])
70
93
  end
71
94
 
72
95
  let(:vendor_path) { Jasmine::Headless.root.join('vendor/assets/javascripts').to_s }
@@ -79,7 +102,7 @@ describe Jasmine::Headless::FilesList do
79
102
 
80
103
  context 'vendored gem paths' do
81
104
  before do
82
- Jasmine::Headless::FilesList.stubs(:vendor_asset_paths).returns([ path ])
105
+ Jasmine::Headless::FilesList.stubs(:asset_paths).returns([ path ])
83
106
  end
84
107
 
85
108
  it 'should add the vendor gem paths to the list' do
@@ -110,7 +133,7 @@ describe Jasmine::Headless::FilesList do
110
133
  end
111
134
  end
112
135
 
113
- describe '.vendor_asset_paths' do
136
+ describe '.asset_paths' do
114
137
  include FakeFS::SpecHelpers
115
138
 
116
139
  let(:dir_one) { 'dir_one' }
@@ -120,7 +143,7 @@ describe Jasmine::Headless::FilesList do
120
143
  let(:gem_two) { stub(:gem_dir => dir_two) }
121
144
 
122
145
  before do
123
- described_class.instance_variable_set(:@vendor_asset_paths, nil)
146
+ described_class.instance_variable_set(:@asset_paths, nil)
124
147
 
125
148
  FileUtils.mkdir_p File.join(dir_two, 'vendor/assets/javascripts')
126
149
 
@@ -128,7 +151,7 @@ describe Jasmine::Headless::FilesList do
128
151
  end
129
152
 
130
153
  it 'should return all matching gems with vendor/assets/javascripts directories' do
131
- described_class.vendor_asset_paths.should == [ File.join(dir_two, 'vendor/assets/javascripts') ]
154
+ described_class.asset_paths.should == [ File.join(dir_two, 'vendor/assets/javascripts') ]
132
155
  end
133
156
  end
134
157
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine-headless-webkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-12-06 00:00:00.000000000Z
14
+ date: 2011-12-12 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: jasmine-core
18
- requirement: &2165681500 !ruby/object:Gem::Requirement
18
+ requirement: &2165633660 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '1.1'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2165681500
26
+ version_requirements: *2165633660
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coffee-script
29
- requirement: &2165681040 !ruby/object:Gem::Requirement
29
+ requirement: &2165633240 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *2165681040
37
+ version_requirements: *2165633240
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rainbow
40
- requirement: &2165680320 !ruby/object:Gem::Requirement
40
+ requirement: &2165632780 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *2165680320
48
+ version_requirements: *2165632780
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: multi_json
51
- requirement: &2165679860 !ruby/object:Gem::Requirement
51
+ requirement: &2165632360 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :runtime
58
58
  prerelease: false
59
- version_requirements: *2165679860
59
+ version_requirements: *2165632360
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: sprockets
62
- requirement: &2165678120 !ruby/object:Gem::Requirement
62
+ requirement: &2165631860 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ~>
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '2'
68
68
  type: :runtime
69
69
  prerelease: false
70
- version_requirements: *2165678120
70
+ version_requirements: *2165631860
71
71
  description: Run Jasmine specs headlessly
72
72
  email:
73
73
  - john@coswellproductions.com
@@ -239,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
239
  version: '0'
240
240
  segments:
241
241
  - 0
242
- hash: 3207600471375665921
242
+ hash: -1333559206445244838
243
243
  required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  none: false
245
245
  requirements:
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  segments:
250
250
  - 0
251
- hash: 3207600471375665921
251
+ hash: -1333559206445244838
252
252
  requirements: []
253
253
  rubyforge_project: jasmine-headless-webkit
254
254
  rubygems_version: 1.8.11