opsicle 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjljYjQ5NzE0M2NhZDU3MWM2MTdjYjFjNzY2NzQ4MmU1MzU2YmE3OA==
4
+ NWMyN2Q2YjBkN2FiMTgwNjhjZjg2N2IwZTI3ZGVkYTFjYTdjY2NlMQ==
5
5
  data.tar.gz: !binary |-
6
- NzQxZmI2NTY1MGVjZjIzMjA2NzdjNWRhZjFkMDQxMDUzZTFhZDYyOQ==
6
+ YzJhOGM3MzMwNDBmNDczMTcwYWRkNjFlYTM2NDJmNjVhMWY4OTM4Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTAzMjJiODFkMjVjZDc5MTYyMGU4NTg4YzdlMjM2YmJjNmRjMTcyYTBlZDY1
10
- MjVhNWNiOWU1NjljZjAzOGZhZTk5NjBhMDE0NThkNDkwOGNhZDk5ZGFjNmUw
11
- ZjQ1ZmYwNjQzYzU2OWZhY2M4NjUwMmYzN2U2NWY1YzRlMmRiY2E=
9
+ ZTRjZDg3ZjQ4MjQwYTBkZDEzOWZjMTE4ZWU5MGE1NWE1ZTI2OTg0ZjFhNGQ4
10
+ ZGQ4MmUwMzJjMzllZDc4Y2M4NjE0YzI3MzA0MzM2ODBjYWFjZGJmMDYwYWE2
11
+ YWQ0Y2EwMzI4ZDdjY2NjNTEyZTFlYjM1MTFlYjQ3Mjc3Yjc5YzQ=
12
12
  data.tar.gz: !binary |-
13
- OTdiNDgwZmM3MjQxNmM0MWE3NTJiMzlmZDY1NTIyYTg2NDcxOTBiNmJmOGE4
14
- ZjIxNzIyZGIyMDc5Y2IyNTkxYTI4ZDVjMGE2YmZkYTk5OTljOTVhMjUxZmE4
15
- YzRkNzM4ZmNiMTlkMWEyZGU4MDRjMTJkZGJmYmFhNWRlMzQzNjQ=
13
+ Y2I5OWMyMTI1YjhkMjg4NjczYjc4YzU5OTQ0MGQ3YzI1MDY3ZDAzY2NmYTkx
14
+ MDk3MTc3NzI4NzJiMDUwZWU4MDg1NzRkNTcyODM1MDZjMDY3ODI4NGI1ZWJi
15
+ MWQ1MWQyZmNlNmE0YmE0MWEzNzdkOGM5NGMzOWRiMDY1ZjM0MTI=
@@ -101,7 +101,7 @@ long_desc """
101
101
  """
102
102
  arg_name '<environment>'
103
103
  command 'opsworks-url' do |c|
104
- opsworks_pages = %w[stack, layers, instances, apps, deployments, monitoring, resources, permissions]
104
+ opsworks_pages = %w(stack layers instances apps deployments monitoring resources permissions)
105
105
  c.flag [:p, :page],
106
106
  :desc => 'Request a specific page in the OpsWorks web interface',
107
107
  :must_match => opsworks_pages,
@@ -28,7 +28,7 @@ module Opsicle
28
28
  Output.say_verbose "Executing shell command: #{command}"
29
29
  %x(#{command})
30
30
  else
31
- Output.say "Deploy failed. No deployment_id was received from OpsWorks", "RED"
31
+ Output.say "Deploy failed. No deployment_id was received from OpsWorks", :error
32
32
  end
33
33
  end
34
34
  end
@@ -14,7 +14,7 @@ module Opsicle
14
14
  instances.each_index do |x|
15
15
  Output.say "#{x+1}) #{instances[x][:hostname]}"
16
16
  end
17
- choice = ask("? ", Integer) { |q| q.in = 1..instances.length }
17
+ choice = Output.ask("? ", Integer) { |q| q.in = 1..instances.length }
18
18
  end
19
19
 
20
20
  instance_ip = instances[choice-1][:elastic_ip] || instances[choice-1][:public_ip]
@@ -64,10 +64,10 @@ module Opsicle
64
64
  end
65
65
 
66
66
  def do_command(key)
67
- command = { q: :stop,
68
- h: [:set_screen, :help],
69
- b: :open_opsworks_browser,
70
- d: [:set_screen, :deployments] }[key.to_sym]
67
+ command = { 'q' => :stop,
68
+ 'h' => [:set_screen, :help],
69
+ 'b' => :open_opsworks_browser,
70
+ 'd' => [:set_screen, :deployments] }[key]
71
71
  command ||= :invalid_input
72
72
 
73
73
  send *command unless command == :invalid_input
@@ -1,17 +1,37 @@
1
- require 'highline/import'
1
+ require 'highline'
2
2
 
3
3
  module Opsicle
4
4
  module Output
5
- def self.say(msg, color_requested=nil)
6
- if $color && color_requested
7
- super "<%= color('#{msg}', #{color_requested}) %>"
5
+ def self.terminal
6
+ HighLine.color_scheme = color_scheme
7
+ @terminal ||= HighLine.new
8
+ end
9
+
10
+ def self.color_scheme
11
+ @color_scheme ||= HighLine::ColorScheme.new(
12
+ :normal => [],
13
+ :error => [:bold, :red],
14
+ :warning => [:bold, :yellow],
15
+ :verbose => [:bold, :magenta],
16
+ :debug => [:bold, :cyan],
17
+ :success => [:bold, :green],
18
+ )
19
+ end
20
+
21
+ def self.say(msg, log_style=:normal)
22
+ if $color
23
+ terminal.say "<%= color('#{msg}', '#{log_style}') %>"
8
24
  else
9
- super msg
25
+ terminal.say msg
10
26
  end
11
27
  end
12
28
 
13
- def self.say_verbose(msg, color="MAGENTA")
14
- self.say "<%= color('#{msg}', #{color}) %>" if $verbose
29
+ def self.say_verbose(msg)
30
+ terminal.say "<%= color('#{msg}', 'verbose') %>" if $verbose
31
+ end
32
+
33
+ def self.ask(*args)
34
+ terminal.ask(*args)
15
35
  end
16
36
  end
17
37
  end
@@ -1,3 +1,3 @@
1
1
  module Opsicle
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -14,7 +14,7 @@ module Opsicle
14
14
  before do
15
15
  allow(Output).to receive(:say)
16
16
  allow(Output).to receive(:say_verbose)
17
- allow(subject).to receive(:ask).and_return(2)
17
+ allow(Output).to receive(:ask).and_return(2)
18
18
  allow(subject).to receive(:ssh_username) {"mrderpyman2014"}
19
19
  end
20
20
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsicle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Fleener
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-06 00:00:00.000000000 Z
11
+ date: 2014-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk