rubysl-shellwords 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/lib/rubysl/shellwords/shellwords.rb +8 -24
- data/lib/rubysl/shellwords/version.rb +1 -1
- data/rubysl-shellwords.gemspec +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d71edb30e8412d218b68afe89ee55a81e33aeb6
|
4
|
+
data.tar.gz: f2742881190d760358018f1f23f504c0592b65eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae06b7fe5b9af89b5b8100734b3ce7a1857e5a1760ff440160f551611192e3fffa1bd567ca91cab9213cf8c6d750885f3840de1ef2dffe3f601edfef73fc4581
|
7
|
+
data.tar.gz: aa2a7a6c9e907a30355e8eff5c36860750b16ce33317106509c8b0645b19af5d2764ea015bbbe9adcaef7211f2e56edbbb1071b6b0828adea58207ff19183795
|
data/.travis.yml
CHANGED
@@ -30,32 +30,16 @@ module Shellwords
|
|
30
30
|
# argv #=> ["here", "are", "two words"]
|
31
31
|
#
|
32
32
|
def shellsplit(line)
|
33
|
-
line = String.new(line) rescue
|
34
|
-
raise(ArgumentError, "Argument must be a string")
|
35
|
-
line.lstrip!
|
36
33
|
words = []
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
snippet = $1
|
46
|
-
elsif line =~ /\A'/ then
|
47
|
-
raise ArgumentError, "Unmatched single quote: #{line}"
|
48
|
-
elsif line.sub!(/\A\\(.)?/, '') then
|
49
|
-
snippet = $1 || '\\'
|
50
|
-
elsif line.sub!(/\A([^\s\\'"]+)/, '') then
|
51
|
-
snippet = $1
|
52
|
-
else
|
53
|
-
line.lstrip!
|
54
|
-
break
|
55
|
-
end
|
56
|
-
field.concat(snippet)
|
34
|
+
field = ''
|
35
|
+
line.scan(/\G\s*(?>([^\s\\\'\"]+)|'([^\']*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|\z)?/m) do
|
36
|
+
|word, sq, dq, esc, garbage, sep|
|
37
|
+
raise ArgumentError, "Unmatched double quote: #{line.inspect}" if garbage
|
38
|
+
field << (word || sq || (dq || esc).gsub(/\\(?=.)/, ''))
|
39
|
+
if sep
|
40
|
+
words << field
|
41
|
+
field = ''
|
57
42
|
end
|
58
|
-
words.push(field)
|
59
43
|
end
|
60
44
|
words
|
61
45
|
end
|
data/rubysl-shellwords.gemspec
CHANGED
@@ -16,6 +16,8 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
+
spec.required_ruby_version = "~> 2.0"
|
20
|
+
|
19
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
20
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
21
23
|
spec.add_development_dependency "mspec", "~> 1.5"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysl-shellwords
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,9 +81,9 @@ require_paths:
|
|
81
81
|
- lib
|
82
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- -
|
84
|
+
- - ~>
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: '0'
|
86
|
+
version: '2.0'
|
87
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - '>='
|