Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

bundle inject must show the usage when it is used incorrectly #5384

Closed
Shekharrajak opened this issue Jan 31, 2017 · 2 comments
Closed

bundle inject must show the usage when it is used incorrectly #5384

Shekharrajak opened this issue Jan 31, 2017 · 2 comments

Comments

@Shekharrajak
Copy link
Contributor

Shekharrajak commented Jan 31, 2017

$ bundle inject 'pry' 1 '>0'
--- ERROR REPORT TEMPLATE -------------------------------------------------------

Error Report

Questions

Please fill out answers to these questions, it'll help us figure out
why things are going wrong.

  • What did you do?

    I ran the command bundle inject 'pry' 1 '>0'

  • What did you expect to happen?

    I expected Bundler to show error message saying the correct format and usage of bundle inject.

  • What happened instead?

    Showing to open an issue

  • Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?

Asked in slack channel.

Backtrace

NoMethodError: undefined method `start_with?' for nil:NilClass
  /Users/bundler/lib/bundler/cli/inject.rb:23:in `block (2 levels) in run'
  /Users/bundler/lib/bundler/cli/inject.rb:23:in `any?'
  /Users/bundler/lib/bundler/cli/inject.rb:23:in `block in run'
  /Users/bundler/lib/bundler/cli/inject.rb:21:in `each_slice'
  /Users/bundler/lib/bundler/cli/inject.rb:21:in `run'
  /Users/bundler/lib/bundler/cli.rb:468:in `inject'
  /Users/bundler/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /Users/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /Users/bundler/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
  /Users/bundler/lib/bundler/cli.rb:21:in `dispatch'
  /Users/bundler/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
  /Users/bundler/lib/bundler/cli.rb:11:in `start'
  /Users/bundler/exe/bundle:32:in `block in <main>'
  /Usersbundler/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
  /Users/bundler/exe/bundle:24:in `<main>'

Environment

Bundler   1.14.3
Rubygems  2.5.1
Ruby      2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
GEM_HOME  /Users/.rvm/gems/ruby-2.3.1
GEM_PATH  /Users/.rvm/gems/ruby-2.3.1:/Users/.rvm/gems/ruby-2.3.1@global
RVM       1.28.0 (latest)
Git       2.10.1
Platform  x86_64-darwin-15
OpenSSL   OpenSSL 1.0.2j  26 Sep 2016
rubygems-bundler (1.4.4)

Bundler settings

gem.test
  Set for the current user (/Users/.bundle/config): "false"
gem.mit
  Set for the current user (/Users/.bundle/config): "true"
gem.coc
  Set for the current user (/Users/.bundle/config): "true"
trampoline_disable
  Set via BUNDLE_TRAMPOLINE_DISABLE: "1"
@Shekharrajak
Copy link
Contributor Author

Also bundle inject 'pry' > '>0' shows(and does) nothing.

and

bundle inject 'pry'1234 '>0'
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/.
Could not find gem 'pry1234 (> 0)' in any of the gem sources listed in your Gemfile.

must show the bundle inject usage.

@Shekharrajak
Copy link
Contributor Author

I am working on it and i'll open PR soon.

bundlerbot added a commit that referenced this issue Feb 3, 2017
Show inject usage when args are passed incorrectly

Closes #5384

Now it shows the error :

```
$ bundle inject "gem_name" 1 "v"
ERROR: "bundle inject" was called with arguments ["gem_name", "1", "v"]
Usage: "bundle inject GEM VERSION"
$ bundle inject "gem_name" "v" 1
ERROR: "bundle inject" was called with arguments ["gem_name", "v", "1"]
Usage: "bundle inject GEM VERSION"

```
segiddins pushed a commit that referenced this issue Feb 12, 2017
Show inject usage when args are passed incorrectly

Closes #5384

Now it shows the error :

```
$ bundle inject "gem_name" 1 "v"
ERROR: "bundle inject" was called with arguments ["gem_name", "1", "v"]
Usage: "bundle inject GEM VERSION"
$ bundle inject "gem_name" "v" 1
ERROR: "bundle inject" was called with arguments ["gem_name", "v", "1"]
Usage: "bundle inject GEM VERSION"

```

(cherry picked from commit ec5cab3)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants