summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2018-03-17 18:40:22 +0000
committerThe Bundler Bot <bot@bundler.io>2018-03-17 18:40:22 +0000
commit94d328be35394eecce9b9d2b42848195e6f204c2 (patch)
tree0ae9dccfeae8ecfa82a1e6ccc4e0212f7305e35a
parent6a7af6b4016ad2c659a66cff86074f7dd52b3cdf (diff)
parent46b8f26487a7c58f8cedb821b1cabba2c4f7ded0 (diff)
downloadbundler-94d328be35394eecce9b9d2b42848195e6f204c2.tar.gz
Auto merge of #6346 - nesaulov:explain-spec-files, r=segiddins
Explain spec files and output a link to bundler.io guides Resolves #6246 ### What was the end-user problem that led to this PR? 1. There is no helpful comment about `spec.files` method in a new gem's gemspec. 2. `$ bundle gem gem_name` is missing link to further reading about developing, testing and releasing the newly created gem. ### What is your fix for the problem, implemented in this PR? 1. Add a comment in the `newgem.gemspec.tt` 2. Add a message after new gem generation with link to [bundler.io guides](https://bundler.io/guides/creating_gem.html) Example: ```bash ๛ ~/code/oss/tmp $ ../bundler/bin/bundle gem new_gem Creating gem 'new_gem'... create new_gem/Gemfile create new_gem/lib/new_gem.rb create new_gem/lib/new_gem/version.rb create new_gem/new_gem.gemspec create new_gem/Rakefile create new_gem/README.md create new_gem/bin/console create new_gem/bin/setup create new_gem/.gitignore Initializing git repo in /Users/nesaulov/code/oss/tmp/new_gem Gem 'new_gem' was successfully created. For detailed information on further steps please visit https://bundler.io/guides/creating_gem.html ๛ ~/code/oss/tmp $ ```
-rw-r--r--lib/bundler/cli/gem.rb3
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt2
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index ebfaf75b8c..58e2f8a3fd 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -158,6 +158,9 @@ module Bundler
# Open gemspec in editor
open_editor(options["edit"], target.join("#{name}.gemspec")) if options[:edit]
+
+ Bundler.ui.info "Gem '#{name}' was successfully created. " \
+ "For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
rescue Errno::EEXIST => e
raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
end
diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt
index 97da2b14d8..991d645cc6 100644
--- a/lib/bundler/templates/newgem/newgem.gemspec.tt
+++ b/lib/bundler/templates/newgem/newgem.gemspec.tt
@@ -28,6 +28,8 @@ Gem::Specification.new do |spec|
"public gem pushes."
end
+ # Specify which files should be added to the gem when it is released.
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end