cli_tool 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/cli_tool.gemspec +2 -1
- data/lib/cli_tool/option_parser.rb +1 -1
- data/lib/cli_tool/remote.rb +9 -1
- data/lib/cli_tool/version.rb +1 -1
- metadata +18 -2
data/cli_tool.gemspec
CHANGED
data/lib/cli_tool/remote.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'singleton'
|
2
|
+
require 'awesome_print'
|
2
3
|
require 'pry'
|
3
4
|
|
4
5
|
module CliTool
|
@@ -118,6 +119,13 @@ module CliTool
|
|
118
119
|
script = File.read(script)
|
119
120
|
end
|
120
121
|
|
122
|
+
# Remove unnecessary indentation
|
123
|
+
if script.include?("\n")
|
124
|
+
script = script.split("\n").reject { |x| x.strip.empty? }
|
125
|
+
indents = script.first.match(/^([\t ]*)(.*)$/)[1]
|
126
|
+
script = script.map { |x| x.gsub(/#{indents}/, '') }.join("\n")
|
127
|
+
end
|
128
|
+
|
121
129
|
# Wrap the script in a sudoers block
|
122
130
|
if sudo || sudo == :sudo
|
123
131
|
sudo_script = %{sudo su -c "/bin/bash" #{sudouser || :root}}
|
@@ -125,7 +133,7 @@ module CliTool
|
|
125
133
|
script = sudo_script
|
126
134
|
end
|
127
135
|
|
128
|
-
@commands << script.rstrip
|
136
|
+
@commands << script.rstrip.gsub('$', '\$')
|
129
137
|
self
|
130
138
|
end
|
131
139
|
|
data/lib/cli_tool/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cli_tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: awesome_print
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: pry
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -51,7 +67,7 @@ dependencies:
|
|
51
67
|
- - ! '>='
|
52
68
|
- !ruby/object:Gem::Version
|
53
69
|
version: '0'
|
54
|
-
type: :
|
70
|
+
type: :runtime
|
55
71
|
prerelease: false
|
56
72
|
version_requirements: !ruby/object:Gem::Requirement
|
57
73
|
none: false
|