standup 0.5.5 → 0.5.6

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.
data/README.md CHANGED
@@ -91,7 +91,7 @@ For example, if you want to add `rescue` to your configuration, you need to:
91
91
  ## To do
92
92
 
93
93
  - **?** Script sequences: rework default script as script sequence
94
-
94
+ - change shell for www-data user
95
95
 
96
96
  ## Copyright
97
97
 
@@ -52,11 +52,10 @@ module Standup
52
52
  :sudo => opts[:sudo]
53
53
  end
54
54
 
55
- def with_context new_context = {}
55
+ def with_context new_context = {}, replace = false
56
56
  old_context = @context.dup
57
- yield(@context = @context.merge(new_context).merge(:prefix => "#{old_context[:prefix]} #{new_context[:prefix]}")).tap do
58
- @context = old_context
59
- end
57
+ @context = replace ? new_context : @context.merge(new_context).merge(:prefix => "#{old_context[:prefix]} #{new_context[:prefix]}")
58
+ yield(@context).tap { @context = old_context }
60
59
  end
61
60
 
62
61
  def in_dir path, &block
@@ -98,22 +97,27 @@ module Standup
98
97
  end
99
98
 
100
99
  main_channel.wait
100
+ main_channel.close
101
101
 
102
102
  result
103
103
  end
104
104
 
105
- def exec command, context = @context
106
- command = "#{context[:prefix].strip} #{command}" if context[:prefix].present?
107
- command = "cd #{context[:path]} && #{command}" if context[:path].present?
105
+ def remote_command command
106
+ command = "#{@context[:prefix].strip} #{command}" if @context[:prefix].present?
107
+ command = "cd #{@context[:path]} && #{command}" if @context[:path].present?
108
108
  command = "#{shell_command} -c \"#{command.gsub(/"/, '\"')}\""
109
109
 
110
- if context[:user].present?
111
- command = "sudo -u #{context[:user]} #{command}"
112
- elsif context[:sudo]
110
+ if @context[:user].present?
111
+ command = "sudo -u #{@context[:user]} #{command}"
112
+ elsif @context[:sudo]
113
113
  command = "sudo #{command}"
114
114
  end
115
115
 
116
- raw_exec command
116
+ command
117
+ end
118
+
119
+ def exec command, context = {}
120
+ with_context(context) { raw_exec(remote_command(command)) }
117
121
  end
118
122
 
119
123
  def shell_command
@@ -12,7 +12,7 @@ module Standup
12
12
  :to => :@node
13
13
 
14
14
  delegate :download, :upload, :remote_update, :file_exists?, :install_package, :install_packages, :install_gem, :update_cron,
15
- :with_context, :exec, :sudo, :su_exec, :in_dir, :in_temp_dir, :as_user, :with_prefix,
15
+ :with_context, :exec, :sudo, :su_exec, :in_dir, :in_temp_dir, :as_user, :with_prefix, :remote_command,
16
16
  :to => :remoting
17
17
 
18
18
  attr_accessor :node
@@ -1,5 +1,5 @@
1
1
  module Standup
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -3,7 +3,7 @@ Standup.script :node do
3
3
 
4
4
  def run
5
5
  scripts.webapp.with_environment do
6
- exec 'rails console'
6
+ scripts.shell.make_shell(remote_command('rails console'))
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 5
9
- - 5
10
- version: 0.5.5
5
+ version: 0.5.6
11
6
  platform: ruby
12
7
  authors:
13
8
  - Ilia Ablamonov
@@ -17,7 +12,7 @@ autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
14
 
20
- date: 2011-07-12 00:00:00 +04:00
15
+ date: 2011-07-13 00:00:00 +04:00
21
16
  default_executable:
22
17
  dependencies:
23
18
  - !ruby/object:Gem::Dependency
@@ -28,10 +23,6 @@ dependencies:
28
23
  requirements:
29
24
  - - ">="
30
25
  - !ruby/object:Gem::Version
31
- hash: 47
32
- segments:
33
- - 1
34
- - 16
35
26
  version: "1.16"
36
27
  type: :runtime
37
28
  version_requirements: *id001
@@ -43,11 +34,6 @@ dependencies:
43
34
  requirements:
44
35
  - - ">="
45
36
  - !ruby/object:Gem::Version
46
- hash: 11
47
- segments:
48
- - 0
49
- - 5
50
- - 0
51
37
  version: 0.5.0
52
38
  type: :runtime
53
39
  version_requirements: *id002
@@ -59,10 +45,6 @@ dependencies:
59
45
  requirements:
60
46
  - - ">="
61
47
  - !ruby/object:Gem::Version
62
- hash: 7
63
- segments:
64
- - 3
65
- - 0
66
48
  version: "3.0"
67
49
  type: :runtime
68
50
  version_requirements: *id003
@@ -74,10 +56,6 @@ dependencies:
74
56
  requirements:
75
57
  - - ">="
76
58
  - !ruby/object:Gem::Version
77
- hash: 3
78
- segments:
79
- - 2
80
- - 0
81
59
  version: "2.0"
82
60
  type: :runtime
83
61
  version_requirements: *id004
@@ -89,10 +67,6 @@ dependencies:
89
67
  requirements:
90
68
  - - ">="
91
69
  - !ruby/object:Gem::Version
92
- hash: 25
93
- segments:
94
- - 0
95
- - 9
96
70
  version: "0.9"
97
71
  type: :runtime
98
72
  version_requirements: *id005
@@ -104,10 +78,6 @@ dependencies:
104
78
  requirements:
105
79
  - - ">="
106
80
  - !ruby/object:Gem::Version
107
- hash: 1
108
- segments:
109
- - 0
110
- - 5
111
81
  version: "0.5"
112
82
  type: :runtime
113
83
  version_requirements: *id006
@@ -119,10 +89,6 @@ dependencies:
119
89
  requirements:
120
90
  - - ">="
121
91
  - !ruby/object:Gem::Version
122
- hash: 3
123
- segments:
124
- - 2
125
- - 0
126
92
  version: "2.0"
127
93
  type: :runtime
128
94
  version_requirements: *id007
@@ -134,11 +100,6 @@ dependencies:
134
100
  requirements:
135
101
  - - ">="
136
102
  - !ruby/object:Gem::Version
137
- hash: 7
138
- segments:
139
- - 1
140
- - 5
141
- - 2
142
103
  version: 1.5.2
143
104
  type: :runtime
144
105
  version_requirements: *id008
@@ -237,18 +198,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
237
198
  requirements:
238
199
  - - ">="
239
200
  - !ruby/object:Gem::Version
240
- hash: 3
241
- segments:
242
- - 0
243
201
  version: "0"
244
202
  required_rubygems_version: !ruby/object:Gem::Requirement
245
203
  none: false
246
204
  requirements:
247
205
  - - ">="
248
206
  - !ruby/object:Gem::Version
249
- hash: 3
250
- segments:
251
- - 0
252
207
  version: "0"
253
208
  requirements: []
254
209