Skip to content

Commit

Permalink
Add helper scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
blambeau committed Jun 1, 2012
1 parent 965ade3 commit 8a0cf4c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/replace.rb
@@ -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
11 changes: 11 additions & 0 deletions scripts/spaces.rb
@@ -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.