slinky 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/Gemfile +8 -7
- data/README.md +36 -4
- data/Rakefile +4 -4
- data/VERSION +1 -1
- data/lib/slinky.rb +2 -0
- data/lib/slinky/builder.rb +5 -1
- data/lib/slinky/compiled_file.rb +5 -5
- data/lib/slinky/listener.rb +35 -0
- data/lib/slinky/manifest.rb +197 -49
- data/lib/slinky/proxy_server.rb +0 -1
- data/lib/slinky/runner.rb +7 -1
- data/lib/slinky/server.rb +15 -5
- data/slinky.gemspec +38 -37
- data/spec/slinky_spec.rb +128 -27
- data/spec/spec_helper.rb +16 -1
- metadata +64 -53
data/lib/slinky/proxy_server.rb
CHANGED
@@ -58,7 +58,6 @@ module Slinky
|
|
58
58
|
data = ProxyServer.replace_path(data, path, new_path, proxy[1].path)
|
59
59
|
new_host = proxy[1].select(:host, :port).join(":")
|
60
60
|
data = ProxyServer.replace_host(data, new_host)
|
61
|
-
puts [data, [proxy[1].host, proxy[1].port]].inspect
|
62
61
|
[proxy[1].host, proxy[1].port]
|
63
62
|
else :slinky
|
64
63
|
end
|
data/lib/slinky/runner.rb
CHANGED
@@ -59,12 +59,18 @@ module Slinky
|
|
59
59
|
EM::run {
|
60
60
|
Slinky::Server.dir = @options[:src_dir]
|
61
61
|
Slinky::Server.config = @config
|
62
|
+
manifest = Manifest.new(Slinky::Server.dir,
|
63
|
+
Slinky::Server.config)
|
64
|
+
Slinky::Server.manifest = manifest
|
65
|
+
|
62
66
|
if @config && !@config.proxies.empty? && !@options[:no_proxy]
|
63
67
|
server = EM::start_server "127.0.0.1", @options[:port]+1, Slinky::Server
|
64
|
-
ProxyServer.run(@config.proxies, @options[:port],
|
68
|
+
ProxyServer.run(@config.proxies, @options[:port], @options[:port]+1)
|
65
69
|
else
|
66
70
|
EM::start_server "0.0.0.0", @options[:port], Slinky::Server
|
67
71
|
end
|
72
|
+
|
73
|
+
Listener.new(manifest).run
|
68
74
|
puts "Started static file server on port #{@options[:port]}"
|
69
75
|
}
|
70
76
|
end
|
data/lib/slinky/server.rb
CHANGED
@@ -10,6 +10,9 @@ module Slinky
|
|
10
10
|
def self.config= _config; @config = _config; end
|
11
11
|
def self.config; @config || {}; end
|
12
12
|
|
13
|
+
def self.manifest= _manifest; @manifest = _manifest; end
|
14
|
+
def self.manifest; @manifest; end
|
15
|
+
|
13
16
|
# Splits a uri into its components, returning only the path sans
|
14
17
|
# initial forward slash.
|
15
18
|
def self.path_for_uri uri
|
@@ -60,13 +63,20 @@ module Slinky
|
|
60
63
|
|
61
64
|
# Method called for every HTTP request made
|
62
65
|
def process_http_request
|
63
|
-
|
64
|
-
|
65
|
-
path = Server.path_for_uri(@http_request_uri)
|
66
|
-
file = @manifest.find_by_path(path)
|
66
|
+
manifest = Server.manifest
|
67
67
|
resp = EventMachine::DelegatedHttpResponse.new(self)
|
68
|
+
|
69
|
+
begin
|
70
|
+
path = Server.path_for_uri(@http_request_uri)
|
71
|
+
rescue
|
72
|
+
resp.status = 500
|
73
|
+
resp.content = "Invalid request"
|
74
|
+
return
|
75
|
+
end
|
76
|
+
|
77
|
+
file = manifest.find_by_path(path).first
|
68
78
|
if file.is_a? ManifestDir
|
69
|
-
file =
|
79
|
+
file = manifest.find_by_path(path+"/index.html").first
|
70
80
|
end
|
71
81
|
resp.content_type MIME::Types.type_for(path).first
|
72
82
|
Server.handle_file(resp, file).send_response
|
data/slinky.gemspec
CHANGED
@@ -4,15 +4,15 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.
|
7
|
+
s.name = "slinky"
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
15
|
-
s.executables = [
|
11
|
+
s.authors = ["Micah Wylde"]
|
12
|
+
s.date = "2012-06-15"
|
13
|
+
s.description = "A static file server for rich web apps that automatically compiles SASS, HAML, CoffeeScript and more"
|
14
|
+
s.email = "micah@micahw.com"
|
15
|
+
s.executables = ["slinky"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE.txt",
|
18
18
|
"README.md"
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
22
|
".rspec",
|
23
|
+
".travis.yml",
|
23
24
|
"Gemfile",
|
24
25
|
"LICENSE.txt",
|
25
26
|
"README.md",
|
@@ -36,6 +37,7 @@ Gem::Specification.new do |s|
|
|
36
37
|
"lib/slinky/compilers/sass-compiler.rb",
|
37
38
|
"lib/slinky/config_reader.rb",
|
38
39
|
"lib/slinky/em-popen3.rb",
|
40
|
+
"lib/slinky/listener.rb",
|
39
41
|
"lib/slinky/manifest.rb",
|
40
42
|
"lib/slinky/proxy_server.rb",
|
41
43
|
"lib/slinky/runner.rb",
|
@@ -44,15 +46,11 @@ Gem::Specification.new do |s|
|
|
44
46
|
"spec/slinky_spec.rb",
|
45
47
|
"spec/spec_helper.rb"
|
46
48
|
]
|
47
|
-
s.homepage =
|
48
|
-
s.licenses = [
|
49
|
-
s.require_paths = [
|
50
|
-
s.rubygems_version =
|
51
|
-
s.summary =
|
52
|
-
s.test_files = [
|
53
|
-
"spec/slinky_spec.rb",
|
54
|
-
"spec/spec_helper.rb"
|
55
|
-
]
|
49
|
+
s.homepage = "http://mwylde.github.com/slinky/"
|
50
|
+
s.licenses = ["MIT"]
|
51
|
+
s.require_paths = ["lib"]
|
52
|
+
s.rubygems_version = "1.8.10"
|
53
|
+
s.summary = "Static file server for javascript apps"
|
56
54
|
|
57
55
|
if s.respond_to? :specification_version then
|
58
56
|
s.specification_version = 3
|
@@ -60,55 +58,58 @@ Gem::Specification.new do |s|
|
|
60
58
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
61
59
|
s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.0"])
|
62
60
|
s.add_runtime_dependency(%q<eventmachine_httpserver>, [">= 0.2.0"])
|
63
|
-
s.add_runtime_dependency(%q<em-proxy>, [">= 0.1.
|
64
|
-
s.add_runtime_dependency(%q<rainbow>, [">= 1.1.
|
61
|
+
s.add_runtime_dependency(%q<em-proxy>, [">= 0.1.6"])
|
62
|
+
s.add_runtime_dependency(%q<rainbow>, [">= 1.1.3"])
|
65
63
|
s.add_runtime_dependency(%q<haml>, [">= 3.0.0"])
|
66
64
|
s.add_runtime_dependency(%q<sass>, [">= 3.1.1"])
|
67
65
|
s.add_runtime_dependency(%q<coffee-script>, [">= 2.2.0"])
|
68
66
|
s.add_runtime_dependency(%q<mime-types>, [">= 1.16"])
|
69
67
|
s.add_runtime_dependency(%q<yui-compressor>, [">= 0.9.6"])
|
70
|
-
s.
|
68
|
+
s.add_runtime_dependency(%q<listen>, [">= 0.4.5"])
|
69
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.10.0"])
|
71
70
|
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
72
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.
|
73
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.
|
71
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
|
72
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.0"])
|
74
73
|
s.add_development_dependency(%q<cover_me>, [">= 1.0.0.rc6"])
|
75
|
-
s.add_development_dependency(%q<fakefs>, ["
|
76
|
-
s.add_development_dependency(%q<em-http-request>, ["
|
74
|
+
s.add_development_dependency(%q<fakefs>, ["~> 0.4.0"])
|
75
|
+
s.add_development_dependency(%q<em-http-request>, ["~> 1.0.0"])
|
77
76
|
else
|
78
77
|
s.add_dependency(%q<eventmachine>, [">= 0.12.0"])
|
79
78
|
s.add_dependency(%q<eventmachine_httpserver>, [">= 0.2.0"])
|
80
|
-
s.add_dependency(%q<em-proxy>, [">= 0.1.
|
81
|
-
s.add_dependency(%q<rainbow>, [">= 1.1.
|
79
|
+
s.add_dependency(%q<em-proxy>, [">= 0.1.6"])
|
80
|
+
s.add_dependency(%q<rainbow>, [">= 1.1.3"])
|
82
81
|
s.add_dependency(%q<haml>, [">= 3.0.0"])
|
83
82
|
s.add_dependency(%q<sass>, [">= 3.1.1"])
|
84
83
|
s.add_dependency(%q<coffee-script>, [">= 2.2.0"])
|
85
84
|
s.add_dependency(%q<mime-types>, [">= 1.16"])
|
86
85
|
s.add_dependency(%q<yui-compressor>, [">= 0.9.6"])
|
87
|
-
s.add_dependency(%q<
|
86
|
+
s.add_dependency(%q<listen>, [">= 0.4.5"])
|
87
|
+
s.add_dependency(%q<rspec>, ["~> 2.10.0"])
|
88
88
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
89
|
-
s.add_dependency(%q<bundler>, ["~> 1.
|
90
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
89
|
+
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
90
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.0"])
|
91
91
|
s.add_dependency(%q<cover_me>, [">= 1.0.0.rc6"])
|
92
|
-
s.add_dependency(%q<fakefs>, ["
|
93
|
-
s.add_dependency(%q<em-http-request>, ["
|
92
|
+
s.add_dependency(%q<fakefs>, ["~> 0.4.0"])
|
93
|
+
s.add_dependency(%q<em-http-request>, ["~> 1.0.0"])
|
94
94
|
end
|
95
95
|
else
|
96
96
|
s.add_dependency(%q<eventmachine>, [">= 0.12.0"])
|
97
97
|
s.add_dependency(%q<eventmachine_httpserver>, [">= 0.2.0"])
|
98
|
-
s.add_dependency(%q<em-proxy>, [">= 0.1.
|
99
|
-
s.add_dependency(%q<rainbow>, [">= 1.1.
|
98
|
+
s.add_dependency(%q<em-proxy>, [">= 0.1.6"])
|
99
|
+
s.add_dependency(%q<rainbow>, [">= 1.1.3"])
|
100
100
|
s.add_dependency(%q<haml>, [">= 3.0.0"])
|
101
101
|
s.add_dependency(%q<sass>, [">= 3.1.1"])
|
102
102
|
s.add_dependency(%q<coffee-script>, [">= 2.2.0"])
|
103
103
|
s.add_dependency(%q<mime-types>, [">= 1.16"])
|
104
104
|
s.add_dependency(%q<yui-compressor>, [">= 0.9.6"])
|
105
|
-
s.add_dependency(%q<
|
105
|
+
s.add_dependency(%q<listen>, [">= 0.4.5"])
|
106
|
+
s.add_dependency(%q<rspec>, ["~> 2.10.0"])
|
106
107
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
107
|
-
s.add_dependency(%q<bundler>, ["~> 1.
|
108
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
108
|
+
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
109
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.0"])
|
109
110
|
s.add_dependency(%q<cover_me>, [">= 1.0.0.rc6"])
|
110
|
-
s.add_dependency(%q<fakefs>, ["
|
111
|
-
s.add_dependency(%q<em-http-request>, ["
|
111
|
+
s.add_dependency(%q<fakefs>, ["~> 0.4.0"])
|
112
|
+
s.add_dependency(%q<em-http-request>, ["~> 1.0.0"])
|
112
113
|
end
|
113
114
|
end
|
114
115
|
|
data/spec/slinky_spec.rb
CHANGED
@@ -39,12 +39,12 @@ describe "Slinky" do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should find files in the manifest by path" do
|
42
|
-
@mdevel.find_by_path("test.haml").source.should == "/src/test.haml"
|
43
|
-
@mdevel.find_by_path("asdf.haml").should == nil
|
44
|
-
@mdevel.find_by_path("l1/l2/test.txt").source.should == "/src/l1/l2/test.txt"
|
45
|
-
@mdevel.find_by_path("l1/test.css").source.should == "/src/l1/test.sass"
|
42
|
+
@mdevel.find_by_path("test.haml").first.source.should == "/src/test.haml"
|
43
|
+
@mdevel.find_by_path("asdf.haml").first.should == nil
|
44
|
+
@mdevel.find_by_path("l1/l2/test.txt").first.source.should == "/src/l1/l2/test.txt"
|
45
|
+
@mdevel.find_by_path("l1/test.css").first.source.should == "/src/l1/test.sass"
|
46
46
|
l1 = @mdevel.manifest_dir.children.find{|c| c.dir == "/src/l1"}
|
47
|
-
l1.find_by_path("../test.haml").source.should == "/src/test.haml"
|
47
|
+
l1.find_by_path("../test.haml").first.source.should == "/src/test.haml"
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should produce the correct scripts string for production" do
|
@@ -98,6 +98,7 @@ describe "Slinky" do
|
|
98
98
|
it "should compile files that need it" do
|
99
99
|
$stdout.should_receive(:puts).with("Compiled /src/test.haml".foreground(:green))
|
100
100
|
mf = Slinky::ManifestFile.new("/src/test.haml", "/src/build", @mprod)
|
101
|
+
FileUtils.mkdir("/src/build")
|
101
102
|
build_path = mf.process mf.build_to
|
102
103
|
build_path.to_s.split(".")[-1].should == "html"
|
103
104
|
File.read("/src/test.haml").match("<head>").should == nil
|
@@ -107,6 +108,7 @@ describe "Slinky" do
|
|
107
108
|
mf = Slinky::ManifestFile.new("/src/test.haml", "/src/build", @mprod)
|
108
109
|
build_path = mf.process "/src/build/test.html"
|
109
110
|
File.read("/src/build/test.html").match("<head>").should_not == nil
|
111
|
+
FileUtils.rm_rf("/src/build") rescue nil
|
110
112
|
end
|
111
113
|
|
112
114
|
it "should report errors for bad files" do
|
@@ -194,6 +196,92 @@ describe "Slinky" do
|
|
194
196
|
proc { manifest.dependency_list }.should raise_error Slinky::DependencyError
|
195
197
|
end
|
196
198
|
|
199
|
+
it "should handle depends directives" do
|
200
|
+
File.open("/src/l1/test5.coffee", "w+"){|f| f.write("slinky_depends('test.sass')")}
|
201
|
+
manifest = Slinky::Manifest.new("/src", @config, :devel => true)
|
202
|
+
f = manifest.find_by_path("l1/test5.js").first
|
203
|
+
f.should_not == nil
|
204
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/l1\/test.sass/)
|
205
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/l1\/test5.coffee/)
|
206
|
+
f.process
|
207
|
+
end
|
208
|
+
|
209
|
+
it "should handle depends directives with glob patterns" do
|
210
|
+
File.open("/src/l1/test5.coffee", "w+"){|f| f.write("slinky_depends('*.sass')")}
|
211
|
+
File.open("/src/l1/test2.sass", "w+"){|f| f.write("body\n\tcolor: red")}
|
212
|
+
manifest = Slinky::Manifest.new("/src", @config, :devel => true)
|
213
|
+
f = manifest.find_by_path("l1/test5.js").first
|
214
|
+
f.should_not == nil
|
215
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/l1\/test.sass/)
|
216
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/l1\/test2.sass/)
|
217
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/l1\/test5.coffee/)
|
218
|
+
f.process
|
219
|
+
end
|
220
|
+
|
221
|
+
it "should handle depends directives with infinite loops" do
|
222
|
+
File.open("/src/l1/test5.coffee", "w+"){|f| f.write("slinky_depends('*.sass')")}
|
223
|
+
File.open("/src/l1/test2.sass", "w+"){|f| f.write("/* slinky_depends('*.coffee')")}
|
224
|
+
manifest = Slinky::Manifest.new("/src", @config, :devel => true)
|
225
|
+
f = manifest.find_by_path("l1/test5.js").first
|
226
|
+
f.should_not == nil
|
227
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/l1\/test.sass/)
|
228
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/l1\/test2.sass/)
|
229
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/l1\/test5.coffee/)
|
230
|
+
f.process
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should cache files" do
|
234
|
+
File.open("/src/l1/cache.coffee", "w+"){|f| f.write("() -> 'hello, world!'\n")}
|
235
|
+
manifest = Slinky::Manifest.new("/src", @config, :devel => true)
|
236
|
+
f = manifest.find_by_path("l1/cache.js").first
|
237
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/l1\/cache.coffee/)
|
238
|
+
f.process
|
239
|
+
f.process
|
240
|
+
File.open("/src/l1/cache.coffee", "a"){|f| f.write("() -> 'goodbye, world!'\n")}
|
241
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/l1\/cache.coffee/)
|
242
|
+
f.process
|
243
|
+
end
|
244
|
+
|
245
|
+
it "should handle new directives" do
|
246
|
+
manifest = Slinky::Manifest.new("/src", @config, :devel => true)
|
247
|
+
f = manifest.find_by_path("l1/test.js").first
|
248
|
+
f.process
|
249
|
+
f.directives.should == {:slinky_require=>["test2.js", "l2/test3.js"]}
|
250
|
+
File.open("/src/l1/test.js", "a"){|f| f.write("slinky_require('test5.js')\n")}
|
251
|
+
f.process
|
252
|
+
f.directives.should == {:slinky_require=>["test2.js", "l2/test3.js", "test5.js"]}
|
253
|
+
end
|
254
|
+
|
255
|
+
it "should detect new files" do
|
256
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/test.haml/)
|
257
|
+
manifest = Slinky::Manifest.new("/src", @config, :devel => true)
|
258
|
+
File.open("/src/l1/cache.coffee", "w+"){|f| f.write("console.log 'hello'")}
|
259
|
+
manifest.add_all_by_path(["/src/l1/cache.coffee"])
|
260
|
+
f = manifest.find_by_path("l1/cache.js").first
|
261
|
+
f.should_not == nil
|
262
|
+
manifest.scripts_string.match("cache.js").should_not == nil
|
263
|
+
FileUtils.mkdir("/src/l1/hello")
|
264
|
+
File.open("/src/l1/hello/asdf.sass", "w+"){|f| f.write("hello")}
|
265
|
+
f = manifest.find_by_path("l1/hello/asdf.sass")
|
266
|
+
f.should_not == nil
|
267
|
+
end
|
268
|
+
|
269
|
+
it "should handle deletion of files" do
|
270
|
+
File.open("/src/l1/cache.coffee", "w+"){|f| f.write("console.log 'hello'")}
|
271
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/test.haml/)
|
272
|
+
manifest = Slinky::Manifest.new("/src", @config, :devel => true)
|
273
|
+
f = manifest.find_by_path("l1/cache.coffee").first
|
274
|
+
f.should_not == nil
|
275
|
+
manifest.scripts_string.match("l1/cache.js").should_not == nil
|
276
|
+
|
277
|
+
FileUtils.rm("/src/l1/cache.coffee")
|
278
|
+
File.exists?("/src/l1/cache.coffee").should == false
|
279
|
+
manifest.remove_all_by_path(["/src/l1/cache.coffee"])
|
280
|
+
f = manifest.find_by_path("l1/cache.coffee").first
|
281
|
+
f.should == nil
|
282
|
+
manifest.scripts_string.match("l1/cache.js").should == nil
|
283
|
+
end
|
284
|
+
|
197
285
|
it "should ignore the build directory" do
|
198
286
|
$stdout.should_receive(:puts).with(/Compiled \/src\/.+/).exactly(6).times
|
199
287
|
Slinky::Builder.build("/src", "/src/build", @config)
|
@@ -204,6 +292,7 @@ describe "Slinky" do
|
|
204
292
|
end
|
205
293
|
|
206
294
|
it "should combine and compress javascript" do
|
295
|
+
FileUtils.rm_rf("/build") rescue nil
|
207
296
|
$stdout.should_receive(:puts).with(/Compiled \/src\/.+/).exactly(3).times
|
208
297
|
@mprod.build
|
209
298
|
File.exists?("/build/scripts.js").should == true
|
@@ -281,29 +370,41 @@ describe "Slinky" do
|
|
281
370
|
end
|
282
371
|
end
|
283
372
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
373
|
+
it "should serve files for realz" do
|
374
|
+
$stdout.should_receive(:puts).with(/Started static file server on port 43453/)
|
375
|
+
@results = []
|
376
|
+
File.open("/src/index.haml", "w+"){|f|
|
377
|
+
f.write <<eos
|
378
|
+
!!5
|
379
|
+
%head
|
380
|
+
slinky_scripts
|
381
|
+
slinky_styles
|
382
|
+
%body
|
383
|
+
h1. index
|
384
|
+
eos
|
385
|
+
}
|
386
|
+
run_for 3 do
|
387
|
+
Slinky::Runner.new(["start","--port", "43453", "--src-dir", "/src"]).run
|
388
|
+
base = "http://localhost:43453"
|
389
|
+
multi = EventMachine::MultiRequest.new
|
390
|
+
$stdout.should_receive(:puts).with(/Compiled \/src\/index.haml/)
|
391
|
+
|
392
|
+
# add multiple requests to the multi-handler
|
393
|
+
multi.add(:index, EventMachine::HttpRequest.new("#{base}/index.html").get)
|
394
|
+
multi.add(:base, EventMachine::HttpRequest.new(base).get)
|
395
|
+
multi.callback do
|
396
|
+
rs = [multi.responses[:callback][:index], multi.responses[:callback][:base]]
|
397
|
+
rs.compact.size.should == 2
|
398
|
+
rs.each{|r|
|
399
|
+
r.response.include?("index").should == true
|
400
|
+
}
|
401
|
+
multi.responses[:errback].size.should == 0
|
402
|
+
EM.stop_event_loop
|
403
|
+
end
|
404
|
+
end
|
405
|
+
end
|
306
406
|
end
|
407
|
+
|
307
408
|
context "Builder" do
|
308
409
|
before :each do
|
309
410
|
@compilation_subs = {".sass" => ".css", ".coffee" => ".js", ".haml" => ".html"}
|
data/spec/spec_helper.rb
CHANGED
@@ -17,8 +17,18 @@ module FakeFS
|
|
17
17
|
RealFile.absolute_path(*args)
|
18
18
|
end
|
19
19
|
end
|
20
|
-
end
|
21
20
|
|
21
|
+
# Neccessary to fix a problem between FakeFS and Tempfile
|
22
|
+
class Dir
|
23
|
+
def self.mkdir(string, integer = 0)
|
24
|
+
parent = string.split('/')
|
25
|
+
parent.pop
|
26
|
+
raise Errno::ENOENT, "No such file or directory - #{string}" unless parent.join == "" || parent.join == "." || FileSystem.find(parent.join('/'))
|
27
|
+
raise Errno::EEXIST, "File exists - #{string}" if File.exists?(string)
|
28
|
+
FileUtils.mkdir_p(string)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
22
32
|
|
23
33
|
module Slinky
|
24
34
|
module CoffeeCompiler
|
@@ -29,6 +39,11 @@ module Slinky
|
|
29
39
|
o
|
30
40
|
end
|
31
41
|
end
|
42
|
+
|
43
|
+
# No way to make this work with FakeFS, so just disabled it
|
44
|
+
class Listener
|
45
|
+
def run; end
|
46
|
+
end
|
32
47
|
end
|
33
48
|
|
34
49
|
RSpec.configure do |config|
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slinky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- Micah Wylde
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
16
|
-
requirement: &
|
16
|
+
requirement: &70288588008440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.12.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70288588008440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: eventmachine_httpserver
|
27
|
-
requirement: &
|
27
|
+
requirement: &70288588022920 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,32 +32,32 @@ dependencies:
|
|
32
32
|
version: 0.2.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70288588022920
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: em-proxy
|
38
|
-
requirement: &
|
38
|
+
requirement: &70288588021180 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.1.
|
43
|
+
version: 0.1.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70288588021180
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rainbow
|
49
|
-
requirement: &
|
49
|
+
requirement: &70288588019100 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.1.
|
54
|
+
version: 1.1.3
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70288588019100
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: haml
|
60
|
-
requirement: &
|
60
|
+
requirement: &70288588031920 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 3.0.0
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70288588031920
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sass
|
71
|
-
requirement: &
|
71
|
+
requirement: &70288588029260 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 3.1.1
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70288588029260
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: coffee-script
|
82
|
-
requirement: &
|
82
|
+
requirement: &70288588026700 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 2.2.0
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70288588026700
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: mime-types
|
93
|
-
requirement: &
|
93
|
+
requirement: &70288588025080 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '1.16'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70288588025080
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: yui-compressor
|
104
|
-
requirement: &
|
104
|
+
requirement: &70288588039500 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,21 +109,32 @@ dependencies:
|
|
109
109
|
version: 0.9.6
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70288588039500
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: listen
|
115
|
+
requirement: &70288588035780 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 0.4.5
|
121
|
+
type: :runtime
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70288588035780
|
113
124
|
- !ruby/object:Gem::Dependency
|
114
125
|
name: rspec
|
115
|
-
requirement: &
|
126
|
+
requirement: &70288588032800 !ruby/object:Gem::Requirement
|
116
127
|
none: false
|
117
128
|
requirements:
|
118
129
|
- - ~>
|
119
130
|
- !ruby/object:Gem::Version
|
120
|
-
version: 2.
|
131
|
+
version: 2.10.0
|
121
132
|
type: :development
|
122
133
|
prerelease: false
|
123
|
-
version_requirements: *
|
134
|
+
version_requirements: *70288588032800
|
124
135
|
- !ruby/object:Gem::Dependency
|
125
136
|
name: yard
|
126
|
-
requirement: &
|
137
|
+
requirement: &70288588047820 !ruby/object:Gem::Requirement
|
127
138
|
none: false
|
128
139
|
requirements:
|
129
140
|
- - ~>
|
@@ -131,32 +142,32 @@ dependencies:
|
|
131
142
|
version: 0.6.0
|
132
143
|
type: :development
|
133
144
|
prerelease: false
|
134
|
-
version_requirements: *
|
145
|
+
version_requirements: *70288588047820
|
135
146
|
- !ruby/object:Gem::Dependency
|
136
147
|
name: bundler
|
137
|
-
requirement: &
|
148
|
+
requirement: &70288588056400 !ruby/object:Gem::Requirement
|
138
149
|
none: false
|
139
150
|
requirements:
|
140
151
|
- - ~>
|
141
152
|
- !ruby/object:Gem::Version
|
142
|
-
version: 1.
|
153
|
+
version: 1.1.0
|
143
154
|
type: :development
|
144
155
|
prerelease: false
|
145
|
-
version_requirements: *
|
156
|
+
version_requirements: *70288588056400
|
146
157
|
- !ruby/object:Gem::Dependency
|
147
158
|
name: jeweler
|
148
|
-
requirement: &
|
159
|
+
requirement: &70288588055540 !ruby/object:Gem::Requirement
|
149
160
|
none: false
|
150
161
|
requirements:
|
151
162
|
- - ~>
|
152
163
|
- !ruby/object:Gem::Version
|
153
|
-
version: 1.
|
164
|
+
version: 1.8.0
|
154
165
|
type: :development
|
155
166
|
prerelease: false
|
156
|
-
version_requirements: *
|
167
|
+
version_requirements: *70288588055540
|
157
168
|
- !ruby/object:Gem::Dependency
|
158
169
|
name: cover_me
|
159
|
-
requirement: &
|
170
|
+
requirement: &70288588054760 !ruby/object:Gem::Requirement
|
160
171
|
none: false
|
161
172
|
requirements:
|
162
173
|
- - ! '>='
|
@@ -164,32 +175,32 @@ dependencies:
|
|
164
175
|
version: 1.0.0.rc6
|
165
176
|
type: :development
|
166
177
|
prerelease: false
|
167
|
-
version_requirements: *
|
178
|
+
version_requirements: *70288588054760
|
168
179
|
- !ruby/object:Gem::Dependency
|
169
180
|
name: fakefs
|
170
|
-
requirement: &
|
181
|
+
requirement: &70288588053400 !ruby/object:Gem::Requirement
|
171
182
|
none: false
|
172
183
|
requirements:
|
173
|
-
- -
|
184
|
+
- - ~>
|
174
185
|
- !ruby/object:Gem::Version
|
175
|
-
version:
|
186
|
+
version: 0.4.0
|
176
187
|
type: :development
|
177
188
|
prerelease: false
|
178
|
-
version_requirements: *
|
189
|
+
version_requirements: *70288588053400
|
179
190
|
- !ruby/object:Gem::Dependency
|
180
191
|
name: em-http-request
|
181
|
-
requirement: &
|
192
|
+
requirement: &70288588051060 !ruby/object:Gem::Requirement
|
182
193
|
none: false
|
183
194
|
requirements:
|
184
|
-
- -
|
195
|
+
- - ~>
|
185
196
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
197
|
+
version: 1.0.0
|
187
198
|
type: :development
|
188
199
|
prerelease: false
|
189
|
-
version_requirements: *
|
190
|
-
description: A static file server for rich
|
191
|
-
|
192
|
-
email:
|
200
|
+
version_requirements: *70288588051060
|
201
|
+
description: A static file server for rich web apps that automatically compiles SASS,
|
202
|
+
HAML, CoffeeScript and more
|
203
|
+
email: micah@micahw.com
|
193
204
|
executables:
|
194
205
|
- slinky
|
195
206
|
extensions: []
|
@@ -199,6 +210,7 @@ extra_rdoc_files:
|
|
199
210
|
files:
|
200
211
|
- .document
|
201
212
|
- .rspec
|
213
|
+
- .travis.yml
|
202
214
|
- Gemfile
|
203
215
|
- LICENSE.txt
|
204
216
|
- README.md
|
@@ -215,6 +227,7 @@ files:
|
|
215
227
|
- lib/slinky/compilers/sass-compiler.rb
|
216
228
|
- lib/slinky/config_reader.rb
|
217
229
|
- lib/slinky/em-popen3.rb
|
230
|
+
- lib/slinky/listener.rb
|
218
231
|
- lib/slinky/manifest.rb
|
219
232
|
- lib/slinky/proxy_server.rb
|
220
233
|
- lib/slinky/runner.rb
|
@@ -222,7 +235,7 @@ files:
|
|
222
235
|
- slinky.gemspec
|
223
236
|
- spec/slinky_spec.rb
|
224
237
|
- spec/spec_helper.rb
|
225
|
-
homepage: http://github.com/
|
238
|
+
homepage: http://mwylde.github.com/slinky/
|
226
239
|
licenses:
|
227
240
|
- MIT
|
228
241
|
post_install_message:
|
@@ -237,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
237
250
|
version: '0'
|
238
251
|
segments:
|
239
252
|
- 0
|
240
|
-
hash:
|
253
|
+
hash: -2592602911110738570
|
241
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
255
|
none: false
|
243
256
|
requirements:
|
@@ -246,10 +259,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
259
|
version: '0'
|
247
260
|
requirements: []
|
248
261
|
rubyforge_project:
|
249
|
-
rubygems_version: 1.8.
|
262
|
+
rubygems_version: 1.8.10
|
250
263
|
signing_key:
|
251
264
|
specification_version: 3
|
252
265
|
summary: Static file server for javascript apps
|
253
|
-
test_files:
|
254
|
-
- spec/slinky_spec.rb
|
255
|
-
- spec/spec_helper.rb
|
266
|
+
test_files: []
|