-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update "ruby-gems" test to check the required "ruby_version" of each …
…gem and auto-skip gems we can't satisfy the latest release of on our current RUBY_VERSION
- Loading branch information
Showing
1 changed file
with
32 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# ruby 2.2.2+: rack activesupport | ||
# ruby 2.0+: mime-types | ||
# (jruby 1.7 is ruby 1.9) | ||
extras="$(ruby -e ' | ||
rubyVersion = Gem::Version.new(RUBY_VERSION) | ||
puts ( | ||
( | ||
rubyVersion >= Gem::Version.new("2.2.2") ? [ | ||
"rack", | ||
"activesupport", | ||
] : [] | ||
) + ( | ||
rubyVersion >= Gem::Version.new("2.0") ? [ | ||
"mime-types", | ||
] : [] | ||
) | ||
).join(" ") | ||
gems="$(ruby -e ' | ||
# list taken from https://rubygems.org/stats | ||
gems = %w{ | ||
bundler | ||
multi_json | ||
rake | ||
rack | ||
json | ||
mime-types | ||
activesupport | ||
thor | ||
i18n | ||
diff-lcs | ||
} | ||
# last updated 2017-11-15 | ||
require "json" | ||
require "open-uri" | ||
for gem in gems | ||
# ruby 2.2.2+: rack activesupport | ||
# ruby 2.0+: mime-types | ||
# (jruby 1.7 is ruby 1.9) | ||
gemRubyVersion = JSON.load(open("https://rubygems.org/api/v1/versions/#{ gem }.json"))[0]["ruby_version"] | ||
if Gem::Dependency.new("", gemRubyVersion).match?("", RUBY_VERSION) | ||
puts gem | ||
else | ||
STDERR.puts "skipping #{ gem } due to required Ruby version: #{ gemRubyVersion } (vs #{ RUBY_VERSION })" | ||
end | ||
end | ||
')" | ||
|
||
# list taken from https://rubygems.org/stats | ||
for gem in \ | ||
$extras \ | ||
rake \ | ||
multi_json \ | ||
bundler \ | ||
json \ | ||
thor \ | ||
i18n \ | ||
builder \ | ||
; do | ||
for gem in $gems; do | ||
echo "$ gem install $gem" | ||
gem install "$gem" | ||
done |