diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..93df679d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,20 @@ +name: Build and Publish Ruby Gem to the GitHub RubyGems registry +on: + # https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch + workflow_dispatch: # GITHUB_SHA: Last commit on the GITHUB_REF branch + # https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release + release: + types: + - released + + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Build and publish gem + uses: jstastny/publish-gem-to-github@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + owner: ${{ github.repository_owner }} diff --git a/.gitignore b/.gitignore index d326d68f..0abb26c3 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ bin/wkhtmltopdf_debian_10_i386 bin/wkhtmltopdf_ubuntu_16.04_i386 bin/wkhtmltopdf_ubuntu_18.04_i386 bin/wkhtmltopdf_archlinux_amd64 +*.gem diff --git a/CHANGELOG b/CHANGELOG index 56683727..4ecd2aca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,67 +1,69 @@ -# 0.12.6.5 - -Fix ability to use on Debian 9 systems - -# 0.12.6.4 - -Fix version detection for Debian -Use version match check that works on older Ruby versions - -# 0.12.6.3 - -Add support for Archlinux and Manjaro -Add ability to override which binary is detected for you based on `ENV['WKHTMLTOPDF_HOST_SUFFIX']` - -# 0.12.6.2 - -OS mapping for more distros, based in official support OS for wkhtmltopdf - -# 0.12.6.1 - -Add missing binary for Ubuntu 20.04 - -# 0.12.6 -Update `wkhtmltopdf` binaries with version 0.12.6 -Remove binary for Debian 8/Ubuntu 14.04/MacOS Carbon, that is not supported anymore by `wkhtmltopdf` -Add binary for Ubuntu 20.04 - -# 0.12.5.4 -Remove accidental unpacked binary - -# 0.12.5.3 -Fix typo (missing question mark in `start_with`) - -# 0.12.5.2 -Add support for CentOS 8 -Add support for Amazon Linux using the CentOS 6 binary -Add support for Linux Mint 19 and Elementary OS using the Ubuntu 18 binary -Use `exec` instead of `system` in binstub - -# 0.12.5.1 -Add support for Debian Buster (10) - -# 0.12.5 -Update `wkhtmltopdf` binaries with version 0.12.5 - -# 0.12.4 -Update `wkhtmltopdf` binaries with version 0.12.4 - -# 0.12.3.1 -Fix JRuby compatibility - -# 0.12.3 -Update `wkhtmltopdf` binaries with version 0.12.3 - -# 0.12.1 -Update `wkhtmltopdf` binaries with version 0.12.1 - -# 0.9.9.2 -Add Apache License -Use `/usr/bin/env` to find Ruby binary - -# 0.9.9.1 -Update MacOS `wkhtmltopdf` binary to 0.9.9 - -# 0.9.9 -Update `wkhtmltopdf` binaries with version 0.9.9 - +# 0.12.6.6 +# Add removal of the gzipped binaries in the gem native extension build step (disabled by default) +# +# # 0.12.6.5 +# +# Fix ability to use on Debian 9 systems +# +# # 0.12.6.4 +# +# Fix version detection for Debian +# Use version match check that works on older Ruby versions +# +# # 0.12.6.3 +# +# Add support for Archlinux and Manjaro +# Add ability to override which binary is detected for you based on `ENV['WKHTMLTOPDF_HOST_SUFFIX']` +# +# # 0.12.6.2 +# +# OS mapping for more distros, based in official support OS for wkhtmltopdf +# +# # 0.12.6.1 +# +# Add missing binary for Ubuntu 20.04 +# +# # 0.12.6 +# Update `wkhtmltopdf` binaries with version 0.12.6 +# Remove binary for Debian 8/Ubuntu 14.04/MacOS Carbon, that is not supported anymore by `wkhtmltopdf` +# Add binary for Ubuntu 20.04 +# +# # 0.12.5.4 +# Remove accidental unpacked binary +# +# # 0.12.5.3 +# Fix typo (missing question mark in `start_with`) +# +# # 0.12.5.2 +# Add support for CentOS 8 +# Add support for Amazon Linux using the CentOS 6 binary +# Add support for Linux Mint 19 and Elementary OS using the Ubuntu 18 binary +# Use `exec` instead of `system` in binstub +# +# # 0.12.5.1 +# Add support for Debian Buster (10) +# +# # 0.12.5 +# Update `wkhtmltopdf` binaries with version 0.12.5 +# +# # 0.12.4 +# Update `wkhtmltopdf` binaries with version 0.12.4 +# +# # 0.12.3.1 +# Fix JRuby compatibility +# +# # 0.12.3 +# Update `wkhtmltopdf` binaries with version 0.12.3 +# +# # 0.12.1 +# Update `wkhtmltopdf` binaries with version 0.12.1 +# +# # 0.9.9.2 +# Add Apache License +# Use `/usr/bin/env` to find Ruby binary +# +# # 0.9.9.1 +# Update MacOS `wkhtmltopdf` binary to 0.9.9 +# +# # 0.9.9 +# Update `wkhtmltopdf` binaries with version 0.9.9 diff --git a/README.md b/README.md index fa7a7dad..c2e270fa 100644 --- a/README.md +++ b/README.md @@ -63,3 +63,6 @@ There also is a rudimentary minitest test that simply invokes `docker-compose ru expects to see the output of `wkhtmltopdf --version`. Just run `rake` to run it. You can clean up after testing with `docker-compose down --rmi all`. + + + diff --git a/bin/wkhtmltopdf b/bin/wkhtmltopdf old mode 100755 new mode 100644 index c06450fb..6bf064ad --- a/bin/wkhtmltopdf +++ b/bin/wkhtmltopdf @@ -63,4 +63,9 @@ unless File.exist? binary "(missing binary: #{binary})." end -exec *$*.unshift(binary) +if $PROGRAM_NAME.eql? 'extconf.rb' + define_method(:suffix) { suffix } + define_method(:binary) { binary } +else + exec *$*.unshift(binary) +end diff --git a/bin/wkhtmltopdf_archlinux_amd64.gz b/bin/wkhtmltopdf_archlinux_amd64.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_centos_6_amd64.gz b/bin/wkhtmltopdf_centos_6_amd64.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_centos_6_i386.gz b/bin/wkhtmltopdf_centos_6_i386.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_centos_7_amd64.gz b/bin/wkhtmltopdf_centos_7_amd64.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_centos_7_i386.gz b/bin/wkhtmltopdf_centos_7_i386.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_debian_9_amd64.gz b/bin/wkhtmltopdf_debian_9_amd64.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_debian_9_i386.gz b/bin/wkhtmltopdf_debian_9_i386.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_macos_cocoa.gz b/bin/wkhtmltopdf_macos_cocoa.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_ubuntu_16.04_amd64.gz b/bin/wkhtmltopdf_ubuntu_16.04_amd64.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_ubuntu_16.04_i386.gz b/bin/wkhtmltopdf_ubuntu_16.04_i386.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_ubuntu_18.04_amd64.gz b/bin/wkhtmltopdf_ubuntu_18.04_amd64.gz old mode 100755 new mode 100644 diff --git a/bin/wkhtmltopdf_ubuntu_18.04_i386.gz b/bin/wkhtmltopdf_ubuntu_18.04_i386.gz old mode 100755 new mode 100644 diff --git a/ext/extconf.rb b/ext/extconf.rb new file mode 100644 index 00000000..7e27e32a --- /dev/null +++ b/ext/extconf.rb @@ -0,0 +1,27 @@ +### +# wkhtmltopdf_binary_gem Copyright 2013 The University of Iowa +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 + +require 'rbconfig' +require 'zlib' +require 'mkmf' + +BUILD_PATH = File.dirname(File.expand_path(__FILE__)) +# Check platform and upack binary +load "#{BUILD_PATH}/../bin/wkhtmltopdf" + +# Remove gziped binaries from the bin directory +Dir.glob("#{File.dirname(binary)}/*.gz").each { |gz| File.delete(gz) } + +# Write phony Makefile +File.write "#{BUILD_PATH}/Makefile", <<~MAKE + all: + + clean: + + install: + +MAKE diff --git a/wkhtmltopdf-binary.gemspec b/wkhtmltopdf-binary.gemspec index 87869977..76c82e5f 100644 --- a/wkhtmltopdf-binary.gemspec +++ b/wkhtmltopdf-binary.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = "wkhtmltopdf-binary" - s.version = "0.12.6.5" + s.version = "0.12.6.7.magnet" s.license = "Apache-2.0" s.author = "Zakir Durumeric" s.email = "zakird@gmail.com" @@ -11,6 +11,7 @@ Gem::Specification.new do |s| s.files = Dir['bin/*'] s.executables << "wkhtmltopdf" s.require_path = '.' - - s.add_development_dependency "minitest" + s.extensions = ['ext/extconf.rb'.freeze] + s.add_development_dependency "rubocop" +# s.add_development_dependency "minitest" end