[chef] Re: Re: Re: Cookbook dependency graphing


Chronological Thread 
  • From: Torben Knerr < >
  • To:
  • Subject: [chef] Re: Re: Re: Cookbook dependency graphing
  • Date: Thu, 11 Jul 2013 07:52:00 +0200

P.S.: just added a pull requrest so it can be installed via bundler as well:



On Wed, Jul 10, 2013 at 9:55 AM, Torben Knerr < " target="_blank"> > wrote:
Hi Steve, 

thanks! It works on Windows as well, you just need graphviz installed (and in the path), and you need to install it either as you or Roman described.

I just understood that it simply looks for all the `metadata.rb` files in the current directory, so it works both with librarian and berkshelf (just make sure the cookbooks are vendored e.g. to the `./cookbooks` directory). That is cool! :-)

One improvement would be to show the version number of the resolved cookbook in the graph nodes in addition to only the name. One step further you could also label the edges with the version constraints, if any.

P.S.: for the use case you describe (i.e. finding out which other cookbooks depend on an updated cookbook) you could also argue that this is the job of a dependency manager to find out. I'm not sure if librarian can do that, but berkshelf supports this exactly via `berks contingent COOKBOOK -F json`



On Wed, Jul 10, 2013 at 7:48 AM, steve . < " target="_blank"> > wrote:
Hi Torbin,

I threw this together today on my Macbook, so I'm not surprised to find that you're having trouble getting it to work on Windows.  I'm pretty sure at least some of the depgraph codebase pre-dates Chef and it definitely _wasn't_ designed with Bundler in mind.  The gemspec is actually declared in the Rakefile.

However, I can attest that "rake gem" and "sudo gem install pkg/depgraph-VERSION.gem" got it installed for me.  No idea how easy it's going to be for you to get graphviz / ruby-graphviz functioning on Windows, though.

I don't know if the original gem is actively maintained at this point -- haven't put together a pull request yet -- but if you get it working on Windows, send me a PR and I'll merge it on in...


On Tue, Jul 9, 2013 at 10:38 PM, Torben Knerr < " target="_blank"> > wrote:
Guess I'm too stupid to install it...

In my `Gemfile`:
```
```

Then I run:
```
D:\Repos\_github\_cookbooks\gitlab>bundle install
remote: Counting objects: 316, done.
remote: Compressing objects: 100% (124/124), done.
rRemote: Total 316 (delta 171), reused 311 (delta 166)
Receiving objects: 100% (316/316), 69.82 KiB | 73 KiB/s, done.
Resolving deltas: 100% (171/171), done.
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Could not find gem 'depgraph (>= 0) x86-mingw32' in
Source does not contain any versions of 'depgraph (>= 0) x86-mingw32'
```

Is it supposed to be installed as a gem? 

Not a Ruby expert, but I don't see a .gemspec there. Might this be the problem?



On Wed, Jul 10, 2013 at 2:00 AM, steve . < " target="_blank"> > wrote:
Not sure if anyone's already doing something like this, but I made some REALLY MINOR modifications to the most ancient and venerable Ruby depgraph tool and got it parsing cookbook metadata instead of C# code and installed gems.


Default behavior is to parse, fire up graphviz and show you a dependency graph.  That's fine but I wanted it as a JSON object.

I added the -json switch to allow you to generate an object that looks like this:

{ "cookbook" : [ "dependency1", "dependency2"],
 ...
}

Hope someone out there finds this useful.







Archive powered by MHonArc 2.6.16.

§