diff --git a/Rakefile b/Rakefile index 2b5212778..554a2ac0a 100644 --- a/Rakefile +++ b/Rakefile @@ -14,3 +14,12 @@ task :default do puts "Nothing to do for the default task" end +task :verify_private_key_present do + private_key = File.expand_path('~/.gem/rspec-gem-private_key.pem') + unless File.exists?(private_key) + raise "Your private key is not present. This gem should not be built without that." + end +end + +task :build => :verify_private_key_present + diff --git a/rspec.gemspec b/rspec.gemspec index b20a1854d..aaea3e5e5 100644 --- a/rspec.gemspec +++ b/rspec.gemspec @@ -24,6 +24,12 @@ Gem::Specification.new do |s| s.rdoc_options = ["--charset=UTF-8"] s.require_path = "lib" + private_key = File.expand_path('~/.gem/rspec-gem-private_key.pem') + if File.exists?(private_key) + s.signing_key = private_key + s.cert_chain = [File.expand_path('~/.gem/rspec-gem-public_cert.pem')] + end + %w[core expectations mocks].each do |name| if RSpec::Version::STRING =~ /[a-zA-Z]+/ s.add_runtime_dependency "rspec-#{name}", "= #{RSpec::Version::STRING}"