summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-03-25 19:28:05 -0700
committerAndre Arko <andre@arko.net>2015-03-25 19:28:05 -0700
commit378120f436b3206ee0b12614b7bcc637c909bc5c (patch)
tree8e586966cabea3f03a901e1811910dca96137619 /Rakefile
parentfec3fcfd631eab76174ef3827f6104c72ab5e4cc (diff)
parent0036502d98d6b31a8e159456ea8894021622fd6d (diff)
downloadbundler-378120f436b3206ee0b12614b7bcc637c909bc5c.tar.gz
Merge tag 'v1.9.1'
Version 1.9.1
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile35
1 files changed, 23 insertions, 12 deletions
diff --git a/Rakefile b/Rakefile
index 1a9a31a137..ec21f6a269 100644
--- a/Rakefile
+++ b/Rakefile
@@ -27,23 +27,32 @@ module Rake
end
end
+def clean_files(files, regex, replacement = '')
+ files.each do |file|
+ contents = File.read(file)
+ contents.gsub!(regex, replacement)
+ File.open(file, 'w') { |f| f << contents }
+ end
+end
+
namespace :molinillo do
task :namespace do
- files = Dir.glob('lib/bundler/vendor/Molinillo*/**/*.rb')
- sh "sed -i.bak 's/Molinillo/Bundler::Molinillo/g' #{files.join(' ')}"
- sh "rm #{files.join('.bak ')}.bak"
+ files = Dir.glob('lib/bundler/vendor/molinillo*/**/*.rb')
+ clean_files(files, 'Molinillo', 'Bundler::Molinillo')
+ clean_files(files, /require (["'])molinillo/, 'require \1bundler/vendor/molinillo/lib/molinillo')
end
task :clean do
- files = Dir.glob('lib/bundler/vendor/Molinillo*/*', File::FNM_DOTMATCH).reject { |f| %(. .. lib).include? f.split('/').last }
- puts files
- sh "rm -r #{files.join(' ')}"
+ files = Dir.glob('lib/bundler/vendor/molinillo*/*', File::FNM_DOTMATCH).reject { |f| %(. .. lib).include? f.split('/').last }
+ rm_r files
end
task :update, [:tag] => [] do |t, args|
tag = args[:tag]
Dir.chdir 'lib/bundler/vendor' do
- `curl -L https://github.com/CocoaPods/molinillo/archive/#{tag}.tar.gz | tar -xz`
+ rm_rf 'molinillo'
+ sh "curl -L https://github.com/CocoaPods/molinillo/archive/#{tag}.tar.gz | tar -xz"
+ sh "mv Molinillo-* molinillo"
end
Rake::Task['molinillo:namespace'].invoke
Rake::Task['molinillo:clean'].invoke
@@ -53,20 +62,22 @@ end
namespace :thor do
task :namespace do
files = Dir.glob('lib/bundler/vendor/thor*/**/*.rb')
- sh "sed -i.bak 's/Thor/Bundler::Thor/g' #{files.join(' ')}"
- sh "rm #{files.join('.bak ')}.bak"
+ clean_files(files, 'Thor', 'Bundler::Thor')
+ clean_files(files, /require (["'])thor/, 'require \1bundler/vendor/thor/lib/thor')
+ clean_files(files, /(autoload\s+[:\w]+,\s+["'])(thor[\w\/]+["'])/, '\1bundler/vendor/thor/lib/\2')
end
task :clean do
files = Dir.glob('lib/bundler/vendor/thor*/*', File::FNM_DOTMATCH).reject { |f| %(. .. lib).include? f.split('/').last }
- puts files
- sh "rm -r #{files.join(' ')}"
+ rm_r files
end
task :update, [:tag] => [] do |t, args|
tag = args[:tag]
Dir.chdir 'lib/bundler/vendor' do
- `curl -L https://github.com/erikhuda/thor/archive/#{tag}.tar.gz | tar -xz`
+ rm_rf 'thor'
+ sh "curl -L https://github.com/erikhuda/thor/archive/#{tag}.tar.gz | tar -xz"
+ sh "mv thor-* thor"
end
Rake::Task['thor:namespace'].invoke
Rake::Task['thor:clean'].invoke