Sha256: 0b811cc4a917c452ab6e6ba0ee9ba72d956d96e743a758ae3927a318d3cc20f3
Contents?: true
Size: 1021 Bytes
Versions: 3
Compression:
Stored size: 1021 Bytes
Contents
require 'paint' def vprint(*args) puts args if $verbose && !$quiet end def error(*args) puts Paint["ERROR", '#e74c3c'] + " - #{args}" end def create(fname) puts Paint[" create", '#2ecc71'] + " #{fname}" unless $quiet end def skip(fname) puts Paint[" skip", '#f1c40f'] + " #{fname}" unless $quiet end def projectify(name) # Name becomes frozen for some reason name = name.gsub(/(.)([A-Z])/,'\1-\2') name.downcase! name.gsub!('..', '') name.gsub!('/', '') name.gsub!('\\', '') name[0] = '' if name[0] == '-' name.gsub!('--', '-') name.gsub!('_-', '-') return name end def find_and_replace_all(target_dir, find, repl) Dir.foreach(target_dir) do |file_name| og_fname = file_name file_name = File.join(target_dir, file_name) next if og_fname == '.' || og_fname == '..' || File.directory?(file_name) text = File.read(file_name) replace = text.gsub!(find, repl) File.open(file_name, "w") { |file| file.puts replace } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
radon-0.1.2 | lib/core/text.rb |
radon-0.1.1 | lib/core/text.rb |
radon-0.1.0 | lib/core/text.rb |