jsus 0.3.0 → 0.3.1
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.
- data/CHANGELOG +3 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/jsus.gemspec +2 -2
- data/lib/jsus/middleware.rb +12 -5
- data/spec/jsus/middleware_spec.rb +28 -0
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/jsus.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{jsus}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mark Abramov"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-19}
|
13
13
|
s.default_executable = %q{jsus}
|
14
14
|
s.description = %q{Javascript packager and dependency resolver}
|
15
15
|
s.email = %q{markizko@gmail.com}
|
data/lib/jsus/middleware.rb
CHANGED
@@ -19,15 +19,15 @@ module Jsus
|
|
19
19
|
#
|
20
20
|
# Examples:
|
21
21
|
#
|
22
|
-
# GET /javascripts/jsus/Mootools.Core+Mootools.More
|
22
|
+
# GET /javascripts/jsus/require/Mootools.Core+Mootools.More
|
23
23
|
# merges packages named Mootools.Core and Mootools.More with all the
|
24
24
|
# dependencies and outputs the result.
|
25
25
|
#
|
26
|
-
# GET /javascripts/jsus/Mootools.More~Mootools.Core
|
26
|
+
# GET /javascripts/jsus/require/Mootools.More~Mootools.Core
|
27
27
|
# returns package Mootools.More with all the dependencies MINUS any of
|
28
28
|
# Mootools.Core dependencies.
|
29
29
|
#
|
30
|
-
# GET /javascripts/jsus/Mootools.Core:Class+Mootools.More:Fx
|
30
|
+
# GET /javascripts/jsus/require/Mootools.Core:Class+Mootools.More:Fx
|
31
31
|
# same thing but for source files providing Mootools.Core/Class and
|
32
32
|
# Mootools.More/Fx
|
33
33
|
#
|
@@ -128,9 +128,16 @@ module Jsus
|
|
128
128
|
package.include_dependencies!
|
129
129
|
package.linked_external_dependencies.to_a + package.source_files.to_a
|
130
130
|
elsif source_file = pool.lookup(source_file_or_package)
|
131
|
-
pool.lookup_dependencies(source_file) << source_file
|
131
|
+
pool.lookup_dependencies(source_file).to_a << source_file
|
132
132
|
else
|
133
|
-
|
133
|
+
# Try using arg as mask
|
134
|
+
mask = source_file_or_package.to_s
|
135
|
+
if !(mask =~ /^\s*$/) && !(source_files = pool.provides_tree.glob(mask)).empty?
|
136
|
+
source_files.map {|source| get_associated_files(source) }.flatten
|
137
|
+
else
|
138
|
+
# No dice
|
139
|
+
[]
|
140
|
+
end
|
134
141
|
end
|
135
142
|
end # get_associated_files
|
136
143
|
|
@@ -177,6 +177,34 @@ describe Jsus::Middleware do
|
|
177
177
|
body.index("script: Color.js").should > body.index("script: Core.js")
|
178
178
|
end
|
179
179
|
end
|
180
|
+
|
181
|
+
|
182
|
+
describe "using wildcard /javascripts/jsus/require/Package:Input.*.js" do
|
183
|
+
let(:path) { "/javascripts/jsus/require/Package:Input.*.js" }
|
184
|
+
|
185
|
+
it "should be successful" do
|
186
|
+
get(path).should be_successful
|
187
|
+
end
|
188
|
+
|
189
|
+
it "should respond with type text/javascript" do
|
190
|
+
get(path).content_type.should == "text/javascript"
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should respond with generated content" do
|
194
|
+
get(path).body.should include("script: Input.Color.js")
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should include dependencies by default" do
|
198
|
+
get(path).body.should include("script: Color.js")
|
199
|
+
get(path).body.should include("script: Core.js")
|
200
|
+
end
|
201
|
+
|
202
|
+
it "should preserve correct order" do
|
203
|
+
body = get(path).body
|
204
|
+
body.index("script: Color.js").should < body.index("script: Input.Color.js")
|
205
|
+
body.index("script: Color.js").should > body.index("script: Core.js")
|
206
|
+
end
|
207
|
+
end
|
180
208
|
end
|
181
209
|
|
182
210
|
describe "for invalid paths" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mark Abramov
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-19 00:00:00 +04:00
|
19
19
|
default_executable: jsus
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|