jasmine-headless-webkit 0.7.3.2 → 0.8.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +6 -0
  3. data/Rakefile +19 -0
  4. data/bin/jasmine-headless-webkit +2 -22
  5. data/jasmine-headless-webkit.gemspec +5 -4
  6. data/lib/digest/jasmine_test.rb +20 -0
  7. data/lib/jasmine/headless/cacheable_action.rb +1 -3
  8. data/lib/jasmine/headless/coffee_template.rb +30 -0
  9. data/lib/jasmine/headless/command_line.rb +31 -0
  10. data/lib/jasmine/headless/css_template.rb +14 -0
  11. data/lib/jasmine/headless/files_list.rb +251 -0
  12. data/lib/jasmine/headless/js_template.rb +18 -0
  13. data/lib/jasmine/headless/jst_template.rb +10 -0
  14. data/lib/jasmine/headless/options.rb +6 -1
  15. data/lib/jasmine/headless/runner.rb +14 -5
  16. data/lib/jasmine/headless/task.rb +2 -21
  17. data/lib/jasmine/headless/unique_asset_list.rb +14 -0
  18. data/lib/jasmine/headless/version.rb +1 -1
  19. data/lib/jasmine/headless.rb +11 -0
  20. data/lib/jasmine-headless-webkit.rb +4 -4
  21. data/skel/template.html.erb +13 -3
  22. data/spec/integration/randomization_spec.rb +13 -0
  23. data/spec/integration/specify_runner_file_spec.rb +22 -0
  24. data/spec/integration/sprockets_spec.rb +19 -0
  25. data/spec/jasmine/console_log/console_log.yml +1 -1
  26. data/spec/jasmine/runner_out_in_jasmine_yml/jasmine.yml +11 -0
  27. data/spec/jasmine/runner_out_in_jasmine_yml/test.js +2 -0
  28. data/spec/jasmine/runner_out_in_jasmine_yml/test_spec.coffee +4 -0
  29. data/spec/jasmine/with_sprockets_includes/assets/application.js.erb +2 -0
  30. data/spec/jasmine/with_sprockets_includes/assets/things/code.js +6 -0
  31. data/spec/jasmine/with_sprockets_includes/assets/things/required.js +2 -0
  32. data/spec/jasmine/with_sprockets_includes/assets/things/subcode/more_code.js +2 -0
  33. data/spec/jasmine/with_sprockets_includes/assets/things/templates/that.jst.ejs +1 -0
  34. data/spec/jasmine/with_sprockets_includes/assets/things/templates/this.jst +2 -0
  35. data/spec/jasmine/with_sprockets_includes/spec/spec_helper.js +1 -0
  36. data/spec/jasmine/with_sprockets_includes/spec/things/code_spec.js +9 -0
  37. data/spec/jasmine/with_sprockets_includes/with_sprockets_includes.yml +12 -0
  38. data/spec/javascripts/console.log_spec.coffee +15 -0
  39. data/spec/javascripts/support/jasmine.yml +4 -1
  40. data/spec/lib/jasmine/headless/cacheable_action_spec.rb +6 -3
  41. data/spec/lib/jasmine/headless/coffee_template_spec.rb +55 -0
  42. data/spec/lib/jasmine/headless/css_template_spec.rb +25 -0
  43. data/spec/lib/jasmine/headless/files_list_spec.rb +203 -0
  44. data/spec/lib/jasmine/headless/js_template_spec.rb +31 -0
  45. data/spec/lib/jasmine/headless/jst_template_spec.rb +21 -0
  46. data/spec/lib/jasmine/headless/options_spec.rb +18 -0
  47. data/spec/lib/jasmine/headless/template_writer_spec.rb +8 -4
  48. data/spec/lib/jasmine/headless/unique_asset_list_spec.rb +22 -0
  49. data/spec/lib/jasmine/headless_spec.rb +2 -0
  50. data/spec/spec_helper.rb +59 -0
  51. data/vendor/assets/coffeescripts/headless_reporter_result.coffee +10 -7
  52. data/vendor/assets/coffeescripts/intense.coffee +1 -0
  53. data/vendor/assets/coffeescripts/jasmine-extensions.coffee +13 -0
  54. data/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee +34 -2
  55. data/vendor/assets/coffeescripts/prolog.coffee +1 -1
  56. data/vendor/assets/javascripts/headless_reporter_result.js +19 -15
  57. data/vendor/assets/javascripts/intense.js +8 -1
  58. data/vendor/assets/javascripts/jasmine-extensions.js +29 -1
  59. data/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js +53 -13
  60. data/vendor/assets/javascripts/prolog.js +6 -4
  61. metadata +83 -20
  62. data/lib/jasmine/files_list.rb +0 -176
  63. data/spec/javascripts/support/jquery-1.6.2.min.js +0 -18
  64. data/spec/lib/jasmine/files_list_spec.rb +0 -248
