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 CHANGED
@@ -20,5 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "pry"
23
+ spec.add_dependency "awesome_print"
24
+ spec.add_dependency "pry"
24
25
  end
@@ -1,6 +1,6 @@
1
1
  require 'getoptlong'
2
- require 'pry'
3
2
  require 'awesome_print'
3
+ require 'pry'
4
4
 
5
5
  module CliTool
6
6
  module OptionParser
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module CliTool
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
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
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: :development
70
+ type: :runtime
55
71
  prerelease: false
56
72
  version_requirements: !ruby/object:Gem::Requirement
57
73
  none: false