diff --git a/CHANGELOG.md b/CHANGELOG.md index 31de174..3cf9a0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### dev (unreleased) + +* Remove extension to conditionally install `ffi` gem on Windows platforms +* Remove runtime dependency on `rake` gem +* Remove unused `rubyforge_project` from gemspec + ### Version 2.0.0 / 2019-07-11 * [#148](https://github.com/enkessler/childprocess/pull/148): Drop support for Ruby 2.0, 2.1, and 2.2 diff --git a/Gemfile b/Gemfile index 8d93ebc..ba9393b 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,9 @@ source 'http://rubygems.org' # Specify your gem's dependencies in child_process.gemspec gemspec +# Used for local development/testing only +gem 'rake' + if RUBY_VERSION =~ /^1\./ gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version diff --git a/README.md b/README.md index 952fc00..3875914 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ a standalone library. * Ruby 2.3+, JRuby 9+ +Windows users **must** ensure the `ffi` gem (`>= 1.0.11`) is installed in order to use ChildProcess. + # Usage The object returned from `ChildProcess.build` will implement `ChildProcess::AbstractProcess`. diff --git a/childprocess.gemspec b/childprocess.gemspec index d52c2b1..2825838 100644 --- a/childprocess.gemspec +++ b/childprocess.gemspec @@ -23,9 +23,4 @@ Gem::Specification.new do |s| s.add_development_dependency "rspec", "~> 3.0" s.add_development_dependency "yard", "~> 0.0" s.add_development_dependency 'coveralls', '< 1.0' - - s.add_runtime_dependency 'rake', '< 13.0' - - # Install FFI gem if we're running on Windows - s.extensions = 'ext/mkrf_conf.rb' end diff --git a/ext/mkrf_conf.rb b/ext/mkrf_conf.rb deleted file mode 100644 index 74e2266..0000000 --- a/ext/mkrf_conf.rb +++ /dev/null @@ -1,24 +0,0 @@ -# Based on the example from https://en.wikibooks.org/wiki/Ruby_Programming/RubyGems#How_to_install_different_versions_of_gems_depending_on_which_version_of_ruby_the_installee_is_using -require 'rubygems' -require 'rubygems/command.rb' -require 'rubygems/dependency_installer.rb' - -begin - Gem::Command.build_args = ARGV -rescue NoMethodError # rubocop:disable Lint/HandleExceptions -end - -inst = Gem::DependencyInstaller.new - -begin - if Gem.win_platform? - inst.install 'ffi', Gem::Requirement.new('~> 1.0', '>= 1.0.11') - end -rescue # rubocop:disable Lint/RescueWithoutErrorClass - exit(1) -end - - # create dummy rakefile to indicate success -File.open(File.join(File.dirname(__FILE__), 'Rakefile'), 'w') do |f| - f.write("task :default\n") -end diff --git a/lib/childprocess/errors.rb b/lib/childprocess/errors.rb index d327319..2245ad7 100644 --- a/lib/childprocess/errors.rb +++ b/lib/childprocess/errors.rb @@ -16,8 +16,8 @@ class LaunchError < Error class MissingFFIError < Error def initialize - message = "FFI is a required pre-requisite for posix_spawn, falling back to default implementation. " + - "Please add it to your deployment to unlock this functionality. " + + message = "FFI is a required pre-requisite for Windows or posix_spawn support in the ChildProcess gem. " + + "Ensure the `ffi` gem is installed. " + "If you believe this is an error, please file a bug at http://github.com/enkessler/childprocess/issues" super(message) diff --git a/lib/childprocess/version.rb b/lib/childprocess/version.rb index d6e0262..2a57384 100644 --- a/lib/childprocess/version.rb +++ b/lib/childprocess/version.rb @@ -1,3 +1,3 @@ module ChildProcess - VERSION = '2.0.0' + VERSION = '3.0.0' end diff --git a/lib/childprocess/windows.rb b/lib/childprocess/windows.rb index e537372..1470a7a 100644 --- a/lib/childprocess/windows.rb +++ b/lib/childprocess/windows.rb @@ -1,6 +1,11 @@ -require "ffi" require "rbconfig" +begin + require 'ffi' +rescue LoadError + raise ChildProcess::MissingFFIError +end + module ChildProcess module Windows module Lib