summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/bundler/cli.rb2
-rw-r--r--lib/bundler/cli/viz.rb2
-rw-r--r--lib/bundler/graph.rb5
4 files changed, 8 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e1da29b176..71eaf9a936 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ Features:
- add support for SVN sources (@msnexploder)
- add metadata allowed_push_host to new gem template (#3002, @juanitofatas)
- adds a `--no-install` flag to `bundle package`
+ - add `bundle viz --without` to exclude gem groups from resulting graph (@fnichol)
## 1.6.2 (2014-04-13)
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 065bc48f91..8da526e2af 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -315,6 +315,8 @@ module Bundler
method_option :format, :type => :string, :default => "png", :aliases => '-F', :banner => "This is output format option. Supported format is png, jpg, svg, dot ..."
method_option :requirements, :type => :boolean, :default => false, :aliases => '-r', :banner => "Set to show the version of each required dependency."
method_option :version, :type => :boolean, :default => false, :aliases => '-v', :banner => "Set to show each gem version."
+ method_option :without, :type => :array, :default => [], :banner => "Exclude gems that are part of the specified named group."
+
def viz
require 'bundler/cli/viz'
Viz.new(options).run
diff --git a/lib/bundler/cli/viz.rb b/lib/bundler/cli/viz.rb
index c404ddbbc5..09557e599c 100644
--- a/lib/bundler/cli/viz.rb
+++ b/lib/bundler/cli/viz.rb
@@ -8,7 +8,7 @@ module Bundler
def run
require 'graphviz'
output_file = File.expand_path(options[:file])
- graph = Graph.new(Bundler.load, output_file, options[:version], options[:requirements], options[:format])
+ graph = Graph.new(Bundler.load, output_file, options[:version], options[:requirements], options[:format], options[:without])
graph.viz
rescue LoadError => e
Bundler.ui.error e.inspect
diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb
index 92f538b9fd..0b5c5723b4 100644
--- a/lib/bundler/graph.rb
+++ b/lib/bundler/graph.rb
@@ -3,12 +3,13 @@ module Bundler
class Graph
GRAPH_NAME = :Gemfile
- def initialize(env, output_file, show_version = false, show_requirements = false, output_format = "png")
+ def initialize(env, output_file, show_version = false, show_requirements = false, output_format = "png", without = [])
@env = env
@output_file = output_file
@show_version = show_version
@show_requirements = show_requirements
@output_format = output_format
+ @without_groups = without.map(&:to_sym)
@groups = []
@relations = Hash.new {|h, k| h[k] = Set.new}
@@ -53,6 +54,8 @@ module Bundler
relations = Hash.new {|h, k| h[k] = Set.new}
@env.current_dependencies.each do |dependency|
dependency.groups.each do |group|
+ next if @without_groups.include?(group)
+
relations[group.to_s].add(dependency)
@relations[group.to_s].add(dependency.name)