Created
July 30, 2013 17:11
-
-
Save mjc/6114889 to your computer and use it in GitHub Desktop.
trying to add fake extension to activemerchant to allow conditionally requiring nokogiri based on ruby version at gem install time
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
index 652e40c..233d9df 100644 | |
--- a/activemerchant.gemspec | |
+++ b/activemerchant.gemspec | |
@@ -13,8 +13,8 @@ Gem::Specification.new do |s| | |
s.homepage = 'http://activemerchant.org/' | |
s.rubyforge_project = 'activemerchant' | |
- s.files = Dir['CHANGELOG', 'README.md', 'MIT-LICENSE', 'CONTRIBUTORS', 'gem-public_cert.pem', 'lib/**/*', 'vendor/**/*'] | |
- s.require_path = 'lib' | |
+ s.files = Dir['CHANGELOG', 'README.md', 'MIT-LICENSE', 'CONTRIBUTORS', 'gem-public_cert.pem', 'lib/**/*', 'vendor/**/*', 'ext/nokogiri_conf.rb'] | |
+ s.require_paths = ['lib', 'ext'] | |
s.has_rdoc = true if Gem::VERSION < '1.7.0' | |
@@ -24,7 +24,7 @@ Gem::Specification.new do |s| | |
s.add_dependency('builder', '>= 2.0.0') | |
s.add_dependency('json', '>= 1.5.1') | |
s.add_dependency('active_utils', '>= 1.0.2') | |
- s.add_dependency('nokogiri', "< 1.6.0") | |
+ s.extensions = ['ext/nokogiri_conf.rb'] | |
s.add_development_dependency('rake') | |
s.add_development_dependency('mocha', '~> 0.13.0') |
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
require 'rubygems' | |
require 'rubygems/command.rb' | |
require 'rubygems/dependency_installer.rb' | |
begin | |
Gem::Command.build_args = ARGV | |
rescue NoMethodError | |
end | |
inst = Gem::DependencyInstaller.new | |
begin | |
if RUBY_VERSION < "1.9" | |
inst.install "nokogiri", "< 0.6.0" | |
else | |
inst.install "nokogiri", "~> 0.6.0" | |
end | |
rescue | |
exit(1) | |
end | |
f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w") # create dummy rakefile to indicate success | |
f.write("task :default\n") | |
f.close |
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
$ gem build activemerchant.gemspec && gem install ./activemerchant-1.35.1.gem | |
WARNING: licenses is empty | |
Successfully built RubyGem | |
Name: activemerchant | |
Version: 1.35.1 | |
File: activemerchant-1.35.1.gem | |
Building native extensions. This could take a while... | |
ERROR: Error installing ./activemerchant-1.35.1.gem: | |
ERROR: Failed to build gem native extension. | |
No builder for extension 'ext/nokogiri_conf.rb' | |
Gem files will remain installed in $MY_GEMS_DIR/activemerchant-1.35.1 for inspection. | |
Results logged to $MY_GEMS_DIR/activemerchant-1.35.1/ext/gem_make.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment