simple_deploy 0.8.2 → 0.9.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: c275a0b17d2ffc87e5ba269299017de6b65ab246
4
- data.tar.gz: 54b123a177b0acf6d7ae49b0a3ea73b82c80e20f
3
+ metadata.gz: 3b5a66b5ce4397770ae389fd8556235e5f07f266
4
+ data.tar.gz: c628209bc7ee9c690904a3f7c05f208eb236bb7f
5
5
  SHA512:
6
- metadata.gz: a7ee30c0cfc745d835ea435ed3841a529551fe7b5a10e6661a40fa0412dcdb8a0d785ab0b473b384e056a1f29a75598bfe295515aefefc6ef408a50fce26fdd3
7
- data.tar.gz: 91690c72640419b5ca572c2a02448d14d83033368d1eb9b8d2720fa7fed41110e94c2c15c4c6e38286b9006d4abaa3a4f64b7196a953b0838cc566b3e74b801e
6
+ metadata.gz: 83fea4bf75b0e8371eb2c1e41066c831b5a6218aeb8f2f4f916cd5b03268514bde9466aeccaf542ade70a9a23adeefd5e76256163424c43ead64376e6a3341fa
7
+ data.tar.gz: b3a4baff01c426bef2949cfe555b03b342beb3e0878484a21ef4c0484a6cfdf79770e9cbe7a9b8a982fe1cc3ce6d9fdd93a49dcb635d7c12e37a4e02e939d87a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## HEAD
2
+
3
+ ## v0.9.0 (04/24/14):
4
+
5
+ * Adding support for pty to execute
6
+
1
7
  ## v0.8.2 (04/02/14):
2
8
 
3
9
  * Support instances in nested stacks (thanks @liwenbing)
@@ -35,6 +35,7 @@ EOS
35
35
  :default => 'info'
36
36
  opt :name, "Stack name(s) of stack to deploy", :type => :string,
37
37
  :multi => true
38
+ opt :pty, "Set pty to true when executing commands."
38
39
  opt :sudo, "Execute command with sudo"
39
40
  end
40
41
 
@@ -55,7 +56,8 @@ EOS
55
56
 
56
57
  begin
57
58
  unless stack.execute :command => @opts[:command],
58
- :sudo => @opts[:sudo]
59
+ :sudo => @opts[:sudo],
60
+ :pty => @opts[:pty]
59
61
  exit 1
60
62
  end
61
63
  rescue SimpleDeploy::Exceptions::NoInstances
@@ -4,13 +4,8 @@ module SimpleDeploy
4
4
  class Stack
5
5
  class Execute
6
6
  def initialize(args)
7
- @config = SimpleDeploy.config
8
- @instances = args[:instances]
9
- @environment = args[:environment]
10
- @ssh_user = args[:ssh_user]
11
- @ssh_key = args[:ssh_key]
12
- @stack = args[:stack]
13
- @name = args[:name]
7
+ @config = SimpleDeploy.config
8
+ @args = args
14
9
  end
15
10
 
16
11
  def execute(args)
@@ -20,13 +15,7 @@ module SimpleDeploy
20
15
  private
21
16
 
22
17
  def ssh
23
- options = { :instances => @instances,
24
- :environment => @environment,
25
- :ssh_user => @ssh_user,
26
- :ssh_key => @ssh_key,
27
- :stack => @stack,
28
- :name => @name }
29
- @ssh ||= SimpleDeploy::Stack::SSH.new options
18
+ @ssh ||= SimpleDeploy::Stack::SSH.new @args
30
19
  end
31
20
 
32
21
  end
@@ -55,6 +55,12 @@ module SimpleDeploy
55
55
  def set_execute_command(args)
56
56
  command = args[:command]
57
57
  sudo = args[:sudo]
58
+ pty = args[:pty]
59
+
60
+ if pty
61
+ @logger.debug "Setting pty to true."
62
+ @task.variables[:default_run_options] = { :pty => true }
63
+ end
58
64
 
59
65
  @logger.info "Setting command: '#{command}'."
60
66
  if sudo
@@ -1,3 +1,3 @@
1
1
  module SimpleDeploy
2
- VERSION = "0.8.2"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -14,7 +14,6 @@ describe SimpleDeploy::Stack::Execute do
14
14
  :stack => @stack_stub,
15
15
  :name => @name }
16
16
 
17
-
18
17
  SimpleDeploy::Stack::SSH.should_receive(:new).
19
18
  with(options).
20
19
  and_return @ssh_mock
@@ -16,6 +16,7 @@ describe SimpleDeploy::Stack::SSH do
16
16
  :ssh_user => 'user',
17
17
  :ssh_key => 'key',
18
18
  :stack => @stack_stub,
19
+ :pty => true,
19
20
  :name => 'test-stack' }
20
21
  @task_logger_mock = mock 'task_logger'
21
22
  @ssh_options = Hash.new
@@ -99,7 +100,8 @@ describe SimpleDeploy::Stack::SSH do
99
100
  @task_mock.should_receive(:load).with({ :string=>"task :execute do\n sudo 'uname'\n end" })
100
101
  @task_mock.should_receive(:execute).and_return true
101
102
 
102
- @ssh.execute(:sudo => true,
103
+ @ssh.execute(:pty => false,
104
+ :sudo => true,
103
105
  :command => 'uname').should be_true
104
106
  end
105
107
 
@@ -107,10 +109,31 @@ describe SimpleDeploy::Stack::SSH do
107
109
  @task_mock.should_receive(:load).with({ :string=>"task :execute do\n run 'uname'\n end" })
108
110
  @task_mock.should_receive(:execute).and_return true
109
111
 
110
- @ssh.execute(:sudo => false,
112
+ @ssh.execute(:pty => false,
113
+ :sudo => false,
111
114
  :command => 'uname').should be_true
112
115
  end
113
116
 
117
+ it "should set the task variables" do
118
+ @task_mock.should_receive(:load).with({ :string=>"task :execute do\n run 'uname'\n end" })
119
+ @task_mock.should_receive(:execute).and_return true
120
+
121
+ @ssh.execute(:pty => false,
122
+ :sudo => false,
123
+ :command => 'uname')
124
+ expect(@task_mock.variables).to eq ({ :ssh_options => { :keys => "key", :paranoid => false } })
125
+ end
126
+
127
+ it "should set the pty to true" do
128
+ @task_mock.should_receive(:load).with({ :string=>"task :execute do\n sudo 'uname'\n end" })
129
+ @task_mock.should_receive(:execute).and_return true
130
+
131
+ @ssh.execute(:pty => true,
132
+ :sudo => true,
133
+ :command => 'uname')
134
+ expect(@task_mock.variables[:default_run_options]).to eq ({ :pty => true })
135
+ end
136
+
114
137
  it "sets the ssh options" do
115
138
  @task_mock.stub(:load)
116
139
  @task_mock.stub(:execute).and_return(true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Weaver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakefs