jasmine-headless-webkit 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@ module Jasmine::Headless
20
20
  Gem::Specification.each do |spec|
21
21
  path = File.join(spec.gem_dir, 'vendor/assets/javascripts')
22
22
 
23
- @vendor_asset_paths << path if File.directory?(path)
23
+ @vendor_asset_paths << path if File.directory?(path) && !@vendor_asset_paths.include?(path)
24
24
  end
25
25
 
26
26
  @vendor_asset_paths
@@ -68,7 +68,11 @@ module Jasmine::Headless
68
68
  @potential_files_to_filter = []
69
69
 
70
70
  self.class.default_files.each do |file|
71
- @required_files << sprockets_environment.find_asset(file, :bundle => false)
71
+ begin
72
+ @required_files << sprockets_environment.find_asset(file, :bundle => false)
73
+ rescue InvalidUniqueAsset => e
74
+ raise StandardError.new("Not an asset: #{file}")
75
+ end
72
76
  end
73
77
 
74
78
  use_config! if config?
@@ -91,9 +95,10 @@ module Jasmine::Headless
91
95
  def search_paths
92
96
  return @search_paths if @search_paths
93
97
 
94
- @search_paths = [ Jasmine::Core.path ]
98
+ @search_paths = [ Jasmine::Core.path, Jasmine::Headless.root.join('vendor/assets/javascripts').to_s ]
95
99
  @search_paths += self.class.vendor_asset_paths
96
100
  @search_paths += src_dir.collect { |dir| File.expand_path(dir) }
101
+ @search_paths += asset_paths.collect { |dir| File.expand_path(dir) }
97
102
  @search_paths += spec_dir.collect { |dir| File.expand_path(dir) }
98
103
 
99
104
  @search_paths
@@ -228,6 +233,10 @@ module Jasmine::Headless
228
233
  @spec_dir ||= config_dir_or_pwd('spec_dir')
229
234
  end
230
235
 
236
+ def asset_paths
237
+ @asset_paths ||= config_dir_or_pwd('asset_paths')
238
+ end
239
+
231
240
  def spec_file_searches
232
241
  @searches['spec_files']
233
242
  end
@@ -1,7 +1,7 @@
1
1
  module Jasmine::Headless
2
2
  class UniqueAssetList < ::Array
3
3
  def <<(asset)
4
- raise StandardError.new("Not an asset") if !asset.respond_to?(:logical_path)
4
+ raise InvalidUniqueAsset.new("Not an asset: #{asset.inspect}") if !asset.respond_to?(:logical_path)
5
5
 
6
6
  super if !self.any? { |other| asset.logical_path == other.logical_path }
7
7
  end
@@ -10,5 +10,7 @@ module Jasmine::Headless
10
10
  self.collect(&:to_a).flatten
11
11
  end
12
12
  end
13
+
14
+ class InvalidUniqueAsset < StandardError ; end
13
15
  end
14
16
 
@@ -1,5 +1,5 @@
1
1
  module Jasmine
2
2
  module Headless
3
- VERSION = "0.8.0"
3
+ VERSION = "0.8.1"
4
4
  end
5
5
  end
@@ -1,32 +1,34 @@
1
1
  require 'pathname'
2
2
 
3
- module Jasmine::Headless
4
- autoload :CommandLine, 'jasmine/headless/command_line'
5
-
6
- autoload :CoffeeScriptCache, 'jasmine/headless/coffee_script_cache'
7
- autoload :SpecFileAnalyzer, 'jasmine/headless/spec_file_analyzer'
8
- autoload :CacheableAction, 'jasmine/headless/cacheable_action'
9
- autoload :VERSION, 'jasmine/headless/version'
10
- autoload :Runner, 'jasmine/headless/runner'
11
- autoload :Options, 'jasmine/headless/options'
12
- autoload :Task, 'jasmine/headless/task'
13
-
14
- autoload :FilesList, 'jasmine/headless/files_list'
15
- autoload :UniqueAssetList, 'jasmine/headless/unique_asset_list'
16
-
17
- autoload :TemplateWriter, 'jasmine/headless/template_writer'
18
-
19
- autoload :CoffeeTemplate, 'jasmine/headless/coffee_template'
20
- autoload :JSTemplate, 'jasmine/headless/js_template'
21
- autoload :JSTTemplate, 'jasmine/headless/jst_template'
22
- autoload :CSSTemplate, 'jasmine/headless/css_template'
23
-
24
- autoload :Report, 'jasmine/headless/report'
25
- autoload :ReportMessage, 'jasmine/headless/report_message'
26
-
27
- class << self
28
- def root
29
- @root ||= Pathname(File.expand_path('../../..', __FILE__))
3
+ module Jasmine
4
+ module Headless
5
+ autoload :CommandLine, 'jasmine/headless/command_line'
6
+
7
+ autoload :CoffeeScriptCache, 'jasmine/headless/coffee_script_cache'
8
+ autoload :SpecFileAnalyzer, 'jasmine/headless/spec_file_analyzer'
9
+ autoload :CacheableAction, 'jasmine/headless/cacheable_action'
10
+ autoload :VERSION, 'jasmine/headless/version'
11
+ autoload :Runner, 'jasmine/headless/runner'
12
+ autoload :Options, 'jasmine/headless/options'
13
+ autoload :Task, 'jasmine/headless/task'
14
+
15
+ autoload :FilesList, 'jasmine/headless/files_list'
16
+ autoload :UniqueAssetList, 'jasmine/headless/unique_asset_list'
17
+
18
+ autoload :TemplateWriter, 'jasmine/headless/template_writer'
19
+
20
+ autoload :CoffeeTemplate, 'jasmine/headless/coffee_template'
21
+ autoload :JSTemplate, 'jasmine/headless/js_template'
22
+ autoload :JSTTemplate, 'jasmine/headless/jst_template'
23
+ autoload :CSSTemplate, 'jasmine/headless/css_template'
24
+
25
+ autoload :Report, 'jasmine/headless/report'
26
+ autoload :ReportMessage, 'jasmine/headless/report_message'
27
+
28
+ class << self
29
+ def root
30
+ @root ||= Pathname(File.expand_path('../../..', __FILE__))
31
+ end
30
32
  end
