em-systemcommand 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,7 +35,7 @@ module EventMachine
35
35
  if arg == @arr.first
36
36
  cmd << arg
37
37
  elsif arg.is_a?(Array)
38
- param, value = arg.first.to_s, arg.last
38
+ param, value = arg.first.to_s, arg.last.to_s
39
39
 
40
40
  if param =~ /^\-{1,2}(.*)/
41
41
  param = $1
@@ -53,10 +53,10 @@ module EventMachine
53
53
  else
54
54
  cmd << ' ' << "--#{arg}"
55
55
  end
56
- elsif arg.strip =~ /^\-/
56
+ elsif arg.is_a?(String) && arg.strip =~ /^\-/
57
57
  cmd << ' ' << arg
58
58
  else
59
- cmd << ' ' << Escape.shell_single_word(arg)
59
+ cmd << ' ' << Escape.shell_single_word(arg.to_s)
60
60
  end
61
61
  end
62
62
  cmd
@@ -1,5 +1,5 @@
1
1
  module Em
2
2
  module Systemcommand
3
- VERSION = "2.0.4"
3
+ VERSION = "2.0.5"
4
4
  end
5
5
  end
@@ -67,6 +67,11 @@ describe EM::SystemCommand::Builder do
67
67
  builder.to_s.should == "echo --creative='not$' 'Irgendwas\"$'"
68
68
  end
69
69
 
70
+ it 'should take integers as arguments' do
71
+ EM::SystemCommand::Builder.new('chmod', 777, 'some_file').to_s.
72
+ should == "chmod 777 some_file"
73
+ end
74
+
70
75
  it 'should escape argument strings' do
71
76
  EM::SystemCommand::Builder.new('echo', 'Irgendwas"$').to_s.
72
77
  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.4
4
+ version: 2.0.5
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: 2920450342281883832
166
+ hash: 3944186604670501465
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: 2920450342281883832
175
+ hash: 3944186604670501465
176
176
  requirements: []
177
177
  rubyforge_project:
178
178
  rubygems_version: 1.8.24