simple_respond 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19bc63b901ef64881d4ab4a1794c7937d7db17c7
4
- data.tar.gz: cfb1e748e9da5852e191255e46cde9a8193fbf7d
3
+ metadata.gz: 5969d5dba35af2b60d4669970edac2d365904e14
4
+ data.tar.gz: cd99e106e74f2f230a685788002904945e22b752
5
5
  SHA512:
6
- metadata.gz: 23378b3a73f61cb6133a4458550377efcb89e64f8f5e7bae34ecf8bc052f79b353064ba27660d7ecf2e09f803a0146bbdb8796ec1ef01339974fb8dcfdd73e5e
7
- data.tar.gz: 9448bd01c111a7c51ebcd46a844a338e5917b0dc0bb7ba4b1ec26d1171e9df5e5189547affa8077bb9e3f553c514849e15c2bcf6cc055d9409d7cab6c64cccfe
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
- system "ruby ./lib/simple_respond.rb #{ARGV[0]} #{ARGV[1]}"
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!
@@ -1,20 +1,22 @@
1
1
  require 'sinatra'
2
2
 
3
- if ARGV.length != 2
4
- STDERR.puts "Usage: simple_respond <port> <JSON file>"
5
- Kernel.exit(1)
6
- end
3
+ class SimpleRespond < Sinatra::Base
4
+
5
+ port = ARGV[0]
6
+ port ||= 80
7
7
 
8
- port = ARGV[0]
9
- port ||= 80
8
+ response_file = ARGV[1]
9
+ response_file ||= 'response.json'
10
10
 
11
- response_file = ARGV[1]
12
- response_file ||= 'response.json'
11
+ set :port, port
13
12
 
14
- set :port, port
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!
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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill Laboon