javaclass 0.0.4 → 0.4.1

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.
Files changed (68) hide show
  1. data/Rakefile +18 -71
  2. data/Readme.txt +13 -22
  3. data/{example_task.rb → dev/example_task.rb} +1 -1
  4. data/dev/saikuro_task.rb +120 -0
  5. data/examples/chart_class_dependencies.rb +43 -0
  6. data/examples/chart_module_dependencies.rb +64 -0
  7. data/examples/check_interface_names.rb +3 -2
  8. data/examples/corpus.rb +52 -12
  9. data/examples/count_classes_in_modules.rb +2 -1
  10. data/examples/cumulative_dependencies.rb +4 -3
  11. data/examples/find_all_imported_types.rb +11 -7
  12. data/examples/find_incoming_dependency_graph.rb +81 -0
  13. data/examples/find_layers_of_modules.rb +79 -0
  14. data/examples/find_referenced_modules.rb +4 -6
  15. data/examples/find_unreferenced_classes.rb +14 -4
  16. data/examples/generate_class_lists.rb +1 -0
  17. data/examples/show_jar_api.rb +93 -0
  18. data/examples/test_corpus.rb +32 -0
  19. data/history.txt +17 -5
  20. data/javaclass.gemspec +9 -8
  21. data/lib/javaclass/analyse/dependencies.rb +1 -1
  22. data/lib/javaclass/analyse/transitive_dependencies.rb +2 -2
  23. data/lib/javaclass/classfile/class_magic.rb +1 -1
  24. data/lib/javaclass/classfile/constant_pool.rb +1 -0
  25. data/lib/javaclass/classfile/java_class_header_as_java_name.rb +4 -0
  26. data/lib/javaclass/classfile/java_class_header_shortcuts.rb +2 -0
  27. data/lib/javaclass/classlist/jar_searcher.rb +11 -5
  28. data/lib/javaclass/classlist/list.rb +27 -14
  29. data/lib/javaclass/classpath/any_classpath.rb +1 -1
  30. data/lib/javaclass/classpath/eclipse_classpath.rb +45 -25
  31. data/lib/javaclass/classpath/factory.rb +23 -13
  32. data/lib/javaclass/classpath/maven_artefact.rb +62 -0
  33. data/lib/javaclass/classpath/tracking_classpath.rb +3 -1
  34. data/lib/javaclass/dependencies/class_node.rb +36 -0
  35. data/lib/javaclass/dependencies/classpath_node.rb +37 -0
  36. data/lib/javaclass/dependencies/edge.rb +41 -0
  37. data/lib/javaclass/dependencies/graph.rb +53 -0
  38. data/lib/javaclass/dependencies/graphml_serializer.rb +102 -0
  39. data/lib/javaclass/dependencies/node.rb +82 -0
  40. data/lib/javaclass/dependencies/yaml_serializer.rb +103 -0
  41. data/lib/javaclass/dsl/java_name_factory.rb +2 -2
  42. data/lib/javaclass/gems/zip_file.rb +41 -33
  43. data/lib/javaclass/java_name.rb +1 -1
  44. data/lib/javaclass/java_name_scanner.rb +9 -7
  45. data/lib/javaclass/string_20.rb +40 -0
  46. data/lib/javaclass/string_hexdump.rb +18 -2
  47. data/lib/javaclass/string_ux.rb +3 -7
  48. data/planned.txt +50 -4
  49. data/rake_analysis.rb +46 -0
  50. data/test/data/api/packagename/Broken.class +0 -0
  51. data/test/logging_folder_classpath.rb +2 -2
  52. data/test/{test_adder_tree.rb → test_adder_tree_node.rb} +1 -1
  53. data/test/test_class_magic.rb +1 -1
  54. data/test/test_eclipse_classpath.rb +1 -1
  55. data/test/test_edge.rb +60 -0
  56. data/test/test_factory.rb +1 -1
  57. data/test/test_graph.rb +28 -0
  58. data/test/test_java_name.rb +13 -1
  59. data/test/test_javaclass_api.rb +18 -3
  60. data/test/test_maven_artefact.rb +37 -0
  61. data/test/test_node.rb +56 -0
  62. data/test/test_yaml_serializer.rb +105 -0
  63. data/test/ts_all_tests.rb +16 -3
  64. metadata +46 -35
  65. data/examples/profiler_scratchpad.rb +0 -33
  66. data/lib/javaclass/analyse/ideas.txt +0 -15
  67. data/lib/javaclass/classpath/classpaths.txt +0 -2
  68. data/lib/javaclass/classscanner/ideas.txt +0 -3
