Skip to content

Commit

Permalink
Find and replace for GemTemplate as well as gem_template
Browse files Browse the repository at this point in the history
  • Loading branch information
winton committed Jun 28, 2010
1 parent 6b033da commit e783bde
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Rakefile
Expand Up @@ -44,6 +44,9 @@ task :default => :spec
desc "Rename project"
task :rename do
name = ENV['NAME'] || File.basename(Dir.pwd)
camelize = lambda do |str|
str.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
end
begin
dir = Dir['**/gem_template*']
from = dir.pop
Expand All @@ -57,6 +60,7 @@ task :rename do
next if path.include?('Rakefile')
if File.file?(path)
`sed -i 's/gem_template/#{name}/g' #{path}`
`sed -i 's/GemTemplate/#{camelize.call(name)}/g' #{path}`
end
end
end

0 comments on commit e783bde

Please sign in to comment.