command-builder 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +4 -7
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/command-builder.gemspec +6 -6
- data/lib/command-builder.rb +2 -21
- metadata +14 -14
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,14 +2,11 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
git (1.2.5)
|
5
|
-
hash-utils (
|
5
|
+
hash-utils (1.1.0)
|
6
6
|
ruby-version
|
7
|
-
|
8
|
-
bundler (~> 1.0)
|
7
|
+
jeweler2 (2.0.9)
|
9
8
|
git (>= 1.2.5)
|
10
|
-
|
11
|
-
pipe-run (0.2.1)
|
12
|
-
rake (0.9.2)
|
9
|
+
pipe-run (0.3.0)
|
13
10
|
ruby-version (0.3.1)
|
14
11
|
|
15
12
|
PLATFORMS
|
@@ -18,5 +15,5 @@ PLATFORMS
|
|
18
15
|
DEPENDENCIES
|
19
16
|
bundler (>= 1.0.0)
|
20
17
|
hash-utils (>= 0.18.0)
|
21
|
-
|
18
|
+
jeweler2
|
22
19
|
pipe-run (>= 0.2.1)
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/command-builder.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "command-builder"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
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
|
+
s.date = "2011-12-13"
|
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.
|
34
|
+
s.rubygems_version = "1.8.12"
|
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
|
@@ -41,18 +41,18 @@ Gem::Specification.new do |s|
|
|
41
41
|
s.add_runtime_dependency(%q<hash-utils>, [">= 0.18.0"])
|
42
42
|
s.add_runtime_dependency(%q<pipe-run>, [">= 0.2.1"])
|
43
43
|
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
44
|
-
s.add_development_dependency(%q<
|
44
|
+
s.add_development_dependency(%q<jeweler2>, [">= 0"])
|
45
45
|
else
|
46
46
|
s.add_dependency(%q<hash-utils>, [">= 0.18.0"])
|
47
47
|
s.add_dependency(%q<pipe-run>, [">= 0.2.1"])
|
48
48
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
49
|
-
s.add_dependency(%q<
|
49
|
+
s.add_dependency(%q<jeweler2>, [">= 0"])
|
50
50
|
end
|
51
51
|
else
|
52
52
|
s.add_dependency(%q<hash-utils>, [">= 0.18.0"])
|
53
53
|
s.add_dependency(%q<pipe-run>, [">= 0.2.1"])
|
54
54
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
55
|
-
s.add_dependency(%q<
|
55
|
+
s.add_dependency(%q<jeweler2>, [">= 0"])
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
data/lib/command-builder.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require "hash-utils/object"
|
5
5
|
require "hash-utils/array"
|
6
|
+
require "shellwords"
|
6
7
|
require "pipe-run"
|
7
8
|
|
8
9
|
##
|
@@ -201,27 +202,7 @@ class CommandBuilder
|
|
201
202
|
|
202
203
|
def quote(value)
|
203
204
|
value = value.to_s
|
204
|
-
|
205
|
-
# Looks for " and '
|
206
|
-
single = value["'"].to_b
|
207
|
-
double = value['"'].to_b
|
208
|
-
|
209
|
-
# According to found characters selects quotation
|
210
|
-
if single and value
|
211
|
-
value = value.gsub('"', '\\"')
|
212
|
-
quotation = '"'
|
213
|
-
elsif single
|
214
|
-
quotation = '"'
|
215
|
-
elsif double
|
216
|
-
quotation = "'"
|
217
|
-
elsif value[" "]
|
218
|
-
quotation = '"'
|
219
|
-
else
|
220
|
-
quotation = ""
|
221
|
-
end
|
222
|
-
|
223
|
-
# Returns
|
224
|
-
return quotation + value + quotation
|
205
|
+
Shellwords::escape(value)
|
225
206
|
end
|
226
207
|
|
227
208
|
##
|
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.
|
4
|
+
version: 0.2.2
|
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
|
+
date: 2011-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hash-utils
|
16
|
-
requirement: &
|
16
|
+
requirement: &8465080 !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: *
|
24
|
+
version_requirements: *8465080
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: pipe-run
|
27
|
-
requirement: &
|
27
|
+
requirement: &8463340 !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: *
|
35
|
+
version_requirements: *8463340
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &8462660 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,18 +43,18 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *8462660
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: &
|
48
|
+
name: jeweler2
|
49
|
+
requirement: &8461920 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *8461920
|
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:
|
92
|
+
hash: 4070120530091503344
|
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.
|
101
|
+
rubygems_version: 1.8.12
|
102
102
|
signing_key:
|
103
103
|
specification_version: 3
|
104
104
|
summary: Builds command runnable from shell by simple and ellegant way. Also allows
|