{"id":735,"date":"2016-04-06T18:07:07","date_gmt":"2016-04-06T18:07:07","guid":{"rendered":"http:\/\/www.pnambic.com\/home\/?p=735"},"modified":"2016-04-11T22:17:33","modified_gmt":"2016-04-11T22:17:33","slug":"depan-now-supports-ruby-dependency-visualization","status":"publish","type":"post","link":"http:\/\/www.pnambic.com\/home\/2016\/04\/06\/depan-now-supports-ruby-dependency-visualization\/","title":{"rendered":"DepAn now supports Ruby dependency visualization"},"content":{"rendered":"<h1>DepAn support for Ruby applications<\/h1>\n<p>A recent set of git commits has added <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ruby_(programming_language)\">Ruby<\/a>\u00a0(<a href=\"https:\/\/github.com\/google\/depan\/tree\/master\/DepanRuby\/prod\">DepanRuby<\/a>)\u00a0plugin\u00a0support to the base <a href=\"https:\/\/github.com\/google\/depan\">DepAn<\/a> product. Interested users should be able to access these capabilities in any recent build of DepAn.<\/p>\n<p>The current Ruby support is focused on exploiting DepAn\u2019s dependency visualization capabilities to analyze Ruby projects. Several different kinds of elements and relations are supported:<\/p>\n<p>Elements<\/p>\n<ul>\n<li>Classes<\/li>\n<li>ClassMethods<\/li>\n<li>InstanceMethods<\/li>\n<li>SingletonMethods<\/li>\n<\/ul>\n<p>Relations<\/p>\n<ul>\n<li>ExtendsType<\/li>\n<li>ClassMember<\/li>\n<li>InstanceMember<\/li>\n<li>SingletonMember<\/li>\n<li>StaticCall<\/li>\n<\/ul>\n<p>Like DepAn\u2019s other dependency models, a Ruby dependency graph\u2019s nodes and edges are obtained by introspection on the Ruby application. Unlike other DepAn analysis components, these dependency graphs are build through an independent application.<\/p>\n<p>The discovery of Ruby dependencies is handled by an separate command line Ruby application. \u00a0The use of Ruby for dependency extraction provides natural access to Ruby\u2019s own introspection system. \u00a0For many classes, their structure and elements are readily available as object methods. \u00a0The call dependencies are naturally deduced by inspecting the <a href=\"http:\/\/ruby-doc.org\/core-2.3.0\/RubyVM.html\">RubyVM<\/a>\u2019s <a href=\"http:\/\/ruby-doc.org\/core-2.3.0\/RubyVM\/InstructionSequence.html\">InstructionSequence <\/a>objects.<\/p>\n<h2>Extracting Ruby Dependencies<\/h2>\n<p>Ruby dependencies can be obtained via the <a href=\"https:\/\/github.com\/pnambic\/ruby-export\"><tt>ruby_export<\/tt><\/a> application available from <a href=\"http:\/\/www.pnambic.com\/\">Pnambic Computing<\/a>. \u00a0This command line Ruby application uses introspection to discover structural and run-time dependencies for Ruby programs.<\/p>\n<p>The <tt>ruby_export<\/tt> application provides basic dependency information about Ruby programs. Class, superclass and method definitions are included. \u00a0However, module structure is not included. Some analysis of Ruby bytecode is performed, allowing the discovery of directly dependent classes and class method class. \u00a0Symbolic interpretation is limited to constant resolution. \u00a0This allows some \u201cclass method\u201d calls to be detected and added as dependencies.<\/p>\n<p>The <tt>ruby_export<\/tt> application uses the standard Ruby <tt>optparse<\/tt> gem for command line parsing.  Details are available with the <span style=\"white-space:nowrap;\"><tt>--help<\/tt><\/span> switch.  Normal use has the following pattern:<\/p>\n<pre>ruby -Ilib lib\/ruby_export.rb -o Rake_20160406a.dgi -c Rake rake<\/pre>\n<p>This examples outputs an analysis of the Rake application into a <tt>Rake_201000406a.dgi<\/tt> file.  A log of activity analysis is written to <tt>STDERR<\/tt>.  This can be redirected with the <tt>-l<\/tt> option.<\/p>\n<p>The <tt>-c<\/tt> indicates the classes the use a starting point, <tt>-o<\/tt> indicates the output file to generate, and unspecified options (e.g. <tt>rake<\/tt>) provide a list of required components to include in the analysis.  Both the <tt>-c<\/tt> and required components can be repeated as necessary.<\/p>\n<p>Teams that require more precise information about their Ruby dependencies are invited to improved the analysis application as appropriate. \u00a0A rich symbolic evaluation engine could help resolve many of the call\/send dependencies in Ruby\u2019s duck-typing method dispatch.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DepAn support for Ruby applications A recent set of git commits has added Ruby\u00a0(DepanRuby)\u00a0plugin\u00a0support to the base DepAn product. Interested users should be able to access these capabilities in any recent build of DepAn. The current Ruby support is focused on exploiting DepAn\u2019s dependency visualization capabilities to analyze Ruby projects. Several different kinds of elements<a class=\"moretag\" href=\"http:\/\/www.pnambic.com\/home\/2016\/04\/06\/depan-now-supports-ruby-dependency-visualization\/\"> [&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":677,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[31],"tags":[],"class_list":["post-735","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.pnambic.com\/home\/wp-content\/uploads\/2015\/12\/depan-icon-60x60.png?fit=60%2C60","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6YqIw-bR","_links":{"self":[{"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/posts\/735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/comments?post=735"}],"version-history":[{"count":5,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/posts\/735\/revisions"}],"predecessor-version":[{"id":742,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/posts\/735\/revisions\/742"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/media\/677"}],"wp:attachment":[{"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/media?parent=735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/categories?post=735"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/tags?post=735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}