rip_hashrocket 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in rip_hashrocket.gemspec
4
4
  gemspec
5
+
6
+ gem 'rspec'
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
1
  require 'bundler/gem_tasks'
2
+
3
+ require 'rspec'
4
+ require "rspec/core/rake_task"
5
+ Rspec::Core::RakeTask.new(:spec) do |spec|
6
+ spec.pattern = 'spec/**/*_spec.rb'
7
+ end
8
+
@@ -49,7 +49,7 @@ class String
49
49
  def replace_rockets(s)
50
50
  s.gsub(/:([0-9a-z_\-.]*)(\s{0,})=>(\s{0,})/) do |n|
51
51
  #puts "n: #{n}"
52
- n.include?('-') ? n : "#{$1}:#{$2.size>1||$2!=' '?$2:''}#{$3}"
52
+ n.include?('-') ? n : "#{$1}:#{$2!=' '?$2:''}#{$3}"
53
53
  end
54
54
  end
55
55
  end
@@ -1,3 +1,3 @@
1
1
  module RipHashrocket
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -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
@@ -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
- hash: 13
5
- prerelease: false
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
- description: R.I.P. Hash Rocket gem will transform Ruby 1.8 hashrocket syntax into Ruby 1.9 friendly syntax
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
- - test_rb_files/test1.rb
41
- - test_rb_files/test2.rb
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
- hash: 3
57
- segments:
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
- hash: 3
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.3.7
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
@@ -1,11 +0,0 @@
1
- {:a => 'a', :b => 'b', :c => 'c'}
2
- {:d => 'd', :e => 'e', :f => 'f'}
3
-
4
-
5
- :name => "Someone",
6
- :address1 => "10 Somewhere Place",
7
- :city => "ACity",
8
- :state => "CA",
9
- :country => "US",
10
- :zip => "91634",
11
-
@@ -1 +0,0 @@
1
- { :a => "a", :b => "b", :c =>"d", :e=>"e"}