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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7218a87d72d7ebbf3905a49f386ca8e8ff85b3d3
4
- data.tar.gz: 1bf9fa5994639347dc7f5ea40c7fc3e5ce4b5aa9
3
+ metadata.gz: 2d71edb30e8412d218b68afe89ee55a81e33aeb6
4
+ data.tar.gz: f2742881190d760358018f1f23f504c0592b65eb
5
5
  SHA512:
6
- metadata.gz: 0be3c1d16ecb39bb9a64ace53f6156f953b754c41579471752bbfdc2164b55d082715697a4df271d18c3627be530bf5be999a55a40a7e27dd9ab06f40f730db9
7
- data.tar.gz: 29b72f1bbc93adcdf7011f757fceded2e35fd49e464052bb6dd3d7203488db7dc7362be297cb9a057edb2acf14d422fb4fdebbe6d890f9ad6b4ff7acc9719775
6
+ metadata.gz: ae06b7fe5b9af89b5b8100734b3ce7a1857e5a1760ff440160f551611192e3fffa1bd567ca91cab9213cf8c6d750885f3840de1ef2dffe3f601edfef73fc4581
7
+ data.tar.gz: aa2a7a6c9e907a30355e8eff5c36860750b16ce33317106509c8b0645b19af5d2764ea015bbbe9adcaef7211f2e56edbbb1071b6b0828adea58207ff19183795
@@ -3,5 +3,5 @@ env:
3
3
  - RUBYLIB=lib
4
4
  script: bundle exec mspec
5
5
  rvm:
6
- - 1.8.7
7
- - rbx-nightly-18mode
6
+ - 1.9.3
7
+ - rbx-nightly-19mode
@@ -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
- until line.empty?
38
- field = ''
39
- loop do
40
- if line.sub!(/\A"(([^"\\]|\\.)*)"/, '') then
41
- snippet = $1.gsub(/\\(.)/, '\1')
42
- elsif line =~ /\A"/ then
43
- raise ArgumentError, "Unmatched double quote: #{line}"
44
- elsif line.sub!(/\A'([^']*)'/, '') then
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
@@ -1,5 +1,5 @@
1
1
  module RubySL
2
2
  module Shellwords
3
- VERSION = "1.0.1"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -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: 1.0.1
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-28 00:00:00.000000000 Z
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
  - - '>='