{"action":"created","issue":{"url":"https://api.github.com/repos/thoughtbot/suspenders/issues/497","labels_url":"https://api.github.com/repos/thoughtbot/suspenders/issues/497/labels{/name}","comments_url":"https://api.github.com/repos/thoughtbot/suspenders/issues/497/comments","events_url":"https://api.github.com/repos/thoughtbot/suspenders/issues/497/events","html_url":"https://github.com/thoughtbot/suspenders/pull/497","id":55206910,"number":497,"title":"Faster, more correct bundler gem and Gemfile install","user":{"login":"bf4","id":142914,"avatar_url":"https://avatars.githubusercontent.com/u/142914?v=3","gravatar_id":"","url":"https://api.github.com/users/bf4","html_url":"https://github.com/bf4","followers_url":"https://api.github.com/users/bf4/followers","following_url":"https://api.github.com/users/bf4/following{/other_user}","gists_url":"https://api.github.com/users/bf4/gists{/gist_id}","starred_url":"https://api.github.com/users/bf4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bf4/subscriptions","organizations_url":"https://api.github.com/users/bf4/orgs","repos_url":"https://api.github.com/users/bf4/repos","events_url":"https://api.github.com/users/bf4/events{/privacy}","received_events_url":"https://api.github.com/users/bf4/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-22T20:49:36Z","updated_at":"2015-01-22T21:30:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/thoughtbot/suspenders/pulls/497","html_url":"https://github.com/thoughtbot/suspenders/pull/497","diff_url":"https://github.com/thoughtbot/suspenders/pull/497.diff","patch_url":"https://github.com/thoughtbot/suspenders/pull/497.patch"},"body":"- About 3x faster when gems are available\r\n- Does not return false positive when other gems on system have 'bundler' in name\r\n\r\nTested on my 2015 macbook pro, Mavericks, with RVM and Ruby 2.1.5 running via bash\r\n\r\nRegarding the `gem uninstall -aIx gem_name` command used below\r\n\r\n```plain\r\n -a  Uninstall all matching versions\r\n -I  Ignore dependency requirements while uninstalling.\r\n -x  Uninstall applicable executables without confirmation.\r\n```\r\n## Bundler not installed\r\n\r\n###  gem list bundler --installed, _0.619_*\r\n\r\n```bash\r\ngem uninstall -aIx bundler\r\ntime gem list bundler --installed; echo $?\r\n```\r\n\r\n```plain\r\ntrue\r\n\r\nreal    0m0.619s\r\nuser    0m0.538s\r\nsys     0m0.077s\r\n0\r\n```\r\n\r\n*but note it is falsely returning 'true' because I have other gems on the system with 'bundler' in the name*\r\n\r\n### gem list ^bundler$ --installed, _0.604_\r\n\r\n```bash\r\ntime gem list ^bundler$ --installed; echo $?\r\n```\r\n\r\n```plain\r\nfalse\r\n\r\nreal    0m0.604s\r\nuser    0m0.525s\r\nsys     0m0.075s\r\n1\r\n```\r\n\r\n### command -v bundle, _0.000_\r\n\r\n```bash\r\ntime command -v bundle; echo $?\r\n```\r\n\r\n```plain\r\nreal    0m0.000s\r\nuser    0m0.000s\r\nsys     0m0.000s\r\n1\r\n```\r\n\r\n## Bundler not installed, installing bundler\r\n\r\n### gem list bundler --installed || gem install bundler, _0.621_*\r\n\r\n```bash\r\ngem uninstall -aIx bundler\r\ntime eval \"gem list bundler --installed || gem install bundler\"; echo $?\r\n```\r\n\r\n```plain\r\ntrue\r\n\r\nreal    0m0.621s\r\nuser    0m0.539s\r\nsys     0m0.076s\r\n0\r\n```\r\n\r\n*again, it is falsely only executing the LHS because I have other gems on the system with 'bundler' in the name*\r\n\r\n### gem list ^bundler$ --installed || gem install bundler, _4.695_\r\n\r\n```bash\r\ngem uninstall -aIx bundler\r\ntime eval \"gem list ^bundler$ --installed || gem install bundler\"; echo $?\r\n```\r\n\r\n```plain\r\nfalse\r\nFetching: bundler-1.7.12.gem (100%)\r\nSuccessfully installed bundler-1.7.12\r\nParsing documentation for bundler-1.7.12\r\nInstalling ri documentation for bundler-1.7.12\r\nDone installing documentation for bundler after 1 seconds\r\n1 gem installed\r\n\r\nreal    0m4.695s\r\nuser    0m2.983s\r\nsys     0m0.348s\r\n0\r\n```\r\n\r\n### command -v bundle || gem install bundler, _4.051_\r\n\r\n```bash\r\ngem uninstall -aIx bundler\r\ntime eval \"command -v bundle || gem install bundler\"; echo $?\r\n```\r\n\r\n```plain\r\nFetching: bundler-1.7.12.gem (100%)\r\nSuccessfully installed bundler-1.7.12\r\nParsing documentation for bundler-1.7.12\r\nInstalling ri documentation for bundler-1.7.12\r\nDone installing documentation for bundler after 1 seconds\r\n1 gem installed\r\n\r\nreal    0m4.051s\r\nuser    0m2.459s\r\nsys     0m0.269s\r\n0\r\n```\r\n\r\n## Bundler installed, Gemfile containing \"gem 'dotenv-rails', '1.0.2'\"\r\n\r\n### Gems Not Installed\r\n\r\n#### Without Gemfile.lock\r\n\r\n##### bundle, _2.706_\r\n\r\n```bash\r\nrm Gemfile.lock; gem uninstall -aIx dotenv-rails dotenv\r\ntime bundle; echo $?\r\n```\r\n\r\n```plain\r\nFetching gem metadata from https://rubygems.org/....\r\nResolving dependencies...\r\nInstalling dotenv 1.0.2\r\nInstalling dotenv-rails 1.0.2\r\nUsing bundler 1.7.12\r\nYour bundle is complete!\r\nUse `bundle show [gemname]` to see where a bundled gem is installed.\r\n\r\nreal    0m2.706s\r\nuser    0m0.739s\r\nsys     0m0.103s\r\n0\r\n```\r\n\r\n##### bundle check || bundle install, _2.423_\r\n\r\n```bash\r\nrm Gemfile.lock; gem uninstall -aIx dotenv-rails dotenv\r\ntime eval \"bundle check || bundle install\"; echo $?\r\n```\r\n\r\n```plain\r\nResolving dependencies...\r\nBundler can't satisfy your Gemfile's dependencies.\r\nInstall missing gems with `bundle install`.\r\nFetching gem metadata from https://rubygems.org/....\r\nResolving dependencies...\r\nInstalling dotenv 1.0.2\r\nInstalling dotenv-rails 1.0.2\r\nUsing bundler 1.7.12\r\nYour bundle is complete!\r\nUse `bundle show [gemname]` to see where a bundled gem is installed.\r\n\r\nreal    0m2.423s\r\nuser    0m1.264s\r\nsys     0m0.171s\r\n0\r\n```\r\n\r\n#### With Gemfile.lock\r\n\r\n##### bundle, _3.176_\r\n\r\n```bash\r\nbundle; gem uninstall -aIx dotenv-rails dotenv\r\ntime bundle; echo $?\r\n```\r\n\r\n```plain\r\nFetching gem metadata from https://rubygems.org/...\r\nInstalling dotenv 1.0.2\r\nInstalling dotenv-rails 1.0.2\r\nUsing bundler 1.7.12\r\nYour bundle is complete!\r\nUse `bundle show [gemname]` to see where a bundled gem is installed.\r\n\r\nreal    0m3.176s\r\nuser    0m0.755s\r\nsys     0m0.105s\r\n0\r\n```\r\n\r\n##### bundle check || bundle install, _2.880_\r\n\r\n```bash\r\nbundle; gem uninstall -aIx dotenv-rails dotenv\r\ntime eval \"bundle check || bundle install\"; echo $?\r\n```\r\n\r\n```plain\r\nThe following gems are missing\r\n * dotenv (1.0.2)\r\n  * dotenv-rails (1.0.2)\r\n  Install missing gems with `bundle install`\r\n  Fetching gem metadata from https://rubygems.org/...\r\n  Installing dotenv 1.0.2\r\n  Installing dotenv-rails 1.0.2\r\n  Using bundler 1.7.12\r\n  Your bundle is complete!\r\n  Use `bundle show [gemname]` to see where a bundled gem is installed.\r\n\r\n  real    0m2.880s\r\n  user    0m1.277s\r\n  sys     0m0.178s\r\n  0\r\n  ```\r\n\r\n### Gems Installed\r\n\r\nAs the time to resolve and install gems increases, `bundle check || bundle`'s speed\r\nadvantage becomes more impressive. As a bonus, `bundle check` will update the `Gemfile.lock`\r\nper changes in the Gemfile and all dependent gem versions are available locally.\r\n\r\n#### Without Gemfile.lock\r\n\r\n##### bundle, _1.519_\r\n\r\n```bash\r\nbundle; rm Gemfile.lock\r\ntime bundle; echo $?\r\n```\r\n\r\n```plain\r\nFetching gem metadata from https://rubygems.org/....\r\nResolving dependencies...\r\nUsing dotenv 1.0.2\r\nUsing dotenv-rails 1.0.2\r\nUsing bundler 1.7.12\r\nYour bundle is complete!\r\nUse `bundle show [gemname]` to see where a bundled gem is installed.\r\n\r\nreal    0m1.519s\r\nuser    0m0.651s\r\nsys     0m0.092s\r\n0\r\n```\r\n\r\n##### bundle check || bundle install, _0.612_\r\n\r\n```bash\r\nbundle; rm Gemfile.lock\r\ntime eval \"bundle check || bundle install\"; echo $?\r\n```\r\n\r\n```plain\r\nResolving dependencies...\r\nThe Gemfile's dependencies are satisfied\r\n\r\nreal    0m0.612s\r\nuser    0m0.535s\r\nsys     0m0.073s\r\n0\r\n```\r\n\r\n#### With Gemfile.lock\r\n\r\n#### bundle, _0.669_\r\n\r\n``bash\r\nbundle\r\ntime bundle; echo $?\r\n```\r\n\r\n```plain\r\nUsing dotenv 1.0.2\r\nUsing dotenv-rails 1.0.2\r\nUsing bundler 1.7.12\r\nYour bundle is complete!\r\nUse `bundle show [gemname]` to see where a bundled gem is installed.\r\n\r\nreal    0m0.669s\r\nuser    0m0.582s\r\nsys     0m0.086s\r\n0\r\n```\r\n\r\n#### bundle check || bundle install, _0.596_\r\n\r\n```bash\r\nbundle\r\ntime eval \"bundle check || bundle install\"; echo $?\r\n```\r\n\r\n```plain\r\nThe Gemfile's dependencies are satisfied\r\n\r\nreal    0m0.596s\r\nuser    0m0.521s\r\nsys     0m0.071s\r\n0\r\n```"},"comment":{"url":"https://api.github.com/repos/thoughtbot/suspenders/issues/comments/71102826","html_url":"https://github.com/thoughtbot/suspenders/pull/497#issuecomment-71102826","issue_url":"https://api.github.com/repos/thoughtbot/suspenders/issues/497","id":71102826,"user":{"login":"derekprior","id":152152,"avatar_url":"https://avatars.githubusercontent.com/u/152152?v=3","gravatar_id":"","url":"https://api.github.com/users/derekprior","html_url":"https://github.com/derekprior","followers_url":"https://api.github.com/users/derekprior/followers","following_url":"https://api.github.com/users/derekprior/following{/other_user}","gists_url":"https://api.github.com/users/derekprior/gists{/gist_id}","starred_url":"https://api.github.com/users/derekprior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekprior/subscriptions","organizations_url":"https://api.github.com/users/derekprior/orgs","repos_url":"https://api.github.com/users/derekprior/repos","events_url":"https://api.github.com/users/derekprior/events{/privacy}","received_events_url":"https://api.github.com/users/derekprior/received_events","type":"User","site_admin":false},"created_at":"2015-01-22T21:30:39Z","updated_at":"2015-01-22T21:30:39Z","body":"`bundle check` seems inline with the idempotentcy changes we've made recently, but `gem list` is still more likely to be correct for everyone. I'm not really sweating half a second in `bin/setup`."}}