rip_hashrocket 0.0.6 → 0.0.7

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.
@@ -1,3 +1,3 @@
1
1
  module RipHashrocket
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -6,7 +6,8 @@ module RipHashrocket
6
6
  directory = options[0] || Dir.pwd
7
7
  backup = options[1] || false
8
8
 
9
- count = 0
9
+ filecount = 0
10
+ linecount = 0
10
11
  rbfiles = File.join(directory ,"**", "*.rb")
11
12
  Dir.glob(rbfiles).each do |filename|
12
13
  file = File.new(filename, "r+")
@@ -21,12 +22,13 @@ module RipHashrocket
21
22
  #puts "newline: #{newline}"
22
23
  lines[i] = newline
23
24
  made_changes = true
24
- count += 1
25
+ linecount += 1
25
26
  end
26
27
  end
27
28
 
28
29
  file.close
29
30
  if made_changes
31
+ filecount += 1
30
32
  if backup
31
33
  File.rename(filename, filename + ".bak")
32
34
  else
@@ -38,14 +40,15 @@ module RipHashrocket
38
40
  file.close
39
41
  end
40
42
  end
41
- p "Hash Rockets has upgraded hash syntax in #{count} out of #{Dir.glob(rbfiles).count} source files tested"
43
+ p "Hash Rockets has upgraded hash syntax on #{linecount} lines in #{filecount} out of #{Dir.glob(rbfiles).count} source files tested"
42
44
  end
43
45
 
44
46
  end
45
47
 
46
48
  class String
47
49
  def replace_rockets(s)
48
- s.gsub(/:([a-z.]*)(\s{0,})=>(\s{0,})/) do |n|
50
+ s.gsub(/:([a-z_\-.]*)(\s{0,})=>(\s{0,})/) do |n|
51
+ #puts "n: #{n}"
49
52
  n.include?('-') ? n : "#{$1}: "
50
53
  end
51
54
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rip_hashrocket
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben Pellow