0.0
No commit activity in last 3 years
No release in over 3 years
A pure ruby, comment-based dependency graph
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

= 0.9.1
= 2.12.0
 Project Readme

Codependency

Codependency is a simple comment-based dependency graph that you can use on arbitrary files. The comment syntax should look familiar to anyone who has used Sprockets, but is not nearly as robust (yet).

Installation

Add this line to your application's Gemfile:

gem 'codependency'

And then execute:

$ bundle

Or install it yourself as:

$ gem install codependency

Usage

Say you have two files, bar.rb and foo.rb. bar comes before foo in a natural naming scheme, but bar has a dependency on foo. We can express this using a simple comment syntax at the head of the file like this:

bar.rb:

#= require foo

class Bar
end

foo.rb:

class Foo
end

Then, we create a dependency graph to determine the order in which the files might need to be loaded, inserted, or compiled:

graph = Codependency::Graph.new
graph.path << '.' # works like PATH, append search paths for this graph
graph << 'bar'    # adds a file to this graph, finds its dependencies recursively
graph.files       # returns a topologically sorted list of relative pathnames

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request