aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-10-26 18:29:09 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-11-06 20:50:57 +0900
commitbfe5c5dc3a1a4906016b6e387dee04f94f6ca9c9 (patch)
tree9e3bc33b05ad140c6ae7807109382837d4f1e90e
parent3f23a129fcc52a56a2a34739d6f3cfb9a75766d4 (diff)
downloadruby-openssl-bfe5c5dc3a1a4906016b6e387dee04f94f6ca9c9.tar.gz
Add install_dependencies rake task that installs testing dependenciestopic/rake-install-dependencies
Parse the dependency gems from openssl.gemspec and install them. This is extracted from tool/ruby-openssl-docker/init.sh. .travis.yml, appveyor.yml and CONTRIBUTING.md are also updated to use the new task.
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--Rakefile25
-rw-r--r--appveyor.yml2
-rwxr-xr-xtool/ruby-openssl-docker/init.sh11
4 files changed, 24 insertions, 16 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 523c555e..6e6e2a54 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -44,7 +44,7 @@ Test cases are located under the
You can run it with the following three commands:
```
-$ gem install rake-compiler test-unit
+$ rake install_dependencies # installs rake-compiler, test-unit, ...
$ rake compile
$ rake test
```
diff --git a/Rakefile b/Rakefile
index f3e7e3fa..91502607 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,11 +1,14 @@
-gem 'rake-compiler'
-
require 'rake'
-require 'rake/extensiontask'
require 'rake/testtask'
require 'rdoc/task'
-Rake::ExtensionTask.new('openssl')
+begin
+ require 'rake/extensiontask'
+ Rake::ExtensionTask.new('openssl')
+rescue LoadError
+ warn "rake-compiler not installed. Run 'rake install_dependencies' to " \
+ "install testing dependency gems."
+end
Rake::TestTask.new do |t|
t.libs << 'test'
@@ -22,6 +25,20 @@ task :debug do
ruby "-I./lib -ropenssl -ve'puts OpenSSL::OPENSSL_VERSION, OpenSSL::OPENSSL_LIBRARY_VERSION'"
end
+task :install_dependencies do
+ if ENV["USE_HTTP_RUBYGEMS_ORG"] == "1"
+ Gem.sources.replace([Gem::Source.new("http://rubygems.org")])
+ end
+
+ Gem.configuration.verbose = false
+ gemspec = eval(File.read("openssl.gemspec"))
+ gemspec.development_dependencies.each do |dep|
+ print "Installing #{dep.name} (#{dep.requirement}) ... "
+ gem = Gem.install(dep.name, dep.requirement, force: true)
+ puts "#{gem[0].version}"
+ end
+end
+
namespace :sync do
task :from_ruby do
sh "./tool/sync-with-trunk"
diff --git a/appveyor.yml b/appveyor.yml
index 9f2f8d05..c3e9c303 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -5,7 +5,7 @@ install:
- appveyor DownloadFile http://dl.bintray.com/oneclick/OpenKnapsack/x64/openssl-1.0.1m-x64-windows.tar.lzma
- 7z e openssl-1.0.1m-x64-windows.tar.lzma
- 7z x -y -oC:\Ruby%ruby_version% openssl-1.0.1m-x64-windows.tar
- - gem install rake-compiler
+ - ruby -S rake install_dependencies
build_script:
- rake -rdevkit compile -- --with-openssl-dir=C:\Ruby%ruby_version%
test_script:
diff --git a/tool/ruby-openssl-docker/init.sh b/tool/ruby-openssl-docker/init.sh
index 3fa271c4..c4301482 100755
--- a/tool/ruby-openssl-docker/init.sh
+++ b/tool/ruby-openssl-docker/init.sh
@@ -15,15 +15,6 @@ export PATH="/opt/ruby/${RUBY_VERSION}/bin:$PATH"
export LD_LIBRARY_PATH="/opt/openssl/${OPENSSL_VERSION}/lib"
export PKG_CONFIG_PATH="/opt/openssl/${OPENSSL_VERSION}/lib/pkgconfig"
-ruby -e '
- newsource = Gem::Source.new("http://rubygems.org")
- Gem.sources.replace([newsource])
- Gem.configuration.write
-
- spec = eval(File.read("openssl.gemspec"))
- spec.development_dependencies.each do |dep|
- Gem.install(dep.name, dep.requirement, force: true)
- end
-'
+rake install_dependencies USE_HTTP_RUBYGEMS_ORG=1
exec $*