icwot 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d23bec7c4b1456f3d7ff8498f33c0ee9dda51db2
4
- data.tar.gz: 58e231a3bc652d93b47c27a9914e507758f88140
3
+ metadata.gz: 9748124ee09d8751db32f73b2f49c64ed8bbf047
4
+ data.tar.gz: 1b0ed9c7114b9c2c2ce31f8e5109e6bfd8cd5110
5
5
  SHA512:
6
- metadata.gz: 053c2b0d3dacb57e190d23a856ac2eca9368a6c7505ef3e4e98f52cd2e3ecf2cc24f14615ae8a8474be5346c2ae8d8a14837c164ff3d5a06caf4d267c8254797
7
- data.tar.gz: d3cadbfa43dc070434bf20b18a6f2ccb201c13199b637cd415104b421d04e60cdd437fdf86e3286b508e42ca6c9726c1496b061fbba6e2d8aaaa1a5abd02328c
6
+ metadata.gz: f00d11625ac678564c01ad1485d581e1cb3795bdc9b57db7afb4ad12be65e5a4c578bd0a52cdd432434003f30b61e95cb3514b880812e3881effa57e0be89afb
7
+ data.tar.gz: 805d0bf9d9df6c6823f3ded793173862ce804d664b92593e706251efeb2f2005ea77e31af2eac456f7afba6cbd04b7ef10409c7d49975b5ec925fe78a7a31921
data/bin/icwot CHANGED
@@ -19,9 +19,10 @@ if Icwot.is_port_open?('localhost', console.port)
19
19
  end
20
20
 
21
21
  client = Client.new(port: console.port, content_type: console.produces)
22
+ console.host_url = client.uri
22
23
 
23
24
  begin
24
- response = RestClient.post console.url, client.to_s, console.header
25
+ response = RestClient.put console.url, client.to_s, console.header
25
26
  rescue RestClient::Exception => e
26
27
  puts "Error #{e.response.code} while contacting the host. The url is: '#{console.url}'"
27
28
  exit 0
@@ -32,5 +33,9 @@ end
32
33
 
33
34
  #TODO handle the case when the response of the host is not correct
34
35
  puts "The response server: '#{response}' with code #{response.code}"
35
-
36
- Icwot.run(console.port, console.log_path)
36
+ begin
37
+ app = Icwot.run(console.port, console.log_path)
38
+ rescue Interrupt => e
39
+ RestClient.delete console.url
40
+ app.quit!
41
+ end
data/lib/icwot.rb CHANGED
@@ -9,6 +9,7 @@ module Icwot
9
9
  app.settings.port = port
10
10
  app.settings.log_path = log_path
11
11
  app.settings.run!
12
+ app
12
13
  end
13
14
 
14
15
  # determine if a port is used or not
data/lib/icwot/client.rb CHANGED
@@ -7,7 +7,7 @@ class Client
7
7
  def initialize(options = {})
8
8
  @content_type = options[:content_type] || 'application/json'
9
9
  @uri = options[:uri]
10
- @port = options[:port]
10
+ @port = options[:port] || '4567'
11
11
  end
12
12
 
13
13
  def uri
data/lib/icwot/console.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  class Console
2
2
 
3
3
  attr_reader :produces, :accept, :port, :host, :protocol, :log_path, :errors
4
+ attr_accessor :host_url
4
5
 
5
6
  def initialize
6
7
  @produces = 'application/json'
@@ -53,7 +54,9 @@ class Console
53
54
  end
54
55
 
55
56
  def url
56
- protocol+host
57
+ base_uri = protocol+host
58
+ base_uri += '/' unless base_uri[-1] == '/'
59
+ base_uri + host_url
57
60
  end
58
61
 
59
62
  def header
data/lib/icwot/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Icwot
2
2
  def self.version
3
- '0.2.1'
3
+ '0.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icwot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - leo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-05 00:00:00.000000000 Z
11
+ date: 2014-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake