Skip to content

Commit

Permalink
[Fix #104] Exclude Rails-independent bin/bundle by default
Browse files Browse the repository at this point in the history
Resolves #104.

`bin/bundle` was generated by Bundler. And Bundler doesn't
depend on Active Support (Rails).

This PR prevents the following error.

```console
% cd path/to/new-rails-app
% bin/rails -v
Rails 6.0.0.rc2
% bundle exec rubocop -a --only Rails/Present
% g diff
diff --git a/bin/bundle b/bin/bundle
index 4f5e057..fa7b83b 100755
--- a/bin/bundle
+++ b/bin/bundle
@@ -39,7 +39,7 @@ m = Module.new do

   def gemfile
     gemfile = ENV["BUNDLE_GEMFILE"]
-    return gemfile if gemfile && !gemfile.empty?
+    return gemfile if gemfile.present?

     File.expand_path("../../Gemfile", __FILE__)
   end
% ./bin/bundle
Traceback (most recent call last):
        2: from ./bin/bundle:101:in `<main>'
        1: from ./bin/bundle:71:in `load_bundler!'
./bin/bundle:42:in `gemfile': undefined method `present?' for
   nil:NilClass (NoMethodError)
```
  • Loading branch information
koic committed Aug 16, 2019
1 parent 3f5dc44 commit 3bd10b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Bug fixes

* [#104](https://github.com/rubocop-hq/rubocop-rails/issues/104): Exclude Rails-independent `bin/bundle` by default. ([@koic][])

## 2.3.0 (2019-08-13)

### New features
Expand Down
2 changes: 2 additions & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Common configuration.

AllCops:
Exclude:
- bin/bundle
# What version of Rails is the inspected code using? If a value is specified
# for TargetRailsVersion then it is used. Acceptable values are specificed
# as a float (i.e. 5.1); the patch version of Rails should not be included.
Expand Down

0 comments on commit 3bd10b4

Please sign in to comment.