em-systemcommand 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,12 +35,12 @@ module EventMachine
35
35
  if arg == @arr.first
36
36
  cmd << arg
37
37
  elsif arg.is_a?(Array)
38
- param = arg.shift
39
- param = param.to_s if param.is_a?(Symbol)
38
+ param, value = arg.first.to_s, arg.last
39
+
40
40
  if param =~ /^\-{1,2}(.*)/
41
41
  param = $1
42
42
  end
43
- value = arg.shift
43
+
44
44
  if param.length == 1
45
45
  cmd << ' ' << "-#{param} #{Escape.shell_single_word(value)}"
46
46
  else
@@ -1,5 +1,5 @@
1
1
  module Em
2
2
  module Systemcommand
3
- VERSION = "2.0.3"
3
+ VERSION = "2.0.4"
4
4
  end
5
5
  end
@@ -60,6 +60,13 @@ describe EM::SystemCommand::Builder do
60
60
  builder.to_s.should == "echo 'Irgendwas\"$'"
61
61
  end
62
62
 
63
+ it 'should stay the same with params' do
64
+ builder = EM::SystemCommand::Builder.new('echo', [:creative, 'not$'], 'Irgendwas"$')
65
+ builder.to_s.should == "echo --creative='not$' 'Irgendwas\"$'"
66
+ builder.to_s.should == "echo --creative='not$' 'Irgendwas\"$'"
67
+ builder.to_s.should == "echo --creative='not$' 'Irgendwas\"$'"
68
+ end
69
+
63
70
  it 'should escape argument strings' do
64
71
  EM::SystemCommand::Builder.new('echo', 'Irgendwas"$').to_s.
65
72
  should == "echo 'Irgendwas\"$'"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-systemcommand
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -163,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
163
  version: '0'
164
164
  segments:
165
165
  - 0
166
- hash: 1054973868383458141
166
+ hash: 2920450342281883832
167
167
  required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  none: false
169
169
  requirements:
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  segments:
174
174
  - 0
175
- hash: 1054973868383458141
175
+ hash: 2920450342281883832
176
176
  requirements: []
177
177
  rubyforge_project:
178
178
  rubygems_version: 1.8.24