doo 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/doo/stock/common.rb +11 -5
- data/lib/doo/stock/run_locally.rb +1 -1
- data/lib/doo/stock/run_on_server.rb +2 -2
- metadata +4 -4
data/lib/doo/stock/common.rb
CHANGED
@@ -6,22 +6,28 @@ Doo::Base.class_eval do
|
|
6
6
|
|
7
7
|
def replace(file, src, replace, opts = {})
|
8
8
|
sep = SEPARATORS.detect { |x| !src.include?(x) && !replace.include?(x) }
|
9
|
-
run "sed -i -e 's#{sep}#{src}#{sep}#{replace}#{sep}g' #{file}", opts
|
9
|
+
run "sed -i -e 's#{sep}#{src.escape_for_shell}#{sep}#{replace.escape_for_shell}#{sep}g' #{file}", opts
|
10
10
|
end
|
11
11
|
|
12
12
|
def append(file, text, opts = {})
|
13
|
-
run "grep '#{text}' #{file} || echo '#{text}' >> #{file}", opts
|
13
|
+
run "grep '#{text.escape_for_shell}' #{file} || echo '#{text.escape_for_shell}' >> #{file}", opts
|
14
14
|
end
|
15
15
|
|
16
16
|
def sudo(cmd, opts = {})
|
17
17
|
run(cmd, opts.merge(:sudo => true))
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
class String
|
21
|
+
def sudoize!
|
22
|
+
replace "sudo sh -c \"#{escape_for_shell}\""
|
23
|
+
end
|
24
|
+
|
25
|
+
def escape_for_shell
|
26
|
+
gsub "\"", "\\\""
|
27
|
+
end
|
23
28
|
end
|
24
29
|
|
30
|
+
private
|
25
31
|
def run!(cmd, opts = {})
|
26
32
|
with_clone(opts) do
|
27
33
|
if confirm
|
@@ -6,8 +6,8 @@ Doo::Base.class_eval do
|
|
6
6
|
cmdopts = ["-S \"~/.ssh/master-%l-%r@%h:%p\""]
|
7
7
|
cmdopts << "-t" if !opts.include? :pty || opts[:pty]
|
8
8
|
cmdopts << "-p#{ssh_port}" if defined? ssh_port
|
9
|
-
remote_cmd
|
10
|
-
run! "ssh #{cmdopts.join(' ')} #{user}@#{host} \"#{remote_cmd.
|
9
|
+
remote_cmd.sudoize! if opts[:sudo]
|
10
|
+
run! "ssh #{cmdopts.join(' ')} #{user}@#{host} \"#{remote_cmd.escape_for_shell}\"", opts
|
11
11
|
end
|
12
12
|
|
13
13
|
def put(local, remote, opts = {})
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mat Trudel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-17 00:00:00 -05:00
|
19
19
|
default_executable: doo
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|