31
33
  end
32
34
  end
@@ -56,20 +56,24 @@ describe Jasmine::Headless::FilesList do
56
56
 
57
57
  let(:config) { {
58
58
  'src_dir' => src_dir,
59
- 'spec_dir' => spec_dir
59
+ 'spec_dir' => spec_dir,
60
+ 'asset_paths' => asset_paths
60
61
  } }
61
62
 
62
63
  let(:src_dir) { 'src dir' }
63
64
  let(:spec_dir) { 'spec dir' }
65
+ let(:asset_paths) { [] }
64
66
  let(:path) { 'path' }
65
67
 
66
68
  before do
67
69
  Jasmine::Headless::FilesList.stubs(:vendor_asset_paths).returns([])
68
70
  end
69
71
 
72
+ let(:vendor_path) { Jasmine::Headless.root.join('vendor/assets/javascripts').to_s }
73
+
70
74
  context 'no vendored gem paths' do
71
75
  it 'should take the src dir and spec dirs' do
72
- files_list.search_paths.should == [ Jasmine::Core.path, File.expand_path(src_dir), File.expand_path(spec_dir) ]
76
+ files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, File.expand_path(src_dir), File.expand_path(spec_dir) ]
73
77
  end
74
78
  end
75
79
 
@@ -79,18 +83,29 @@ describe Jasmine::Headless::FilesList do
79
83
  end
80
84
 
81
85
  it 'should add the vendor gem paths to the list' do
82
- files_list.search_paths.should == [ Jasmine::Core.path, path, File.expand_path(src_dir), File.expand_path(spec_dir) ]
86
+ files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, path, File.expand_path(src_dir), File.expand_path(spec_dir) ]
83
87
  end
84
88
  end
85
89
 
86
- context 'src_dir is an array' do
90
+ context 'multiple dirs' do
87
91
  let(:dir_1) { 'dir 1' }
88
92
  let(:dir_2) { 'dir 2' }
89
93
 
90
- let(:src_dir) { [ dir_1, dir_2 ] }
94
+ context 'src_dir is an array' do
95
+ let(:src_dir) { [ dir_1, dir_2 ] }
91
96
 
92
- it 'should take the src dir and spec dirs' do
93
- files_list.search_paths.should == [ Jasmine::Core.path, File.expand_path(dir_1), File.expand_path(dir_2), File.expand_path(spec_dir) ]
97
+ it 'should take the src dir and spec dirs' do
98
+ files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, File.expand_path(dir_1), File.expand_path(dir_2), File.expand_path(spec_dir) ]
99
+ end
100
+ end
101
+
102
+ context 'asset_paths has entries' do
103
+ let(:src_dir) { dir_1 }
104
+ let(:asset_paths) { [ dir_2 ] }
105
+
106
+ it 'should take the src dir and spec dirs' do
107
+ files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, File.expand_path(dir_1), File.expand_path(dir_2), File.expand_path(spec_dir) ]
108
+ end
94
109
  end
95
110
  end
96
111
  end
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.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ date: 2011-12-01 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: jasmine-core
18
- requirement: &2165048040 !ruby/object:Gem::Requirement
18
+ requirement: &2155294260 !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: *2165048040
26
+ version_requirements: *2155294260
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coffee-script
29
- requirement: &2165047320 !ruby/object:Gem::Requirement
29
+ requirement: &2155293840 !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: *2165047320
37
+ version_requirements: *2155293840
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rainbow
40
- requirement: &2165046600 !ruby/object:Gem::Requirement
40
+ requirement: &2155293380 !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: *2165046600
48
+ version_requirements: *2155293380
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: multi_json
51
- requirement: &2165045900 !ruby/object:Gem::Requirement
51
+ requirement: &2155292960 !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: *2165045900
59
+ version_requirements: *2155292960
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: sprockets
62
- requirement: &2165045140 !ruby/object:Gem::Requirement
62
+ requirement: &2155292460 !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: *2165045140
70
+ version_requirements: *2155292460
71
71
  description: Run Jasmine specs headlessly
72
72
  email:
73
73
  - john@coswellproductions.com
@@ -232,18 +232,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
232
  - - ! '>='
233
233
  - !ruby/object:Gem::Version
234
234
  version: '0'
235
- segments:
236
- - 0
237
- hash: -4186613631936924069
238
235
  required_rubygems_version: !ruby/object:Gem::Requirement
239
236
  none: false
240
237
  requirements:
241
238
  - - ! '>='
242
239
  - !ruby/object:Gem::Version
243
240
  version: '0'
244
- segments:
245
- - 0
246
- hash: -4186613631936924069
247
241
  requirements: []
248
242
  rubyforge_project: jasmine-headless-webkit
249
243
  rubygems_version: 1.8.11
@@ -324,3 +318,4 @@ test_files:
324
318
  - spec/lib/jasmine/headless_spec.rb
325
319
  - spec/lib/qt/qmake_spec.rb
326
320
  - spec/spec_helper.rb
321
+ has_rdoc: