diff options
author | The Bundler Bot <bot@bundler.io> | 2018-03-17 18:40:22 +0000 |
---|---|---|
committer | Colby Swandale <me@colby.fyi> | 2018-04-20 10:28:35 +1000 |
commit | 55dd64414c5c25d02d10383fa9874193845db0d5 (patch) | |
tree | a6ddda210ef08407f1eaa40c34b78b9c77be2ca9 | |
parent | 36492998846af615110b2fbe97329d41d66d8e4e (diff) | |
download | bundler-55dd64414c5c25d02d10383fa9874193845db0d5.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
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.
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 $
```
(cherry picked from commit 94d328be35394eecce9b9d2b42848195e6f204c2)
-rw-r--r-- | lib/bundler/cli/gem.rb | 3 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/newgem.gemspec.tt | 6 |
2 files changed, 7 insertions, 2 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 9a87a1374a..cb5d1ae3e6 100644 --- a/lib/bundler/templates/newgem/newgem.gemspec.tt +++ b/lib/bundler/templates/newgem/newgem.gemspec.tt @@ -28,8 +28,10 @@ Gem::Specification.new do |spec| "public gem pushes." end - spec.files = `git ls-files -z`.split("\x0").reject do |f| - f.match(%r{^(test|spec|features)/}) + # 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 spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } |