Permalink
Browse files

Add helper scripts.

  • Loading branch information...
1 parent 965ade3 commit 8a0cf4c30c1a642d450d079e40181ddbec5957cf @blambeau committed Jun 1, 2012
Showing with 22 additions and 0 deletions.
  1. +11 −0 scripts/replace.rb
  2. +11 −0 scripts/spaces.rb
View
@@ -0,0 +1,11 @@
+require 'epath'
+search, replace = ARGV
+Dir["**/*.rb"].each do |file|
+ c = Path(file).read
+ rx = Regexp.new(search)
+ if c =~ rx
+ File.open(file, "w") do |io|
+ io << c.gsub(rx, replace)
+ end
+ end
+end
View
@@ -0,0 +1,11 @@
+def clean_file(file)
+ c = File.read(file)
+ c.gsub!(/[ \t]+\n/, "\n")
+ File.open(file, 'w'){|io|
+ io << c
+ }
+end
+
+Dir["**/*.rb"].each{|file| clean_file(file)}
+Dir["**/*.yml"].each{|file| clean_file(file)}
+Dir["**/*.md"].each{|file| clean_file(file)}

0 comments on commit 8a0cf4c

Please sign in to comment.