diff options
author | Keiji Yoshimi <walf443@gmail.com> | 2018-09-12 18:11:59 +0900 |
---|---|---|
committer | Keiji Yoshimi <walf443@gmail.com> | 2018-09-14 13:57:37 +0900 |
commit | f78645d5dbfdd1ebc5419d589d3032371bc8e634 (patch) | |
tree | f99799c45cfee4353b8b1b9a83d6443a9ec86972 | |
parent | 8c31a61037e2d526affb13d4fe07035e18266947 (diff) | |
download | bundler-f78645d5dbfdd1ebc5419d589d3032371bc8e634.tar.gz |
bundle gem will generate homepage_uri and code and changelog section by default
-rw-r--r-- | lib/bundler/templates/newgem/newgem.gemspec.tt | 4 | ||||
-rw-r--r-- | spec/bundler/gem_helper_spec.rb | 1 | ||||
-rw-r--r-- | spec/commands/newgem_spec.rb | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt index 116bb5fa62..113bf82eb2 100644 --- a/lib/bundler/templates/newgem/newgem.gemspec.tt +++ b/lib/bundler/templates/newgem/newgem.gemspec.tt @@ -25,6 +25,10 @@ Gem::Specification.new do |spec| # to allow pushing to a single host or delete this section to allow pushing to any host. if spec.respond_to?(:metadata) spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." + spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." else raise "RubyGems 2.0 or newer is required to protect against " \ "public gem pushes." diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index bd7cdc170a..3620035fe1 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -77,6 +77,7 @@ RSpec.describe Bundler::GemHelper do before(:each) do content = app_gemspec_content.gsub("TODO: ", "") content.sub!(/homepage\s+= ".*"/, 'homepage = ""') + content.gsub!(/spec\.metadata.+\n/, "") File.open(app_gemspec_path, "w") {|file| file << content } end diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index 9f45fb665b..4b5db87b00 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -196,7 +196,7 @@ RSpec.describe "bundle gem" do process_file(bundled_app("newgem", "newgem.gemspec")) do |line| # Simulate replacing TODOs with real values case line - when /spec\.metadata\['allowed_push_host'\]/, /spec\.homepage/ + when /spec\.metadata\["(?:allowed_push_host|homepage_uri|source_code_uri|changelog_uri)"\]/, /spec\.homepage/ line.gsub(/\=.*$/, "= 'http://example.org'") when /spec\.summary/ line.gsub(/\=.*$/, "= %q{A short summary of my new gem.}") |