middleman-jasmine 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2VjZjM4Y2I0ZjUyODFiYjQwMmQ1YTkyYzA4ZDc2NTNhNzEyMmJjYw==
4
+ OWQxOTAxZmYwNjQ3NzU0MjgyYjg5OTJkZDBiYjM5MjMyMWIxNDZjNg==
5
5
  data.tar.gz: !binary |-
6
- YmQ2MTM0NzE1YTU3NDg3YTczODg5MzM0N2U3ODg5OGQ4YjYxNWFjMA==
6
+ ODE0MzllMzE1ZmNmYzBkOGM2ZmFhZjdlZjVmODFjNmYzNjNjZDEzYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTk4NmZlZGNmNDU0MzBlNTQ5NzkyZGIzZmJhOGU3OGZiNGNkZjBlNmM0MmM2
10
- NmI1MmNmYzY3NDQzNTY3MmM0ODdmZDk5OGQzMTAwODhjMWQ0YmZhZDExMzEz
11
- NWNmYjk3YWVkNTJiNTQ5OGY1MGUyNzI0ZjRmOTMwNmRkZGY2Mjc=
9
+ ZWYxZWYxYzIyNGY3ODlmMGY0ZGYxNjI4MDQ5MDUyYmM0MjRhOTBmNmQ3Njdh
10
+ ZjlkYjJkZDJjMzNkZWZkODJlODVjYmI1ZTc3ZDlkNjFmMjFmODgwODc3ZmZk
11
+ NjA3YzE3ZDkzYTE1OTYxZGE2MDdmZjZkMWUyOTIwNDgwYjExZGQ=
12
12
  data.tar.gz: !binary |-
13
- YzlhMGVhYjM3MDkwZWIyZGMxNDYzMGFlNzFhM2Q3ZmQ0ZWFiOWVjMjgwZWQ0
14
- ZWMwZGZhZjA1YzQwMTk4YzQ4N2Y3NGJmNmZmZjcxMTY2MjQ3M2UxZTFhNDNm
15
- NGFjODZhYTZkMTEzYTE0MDA0NDFiNWE0ZWQ0YWVjMWRkODk4ZmQ=
13
+ ZTE3MWY5ZTg0ZTQ0OTNjYzQzYjJhNjcwMjFhNGE1YjAyZTU2NDUxNmJiMDgw
14
+ NzBlN2YwOTdmYTdiZTg3YjgyMGZhMzg3Mzc3N2Q1OGY5OTFiNDM0NDRkMWQ5
15
+ YTRjNzMzZTAxNzQyMTI3MzdhZTMxYWYxYWJjZTRlNmZmMjNkMWE=
@@ -1,3 +1,7 @@
1
+ 0.4.0
2
+ ===
3
+ * Add debug_assets option to expand the assets into individual files. Defaults to false.
4
+
1
5
  0.3.0
2
6
  ===
3
7
  * Add config_file option for specifying jasmine config file [byteio, mrship]
data/README.md CHANGED
@@ -45,9 +45,16 @@ end
45
45
 
46
46
  To configure the extension, use:
47
47
  ```
48
- activate :jasmine, fixtures_dir: "spec/javascripts/fixtures", jasmine_url: "/jasmine", config_file: "spec/config.yml"
48
+ activate :jasmine do |options|
49
+ options.fixtures_dir = "spec/javascripts/fixtures"
50
+ options.jasmine_url = "/jasmine"
51
+ options.config_file = "spec/config.yml"
52
+ options.debug_assets = false
53
+ end
49
54
  ```
50
55
 
56
+ NOTE: `debug_assets` can be used to extract any assets included in the spec files and serve them with `?body=t` to avoid sprockets compiling them every time a spec re-runs.
57
+
51
58
  ## Contributing
52
59
 
53
60
  1. Fork it
@@ -19,7 +19,7 @@ module Middleman
19
19
  app.map("/#{options.fixtures_dir}") { run Rack::Directory.new(options.fixtures_dir) }
20
20
 
21
21
  app.after_configuration do
22
- ::JasmineSprocketsProxy.configure(sprockets, options.config_file)
22
+ ::JasmineSprocketsProxy.configure(sprockets, options.config_file, options.debug_assets)
23
23
  end
24
24
  end
25
25
 
@@ -35,9 +35,11 @@ module Middleman
35
35
  {
36
36
  jasmine_url: "/jasmine",
37
37
  fixtures_dir: "spec/javascripts/fixtures",
38
- config_file: nil
38
+ config_file: nil,
39
+ debug_assets: false
39
40
  }
40
- end
41
+ end
42
+
41
43
  alias :included :registered
42
44
  end
43
45
 
@@ -10,7 +10,7 @@ class JasmineSprocketsProxy
10
10
  @@sprockets_app
11
11
  end
12
12
 
13
- def configure(middleman_sprockets, config_file = nil)
13
+ def configure(middleman_sprockets, config_file, debug_assets)
14
14
  raise "Config file not found" unless valid_config_file?(config_file)
15
15
  Jasmine.load_configuration_from_yaml(config_file)
16
16
  @@jasmine_app = Jasmine::Application.app(Jasmine.config)
@@ -25,6 +25,10 @@ class JasmineSprocketsProxy
25
25
  else
26
26
  @@jasmine_app
27
27
  end
28
+
29
+ if debug_assets
30
+ Jasmine.config.add_path_mapper(lambda { |config| DebugAssetMapper.new(@@sprockets_app) } )
31
+ end
28
32
  end
29
33
 
30
34
  private
@@ -76,3 +80,18 @@ module Rack
76
80
  end
77
81
  end
78
82
  end
83
+
84
+ class DebugAssetMapper
85
+ attr_reader :sprockets
86
+ def initialize(sprockets)
87
+ @sprockets = sprockets
88
+ end
89
+
90
+ def map_spec_paths(spec_paths)
91
+ spec_paths.map do |path|
92
+ sprockets[File.basename(path)].to_a.map do | dependency |
93
+ "/__spec__/#{dependency.logical_path}?body=t"
94
+ end
95
+ end.flatten.uniq
96
+ end
97
+ end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Jasmine
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-jasmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Shipman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-17 00:00:00.000000000 Z
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jasmine