middleman-jasmine 0.3.0 → 0.4.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 +8 -8
- data/CHANGELOG.md +4 -0
- data/README.md +8 -1
- data/lib/middleman/jasmine/extension.rb +5 -3
- data/lib/middleman/jasmine/jasmine_sprockets_proxy.rb +20 -1
- data/lib/middleman/jasmine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWQxOTAxZmYwNjQ3NzU0MjgyYjg5OTJkZDBiYjM5MjMyMWIxNDZjNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODE0MzllMzE1ZmNmYzBkOGM2ZmFhZjdlZjVmODFjNmYzNjNjZDEzYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWYxZWYxYzIyNGY3ODlmMGY0ZGYxNjI4MDQ5MDUyYmM0MjRhOTBmNmQ3Njdh
|
10
|
+
ZjlkYjJkZDJjMzNkZWZkODJlODVjYmI1ZTc3ZDlkNjFmMjFmODgwODc3ZmZk
|
11
|
+
NjA3YzE3ZDkzYTE1OTYxZGE2MDdmZjZkMWUyOTIwNDgwYjExZGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTE3MWY5ZTg0ZTQ0OTNjYzQzYjJhNjcwMjFhNGE1YjAyZTU2NDUxNmJiMDgw
|
14
|
+
NzBlN2YwOTdmYTdiZTg3YjgyMGZhMzg3Mzc3N2Q1OGY5OTFiNDM0NDRkMWQ5
|
15
|
+
YTRjNzMzZTAxNzQyMTI3MzdhZTMxYWYxYWJjZTRlNmZmMjNkMWE=
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -45,9 +45,16 @@ end
|
|
45
45
|
|
46
46
|
To configure the extension, use:
|
47
47
|
```
|
48
|
-
activate :jasmine
|
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
|
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
|
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.
|
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-
|
11
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jasmine
|