simple_respond 0.0.1 → 0.0.2
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 +22 -1
- data/lib/simple_respond.rb +15 -13
- 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: 5969d5dba35af2b60d4669970edac2d365904e14
|
4
|
+
data.tar.gz: cd99e106e74f2f230a685788002904945e22b752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 159053bc1c410cde7f9347c62db87acd95746319a6f9819eff4803b930b4146735c5fa370d84fb9f74075af88966829255040d6031978a4d998be50e75347a97
|
7
|
+
data.tar.gz: acce6ae0e257fe00c148ea7b1aece5201b784c989d4ecffd5d5b2ce9b5feaaa73fa80b9b111a4e752db6135b37126bbe3d29c7b3561a4c410edab9ce9bf02b00
|
data/bin/simple_respond
CHANGED
@@ -1,3 +1,24 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
require 'sinatra'
|
4
|
+
|
5
|
+
port = ARGV[0]
|
6
|
+
port ||= 80
|
7
|
+
|
8
|
+
response_file = ARGV[1]
|
9
|
+
response_file ||= 'response.json'
|
10
|
+
|
11
|
+
class SimpleRespond < Sinatra::Base
|
12
|
+
|
13
|
+
set :port, port
|
14
|
+
|
15
|
+
get '*' do
|
16
|
+
content_type :json
|
17
|
+
puts "Responding with #{response_file}"
|
18
|
+
File.read(response_file)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
puts "Responding with #{response_file} on port #{port}"
|
24
|
+
SimpleRespond.run!
|
data/lib/simple_respond.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
require 'sinatra'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
class SimpleRespond < Sinatra::Base
|
4
|
+
|
5
|
+
port = ARGV[0]
|
6
|
+
port ||= 80
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
response_file = ARGV[1]
|
9
|
+
response_file ||= 'response.json'
|
10
10
|
|
11
|
-
|
12
|
-
response_file ||= 'response.json'
|
11
|
+
set :port, port
|
13
12
|
|
14
|
-
|
13
|
+
get '*' do
|
14
|
+
content_type :json
|
15
|
+
puts "Responding with #{response_file}"
|
16
|
+
File.read(response_file)
|
17
|
+
end
|
15
18
|
|
16
|
-
get '*' do
|
17
|
-
content_type :json
|
18
|
-
puts "Responding with #{response_file}"
|
19
|
-
File.read(response_file)
|
20
19
|
end
|
20
|
+
|
21
|
+
puts "Hello, you're running your web app from a gem!"
|
22
|
+
SimpleRespond.run!
|