data/.gitignore CHANGED
@@ -14,3 +14,4 @@ jhw-test
14
14
  .jhw-cache/
15
15
  _site/
16
16
  jhw.*.html
17
+ coverage/
data/Gemfile CHANGED
@@ -15,3 +15,9 @@ gem 'mocha', '0.9.12'
15
15
  gem 'guard-jasmine-headless-webkit', :git => 'git://github.com/johnbintz/guard-jasmine-headless-webkit.git'
16
16
  gem 'facter'
17
17
 
18
+ gem 'jquery-rails'
19
+ gem 'ejs'
20
+
21
+ gem 'simplecov'
22
+ #gem 'perftools.rb'
23
+
data/Rakefile CHANGED
@@ -43,3 +43,22 @@ task :build_runner do
43
43
  end
44
44
  end
45
45
 
46
+ desc "Generate vendored JS"
47
+ task :generate_js do
48
+ require 'sprockets'
49
+
50
+ source = 'vendor/assets/coffeescripts'
51
+ target = 'vendor/assets/javascripts'
52
+
53
+ env = Sprockets::Environment.new { |s| s.append_path 'vendor/assets/coffeescripts' }
54
+
55
+ Dir[File.join(File.expand_path(source), '*.coffee')].each do |file|
56
+ file_target = file.gsub(source, target).gsub('.coffee', '.js')
57
+ puts "#{file} => #{file_target}"
58
+
59
+ File.open(file_target, 'wb') do |fh|
60
+ fh.print env.find_asset(File.expand_path(file)).to_s
61
+ end
62
+ end
63
+ end
64
+
@@ -1,31 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
- require 'rainbow'
5
4
 
6
- def gem_dir
7
- File.expand_path('../..', __FILE__)
8
- end
5
+ $: << File.expand_path('../../lib', __FILE__)
9
6
 
10
- $:.unshift(File.join(gem_dir, 'lib'))
11
7
  require 'jasmine-headless-webkit'
12
8
  require 'coffee-script'
13
9
 
14
- begin
15
- options = Jasmine::Headless::Options.from_command_line
16
- runner = Jasmine::Headless::Runner.new(options)
17
-
18
- if options[:do_list]
19
- files_list = Jasmine::FilesList.new(:config => runner.jasmine_config)
20
- files_list.files.each { |file| puts file }
21
- else
22
- exit runner.run
23
- end
24
- rescue CoffeeScript::CompilationError
25
- exit 1
26
- rescue StandardError => e
27
- $stderr.puts "[%s] %s (%s)" % [ "jasmine-headless-webkit".color(:red), e.message.color(:white), e.class.name.color(:yellow) ]
28
- $stderr.puts e.backtrace.collect { |line| " #{line}" }.join("\n")
29
- exit 1
30
- end
10
+ Jasmine::Headless::CommandLine.run!
31
11
 
@@ -20,8 +20,9 @@ Gem::Specification.new do |s|
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
22
 
23
- s.add_dependency 'jasmine-core', '~>1.1.beta'
24
- s.add_dependency 'coffee-script', '>= 2.2'
25
- s.add_dependency 'rainbow'
26
- s.add_dependency 'multi_json'
23
+ s.add_runtime_dependency 'jasmine-core', '~> 1.1'
24
+ s.add_runtime_dependency 'coffee-script'
25
+ s.add_runtime_dependency 'rainbow'
26
+ s.add_runtime_dependency 'multi_json'
27
+ s.add_runtime_dependency 'sprockets', '~> 2'
27
28
  end
