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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/simple_respond +11 -17
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3713a43a4f1bcb2eb8cabb1b726213f9ffe4b1d5
4
- data.tar.gz: 2dcf726d366920887c425b67e8d81f7d23b8fb28
3
+ metadata.gz: 254c351b2cb5b677e4e6d236f1b810990983e368
4
+ data.tar.gz: d3135db8fd03b0282aa8904ba4faa5ad0d95ef0d
5
5
  SHA512:
6
- metadata.gz: 6f8b42242c95a2b85ed6d0e627154ba21103487e0811d33a30dfdc6e20673b14de85e45a42ef287e8cfbeb359feedc7052823be99fdd5a4be045bb5e9b777d41
7
- data.tar.gz: 6165665defd8950194a7cb1287fc8288eba7c36c50459452800abb567d1d9181df8f86d731d271da4c549589155273a9b81e93569ebddd731a6fea479a37ed1b
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
- 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
5
+ if ARGV.length != 2 then
6
+ puts 'USAGE: simple_respond <port> <JSON file>'
7
+ Kernel.exit(1)
8
+ end
14
9
 
15
- get '*' do
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!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_respond
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill Laboon