command-builder 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,8 @@
1
1
 
2
+ 0.2.2 (2011-12-13)
3
+ * switch to 'jeweler2' gem
4
+ * switch to STL's Shellwords class for arguments escaping
5
+
2
6
  0.2.1 (2011-10-18)
3
7
  * #execute yields both output and done indicator
4
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.3.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "command-builder"
8
- s.version = "0.2.2"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Martin Koz\u{e1}k"]
12
- s.date = "2011-12-13"
12
+ s.date = "2012-01-22"
13
13
  s.email = "martinkozak@martinkozak.net"
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.homepage = "https://github.com/martinkozak/command-builder"
32
32
  s.licenses = ["MIT"]
33
33
  s.require_paths = ["lib"]
34
- s.rubygems_version = "1.8.12"
34
+ s.rubygems_version = "1.8.15"
35
35
  s.summary = "Builds command runnable from shell by simple and ellegant way. Also allows both synchronous executing or asynchronous one using EventMachine."
36
36
 
37
37
  if s.respond_to? :specification_version then
@@ -94,6 +94,7 @@ class CommandBuilder
94
94
 
95
95
  def argument(name, value = nil)
96
96
  @args << [name, value]
97
+ @order << :argument
97
98
  end
98
99
 
99
100
  alias :arg :argument
@@ -117,6 +118,7 @@ class CommandBuilder
117
118
 
118
119
  def parameter(value)
119
120
  @params << value
121
+ @order << :parameter
120
122
  end
121
123
 
122
124
  alias :param :parameter
@@ -139,6 +141,8 @@ class CommandBuilder
139
141
  return @params
140
142
  else
141
143
  @params += values
144
+ orders = [:parameter] * values.length
145
+ @order.push(*orders)
142
146
  end
143
147
  end
144
148
 
@@ -236,17 +240,19 @@ class CommandBuilder
236
240
 
237
241
  def to_s
238
242
  cmd = @command.to_s.gsub(" ", "\\ ")
243
+ args = @args.dup
244
+ params = @params.dup
239
245
 
240
- # Arguments
241
- @args.each do |name, value|
242
- __add_arg(cmd, name, value)
243
- end
244
-
245
- # Parameters
246
- @params.each do |param|
247
- cmd << " " << self.quote(param.to_s)
246
+ @order.each do |type|
247
+ if type == :argument
248
+ name, value = args.shift
249
+ __add_arg(cmd, name, value)
250
+ else
251
+ param = params.shift
252
+ cmd << " " << self.quote(param.to_s)
253
+ end
248
254
  end
249
-
255
+
250
256
  return cmd
251
257
  end
252
258
 
@@ -260,6 +266,7 @@ class CommandBuilder
260
266
  def reset!
261
267
  @args = [ ]
262
268
  @params = [ ]
269
+ @order = [ ]
263
270
  self
264
271
  end
265
272
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-13 00:00:00.000000000 Z
12
+ date: 2012-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hash-utils
16
- requirement: &8465080 !ruby/object:Gem::Requirement
16
+ requirement: &70274993164260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.18.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8465080
24
+ version_requirements: *70274993164260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: pipe-run
27
- requirement: &8463340 !ruby/object:Gem::Requirement
27
+ requirement: &70274993163780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.2.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *8463340
35
+ version_requirements: *70274993163780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &8462660 !ruby/object:Gem::Requirement
38
+ requirement: &70274993163300 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *8462660
46
+ version_requirements: *70274993163300
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler2
49
- requirement: &8461920 !ruby/object:Gem::Requirement
49
+ requirement: &70274993162820 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *8461920
57
+ version_requirements: *70274993162820
58
58
  description:
59
59
  email: martinkozak@martinkozak.net
60
60
  executables: []
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  segments:
91
91
  - 0
92
- hash: 4070120530091503344
92
+ hash: -3964241019989183183
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 1.8.12
101
+ rubygems_version: 1.8.15
102
102
  signing_key:
103
103
  specification_version: 3
104
104
  summary: Builds command runnable from shell by simple and ellegant way. Also allows