Skip to content

Commit

Permalink
add a gemspec for the openssl gem, and a rakefile to build the gemspec
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jan 24, 2014
1 parent 92235e4 commit fd96a5b
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
69 changes: 69 additions & 0 deletions ext/openssl/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
require 'erb'

template = ERB.new(<<-eotemplate)
Gem::Specification.new do |s|
s.name = '<%= name %>'
s.version = '<%= version %>'
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = [<%= authors.map { |auth| "\#{auth.inspect}" }.join(",") %>]
s.date = "<%= date.strftime("%Y-%m-%d") %>"
s.description = "<%= description %>"
s.email = [<%= emails.map { |mail| "\#{mail.inspect}" }.join(",") %>]
s.extensions = [<%= exts.map { |ext| "\#{ext.inspect}" }.join(",") %>]
s.extra_rdoc_files = []
s.files = [<%= files.map { |file| "\#{file.inspect}" }.join(",") %>]
s.homepage = "http://www.ruby-lang.org"
s.licenses = [<%= licenses.map { |license| "\#{license.inspect}" }.join(",") %>]
s.require_paths = ["lib"]
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
s.rubyforge_project = "<%= name %>"
s.rubygems_version = "<%= Gem::VERSION %>"
s.summary = "<%= summary %>"
s.test_files = [<%= test_files.map { |file| "\#{file.inspect}" }.join(",") %>]
end
eotemplate

task :gemfile do
name = "openssl"
authors = ["Martin"]
date = Time.now
description = "A wrapper around OpenSSL"
emails = ['martin@example.org']
exts = ['ext/openssl/extconf.rb']

version = files = test_files = nil

Dir.chdir(File.join(File.dirname(__FILE__), '..', '..')) {
version = File.read('ext/openssl/ossl_version.h').match(/OSSL_VERSION[^"]*"([^"]*)"/)[1]
files = Dir['ext/openssl/*.{c,h,rb}'] + Dir.chdir('ext/openssl') {
Dir['lib/**/*']
}
test_files = Dir['test/openssl/**/*']
}

licenses = ['Ruby']
summary = 'A thin wrapper exposing OpenSSL to Ruby'


File.open('openssl.gemspec', 'w') { |f| f.write template.result(binding) }
end

task :package => :gemfile do
require 'tempfile'
require 'fileutils'

gemdir = Dir.mktmpdir
puts gemdir
Dir.chdir(File.join(File.dirname(__FILE__), '..', '..')) {
ext = File.join gemdir, 'ext'
test = File.join gemdir, 'test'
FileUtils.mkdir ext
FileUtils.mkdir test
FileUtils.cp_r 'ext/openssl', ext
FileUtils.cp_r 'test/openssl', test
FileUtils.mv File.join(ext, 'openssl', 'lib'), gemdir
FileUtils.mv File.join(ext, 'openssl', 'openssl.gemspec'), gemdir
}
Dir.chdir(gemdir) { system "gem build openssl.gemspec" }
end
21 changes: 21 additions & 0 deletions ext/openssl/openssl.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Gem::Specification.new do |s|
s.name = 'openssl'
s.version = '1.1.0'

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Martin"]
s.date = "2014-01-24"
s.description = "A wrapper around OpenSSL"
s.email = ["martin@example.org"]
s.extensions = ["ext/openssl/extconf.rb"]
s.extra_rdoc_files = []
s.files = ["ext/openssl/openssl_missing.c","ext/openssl/ossl.c","ext/openssl/ossl_asn1.c","ext/openssl/ossl_bio.c","ext/openssl/ossl_bn.c","ext/openssl/ossl_cipher.c","ext/openssl/ossl_config.c","ext/openssl/ossl_digest.c","ext/openssl/ossl_engine.c","ext/openssl/ossl_hmac.c","ext/openssl/ossl_ns_spki.c","ext/openssl/ossl_ocsp.c","ext/openssl/ossl_pkcs12.c","ext/openssl/ossl_pkcs5.c","ext/openssl/ossl_pkcs7.c","ext/openssl/ossl_pkey.c","ext/openssl/ossl_pkey_dh.c","ext/openssl/ossl_pkey_dsa.c","ext/openssl/ossl_pkey_ec.c","ext/openssl/ossl_pkey_rsa.c","ext/openssl/ossl_rand.c","ext/openssl/ossl_ssl.c","ext/openssl/ossl_ssl_session.c","ext/openssl/ossl_x509.c","ext/openssl/ossl_x509attr.c","ext/openssl/ossl_x509cert.c","ext/openssl/ossl_x509crl.c","ext/openssl/ossl_x509ext.c","ext/openssl/ossl_x509name.c","ext/openssl/ossl_x509req.c","ext/openssl/ossl_x509revoked.c","ext/openssl/ossl_x509store.c","ext/openssl/extconf.h","ext/openssl/openssl_missing.h","ext/openssl/ossl.h","ext/openssl/ossl_asn1.h","ext/openssl/ossl_bio.h","ext/openssl/ossl_bn.h","ext/openssl/ossl_cipher.h","ext/openssl/ossl_config.h","ext/openssl/ossl_digest.h","ext/openssl/ossl_engine.h","ext/openssl/ossl_hmac.h","ext/openssl/ossl_ns_spki.h","ext/openssl/ossl_ocsp.h","ext/openssl/ossl_pkcs12.h","ext/openssl/ossl_pkcs5.h","ext/openssl/ossl_pkcs7.h","ext/openssl/ossl_pkey.h","ext/openssl/ossl_rand.h","ext/openssl/ossl_ssl.h","ext/openssl/ossl_version.h","ext/openssl/ossl_x509.h","ext/openssl/ruby_missing.h","ext/openssl/deprecation.rb","ext/openssl/extconf.rb","ext/openssl/gemspec.rb","lib/openssl","lib/openssl/bn.rb","lib/openssl/buffering.rb","lib/openssl/cipher.rb","lib/openssl/config.rb","lib/openssl/digest.rb","lib/openssl/ssl.rb","lib/openssl/x509.rb","lib/openssl.rb"]
s.homepage = "http://www.ruby-lang.org"
s.licenses = ["Ruby"]
s.require_paths = ["lib"]
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
s.rubyforge_project = "openssl"
s.rubygems_version = "2.2.1"
s.summary = "A thin wrapper exposing OpenSSL to Ruby"
s.test_files = ["test/openssl/ssl_server.rb","test/openssl/test_asn1.rb","test/openssl/test_bn.rb","test/openssl/test_buffering.rb","test/openssl/test_cipher.rb","test/openssl/test_config.rb","test/openssl/test_digest.rb","test/openssl/test_engine.rb","test/openssl/test_fips.rb","test/openssl/test_hmac.rb","test/openssl/test_ns_spki.rb","test/openssl/test_ocsp.rb","test/openssl/test_pair.rb","test/openssl/test_pkcs12.rb","test/openssl/test_pkcs5.rb","test/openssl/test_pkcs7.rb","test/openssl/test_pkey_dh.rb","test/openssl/test_pkey_dsa.rb","test/openssl/test_pkey_ec.rb","test/openssl/test_pkey_rsa.rb","test/openssl/test_ssl.rb","test/openssl/test_ssl_session.rb","test/openssl/test_x509cert.rb","test/openssl/test_x509crl.rb","test/openssl/test_x509ext.rb","test/openssl/test_x509name.rb","test/openssl/test_x509req.rb","test/openssl/test_x509store.rb","test/openssl/utils.rb"]
end

0 comments on commit fd96a5b

Please sign in to comment.