aboutsummaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-08-05 17:05:42 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-08-07 17:16:00 +0900
commit57ca27cd9ad393d37c6d5887d036cdd16b739150 (patch)
tree6cb266eb6d2db8c9a15bf8eeccb0c13a53aee549 /Rakefile
parent5a5b44208fa188d18cc6cb4087614ff23d0d4dd5 (diff)
downloadruby-openssl-57ca27cd9ad393d37c6d5887d036cdd16b739150.tar.gz
Add Rake task sync:to_ruby
Preparing for gem release... The task copies the content of this repository to the Ruby tree.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile35
1 files changed, 29 insertions, 6 deletions
diff --git a/Rakefile b/Rakefile
index a7d33fa6..7adf9500 100644
--- a/Rakefile
+++ b/Rakefile
@@ -22,11 +22,34 @@ task :debug do
ruby "-I./lib -ropenssl -ve'puts OpenSSL::OPENSSL_VERSION, OpenSSL::OPENSSL_LIBRARY_VERSION'"
end
-task :sync do
- trunk = ENV.fetch("RUBY_TRUNK_PATH", "../ruby")
+namespace :sync do
+ task :from_ruby do
+ sh "./tool/sync-with-trunk"
+ end
- sh "cp #{trunk}/ext/openssl/*.c #{trunk}/ext/openssl/*.h #{trunk}/ext/openssl/*.rb ext/openssl/."
- sh "cp -R #{trunk}/ext/openssl/lib/* lib/."
- sh "cp #{trunk}/test/openssl/test_*.rb test/."
- sh "cp #{trunk}/test/openssl/utils.rb test/utils.rb"
+ task :to_ruby do
+ trunk_path = ENV.fetch("RUBY_TRUNK_PATH", "../ruby")
+
+ rsync = "rsync -av --delete"
+ excludes = %w{Makefile extconf.h mkmf.log depend *.o *.so *.bundle}
+ excludes.each { |name| rsync << " --exclude #{name}" }
+
+ paths = [
+ ["ext/openssl/", "ext/openssl/"],
+ ["test/utils.rb", "test/openssl/"],
+ ["test/ut_eof.rb", "test/openssl/"],
+ ["test/test_*", "test/openssl/"],
+ ["lib/", "ext/openssl/lib/"],
+ ["sample/", "sample/openssl/"],
+ ]
+ paths.each do |src, dst|
+ sh "#{rsync} #{src} #{trunk_path}/#{dst}"
+ end
+
+ gemspec_file = File.expand_path("../openssl.gemspec", __FILE__)
+ gemspec = eval(File.read(gemspec_file), binding, gemspec_file)
+ File.write("#{trunk_path}/ext/openssl/openssl.gemspec", gemspec.to_ruby)
+
+ puts "Don't forget to update ext/openssl/depend"
+ end
end