spurious 0.2.3 → 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: 25242e746da3686b044a4fd8ccec447ac091d59e
4
- data.tar.gz: 3456cf99bf6fc61f4e3f7ebc7124512a2312c34b
3
+ metadata.gz: 7270ed8a81a8fe9b5984c50cd9937c9e8d0c4e67
4
+ data.tar.gz: 737f429e662bc5f739a8665c3f758bbe7129ed95
5
5
  SHA512:
6
- metadata.gz: 870688510a18a3706d4e503f71570c8439c4be57efd85a73dfa6ab3b2cd41321adba2dc80f75cd692b72b9033b707421bebc277a2e44fe8a1475ad117a00991f
7
- data.tar.gz: 6f4333f739bbf498a5cf0da27c57037969a1eb548fc36e8d9eef4ca2787de0bff2302b22834afe6d974de90136c67c1990cbfc79aead011fdd0222d95f8694c5
6
+ metadata.gz: e7b8de0f2bd5a3b8e13161c60659f898c37fccd113ebc5f9b90af7373824a0c9c83f012cb5f035082bf75797206e4f3b5fdd25d07260c868ec50668e5dfbbb6e
7
+ data.tar.gz: 54de9fee9c573592941ecf1b6b11b0e58fe60a1c8ba247d4c8276142816b4c1b8f53cb922238d6b8665d1e74be042ab538d89b6b16261fdf008fdd03cef29047
data/README.md CHANGED
@@ -31,8 +31,7 @@ Spurious works on the following platforms:
31
31
 
32
32
  * OSX
33
33
  * Windows
34
-
35
- > Support for linux will be available shortly.
34
+ * Linux
36
35
 
37
36
  ### Dependencies
38
37
 
@@ -154,6 +153,20 @@ spurious ports
154
153
  that returns the list of host and port details for each of the spurious containers. If you pass the flag --json you'll
155
154
  get the result back as a JSON string so you can then parse this and use it to automatically configure your chosen method of working with AWS.
156
155
 
156
+ ### Debug mode
157
+
158
+ To enable debug output when running spurious, either use the command line argument:
159
+
160
+ ```bash
161
+ spurious init --debug-mode=true
162
+ ```
163
+
164
+ or set the env variable:
165
+
166
+ ```bash
167
+ SPURIOUS_DEBUG=true spurious init
168
+ ```
169
+
157
170
  ### SDK Helpers
158
171
 
159
172
  Once the containers are running you'll need to wire up the SDK to point to the correct endpoints and port numbers. Here's
data/lib/spurious/app.rb CHANGED
@@ -12,6 +12,7 @@ module Spurious
12
12
 
13
13
  class_option :server_port, :type => :string, :default => ENV.fetch('SPURIOUS_SERVER_PORT', 4590), :desc => "The port of spurious server"
14
14
  class_option :server_ip, :type => :string, :default => ENV.fetch('SPURIOUS_SERVER_IP', 'localhost'), :desc => "The ip address of spurious server"
15
+ class_option :debug_mode, :type => :string, :default => ENV.fetch('SPURIOUS_DEBUG', false), :desc => "More verbose output from the spurious server"
15
16
  def initialize(*args)
16
17
  super
17
18
  end
@@ -19,6 +19,11 @@ module Spurious
19
19
  end
20
20
  end
21
21
 
22
+ if data.length == 0
23
+ app.say "[error] Spurious services haven't been started, please run 'spurious start'", :red
24
+ close_connection
25
+ end
26
+
22
27
  if app.options[:json]
23
28
  app.say JSON.generate(parsed_data['response'])
24
29
  else
@@ -28,7 +33,9 @@ module Spurious
28
33
  ) unless parsed_data['response'].empty?
29
34
 
30
35
  end
31
- EventMachine.stop_event_loop if parsed_data['close']
36
+ if parsed_data['close']
37
+ close_connection
38
+ end
32
39
 
33
40
  end
34
41
 
@@ -14,6 +14,14 @@ module Spurious
14
14
  super
15
15
  @type = type
16
16
  @app = app
17
+ @exiting = false
18
+ end
19
+
20
+ def unbind
21
+ unless @exiting
22
+ app.say "[error] The spurious-server instance has died, start it again with: 'spurious-server start'", :red
23
+ EventMachine.stop_event_loop
24
+ end
17
25
  end
18
26
 
19
27
  def post_init
@@ -24,11 +32,28 @@ module Spurious
24
32
  data_parts = data.split("\n")
25
33
  data_parts.each do |data_part|
26
34
  parsed_data = JSON.parse(data_part.strip)
27
- app.say parsed_data['response'], parsed_data['type'] == 'error' ? :red : :green
28
- EventMachine.stop_event_loop if parsed_data['close']
35
+ output parsed_data
36
+ if parsed_data['close']
37
+ close_connection
38
+ end
29
39
  end
40
+ end
30
41
 
42
+ def close_connection
43
+ @exiting = true
44
+ EventMachine.stop_event_loop
45
+ exit
31
46
  end
47
+
48
+ protected
49
+
50
+ def output(data)
51
+ message_type = data['message_type']
52
+ if message_type != 'debug' || (message_type == 'debug' && app.options['debug_mode'] == 'true')
53
+ app.say "[#{data['message_type']}] #{data['response']}", data['colour'].to_sym
54
+ end
55
+ end
56
+
32
57
  end
33
58
  end
34
59
  end
@@ -1,3 +1,3 @@
1
1
  module Spurious
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/spurious.rb CHANGED
@@ -1,5 +1,3 @@
1
1
  require "spurious/version"
2
2
 
3
- module Spurious
4
- # Your code goes here...
5
- end
3
+ module Spurious; end
data/spurious.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "rspec"
27
27
 
28
28
  spec.add_runtime_dependency "thor"
29
- spec.add_runtime_dependency "spurious-server"
29
+ spec.add_runtime_dependency "spurious-server", "~> 0.4.0"
30
30
  spec.add_runtime_dependency "eventmachine"
31
31
  spec.add_runtime_dependency "timeout"
32
32
  end
data/tools/install.sh CHANGED
@@ -50,11 +50,17 @@ if [[ $(command -v boot2docker) ]]; then
50
50
  fi
51
51
 
52
52
  if [[ $(command -v ruby) ]]; then
53
- RUBY_VERSION=$(ruby -v | cut -d' ' -f2 | cut -d'p' -f1)
54
- vercomp $RUBY_VERSION "1.9"
55
- if [[ $? == 2 ]]; then
56
- echo "You must have version 1.9 or greater of ruby installed, currently installed: $(ruby -v)"
53
+ IS_JRUBY=$(ruby -v | cut -d' ' -f1)
54
+ if [[ $IS_JRUBY == "jruby" ]]; then
55
+ echo "Spurious should be run on standard MRI ruby (Specifically the server needs to as it uses fork but you can install the CLI tool under jruby"
57
56
  exit 1
57
+ else
58
+ RUBY_VERSION=$(ruby -v | cut -d' ' -f2 | cut -d'p' -f1)
59
+ vercomp $RUBY_VERSION "1.9"
60
+ if [[ $? == 2 ]]; then
61
+ echo "You must have version 1.9 or greater of ruby installed, currently installed: $(ruby -v)"
62
+ exit 1
63
+ fi
58
64
  fi
59
65
  fi
60
66
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spurious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Jack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-29 00:00:00.000000000 Z
11
+ date: 2014-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: spurious-server
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 0.4.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 0.4.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: eventmachine
113
113
  requirement: !ruby/object:Gem::Requirement