@@ -0,0 +1,20 @@
1
+ module Digest
2
+ class JasmineTest
3
+ def self.file(file)
4
+ new
5
+ end
6
+
7
+ def file(file)
8
+ self
9
+ end
10
+
11
+ def hexdigest
12
+ 'test'
13
+ end
14
+
15
+ def update(prefix)
16
+ self
17
+ end
18
+ end
19
+ end
20
+
@@ -1,5 +1,3 @@
1
- require 'digest/sha1'
2
-
3
1
  module Jasmine::Headless
4
2
  class CacheableAction
5
3
  class << self
@@ -56,7 +54,7 @@ module Jasmine::Headless
56
54
  end
57
55
 
58
56
  def cache_file
59
- @cache_file ||= File.join(self.class.cache_dir, self.class.cache_type, Digest::SHA1.hexdigest(file)) + '.js'
57
+ @cache_file ||= File.expand_path(File.join(self.class.cache_dir, self.class.cache_type, file)) + '.js'
60
58
  end
61
59
 
62
60
  def fresh?
@@ -0,0 +1,30 @@
1
+ require 'tilt/template'
2
+ require 'rainbow'
3
+
4
+ module Jasmine::Headless
5
+ class CoffeeTemplate < Tilt::Template
6
+ self.default_mime_type = 'application/javascript'
7
+
8
+ def prepare ; end
9
+
10
+ def evaluate(scope, locals, &block)
11
+ begin
12
+ cache = Jasmine::Headless::CoffeeScriptCache.new(file)
13
+ source = cache.handle
14
+ if cache.cached?
15
+ %{<script type="text/javascript" src="#{cache.cache_file}"></script>
16
+ <script type="text/javascript">window.CSTF['#{File.split(cache.cache_file).last}'] = '#{file}';</script>}
17
+ else
18
+ %{<script type="text/javascript">#{source}</script>}
19
+ end
20
+ rescue CoffeeScript::CompilationError => ne
21
+ puts "[%s] %s: %s" % [ 'coffeescript'.color(:red), file.color(:yellow), "#{ne.message}".color(:white) ]
22
+ raise ne
23
+ rescue StandardError => e
24
+ puts "[%s] Error in compiling file: %s" % [ 'coffeescript'.color(:red), file.color(:yellow) ]
25
+ raise e
26
+ end
27
+ end
28
+ end
29
+ end
30
+
@@ -0,0 +1,31 @@
1
+ module Jasmine::Headless
2
+ class CommandLine
3
+ class << self
4
+ def run!
5
+ require 'coffee-script'
6
+ require 'rainbow'
7
+
8
+ begin
9
+ options = Options.from_command_line
10
+ runner = Runner.new(options)
11
+
12
+ if options[:do_list]
13
+ FilesList.reset!
14
+
15
+ files_list = FilesList.new(:config => runner.jasmine_config)
16
+ files_list.files.each { |file| puts file }
17
+ else
18
+ exit runner.run
19
+ end
20
+ rescue CoffeeScript::CompilationError
21
+ exit 1
22
+ rescue StandardError => e
23
+ $stderr.puts "[%s] %s (%s)" % [ "jasmine-headless-webkit".color(:red), e.message.color(:white), e.class.name.color(:yellow) ]
24
+ $stderr.puts e.backtrace.collect { |line| " #{line}" }.join("\n")
25
+ exit 1
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+
@@ -0,0 +1,14 @@
1
+ require 'tilt/template'
2
+
3
+ module Jasmine::Headless
4
+ class CSSTemplate < Tilt::Template
5
+ self.default_mime_type = 'text/css'
6
+
7
+ def prepare ; end
8
+
9
+ def evaluate(scope, locals, &block)
10
+ file ? %{<link rel="stylesheet" href="#{file}" type="text/css" />} : data
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,251 @@
1
+ require 'jasmine-core'
2
+ require 'time'
3
+ require 'multi_json'
4
+ require 'set'
5
+ require 'sprockets'
6
+ require 'sprockets/engines'
7
+
8
+ module Jasmine::Headless
9
+ class FilesList
10
+ class << self
11
+ def vendor_asset_paths
12
+ return @vendor_asset_paths if @vendor_asset_paths
13
+
14
+ require 'rubygems'
15
+
16
+ raise StandardError.new("A newer version of Rubygems is required to use vendored assets. Please upgrade.") if !Gem::Specification.respond_to?(:each)
17
+
18
+ @vendor_asset_paths = []
19
+
20
+ Gem::Specification.each do |spec|
21
+ path = File.join(spec.gem_dir, 'vendor/assets/javascripts')
22
+
23
+ @vendor_asset_paths << path if File.directory?(path)
24
+ end
25
+
26
+ @vendor_asset_paths
27
+ end
28
+
29
+ def reset!
30
+ @vendor_asset_paths = nil
31
+
32
+ # register haml-sprockets if it's available...
33
+ %w{haml-sprockets}.each do |library|
34
+ begin
35
+ require library
36
+ rescue LoadError
37
+ end
38
+ end
39
+
40
+ # ...and unregister ones we don't want/need
41
+ Sprockets.instance_eval do
42
+ %w{less sass scss erb str}.each do |extension|
43
+ @engines.delete(".#{extension}")
44
+ end
45
+
46
+ register_engine '.coffee', Jasmine::Headless::CoffeeTemplate
47
+ register_engine '.js', Jasmine::Headless::JSTemplate
48
+ register_engine '.css', Jasmine::Headless::CSSTemplate
49
+ register_engine '.jst', Jasmine::Headless::JSTTemplate
50
+ end
51
+ end
52
+
53
+ def default_files
54
+ %w{jasmine.js jasmine-html jasmine.css jasmine-extensions intense headless_reporter_result jasmine.HeadlessConsoleReporter jsDump beautify-html}
55
+ end
56
+ end
57
+
58
+ PLEASE_WAIT_IM_WORKING_TIME = 2
59
+
60
+ attr_reader :required_files, :potential_files_to_filter
61
+
62
+ def initialize(options = {})
63
+ @options = options
64
+
65
+ Kernel.srand(@options[:seed]) if @options[:seed]
66
+
67
+ @required_files = UniqueAssetList.new
68
+ @potential_files_to_filter = []
69
+
70
+ self.class.default_files.each do |file|
71
+ @required_files << sprockets_environment.find_asset(file, :bundle => false)
72
+ end
73
+
74
+ use_config! if config?
75
+ end
76
+
77
+ def files
78
+ required_files.flatten.collect { |asset| asset.pathname.to_s }.uniq
79
+ end
80
+
81
+ def spec_files
82
+ filter_for_requested_specs(
83
+ files.find_all { |file| spec_dir.any? { |dir| file[dir] } }
84
+ )
85
+ end
86
+
87
+ def filtered_files
88
+ filter_for_requested_specs(files)
89
+ end
90
+
91
+ def search_paths
92
+ return @search_paths if @search_paths
93
+
94
+ @search_paths = [ Jasmine::Core.path ]
95
+ @search_paths += self.class.vendor_asset_paths
96
+ @search_paths += src_dir.collect { |dir| File.expand_path(dir) }
97
+ @search_paths += spec_dir.collect { |dir| File.expand_path(dir) }
98
+
99
+ @search_paths
100
+ end
101
+
102
+ def sprockets_environment
103
+ return @sprockets_environment if @sprockets_environment
104
+
105
+ @sprockets_environment = Sprockets::Environment.new
106
+ search_paths.each { |path| @sprockets_environment.append_path(path) }
107
+
108
+ @sprockets_environment.unregister_postprocessor('application/javascript', Sprockets::SafetyColons)
109
+ @sprockets_environment
110
+ end
111
+
112
+ def has_spec_outside_scope?
113
+ if is_outside_scope = !spec_filter.empty?
114
+ is_outside_scope = spec_dir.any? do |dir|
115
+ spec_file_searches.any? do |search|
116
+ !spec_files.any? { |file| File.fnmatch?(File.join(dir, search), file) }
117
+ end
118
+ end
119
+ end
120
+
121
+ is_outside_scope
122
+ end
123
+
124
+ def filtered?
125
+ files != filtered_files
126
+ end
127
+
128
+ def files_to_html
129
+ to_html(files)
130
+ end
131
+
132
+ def filtered_files_to_html
133
+ to_html(filtered_files)
134
+ end
135
+
136
+ def spec_file_line_numbers
137
+ @spec_file_line_numbers ||= Hash[spec_files.collect { |file|
138
+ if File.exist?(file)
139
+ if !(lines = Jasmine::Headless::SpecFileAnalyzer.for(file)).empty?
140
+ [ file, lines ]
141
+ end
142
+ else
143
+ nil
144
+ end
145
+ }.compact]
146
+ end
147
+
148
+ private
149
+ def to_html(files)
150
+ alert_time = Time.now + PLEASE_WAIT_IM_WORKING_TIME
151
+
152
+ files.collect do |file|
153
+ if alert_time && alert_time < Time.now
154
+ puts "Rebuilding cache, please wait..."
155
+ alert_time = nil
156
+ end
157
+
158
+ sprockets_environment.find_asset(file, :bundle => false).body
159
+ end.compact.reject(&:empty?)
160
+ end
161
+
162
+ def spec_filter
163
+ @spec_filter ||= (@options[:only] && @options[:only].collect { |path| expanded_dir(path) }.flatten) || []
164
+ end
165
+
166
+ SEARCH_ROOTS = {
167
+ 'src_files' => 'src_dir',
168
+ 'stylesheets' => 'src_dir',
169
+ 'helpers' => 'spec_dir',
170
+ 'spec_files' => 'spec_dir'
171
+ }
172
+
173
+ def use_config!
174
+ @config = @options[:config].dup
175
+ @searches = {}
176
+ @potential_files_to_filter = []
177
+
178
+ %w{src_files stylesheets helpers spec_files}.each do |type|
179
+ if data = @config[type]
180
+ add_files(@searches[type] = data.flatten, type, send(SEARCH_ROOTS[type]))
181
+ end
182
+ end
183
+ end
184
+
185
+ def add_files(patterns, type, dirs)
186
+ dirs.product(patterns).each do |search|
187
+ files = Dir[File.join(*search)].find_all { |file| file[extension_filter] }
188
+
189
+ files.sort! { |a, b| Kernel.rand(3) - 1 } if type == 'spec_files'
190
+
191
+ files.each do |path|
192
+ add_path(path, type) if File.file?(path)
193
+ end
194
+ end
195
+
196
+ if type == 'spec_files'
197
+ spec_filter.each { |path| add_path(path, type) }
198
+ end
199
+ end
200
+
201
+ def config?
202
+ @options[:config]
203
+ end
204
+
205
+ def expanded_dir(path)
206
+ Dir[path].find_all { |file| file[extension_filter] }.collect { |file| File.expand_path(file) }.find_all { |path| File.file?(path) }
207
+ end
208
+
209
+ def extension_filter
210
+ %r{(#{(%w{.js .css} + Sprockets.engine_extensions).join('|')})$}
211
+ end
212
+
213
+ def add_path(path, type)
214
+ asset = sprockets_environment.find_asset(path)
215
+
216
+ @required_files << asset
217
+
218
+ if type == 'spec_files'
219
+ @potential_files_to_filter << path
220
+ end
221
+ end
222
+
223
+ def src_dir
224
+ @src_dir ||= config_dir_or_pwd('src_dir')
225
+ end
226
+
227
+ def spec_dir
228
+ @spec_dir ||= config_dir_or_pwd('spec_dir')
229
+ end
230
+
231
+ def spec_file_searches
232
+ @searches['spec_files']
233
+ end
234
+
235
+ def config_dir_or_pwd(dir)
236
+ found_dir = (@options[:config] && @options[:config][dir]) || Dir.pwd
237
+
238
+ [ found_dir ].flatten.collect { |dir| File.expand_path(dir) }
239
+ end
240
+
241
+ def filter_for_requested_specs(files)
242
+ files.find_all do |file|
243
+ if potential_files_to_filter.include?(file)
244
+ spec_filter.empty? || spec_filter.any? { |pattern| File.fnmatch?(pattern, file) }
245
+ else
246
+ true
247
+ end
248
+ end
249
+ end
250
+ end
251
+ end
@@ -0,0 +1,18 @@
1
+ require 'tilt/template'
2
+
3
+ module Jasmine::Headless
4
+ class JSTemplate < Tilt::Template
5
+ self.default_mime_type = 'application/javascript'
6
+
7
+ def prepare ; end
8
+
9
+ def evaluate(scope, locals, &block)
10
+ if data[%r{^<script type="text/javascript"}]
11
+ data
12
+ else
13
+ file ? %{<script type="text/javascript" src="#{file}"></script>} : data
14
+ end
15
+ end
16
+ end
17
+ end
18
+
@@ -0,0 +1,10 @@
1
+ require 'sprockets/jst_processor'
2
+
3
+ module Jasmine::Headless
4
+ class JSTTemplate < Sprockets::JstProcessor
5
+ def evaluate(*args)
6
+ %{<script type="text/javascript">#{super}</script>}
7
+ end
8
+ end
9
+ end
10
+
@@ -32,6 +32,8 @@ module Jasmine
32
32
 
33
33
  def initialize(opts = {})
34
34
  @options = DEFAULT_OPTIONS.dup
35
+ srand
36
+ @options[:seed] = rand(10000)
35
37
  read_defaults_files
36
38
  opts.each { |k, v| @options[k] = v if v }
37
39
  end
@@ -60,6 +62,8 @@ module Jasmine
60
62
  @options[:full_run] = false
61
63
  when '--list', '-l'
62
64
  @options[:do_list] = true
65
+ when '--seed'
66
+ @options[:seed] = arg.to_i
63
67
  end
64
68
  end
65
69
 
@@ -82,7 +86,8 @@ module Jasmine
82
86
  [ '--report', GetoptLong::REQUIRED_ARGUMENT ],
83
87
  [ '--jasmine-config', '-j', GetoptLong::REQUIRED_ARGUMENT ],
84
88
  [ '--no-full-run', GetoptLong::NO_ARGUMENT ],
85
- [ '--list', '-l', GetoptLong::NO_ARGUMENT ]
89
+ [ '--list', '-l', GetoptLong::NO_ARGUMENT ],
90
+ [ '--seed', GetoptLong::REQUIRED_ARGUMENT ]
86
91
  )
87
92
 
88
93
  command_line_args.each { |*args| process_option(*args) }
@@ -4,6 +4,8 @@ require 'coffee-script'
4
4
  require 'rainbow'
5
5
 
6
6
  require 'yaml'
7
+ require 'sprockets'
8
+
7
9
 
8
10
  module Jasmine
9
11
  module Headless
@@ -23,9 +25,11 @@ module Jasmine
23
25
 
24
26
  attr_reader :options
25
27
 
26
- def self.run(options = {})
27
- options = Options.new(options) if !options.kind_of?(Options)
28
- new(options).run
28
+ class << self
29
+ def run(options = {})
30
+ options = Options.new(options) if !options.kind_of?(Options)
31
+ new(options).run
32
+ end
29
33
  end
30
34
 
31
35
  def initialize(options)
@@ -65,10 +69,12 @@ module Jasmine
65
69
 
66
70
  def run
67
71
  Jasmine::Headless::CacheableAction.enabled = @options[:enable_cache]
72
+ FilesList.reset!
68
73
 
69
- files_list = Jasmine::FilesList.new(
74
+ files_list = Jasmine::Headless::FilesList.new(
70
75
  :config => jasmine_config,
71
- :only => @options[:files]
76
+ :only => @options[:files],
77
+ :seed => @options[:seed]
72
78
  )
73
79
 
74
80
  @_targets = template_writer.write!(files_list)
@@ -76,6 +82,9 @@ module Jasmine
76
82
  run_targets.pop if (!@options[:full_run] && files_list.filtered?) || files_list.has_spec_outside_scope?
77
83
 
78
84
  system jasmine_command(run_targets)
85
+
86
+ puts "\nTest ordering seed: --seed #{@options[:seed]}"
87
+
79
88
  @_status = $?.exitstatus
80
89
  ensure
81
90
  if @_targets && !runner_filename && (@options[:remove_html_file] || (@_status == 0))
@@ -1,23 +1,3 @@
1
- module Digest
2
- class JasmineTest
3
- def self.file(file)
4
- new
5
- end
6
-
7
- def file(file)
8
- self
9
- end
10
-
11
- def hexdigest
12
- 'test'
13
- end
14
-
15
- def update(prefix)
16
- self
17
- end
18
- end
19
- end
20
-
21
1
  module Jasmine
22
2
  module Headless
23
3
  class Task
@@ -41,8 +21,9 @@ module Jasmine
41
21
  private
42
22
  def create_rails_compliant_task
43
23
  if Rails.respond_to?(:version) && Rails.version >= "3.1.0"
44
- desc 'Force generate static assets without an MD5 hash, all assets end with -test.<ext>'
45
24
  task 'assets:precompile:for_testing' => :environment do
25
+ $stderr.puts "This task is deprecated and will be removed after 2012-01-01"
26
+
46
27
  Rails.application.assets.digest_class = Digest::JasmineTest
47
28
 
48
29
  Rake::Task['assets:precompile'].invoke
@@ -0,0 +1,14 @@
1
+ module Jasmine::Headless
2
+ class UniqueAssetList < ::Array
3
+ def <<(asset)
4
+ raise StandardError.new("Not an asset") if !asset.respond_to?(:logical_path)
5
+
6
+ super if !self.any? { |other| asset.logical_path == other.logical_path }
7
+ end
8
+
9
+ def flatten
10
+ self.collect(&:to_a).flatten
11
+ end
12
+ end
13
+ end
14
+
@@ -1,5 +1,5 @@
1
1
  module Jasmine
2
2
  module Headless
3
- VERSION = "0.7.3.2"
3
+ VERSION = "0.8.0.alpha.1"
4
4
  end
5
5
  end
@@ -1,6 +1,8 @@
1
1
  require 'pathname'
2
2
 
3
3
  module Jasmine::Headless
4
+ autoload :CommandLine, 'jasmine/headless/command_line'
5
+
4
6
  autoload :CoffeeScriptCache, 'jasmine/headless/coffee_script_cache'
5
7
  autoload :SpecFileAnalyzer, 'jasmine/headless/spec_file_analyzer'
6
8
  autoload :CacheableAction, 'jasmine/headless/cacheable_action'
@@ -9,8 +11,16 @@ module Jasmine::Headless
9
11
  autoload :Options, 'jasmine/headless/options'
10
12
  autoload :Task, 'jasmine/headless/task'
11
13
 
14
+ autoload :FilesList, 'jasmine/headless/files_list'
15
+ autoload :UniqueAssetList, 'jasmine/headless/unique_asset_list'
16
+
12
17
  autoload :TemplateWriter, 'jasmine/headless/template_writer'
13
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
+
14
24
  autoload :Report, 'jasmine/headless/report'
15
25
  autoload :ReportMessage, 'jasmine/headless/report_message'
16
26
 
@@ -22,3 +32,4 @@ module Jasmine::Headless
22
32
  end
23
33
 
24
34
  require 'jasmine/headless/errors'
35
+
@@ -1,7 +1,7 @@
1
- module Jasmine
2
- autoload :FilesList, 'jasmine/files_list'
3
- end
4
-
5
1
  require 'jasmine/headless'
6
2
  require 'jasmine/headless/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
7
3
 
4
+ module Digest
5
+ autoload :JasmineTest, 'digest/jasmine_test'
6
+ end
7
+