oaf 0.3.1 → 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 +6 -14
- data/bin/oaf +0 -21
- data/lib/oaf.rb +0 -22
- data/lib/oaf/httphandler.rb +1 -23
- data/lib/oaf/httpserver.rb +0 -22
- data/lib/oaf/util.rb +22 -28
- data/lib/oaf/version.rb +1 -23
- data/spec/oaf/http_spec.rb +35 -24
- data/spec/oaf/util_spec.rb +20 -22
- data/spec/spec_helper.rb +1 -0
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
OWQ0NzRhMGJiYjYxNGQxNmJmNjFmZTBiMDRhODc4NmU0ZDFjNGQyZTExZDI2
|
10
|
-
ZjJhMDkyM2NkMGRhZmU0NzZmYWY2M2IwYjM1NzI2YmQ3NWJkMzc1MzJiMjk5
|
11
|
-
NzQwYmJiMjMyN2I0NzJlOWRkMDU3ZjRiYmRhZDA4MDk3NGNjYWE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YWVmMzQ5NWE1M2FiYzQ4YmQyM2E3YjdjMjkyOWZiMDkxMDJiMDA1NGI2YWU1
|
14
|
-
NTg0ODdlZGU0NTQ1NTljNjU5MGE2NjMwZGY0MTNjOTY4NDdkZmZiYjJmYjYx
|
15
|
-
MGVkMDZkMTg0MTlhMWYxZTUzMWI3YjMxMDJhY2M1ODM0MTdjZjM=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 720ac500bd3afa837043ed6adff3b3e57d9e75a9
|
4
|
+
data.tar.gz: e3b3c50d97dd65860a2793ccb41db1ab80de1a79
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b282c4c90f970cbdd35d0cde3d0491687e9b66f1536eb4d0bf296dc319d7a6c8343b06b2d3502c02ec76b9fa24784f20e28790dd2dec322f85be8b233f7da4d1
|
7
|
+
data.tar.gz: d89e72758ca3113af24fe337ce8aa4e870ce5095fb52c3f71ba1048bd7450b21d008805412763e05bf86b365d3854c65627efc4c9d3171ecbe485d7e941e288c
|
data/bin/oaf
CHANGED
@@ -1,25 +1,4 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
# oaf - Care-free web app prototyping using files and scripts
|
3
|
-
# Copyright 2013 Ryan Uber <ru@ryanuber.com>
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
# a copy of this software and associated documentation files (the
|
7
|
-
# "Software"), to deal in the Software without restriction, including
|
8
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
# the following conditions:
|
12
|
-
#
|
13
|
-
# The above copyright notice and this permission notice shall be
|
14
|
-
# included in all copies or substantial portions of the Software.
|
15
|
-
#
|
16
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
2
|
|
24
3
|
require 'optparse'
|
25
4
|
require 'oaf'
|
data/lib/oaf.rb
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
# oaf - Care-free web app prototyping using files and scripts
|
2
|
-
# Copyright 2013 Ryan Uber <ru@ryanuber.com>
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
1
|
require 'oaf/version'
|
24
2
|
require 'oaf/util'
|
25
3
|
require 'oaf/httphandler'
|
data/lib/oaf/httphandler.rb
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
# oaf - Care-free web app prototyping using files and scripts
|
2
|
-
# Copyright 2013 Ryan Uber <ru@ryanuber.com>
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
1
|
require 'oaf/util'
|
24
2
|
require 'oaf/httpserver'
|
25
3
|
require 'webrick'
|
@@ -35,7 +13,7 @@ module Oaf
|
|
35
13
|
# Remove the predefined WEBrick methods. WEBrick comes with some defaults
|
36
14
|
# for GET, POST, OPTIONS, and HEAD, but let's use our own instead.
|
37
15
|
instance_methods.each do |method|
|
38
|
-
undef_method method if method.to_s =~ /^do_[A-Z]
|
16
|
+
undef_method method if method.to_s =~ /^do_[A-Z]+$/
|
39
17
|
end
|
40
18
|
|
41
19
|
# Creates a new abstract server object and allows passing in the root
|
data/lib/oaf/httpserver.rb
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
# oaf - Care-free web app prototyping using files and scripts
|
2
|
-
# Copyright 2013 Ryan Uber <ru@ryanuber.com>
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
1
|
require 'oaf/util'
|
24
2
|
require 'oaf/httphandler'
|
25
3
|
require 'webrick'
|
data/lib/oaf/util.rb
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
# oaf - Care-free web app prototyping using files and scripts
|
2
|
-
# Copyright 2013 Ryan Uber <ru@ryanuber.com>
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
1
|
module Oaf::Util
|
24
2
|
extend self
|
25
3
|
|
@@ -231,11 +209,20 @@ module Oaf::Util
|
|
231
209
|
# The path to a file to use, or `nil` if none is found.
|
232
210
|
#
|
233
211
|
def get_request_file root, req_path, method
|
234
|
-
|
212
|
+
path = File.join root, req_path
|
213
|
+
file = "#{path}.#{method}"
|
214
|
+
|
235
215
|
if not File.exist? file
|
236
|
-
|
237
|
-
|
238
|
-
|
216
|
+
if File.directory? path
|
217
|
+
Dir.glob(File.join(path, "_*_.#{method}")).each do |f|
|
218
|
+
file = f
|
219
|
+
break
|
220
|
+
end
|
221
|
+
else
|
222
|
+
Dir.glob(File.join(File.dirname(file), "_*_.#{method}")).each do |f|
|
223
|
+
file = f
|
224
|
+
break
|
225
|
+
end
|
239
226
|
end
|
240
227
|
end
|
241
228
|
File.exist?(file) ? file : nil
|
@@ -247,6 +234,8 @@ module Oaf::Util
|
|
247
234
|
# the hard way to maintain compatibility with older rubies.
|
248
235
|
#
|
249
236
|
# == Parameters:
|
237
|
+
# path::
|
238
|
+
# The base path where the script file exists
|
250
239
|
# env::
|
251
240
|
# The environment data to use in the subprocess.
|
252
241
|
# command::
|
@@ -255,7 +244,12 @@ module Oaf::Util
|
|
255
244
|
# == Returns:
|
256
245
|
# A string of stderr concatenated to stdout.
|
257
246
|
#
|
258
|
-
def run_buffered env, command
|
247
|
+
def run_buffered path, env, command
|
248
|
+
begin
|
249
|
+
Dir.chdir path
|
250
|
+
rescue Errno::ENOENT => e
|
251
|
+
return e.message
|
252
|
+
end
|
259
253
|
out, wout = IO.pipe
|
260
254
|
pid = fork do
|
261
255
|
out.close
|
@@ -291,7 +285,7 @@ module Oaf::Util
|
|
291
285
|
out = Oaf::Util.get_default_response
|
292
286
|
elsif File.executable? file
|
293
287
|
env = Oaf::Util.prepare_environment req_path, headers, params, body
|
294
|
-
out = Oaf::Util.run_buffered env, file
|
288
|
+
out = Oaf::Util.run_buffered File.dirname(file), env, file
|
295
289
|
else
|
296
290
|
out = File.open(file).read
|
297
291
|
end
|
data/lib/oaf/version.rb
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
# oaf - Care-free web app prototyping using files and scripts
|
2
|
-
# Copyright 2013 Ryan Uber <ru@ryanuber.com>
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
1
|
module Oaf
|
24
|
-
VERSION = '0.
|
2
|
+
VERSION = '0.4.0'
|
25
3
|
end
|
data/spec/oaf/http_spec.rb
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
# oaf - Care-free web app prototyping using files and scripts
|
2
|
-
# Copyright 2013 Ryan Uber <ru@ryanuber.com>
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
1
|
require 'spec_helper'
|
24
2
|
|
25
3
|
module Oaf
|
@@ -77,12 +55,29 @@ module Oaf
|
|
77
55
|
@f2.write "Containable Test\n---\n202\nx-powered-by: oaf"
|
78
56
|
@f2.close
|
79
57
|
@f2request = File.basename(@f2.path).sub!(/\.PUT$/, '')
|
58
|
+
|
59
|
+
@tempdir2 = Dir.mktmpdir
|
60
|
+
Dir.mkdir File.join(@tempdir2, 'sub')
|
61
|
+
@f3 = File.new File.join(@tempdir2, 'sub', '_default_.GET'), 'w'
|
62
|
+
@f3.write "Directory wins"
|
63
|
+
@f3.close
|
64
|
+
@f3request = 'sub'
|
65
|
+
|
66
|
+
@tempdir3 = Dir.mktmpdir
|
67
|
+
@f4 = File.new File.join(@tempdir3, 'sub.GET'), 'w'
|
68
|
+
@f4.write "File wins"
|
69
|
+
@f4.close
|
70
|
+
@f4request = 'sub'
|
71
|
+
Dir.mkdir File.join(@tempdir3, 'sub')
|
72
|
+
f5 = File.new File.join(@tempdir3, 'sub', '_default_.GET'), 'w'
|
73
|
+
f5.write "Directory wins"
|
74
|
+
f5.close
|
80
75
|
end
|
81
76
|
|
82
77
|
after(:all) do
|
83
|
-
@f1.delete
|
84
78
|
@f2.delete
|
85
|
-
|
79
|
+
FileUtils.rm_rf @tempdir1
|
80
|
+
FileUtils.rm_rf @tempdir2
|
86
81
|
end
|
87
82
|
|
88
83
|
it "should start an HTTP server" do
|
@@ -138,5 +133,21 @@ module Oaf
|
|
138
133
|
handler.do_HEAD(req, res)
|
139
134
|
handler.do_OPTIONS(req, res)
|
140
135
|
end
|
136
|
+
|
137
|
+
it "should use directory default if no higher-level script exists" do
|
138
|
+
req = Oaf::FakeReq.new :path => @f3request
|
139
|
+
res = Oaf::FakeRes.new
|
140
|
+
handler = Oaf::HTTPHandler.new Oaf::FakeServlet.new, @tempdir2
|
141
|
+
handler.process_request req, res
|
142
|
+
res.body.should eq("Directory wins\n")
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should use a file if present with a similarly-named directory" do
|
146
|
+
req = Oaf::FakeReq.new :path => @f4request
|
147
|
+
res = Oaf::FakeRes.new
|
148
|
+
handler = Oaf::HTTPHandler.new Oaf::FakeServlet.new, @tempdir3
|
149
|
+
handler.process_request req, res
|
150
|
+
res.body.should eq("File wins\n")
|
151
|
+
end
|
141
152
|
end
|
142
153
|
end
|
data/spec/oaf/util_spec.rb
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
# oaf - Care-free web app prototyping using files and scripts
|
2
|
-
# Copyright 2013 Ryan Uber <ru@ryanuber.com>
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
1
|
require 'spec_helper'
|
24
2
|
|
25
3
|
module Oaf
|
@@ -223,6 +201,14 @@ module Oaf
|
|
223
201
|
"echo \"$oaf_param_myparam\"\necho \"$oaf_request_body\"\n" +
|
224
202
|
"echo \"$oaf_request_path\""
|
225
203
|
@f4.close
|
204
|
+
|
205
|
+
@tempdir1 = Dir.mktmpdir
|
206
|
+
@tempdir2 = File.join @tempdir1, 'sub'
|
207
|
+
Dir.mkdir @tempdir2
|
208
|
+
@f5 = Tempfile.new 'oaf', @tempdir2
|
209
|
+
@f5.chmod 0755
|
210
|
+
@f5.write "#!/bin/bash\npwd"
|
211
|
+
@f5.close
|
226
212
|
end
|
227
213
|
|
228
214
|
after(:all) do
|
@@ -261,5 +247,17 @@ module Oaf
|
|
261
247
|
result.should eq("#{headers['x-powered-by']}\n#{params['myparam']}\n" +
|
262
248
|
"#{body}\n#{path}\n")
|
263
249
|
end
|
250
|
+
|
251
|
+
it "should chdir to the directory containing the script" do
|
252
|
+
result = Oaf::Util.get_output @f5.path
|
253
|
+
# If the temp dir is a symlink, we don't know about that here. Just
|
254
|
+
# compare the basename instead.
|
255
|
+
File.basename(result).should eq("#{File.basename(@tempdir2)}\n")
|
256
|
+
end
|
257
|
+
|
258
|
+
it "should error if the passed path does not exist" do
|
259
|
+
result = Oaf::Util.run_buffered '/nonexistent', {}, ''
|
260
|
+
result.should eq("No such file or directory - /nonexistent")
|
261
|
+
end
|
264
262
|
end
|
265
263
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Uber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: coveralls
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Care-free web app prototyping using files and scripts
|
@@ -93,17 +93,17 @@ require_paths:
|
|
93
93
|
- lib
|
94
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - '>='
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '1.8'
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.0.
|
106
|
+
rubygems_version: 2.0.3
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: Web app prototyping
|