data/Rakefile CHANGED
@@ -6,8 +6,7 @@ require 'rake'
6
6
  require 'rake/clean' # for clean/clobber
7
7
  require 'rake/testtask'
8
8
  require 'rake/packagetask'
9
- require 'rake/rdoctask'
10
- require 'example_task'
9
+ require File.dirname(__FILE__) + '/dev/example_task'
11
10
 
12
11
  # Test, package and publish functions.
13
12
  # Author:: Peter Kofler
@@ -103,48 +102,8 @@ task :release_rubygems => :package do
103
102
  Gem::GemRunner.new.run ['push', "pkg/#{full_gem_name}.gem"]
104
103
  end
105
104
 
106
- # Read username and password from the <code>~/.hgrc</code> for _authname_ prefix.
107
- # <code>HOME</code> environment must be set.
108
- def user_pass_from_hgrc(authname)
109
- lines = IO.readlines(File.expand_path('~/.hgrc'))
110
- user = lines.find{ |l| l =~ /#{authname}.username/ }[/[^\s=]+$/]
111
- raise "could not find key #{authname}.username in ~/.hgrc" unless user
112
- pass = lines.find{ |l| l =~ /#{authname}.password/ }[/[^\s=]+$/]
113
- raise "could not find key #{authname}.password in ~/.hgrc" unless pass
114
- [user, pass]
115
- end
116
-
117
- # Download the <code>googlecode_upload.py</code> from Google Code repository and save it as _name_ .
118
- # See:: http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py
119
- def download_googlecode_upload_py(name)
120
- Net::HTTP.start('support.googlecode.com', 80) do |http|
121
- body = http.get("/svn/trunk/scripts/#{name}").body
122
- File.open(name, 'w') { |f| f.print body }
123
- end
124
- end
125
-
126
- # Helper method to execute Python with the _params_ array.
127
- # The +python+ executable must be in the path.
128
- def python(params)
129
- puts `python #{params.join(' ')}`
130
- end
131
-
132
- # internal - desc 'Release the gem to Google Code'
133
- task :release_googlecode => :package do
134
- puts "Releasing #{full_gem_name} to GoogleCode"
135
- user, pass = user_pass_from_hgrc(gemspec.name)
136
- # See:: http://code.google.com/p/support/wiki/ScriptedUploads
137
- download_googlecode_upload_py 'googlecode_upload.py'
138
- ['gem', 'zip'].each do |extension|
139
- puts "uploading \"pkg/#{full_gem_name}.#{extension}\"..."
140
- python ['googlecode_upload.py', "-s \"JavaClass #{gemspec.version} #{extension.capitalize}\"",
141
- "-p #{GOOGLE_PROJECT}", "-u #{user}", "-w #{pass}",
142
- "pkg/#{full_gem_name}.#{extension}"]
143
- end
144
- end
145
-
146
- desc 'Package and upload gem to Rubygems and Google Code'
147
- task :publish_gem => [:clobber_package, :example, :package, :release_rubygems, :release_googlecode]
105
+ desc 'Package and upload gem to Rubygems'
106
+ task :publish_gem => [:clobber_package, :example, :package, :release_rubygems]
148
107
 
149
108
  # :example, :clobber_example, :reexample
150
109
  example_task_lib = Rake::ExampleTask.new do |example|
@@ -154,17 +113,25 @@ task :clobber_rdoc => [:clobber_example]
154
113
  task :rdoc => [:example]
155
114
  task :package => [:example]
156
115
 
116
+ begin
117
+ require 'rdoc/task'
118
+ SomeRDocTask = RDoc::Task
119
+ rescue LoadError
120
+ require 'rake/rdoctask'
121
+ SomeRDocTask = Rake::RDocTask
122
+ end
123
+
157
124
  # :rdoc, :clobber_rdoc, :rerdoc
158
- Rake::RDocTask.new do |rdoc|
125
+ SomeRDocTask.new do |rdoc|
159
126
  rdoc.rdoc_dir = RDOC_DIR # 'html' is default anyway
160
127
  rdoc.title = "#{full_gem_name} Documentation"
161
128
  rdoc.main = 'Readme.txt'
162
129
 
163
130
  # examples are generated later and not necessarily available at definition time
164
131
  examples = example_task_lib.conversion_pairs.map { |a| a[1] }
165
-
166
- rdoc.rdoc_files.include *examples
167
- rdoc.rdoc_files.include 'lib/**/*.rb', *gemspec.extra_rdoc_files
132
+
133
+ rdoc.rdoc_files.include(*examples)
134
+ rdoc.rdoc_files.include('lib/**/*.rb', *gemspec.extra_rdoc_files)
168
135
  end
169
136
 
170
137
  # Helper method to add target="_parent" to all external links in _file_ html.
@@ -196,10 +163,10 @@ def add_frameset_version(file, dir)
196
163
  File.open(file, 'w') { |f| f.print lines.join }
197
164
  end
198
165
 
199
- desc 'Publish the RDoc files to Google Code'
166
+ desc 'Publish the RDoc files to repository'
200
167
  task :publish_rdoc => [:clobber_rdoc, :fix_rdoc] do
201
168
  puts "Releasing #{full_gem_name} to API"
202
- remote_repo = "https://code.google.com/p/#{GOOGLE_PROJECT}.#{RDOC_REPO}"
169
+ remote_repo = "https://bitbucket.org/pkofler/#{HG_PROJECT}.#{RDOC_REPO}/"
203
170
  remote_dir = "#{gemspec.version}"
204
171
 
205
172
  FileUtils.rm_r RDOC_REPO rescue nil
@@ -222,26 +189,6 @@ task :publish_rdoc => [:clobber_rdoc, :fix_rdoc] do
222
189
  end
223
190
 
224
191
  # :clean :clobber
225
- CLOBBER.include(RDOC_REPO, 'googlecode_upload.py', 'ClassLists', 'fullClassList*.txt')
226
-
227
- # Helper method to grep all the sources for some _pattern_ words.
228
- def egrep(pattern)
229
- Dir['**/*'].find_all { |fn| FileTest.file?(fn) && File.basename(fn) != /^\./ }.each do |fn|
230
- line_count = 0
231
- open(fn) do |f|
232
- while line = f.gets
233
- line_count += 1
234
- if line =~ pattern
235
- puts "#{fn}:#{line_count}:#{line.strip}"
236
- end
237
- end
238
- end
239
- end
240
- end
241
-
242
- desc 'Look for TODO and FIXME tags'
243
- task :todo do
244
- egrep(/#.*(FI[X]ME|TO[D]O|T[B]D|H[A]CK)/i) # use 'odd' brackets to not find myself (and not have Eclipse markers)
245
- end
192
+ CLOBBER.include(RDOC_REPO, 'ClassLists', 'fullClassList*.txt')
246
193
 
247
194
  task :default => :test
data/Readme.txt CHANGED
@@ -1,8 +1,7 @@
1
1
  javaclass-rb
2
2
  by {Peter 'Code Cop' Kofler}[http://www.code-cop.org/]
3
3
 
4
- * {Homepage (Google Code)}[http://code.google.com/p/javaclass-rb/]
5
- * {Rubyforge Project (old)}[http://rubyforge.org/projects/javaclass]
4
+ * {Homepage (Bitbucket)}[https://bitbucket.org/pkofler/javaclass-rb]
6
5
  * email peter dot kofler at code minus cop dot org
7
6
 
8
7
  == Description
@@ -20,14 +19,15 @@ Ruby for all kind of stuff, just for fun. When I needed some Java class
20
19
  analysis I wrote it in Ruby. As I am a puritan, I did not
21
20
  want to call javap from my script, so I started disassembling the class files,
22
21
  which might be the base for some serious static code analysis tools. (I
23
- {started adding methods}[link:/files/history_txt.html] to that end.)
22
+ {started adding methods}[link:/files/history_txt.html] to that end and
23
+ {planned}[link:/files/planned_txt.html] for some common metrics as well.)
24
24
 
25
25
  == Install
26
26
 
27
27
  sudo gem install javaclass
28
28
 
29
29
  * {Gem Hosting}[http://rubygems.org/gems/javaclass]
30
- * {Download of tarballs and gems}[http://code.google.com/p/javaclass-rb/downloads/list]
30
+ * {Download of tarballs and gems}[https://bitbucket.org/pkofler/javaclass-rb/downloads]
31
31
 
32
32
  == Documentation
33
33
 
@@ -36,9 +36,9 @@ available in Object through the JavaClass::Dsl::Mixin. The main class or the par
36
36
  is JavaClass::ClassFile::JavaClassHeader which provides access to all information
37
37
  of a Java class file.
38
38
 
39
- * {API RDoc}[http://api.javaclass-rb.googlecode.com/hg/index.html]
39
+ * {API RDoc}[http://www.code-cop.org/api/javaclass-rb/]
40
40
 
41
- I tried hard to rdoc all classes and public methods, so just {read it}[http://api.javaclass-rb.googlecode.com/hg/index.html].
41
+ I tried hard to rdoc all classes and public methods, so just {read it}[http://www.code-cop.org/api/javaclass-rb/].
42
42
 
43
43
  == Usage
44
44
 
@@ -51,30 +51,20 @@ See the various examples in the examples folder of the gem.
51
51
  * {Cumulative dependencies of a class}[link:/files/lib/generated/examples/cumulative_dependencies_txt.html]
52
52
  * {Find (un)referenced JARs}[link:/files/lib/generated/examples/find_referenced_modules_txt.html]
53
53
  * {Find unused classes}[link:/files/lib/generated/examples/find_unreferenced_classes_txt.html]
54
+ * {Extract and chart dependencies between classes}[link:/files/lib/generated/examples/chart_class_dependencies_txt.html]
55
+ * {Extract and chart dependency info between modules}[link:/files/lib/generated/examples/chart_module_dependencies_txt.html]
54
56
  * {Generate lists of JDK classes}[link:/files/lib/generated/examples/generate_class_lists_txt.html]
57
+ * {List content of a (Maven) JAR}[link:/files/lib/generated/examples/show_jar_api_txt.html]
55
58
 
56
59
  There is some experimental logic to recognize Java class name literals in Ruby
57
60
  which are mapped to JavaClass::JavaQualifiedName. Packages have to be suffixed
58
61
  with ".*" to be recognized. See JavaClass::Dsl::JavaNameFactory for its usage.
59
62
 
60
- == Support
61
-
62
- The bug tracker is available at {Google Code}[http://code.google.com/p/javaclass-rb/issues/list]
63
- or just drop me an email.
64
-
65
- == How to submit patches
66
-
67
- Read the {8 steps for fixing other people's code}[http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/]
68
- and for section 8, use the {Issue Tracker}[http://code.google.com/p/javaclass-rb/issues/list].
69
-
70
- The trunk repository is available with
71
-
72
- hg clone https://javaclass-rb.googlecode.com/hg/ javaclass-rb
73
-
74
63
  == Dependencies
75
64
 
76
- * Ruby 1.8.6 (runs with 1.8.7 and 1.9.1, too)
77
- * {rubyzip}[http://rubyzip.sourceforge.net/] 0.9.1
65
+ * Ruby 1.8.7 (also tested under 1.9.3, 2.0.0 and 2.1.6)
66
+ * {rubyzip}[https://github.com/rubyzip/rubyzip] 0.9.1 (also tested with 0.9.6.1, 0.9.9, 1.0.0 and 1.1.7)
67
+ * Originally Ruby 1.8.6 with rubyzip 0.9.1
78
68
 
79
69
  == References
80
70
 
@@ -84,4 +74,5 @@ The trunk repository is available with
84
74
 
85
75
  == License
86
76
 
77
+ Typically the licenses listed for the project are that of the project itself, and not of dependencies.
87
78
  * {BSD License}[http://www.opensource.org/licenses/bsd-license.php], it's enclosed in {license.txt}[link:/files/license_txt.html].
@@ -104,8 +104,8 @@ module Rake
104
104
  def define_transform(example_path, example_target)
105
105
  task build_task_name => [example_target]
106
106
  file example_target => [example_path, Rake.application.rakefile] do
107
- print '.'
108
107
  transform(example_path, example_target)
108
+ puts "generated #{example_target}"
109
109
  end
110
110
  end
111
111
 
@@ -0,0 +1,120 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+ require 'saikuro'
4
+
5
+ module Rake
6
+
7
+ # Create a task that will generate the Saikuro complexity report for a project.
8
+ # See http://saikuro.rubyforge.org/
9
+ #
10
+ # The SaikuroTask will create the following targets:
11
+ #
12
+ # [<b>:<em>complexity</em></b>]
13
+ # Main task for this Saikuro task.
14
+ #
15
+ # [<b>:clobber_<em>complexity</em></b>]
16
+ # Delete all the Saikuro report files. This target is automatically added to the main clobber target.
17
+ #
18
+ # Simple Saikuro:
19
+ #
20
+ # Rake::SaikuroTask.new do |rd|
21
+ # rd.output_dir = 'html'
22
+ # rd.files.include('lib/**/*.rb')
23
+ # end
24
+ #
25
+ # The +rd+ object passed to the block is an SaikuroTask object. See the
26
+ # attributes list for the SaikuroTask class for available customization options.
27
+ #
28
+ # Author:: Peter Kofler
29
+ # Copyright:: Copyright (c) 2009, Peter Kofler.
30
+ # License:: {BSD License}[link:/files/license_txt.html]
31
+ #
32
+ class SaikuroTask < TaskLib
33
+ include Saikuro::ResultIndexGenerator
34
+
35
+ # Name of the main, top level task. (default is :complexity)
36
+ attr_accessor :name
37
+
38
+ # Name of directory to receive the Saikuro output files. (default is 'complexity')
39
+ attr_accessor :output_dir
40
+
41
+ # List of files to be included in the saikuro report. (default is [])
42
+ attr_accessor :files
43
+
44
+ # Create the Saikuro tasks with the given base _name_ .
45
+ def initialize(name = :complexity) # :yield: self
46
+ @name = name
47
+ @files = Rake::FileList.new
48
+ @output_dir = 'complexity'
49
+ @cyclo = true
50
+ @token = false
51
+
52
+ yield self if block_given?
53
+
54
+ define_tasks
55
+ end
56
+
57
+ private
58
+
59
+ # Create the tasks defined by this task lib.
60
+ def define_tasks
61
+ define_clobber_task
62
+ define_build_task
63
+ end
64
+
65
+ def define_clobber_task
66
+ desc 'Remove Saikuro products'
67
+ task clobber_task_name do
68
+ rm_r @output_dir rescue nil
69
+ end
70
+
71
+ task :clobber => [clobber_task_name]
72
+ end
73
+
74
+ def define_build_task
75
+ desc "Generate #{build_task_name} report with Saikuro"
76
+ task build_task_name => [clobber_task_name] do
77
+ directory @output_dir
78
+ create_report
79
+ end
80
+ end
81
+
82
+ def build_task_name
83
+ name.to_s
84
+ end
85
+
86
+ def clobber_task_name
87
+ "clobber_#{name}"
88
+ end
89
+
90
+ def create_report
91
+ if @cyclo
92
+ # state_filter = Filter.new(0) use threshold 0 for reporting Measure compatible counts
93
+ state_filter = Filter.new(5)
94
+ state_formater = Saikuro::StateHTMLComplexityFormater.new(STDOUT, state_filter)
95
+ else
96
+ state_formater = nil
97
+ end
98
+
99
+ if @token
100
+ token_filter = Filter.new(10, 25, 50)
101
+ token_count_formater = Saikuro::HTMLTokenCounterFormater.new(STDOUT, token_filter)
102
+ else
103
+ token_count_formater = nil
104
+ end
105
+
106
+ # ignore DEBUG log in Saikuro
107
+ verbosity = $VERBOSE
108
+ $VERBOSE = nil
109
+ begin
110
+ idx_states, idx_tokens = Saikuro.analyze(@files, state_formater, token_count_formater, @output_dir)
111
+ ensure
112
+ $VERBOSE = verbosity
113
+ end
114
+
115
+ write_cyclo_index(idx_states, @output_dir)
116
+ write_token_index(idx_tokens, @output_dir)
117
+ end
118
+
119
+ end
120
+ end
@@ -0,0 +1,43 @@
1
+ # Example usage of JavaClass::Dependencies::Graph: Iterate all classes of a
2
+ # classpath and construct the Java dependency graph.
3
+ # Author:: Peter Kofler
4
+ # Copyright:: Copyright (c) 2009, Peter Kofler.
5
+ # License:: {BSD License}[link:/files/license_txt.html]
6
+ #
7
+ # === Steps
8
+
9
+ #--
10
+ # add the lib of this gem to the load path
11
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
12
+ require File.join(File.dirname(__FILE__), 'corpus')
13
+
14
+ corpus = Corpus[:WF]
15
+ location = corpus.classes
16
+ #++
17
+ require 'javaclass/dsl/mixin'
18
+ require 'javaclass/dependencies/graph'
19
+ require 'javaclass/dependencies/class_node'
20
+ require 'javaclass/dependencies/yaml_serializer'
21
+ require 'javaclass/dependencies/graphml_serializer'
22
+
23
+ # 1) create the classpath of a given location
24
+ cp = classpath(location)
25
+
26
+ dependencies = JavaClass::Dependencies::Graph.new
27
+
28
+ # 2) iterate all classes of the classpath
29
+ cp.values.each do |clazz|
30
+ next unless clazz.access_flags.public?
31
+
32
+ # 3) add a JavaClass::Dependencies::ClassNode for each class to the graph
33
+ dependencies.add(JavaClass::Dependencies::ClassNode.new(clazz))
34
+ end
35
+
36
+ # 4) resolve all dependencies of all nodes in the graph. Now each class (Node) has a dependency to
37
+ # all imported classes (Nodes).
38
+ dependencies.resolve_dependencies
39
+ puts "#{dependencies.to_a.size} classes loaded"
40
+
41
+ # 5) save the result in various formats, e.g. GraphML or YAML, skipping outgoing edges information
42
+ JavaClass::Dependencies::GraphmlSerializer.new(:edges => :no_text).save('class_dependencies', dependencies)
43
+ JavaClass::Dependencies::YamlSerializer.new(:outgoing => :none).save('class_dependencies', dependencies)
@@ -0,0 +1,64 @@
1
+ # Example usage of JavaClass::Dependencies::Graph: Iterate all folders of a root folder.
2
+ # Load each component separately and construct the dependency graph.
3
+ # Author:: Peter Kofler
4
+ # Copyright:: Copyright (c) 2009, Peter Kofler.
5
+ # License:: {BSD License}[link:/files/license_txt.html]
6
+ #
7
+ # === Steps
8
+
9
+ #--
10
+ # add the lib of this gem to the load path
11
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
12
+ require File.join(File.dirname(__FILE__), 'corpus')
13
+
14
+ location = Corpus[:RCP].location
15
+
16
+ def relatedPlugin?(name)
17
+ name == 'com.some.pricing' ||
18
+ name == 'org.eclipse.update.scheduler' || # all other org.eclipse, nebula and zentest are in 1st level
19
+ name =~ /^com\.some\./ && !(
20
+ name =~ /gpe\.persistence$/ || # looks like duplicate of rocketdb
21
+ name =~ /\.test$|\.testing$|\.mock$|\.test\.perfmon$/ || # test
22
+ name =~ /\.build/ || # build
23
+ name =~ /rocketDBtools$/ # tools
24
+ )
25
+ end
26
+ #++
27
+ require 'javaclass/dsl/mixin'
28
+ require 'javaclass/dependencies/graph'
29
+ require 'javaclass/dependencies/classpath_node'
30
+ require 'javaclass/dependencies/yaml_serializer'
31
+ require 'javaclass/dependencies/graphml_serializer'
32
+
33
+ # 1) define the location of the plugins
34
+ # location = 'C:\Eclipse\workspace'
35
+
36
+ plugins = JavaClass::Dependencies::Graph.new
37
+
38
+ # 2) iterate all plugins of a workspace location
39
+ Dir.new(location).each do |folder|
40
+ #--
41
+ next unless relatedPlugin?(folder)
42
+ #++
43
+ path = File.join(location, folder)
44
+ next unless FileTest.directory? path
45
+
46
+ classes = File.join(path, 'bin')
47
+ next unless FileTest.exist?(classes)
48
+
49
+ # 3) create a classpath for each plugin
50
+ cp = classpath(classes)
51
+ next if cp.count == 0
52
+
53
+ # 4) add a JavaClass::Dependencies::Node for that plugin to the graph
54
+ plugins.add(JavaClass::Dependencies::ClasspathNode.new(folder, cp))
55
+ end
56
+
57
+ # 5) resolve all dependencies of all nodes in the graph
58
+ plugins.resolve_dependencies
59
+ puts "#{plugins.to_a.size} plugins loaded"
60
+
61
+ # 6) save the result in various formats, e.g. GraphML or YAML
62
+ JavaClass::Dependencies::GraphmlSerializer.new.save('plugin_dependencies', plugins)
63
+ JavaClass::Dependencies::YamlSerializer.new.save('plugin_dependencies', plugins)
64
+ JavaClass::Dependencies::YamlSerializer.new(:outgoing => :summary).save('plugin_dependencies_summary', plugins)