Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to travelling ruby 2.4.10 #75

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.2.10
ruby-version: 2.4.10

- name: Set up environment
run: bundle install
Expand Down
3 changes: 0 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
#

case $(uname -sm) in
'Linux x86')
os='linux-x86'
;;
'Linux x86_64')
os='linux-x86_64'
;;
Expand Down
1 change: 1 addition & 0 deletions packaging/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ gem "pact-provider-verifier", "1.36.1"
gem "pact_broker-client", "1.64.0"
gem "webrick", "1.3.1" # Later versions require Ruby 2.3
gem "rack", "~>2.1.4"
gem "json", "2.0.4"
3 changes: 2 additions & 1 deletion packaging/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GEM
httparty (0.18.1)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
json (2.5.1)
json (2.0.4)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
Expand Down Expand Up @@ -103,6 +103,7 @@ PLATFORMS
ruby

DEPENDENCIES
json (= 2.0.4)
pact (= 1.62.0)
pact-message (= 0.11.1)
pact-mock_service (= 3.9.0)
Expand Down
46 changes: 20 additions & 26 deletions tasks/package.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,33 @@ require 'bundler/setup'

PACKAGE_NAME = "pact"
VERSION = File.read('VERSION').strip
TRAVELING_RUBY_VERSION = "20150715-2.2.2"
TRAVELING_RUBY_VERSION = "20210206-2.4.10"

desc "Package pact-ruby-standalone for OSX, Linux x86 and Linux x86_64"
task :package => ['package:linux:x86', 'package:linux:x86_64', 'package:osx', 'package:win32']
desc "Package pact-ruby-standalone for OSX, Linux x86_64 and Win32 x86_64"
task :package => ['package:linux:x86_64', 'package:osx', 'package:win32']

namespace :package do
namespace :linux do
desc "Package pact-ruby-standalone for Linux x86"
task :x86 => [:bundle_install, "build/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86.tar.gz"] do
create_package(TRAVELING_RUBY_VERSION, "linux-x86")
end

desc "Package pact-ruby-standalone for Linux x86_64"
task :x86_64 => [:bundle_install, "build/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86_64.tar.gz"] do
create_package(TRAVELING_RUBY_VERSION, "linux-x86_64")
create_package(TRAVELING_RUBY_VERSION, "linux-x86_64", "linux-x86_64", :unix)
end
end

desc "Package pact-ruby-standalone for OS X"
task :osx => [:bundle_install, "build/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx.tar.gz"] do
create_package(TRAVELING_RUBY_VERSION, "osx")
create_package(TRAVELING_RUBY_VERSION, "osx", "osx", :unix)
end

desc "Package pact-ruby-standalone for Windows x86"
task :win32 => [:bundle_install, "build/traveling-ruby-#{TRAVELING_RUBY_VERSION}-win32.tar.gz"] do
create_package(TRAVELING_RUBY_VERSION, "win32", :windows)
desc "Package pact-ruby-standalone for Win32 x86_64"
task :win32 => [:bundle_install, "build/traveling-ruby-#{TRAVELING_RUBY_VERSION}-win32-86_64.tar.gz"] do
create_package(TRAVELING_RUBY_VERSION, "x86_64-win32", "win32", :windows)
end

desc "Install gems to local directory"
task :bundle_install do
if RUBY_VERSION !~ /^2\.2\./
abort "You can only 'bundle install' using Ruby 2.2, because that's what Traveling Ruby uses."
if RUBY_VERSION !~ /^2\.4\./
abort "You can only 'bundle install' using Ruby 2.4, because that's what Traveling Ruby uses."
end
sh "rm -rf build/tmp"
sh "mkdir -p build/tmp"
Expand All @@ -59,10 +54,6 @@ namespace :package do
end
end

file "build/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86.tar.gz" do
download_runtime(TRAVELING_RUBY_VERSION, "linux-x86")
end

file "build/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86_64.tar.gz" do
download_runtime(TRAVELING_RUBY_VERSION, "linux-x86_64")
end
Expand All @@ -71,13 +62,13 @@ file "build/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx.tar.gz" do
download_runtime(TRAVELING_RUBY_VERSION, "osx")
end

file "build/traveling-ruby-#{TRAVELING_RUBY_VERSION}-win32.tar.gz" do
download_runtime(TRAVELING_RUBY_VERSION, "win32")
file "build/traveling-ruby-#{TRAVELING_RUBY_VERSION}-win32-86_64.tar.gz" do
download_runtime(TRAVELING_RUBY_VERSION, "x86_64-win32")
end

def create_package(version, target, os_type = :unix)
def create_package(version, source_target, package_target, os_type)
package_dir = "#{PACKAGE_NAME}"
package_name = "#{PACKAGE_NAME}-#{VERSION}-#{target}"
package_name = "#{PACKAGE_NAME}-#{VERSION}-#{package_target}"
sh "rm -rf #{package_dir}"
sh "mkdir #{package_dir}"
sh "mkdir -p #{package_dir}/lib/app"
Expand All @@ -87,16 +78,19 @@ def create_package(version, target, os_type = :unix)

# sh "cp -pR lib #{package_dir}/lib/app"
sh "mkdir #{package_dir}/lib/ruby"
sh "tar -xzf build/traveling-ruby-#{version}-#{target}.tar.gz -C #{package_dir}/lib/ruby"
sh "tar -xzf build/traveling-ruby-#{version}-#{source_target}.tar.gz -C #{package_dir}/lib/ruby"
# From https://curl.se/docs/caextract.html
sh "cp packaging/cacert.pem #{package_dir}/lib/ruby/lib/ca-bundle.crt"

if os_type == :unix
case os_type
when :unix
Dir.chdir('packaging'){ Dir['pact*.sh'] }.each do | name |
sh "cp packaging/#{name} #{package_dir}/bin/#{name.chomp('.sh')}"
end
else
when :windows
sh "cp packaging/pact*.bat #{package_dir}/bin"
else
raise "We don't serve their kind (#{os_type}) here!"
end

sh "cp -pR build/vendor #{package_dir}/lib/"
Expand Down