rip_hashrocket 0.0.5 → 0.0.6
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/README +9 -0
- data/lib/rip_hashrocket/version.rb +1 -1
- data/lib/rip_hashrocket.rb +11 -8
- data/test_rb_files/test2.rb +1 -0
- metadata +43 -23
data/README
ADDED
data/lib/rip_hashrocket.rb
CHANGED
@@ -6,7 +6,7 @@ module RipHashrocket
|
|
6
6
|
directory = options[0] || Dir.pwd
|
7
7
|
backup = options[1] || false
|
8
8
|
|
9
|
-
|
9
|
+
count = 0
|
10
10
|
rbfiles = File.join(directory ,"**", "*.rb")
|
11
11
|
Dir.glob(rbfiles).each do |filename|
|
12
12
|
file = File.new(filename, "r+")
|
@@ -16,8 +16,13 @@ module RipHashrocket
|
|
16
16
|
|
17
17
|
lines.each_with_index do |line, i|
|
18
18
|
newline = line.replace_rockets(line)
|
19
|
-
|
20
|
-
|
19
|
+
if newline != line
|
20
|
+
#puts "line: #{lines[i]}"
|
21
|
+
#puts "newline: #{newline}"
|
22
|
+
lines[i] = newline
|
23
|
+
made_changes = true
|
24
|
+
count += 1
|
25
|
+
end
|
21
26
|
end
|
22
27
|
|
23
28
|
file.close
|
@@ -29,21 +34,19 @@ module RipHashrocket
|
|
29
34
|
end
|
30
35
|
|
31
36
|
file = File.new(filename, "w+")
|
32
|
-
|
33
|
-
file.rewind
|
34
37
|
file.puts(lines.join)
|
35
38
|
file.close
|
36
39
|
end
|
37
40
|
end
|
38
|
-
p "Hash Rockets
|
41
|
+
p "Hash Rockets has upgraded hash syntax in #{count} out of #{Dir.glob(rbfiles).count} source files tested"
|
39
42
|
end
|
40
43
|
|
41
44
|
end
|
42
45
|
|
43
46
|
class String
|
44
47
|
def replace_rockets(s)
|
45
|
-
s.gsub(/:([a-z.]*)
|
46
|
-
n.include?('-') ? n : "#{
|
48
|
+
s.gsub(/:([a-z.]*)(\s{0,})=>(\s{0,})/) do |n|
|
49
|
+
n.include?('-') ? n : "#{$1}: "
|
47
50
|
end
|
48
51
|
end
|
49
52
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{ :a => "a", :b => "b", :c =>"d", :e=>"e"}
|
metadata
CHANGED
@@ -1,57 +1,77 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rip_hashrocket
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Ben Pellow
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2011-06-13 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
|
-
|
16
|
-
|
17
|
-
email:
|
21
|
+
|
22
|
+
description: R.I.P. Hash Rocket gem will transform Ruby 1.8 hashrocket syntax into Ruby 1.9 friendly syntax
|
23
|
+
email:
|
18
24
|
- ben@campuscred.com
|
19
|
-
executables:
|
25
|
+
executables:
|
20
26
|
- rip_hashrocket
|
21
27
|
extensions: []
|
28
|
+
|
22
29
|
extra_rdoc_files: []
|
23
|
-
|
30
|
+
|
31
|
+
files:
|
24
32
|
- .gitignore
|
25
33
|
- Gemfile
|
34
|
+
- README
|
26
35
|
- Rakefile
|
27
36
|
- bin/rip_hashrocket
|
28
37
|
- lib/rip_hashrocket.rb
|
29
38
|
- lib/rip_hashrocket/version.rb
|
30
39
|
- rip_hashrocket.gemspec
|
31
40
|
- test_rb_files/test1.rb
|
41
|
+
- test_rb_files/test2.rb
|
32
42
|
has_rdoc: true
|
33
43
|
homepage: http://www.campuscred.com
|
34
44
|
licenses: []
|
45
|
+
|
35
46
|
post_install_message:
|
36
47
|
rdoc_options: []
|
37
|
-
|
48
|
+
|
49
|
+
require_paths:
|
38
50
|
- lib
|
39
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
52
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
|
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
|
46
61
|
none: false
|
47
|
-
requirements:
|
48
|
-
- -
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 3
|
66
|
+
segments:
|
67
|
+
- 0
|
68
|
+
version: "0"
|
51
69
|
requirements: []
|
70
|
+
|
52
71
|
rubyforge_project: rip_hashrocket
|
53
|
-
rubygems_version: 1.
|
72
|
+
rubygems_version: 1.3.7
|
54
73
|
signing_key:
|
55
74
|
specification_version: 3
|
56
75
|
summary: R.I.P. Hash Rocket updates hash syntax for Ruby 1.9
|
57
76
|
test_files: []
|
77
|
+
|