summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrohit <rohit.arondekar@gmail.com>2012-12-02 15:45:51 +0530
committerrohit <rohit.arondekar@gmail.com>2012-12-02 15:45:51 +0530
commite7690d91212a4c5943e1d19764fe05ef500fb6e8 (patch)
tree03d06a5b5137c353c72bd421bfa50857ce3317ad
parent78d39d205b554d06fae4ccd69990ba795fd1d3ed (diff)
downloadbundler-e7690d91212a4c5943e1d19764fe05ef500fb6e8.tar.gz
outdated sets non zero exit status if outdated gems found #2021
-rw-r--r--CHANGELOG.md6
-rw-r--r--lib/bundler/cli.rb2
-rw-r--r--spec/other/outdated_spec.rb17
3 files changed, 25 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa05bf8d1b..b107acfd54 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## Next
+
+Bugfixes:
+
+ - `outdated` returns non-zero exit status if outdated gems found (@rohit, #2021)
+
## 1.3.0.pre (Nov 29, 2012)
Features:
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 5871d51b89..f8c2560998 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -333,6 +333,7 @@ module Bundler
Outdated lists the names and versions of gems that have a newer version available
in the given source. Calling outdated with [GEM [GEM]] will only check for newer
versions of the given gems. By default, available prerelease gems will be ignored.
+ If outdated gems are found then the exit status is set to 300.
D
method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
method_option "source", :type => :array, :banner => "Check against a specific source"
@@ -388,6 +389,7 @@ module Bundler
Bundler.ui.info "Your bundle is up to date!" if out_count < 1
Bundler.ui.info ""
+ exit 300 if out_count >= 1
end
desc "cache", "Cache all the gems to vendor/cache", :hide => true
diff --git a/spec/other/outdated_spec.rb b/spec/other/outdated_spec.rb
index 4eab6b61b8..9d529d64bd 100644
--- a/spec/other/outdated_spec.rb
+++ b/spec/other/outdated_spec.rb
@@ -25,6 +25,23 @@ describe "bundle outdated" do
expect(out).to include("activesupport (3.0 > 2.3.5)")
expect(out).to include("foo (1.0")
end
+
+ it "returns non zero exit status if outdated gems present" do
+ update_repo2 do
+ build_gem "activesupport", "3.0"
+ update_git "foo", :path => lib_path("foo")
+ end
+
+ bundle "outdated", :exitstatus => true
+
+ expect(exitstatus).to_not be_zero
+ end
+
+ it "returns success exit status if no outdated gems present" do
+ bundle "outdated", :exitstatus => true
+
+ expect(exitstatus).to be_zero
+ end
end
describe "with --local option" do