aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/cli/outdated.rb
diff options
context:
space:
mode:
authorCirdes Henrique <cirdes@gmail.com>2016-01-28 17:26:37 -0300
committerCirdes Henrique <cirdes@gmail.com>2016-01-29 08:05:14 -0300
commit9096ca93afe111bd0a6feb0d6ebac7de72e422b6 (patch)
tree01d3815fbdd85c8b4330173e3378a799f0903a78 /lib/bundler/cli/outdated.rb
parenta2d40cdde33186ab3bdd42c5080321ae89218a7b (diff)
downloadbundler-9096ca93afe111bd0a6feb0d6ebac7de72e422b6.tar.gz
bundle outdated with major and minor options
This feature adds the ability to specify on outdated command to show only the gems with a major or minor updates
Diffstat (limited to 'lib/bundler/cli/outdated.rb')
-rw-r--r--lib/bundler/cli/outdated.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 53813145..179635b8 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -46,6 +46,18 @@ module Bundler
active_spec = active_spec.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
end
active_spec = active_spec.last
+
+ if options[:major]
+ current_major = current_spec.version.segments.first
+ active_major = active_spec.version.segments.first
+ active_spec = nil unless active_major > current_major
+ end
+
+ if options[:minor]
+ current_minor = current_spec.version.segments[0, 2].compact.join(".")
+ active_minor = active_spec.version.segments[0, 2].compact.join(".")
+ active_spec = nil unless active_minor > current_minor
+ end
end
next if active_spec.nil?