rip_hashrocket 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -0
- data/Rakefile +7 -0
- data/lib/rip_hashrocket.rb +1 -1
- data/lib/rip_hashrocket/version.rb +1 -1
- data/spec/rip_hashrocket/rip_hashrocket_spec.rb +52 -0
- data/spec/spec_helper.rb +19 -0
- metadata +28 -44
- data/test_rb_files/test1.rb +0 -11
- data/test_rb_files/test2.rb +0 -1
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/rip_hashrocket.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RipHashrocket do
|
4
|
+
subject { RipHashrocket }
|
5
|
+
|
6
|
+
describe "#output syntax" do
|
7
|
+
it 'should replace \':a => "a"\' syntax' do
|
8
|
+
line = '{ :a => "a", :b => "b", :c => "c" }'
|
9
|
+
expected = '{ a: "a", b: "b", c: "c" }'
|
10
|
+
|
11
|
+
line.replace_rockets(line).should == expected
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should replace \':a=>"a"\' syntax' do
|
15
|
+
line = '{ :a=>"a", :b=>"b", :c=>"c" }'
|
16
|
+
expected = '{ a:"a", b:"b", c:"c" }'
|
17
|
+
|
18
|
+
line.replace_rockets(line).should == expected
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should replace \':a => "a"\' syntax, retaining whitespace' do
|
22
|
+
line = '{ :a => "a", :b => "b", :c => "c" }'
|
23
|
+
expected = '{ a: "a", b: "b", c: "c" }'
|
24
|
+
|
25
|
+
line.replace_rockets(line).should == expected
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
it 'should replace \'=>\' syntax while preserving tabbing/whitespace' do
|
30
|
+
lines = [
|
31
|
+
':name => "Someone"',
|
32
|
+
':address1 => "10 Somewhere Place"',
|
33
|
+
':city => "ACity"',
|
34
|
+
':state => "CA"',
|
35
|
+
':country => "US"',
|
36
|
+
':zip => "91634"'
|
37
|
+
]
|
38
|
+
expected = [
|
39
|
+
'name: "Someone"',
|
40
|
+
'address1: "10 Somewhere Place"',
|
41
|
+
'city: "ACity"',
|
42
|
+
'state: "CA"',
|
43
|
+
'country: "US"',
|
44
|
+
'zip: "91634"'
|
45
|
+
]
|
46
|
+
|
47
|
+
for line, i in lines.each_with_index do
|
48
|
+
line.replace_rockets(line).should == expected[i]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rip_hashrocket'
|
2
|
+
|
3
|
+
require "bundler"
|
4
|
+
Bundler.setup
|
5
|
+
|
6
|
+
require 'rspec'
|
7
|
+
|
8
|
+
module RipHashrocket
|
9
|
+
class Resource
|
10
|
+
def self.get(*args)
|
11
|
+
raise 'You must stub this, or should_receive at a higher level.'
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.post(*args)
|
15
|
+
raise 'You must stub this, or should_receive at a higher level.'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
metadata
CHANGED
@@ -1,34 +1,26 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rip_hashrocket
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 9
|
10
|
-
version: 0.0.9
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Ben Pellow
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-06-13 00:00:00 -07:00
|
12
|
+
date: 2011-06-13 00:00:00.000000000 -07:00
|
19
13
|
default_executable:
|
20
14
|
dependencies: []
|
21
|
-
|
22
|
-
|
23
|
-
email:
|
15
|
+
description: R.I.P. Hash Rocket gem will transform Ruby 1.8 hashrocket syntax into
|
16
|
+
Ruby 1.9 friendly syntax
|
17
|
+
email:
|
24
18
|
- ben@campuscred.com
|
25
|
-
executables:
|
19
|
+
executables:
|
26
20
|
- rip_hashrocket
|
27
21
|
extensions: []
|
28
|
-
|
29
22
|
extra_rdoc_files: []
|
30
|
-
|
31
|
-
files:
|
23
|
+
files:
|
32
24
|
- .gitignore
|
33
25
|
- Gemfile
|
34
26
|
- README
|
@@ -37,41 +29,33 @@ files:
|
|
37
29
|
- lib/rip_hashrocket.rb
|
38
30
|
- lib/rip_hashrocket/version.rb
|
39
31
|
- rip_hashrocket.gemspec
|
40
|
-
-
|
41
|
-
-
|
32
|
+
- spec/rip_hashrocket/rip_hashrocket_spec.rb
|
33
|
+
- spec/spec_helper.rb
|
42
34
|
has_rdoc: true
|
43
35
|
homepage: http://www.campuscred.com
|
44
36
|
licenses: []
|
45
|
-
|
46
37
|
post_install_message:
|
47
38
|
rdoc_options: []
|
48
|
-
|
49
|
-
require_paths:
|
39
|
+
require_paths:
|
50
40
|
- lib
|
51
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
42
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
|
58
|
-
- 0
|
59
|
-
version: "0"
|
60
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
48
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
segments:
|
67
|
-
- 0
|
68
|
-
version: "0"
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
69
53
|
requirements: []
|
70
|
-
|
71
54
|
rubyforge_project: rip_hashrocket
|
72
|
-
rubygems_version: 1.
|
55
|
+
rubygems_version: 1.6.2
|
73
56
|
signing_key:
|
74
57
|
specification_version: 3
|
75
58
|
summary: R.I.P. Hash Rocket updates hash syntax for Ruby 1.9
|
76
|
-
test_files:
|
77
|
-
|
59
|
+
test_files:
|
60
|
+
- spec/rip_hashrocket/rip_hashrocket_spec.rb
|
61
|
+
- spec/spec_helper.rb
|
data/test_rb_files/test1.rb
DELETED
data/test_rb_files/test2.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{ :a => "a", :b => "b", :c =>"d", :e=>"e"}
|