simple_respond 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/simple_respond +11 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 254c351b2cb5b677e4e6d236f1b810990983e368
|
4
|
+
data.tar.gz: d3135db8fd03b0282aa8904ba4faa5ad0d95ef0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a4ed3561c60d8b5dfdee47ddb0bae89f619c408f47f4bf2484a2d7612ea740210a99ba9ee35a16737e7fa679564d9b7e90ecd66773b0ec8ac764f27d2960905
|
7
|
+
data.tar.gz: 32cfdfed2ddbc1ca7000e0254e8f3d9c5171ef9c504a556a2f3eaf89715ceab66620851827af78ad9685871dd1129891919ce66ebb4371fee8ad1e751cfdf52c
|
data/bin/simple_respond
CHANGED
@@ -2,23 +2,17 @@
|
|
2
2
|
|
3
3
|
require 'sinatra'
|
4
4
|
|
5
|
-
|
6
|
-
port
|
7
|
-
|
8
|
-
|
9
|
-
response_file ||= 'response.json'
|
10
|
-
|
11
|
-
class SimpleRespond < Sinatra::Base
|
12
|
-
|
13
|
-
set :port, port
|
5
|
+
if ARGV.length != 2 then
|
6
|
+
puts 'USAGE: simple_respond <port> <JSON file>'
|
7
|
+
Kernel.exit(1)
|
8
|
+
end
|
14
9
|
|
15
|
-
|
16
|
-
content_type :json
|
17
|
-
puts "Responding with #{response_file}"
|
18
|
-
File.read(response_file)
|
19
|
-
end
|
10
|
+
set :port, ARGV[0]
|
20
11
|
|
12
|
+
get '*' do
|
13
|
+
content_type :json
|
14
|
+
response = ARGV[1]
|
15
|
+
response ||= 'response.json'
|
16
|
+
puts "Responding with #{response}"
|
17
|
+
File.read(response)
|
21
18
|
end
|
22
|
-
|
23
|
-
puts "Responding with #{response_file} on port #{port}"
|
24
|
-
SimpleRespond.run!
|