icwot 0.2.0 → 0.2.1
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 +4 -4
- data/Rakefile +1 -0
- data/bin/icwot +12 -7
- data/lib/icwot.rb +2 -0
- data/lib/icwot/client.rb +3 -0
- data/lib/icwot/console.rb +2 -2
- data/lib/icwot/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d23bec7c4b1456f3d7ff8498f33c0ee9dda51db2
|
4
|
+
data.tar.gz: 58e231a3bc652d93b47c27a9914e507758f88140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 053c2b0d3dacb57e190d23a856ac2eca9368a6c7505ef3e4e98f52cd2e3ecf2cc24f14615ae8a8474be5346c2ae8d8a14837c164ff3d5a06caf4d267c8254797
|
7
|
+
data.tar.gz: d3cadbfa43dc070434bf20b18a6f2ccb201c13199b637cd415104b421d04e60cdd437fdf86e3286b508e42ca6c9726c1496b061fbba6e2d8aaaa1a5abd02328c
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/icwot
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# A simple tool to run server on the client side
|
4
|
-
|
5
|
-
require 'socket'
|
6
|
-
require 'timeout'
|
7
|
-
require 'rest-client'
|
8
|
-
require 'json'
|
9
4
|
require 'icwot'
|
10
5
|
require 'icwot/client'
|
11
6
|
require 'icwot/console'
|
7
|
+
require 'rest-client'
|
12
8
|
|
13
9
|
console = Console.new
|
14
10
|
|
@@ -24,8 +20,17 @@ end
|
|
24
20
|
|
25
21
|
client = Client.new(port: console.port, content_type: console.produces)
|
26
22
|
|
27
|
-
|
23
|
+
begin
|
24
|
+
response = RestClient.post console.url, client.to_s, console.header
|
25
|
+
rescue RestClient::Exception => e
|
26
|
+
puts "Error #{e.response.code} while contacting the host. The url is: '#{console.url}'"
|
27
|
+
exit 0
|
28
|
+
rescue Errno::ECONNREFUSED => e
|
29
|
+
puts "Connection refused. The url is: '#{console.url}'"
|
30
|
+
exit 0
|
31
|
+
end
|
28
32
|
|
29
|
-
#TODO handle
|
33
|
+
#TODO handle the case when the response of the host is not correct
|
34
|
+
puts "The response server: '#{response}' with code #{response.code}"
|
30
35
|
|
31
36
|
Icwot.run(console.port, console.log_path)
|
data/lib/icwot.rb
CHANGED
data/lib/icwot/client.rb
CHANGED
data/lib/icwot/console.rb
CHANGED
@@ -27,7 +27,7 @@ class Console
|
|
27
27
|
-a the accept value for the header text/plain by default
|
28
28
|
-p the port where to run the server
|
29
29
|
-t the protocol to use http:// by default
|
30
|
-
-
|
30
|
+
-o where to save the log. By default your-home-directory/log/icwot-{port}-msg.log
|
31
31
|
host is where to register for the service.
|
32
32
|
'
|
33
33
|
exit 0
|
@@ -43,7 +43,7 @@ class Console
|
|
43
43
|
unless (temp = ARGV.delete_at(index + 1)).nil?
|
44
44
|
@protocol = temp
|
45
45
|
end
|
46
|
-
when '-
|
46
|
+
when '-o'
|
47
47
|
@log_path = ARGV.delete_at index + 1
|
48
48
|
else
|
49
49
|
@host += a
|
data/lib/icwot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icwot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- leo
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- Gemfile
|
108
108
|
- LICENSE.txt
|
109
109
|
- README.md
|
110
|
+
- Rakefile
|
110
111
|
- bin/icwot
|
111
112
|
- icwot.gemspec
|
112
113
|
- lib/icwot.rb
|