gemviz 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ === 0.1.0 / 2009-01-10
2
+
3
+ * initial release
4
+
data/Manifest.txt ADDED
@@ -0,0 +1,7 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/gemviz
6
+ lib/gemviz.rb
7
+ test/test_gemviz.rb
data/README.txt ADDED
@@ -0,0 +1,48 @@
1
+ = gemviz
2
+
3
+ * FIX (url)
4
+
5
+ == DESCRIPTION:
6
+
7
+ FIX (describe your package)
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * FIX (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * FIX (list of requirements)
20
+
21
+ == INSTALL:
22
+
23
+ * FIX (sudo gem install, anything else)
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2009 FIX
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require './lib/version.rb'
6
+
7
+ Hoe.new('gemviz', Gemviz::VERSION::STRING) do |p|
8
+ p.developer('David Rupp', 'david@ruppconsulting.com')
9
+ p.remote_rdoc_dir = ''
10
+ end
11
+
12
+ # vim: syntax=Ruby
data/bin/gemviz ADDED
@@ -0,0 +1,6 @@
1
+ if ARGV.empty?
2
+ puts "Usage: gemviz gem1 [gem2 ...]"
3
+ exit 0
4
+ end
5
+
6
+ require File.dirname(__FILE__) + '/../lib/gemviz'
data/lib/gemviz.rb ADDED
@@ -0,0 +1,40 @@
1
+ require 'rubygems'
2
+ require 'graphviz'
3
+
4
+ module Gemviz #:nodoc:
5
+ VERSION = '0.1.0'
6
+ end
7
+
8
+ def build_dependencies_for(graph, gem_name)
9
+ return if graph[gem_name]
10
+ uses = `gem dep #{gem_name} --pipe`
11
+ uses = uses.split("\n").
12
+ reject {|line| line =~ /Gem #{gem_name}/}.
13
+ reject {|line| line =~ /No gems found/}.
14
+ map {|gem| gem.split('--version')[0].strip} unless uses.nil?
15
+ graph[gem_name] = uses
16
+ uses.each {|gem| build_dependencies_for(graph, gem)}
17
+ end
18
+
19
+ ARGV.each do |gem_name|
20
+ puts "building graph for #{gem_name}..."
21
+ graph = {}
22
+ build_dependencies_for(graph, gem_name)
23
+
24
+ g = GraphViz::new( "G" )
25
+
26
+ graph.each do |gem, dependent_gem|
27
+ gem_node = g.add_node(%Q/"#{gem}"/)
28
+ dependent_gem.each do |dependent|
29
+ dependent_node = g.add_node(%Q/"#{dependent}"/)
30
+ g.add_edge(gem_node, dependent_node)
31
+ end
32
+ end
33
+
34
+ begin
35
+ g.output(:file => 'temp.dot', :output => 'dot')
36
+ system "tred temp.dot|dot -Tpng > #{gem_name}.png"
37
+ ensure
38
+ File.delete('temp.dot')
39
+ end
40
+ end
File without changes
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gemviz
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - David Rupp
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-10 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.2
24
+ version:
25
+ description: FIX (describe your package)
26
+ email:
27
+ - david@ruppconsulting.com
28
+ executables:
29
+ - gemviz
30
+ extensions: []
31
+
32
+ extra_rdoc_files:
33
+ - History.txt
34
+ - Manifest.txt
35
+ - README.txt
36
+ files:
37
+ - History.txt
38
+ - Manifest.txt
39
+ - README.txt
40
+ - Rakefile
41
+ - bin/gemviz
42
+ - lib/gemviz.rb
43
+ - test/test_gemviz.rb
44
+ has_rdoc: true
45
+ homepage: FIX (url)
46
+ post_install_message:
47
+ rdoc_options:
48
+ - --main
49
+ - README.txt
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ version:
64
+ requirements: []
65
+
66
+ rubyforge_project: gemviz
67
+ rubygems_version: 1.3.1
68
+ signing_key:
69
+ specification_version: 2
70
+ summary: FIX (describe your package)
71
+ test_files:
72
+ - test/test_gemviz.rb