spade 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spade/server.rb +14 -3
- data/lib/spade/version.rb +1 -1
- data/package.json +1 -1
- data/spade.gemspec +1 -0
- metadata +17 -6
data/lib/spade/server.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rack'
|
2
2
|
require 'rack/static'
|
3
3
|
require 'tempfile'
|
4
|
+
require 'child_labor'
|
4
5
|
|
5
6
|
module Spade
|
6
7
|
module Server
|
@@ -8,7 +9,7 @@ module Spade
|
|
8
9
|
rootdir = Spade.discover_root(working)
|
9
10
|
static = Rack::Static.new(nil, :urls => ['/'], :root => rootdir)
|
10
11
|
static = CommandRunner.new(static)
|
11
|
-
static = Rack::ShowStatus.new(Rack::ShowExceptions.new(static))
|
12
|
+
static = Rack::ShowStatus.new(Rack::ShowExceptions.new(Rack::Chunked.new(Rack::ContentLength.new(static))))
|
12
13
|
|
13
14
|
Rack::Handler::WEBrick.run static, :Port => port.to_i
|
14
15
|
end
|
@@ -39,12 +40,22 @@ module Spade
|
|
39
40
|
tempfile.write(params['code'])
|
40
41
|
tempfile.close
|
41
42
|
|
43
|
+
|
42
44
|
puts "Running: #{command_path}"
|
43
|
-
|
45
|
+
|
46
|
+
output, error = nil
|
47
|
+
process = ChildLabor.subprocess("#{command_path} < #{tempfile.path}") do |p|
|
48
|
+
output = p.read
|
49
|
+
error = p.read_stderr
|
50
|
+
end
|
44
51
|
|
45
52
|
tempfile.delete
|
46
53
|
|
47
|
-
|
54
|
+
if process.exit_status == 0
|
55
|
+
[200, {}, output]
|
56
|
+
else
|
57
|
+
[500, {}, error]
|
58
|
+
end
|
48
59
|
else
|
49
60
|
@app.call(env)
|
50
61
|
end
|
data/lib/spade/version.rb
CHANGED
data/package.json
CHANGED
data/spade.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_dependency "json_pure", "~> 1.4.6"
|
25
25
|
s.add_dependency "rack", "~> 1.2.1"
|
26
26
|
s.add_dependency "thor", "~> 0.14.3"
|
27
|
+
s.add_dependency "childlabor", "~> 0.0.3"
|
27
28
|
s.add_dependency "therubyracer", "~> 0.8.0" if mri
|
28
29
|
|
29
30
|
s.add_development_dependency "rspec"
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: spade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Charles Jolley
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-06 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: gemcutter
|
@@ -79,27 +79,38 @@ dependencies:
|
|
79
79
|
type: :runtime
|
80
80
|
version_requirements: *id006
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
82
|
+
name: childlabor
|
83
83
|
prerelease: false
|
84
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.0.3
|
90
90
|
type: :runtime
|
91
91
|
version_requirements: *id007
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
|
-
name:
|
93
|
+
name: therubyracer
|
94
94
|
prerelease: false
|
95
95
|
requirement: &id008 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ~>
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 0.8.0
|
101
|
+
type: :runtime
|
102
|
+
version_requirements: *id008
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: rspec
|
105
|
+
prerelease: false
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
96
107
|
none: false
|
97
108
|
requirements:
|
98
109
|
- - ">="
|
99
110
|
- !ruby/object:Gem::Version
|
100
111
|
version: "0"
|
101
112
|
type: :development
|
102
|
-
version_requirements: *
|
113
|
+
version_requirements: *id009
|
103
114
|
description: Unified JavaScript runner for browser and command line
|
104
115
|
email:
|
105
116
|
- charles@sproutcore.com
|