{"id":22327430,"url":"https://github.com/rewindio/dagwood","last_synced_at":"2025-07-29T18:31:00.637Z","repository":{"id":40541369,"uuid":"289947077","full_name":"rewindio/dagwood","owner":"rewindio","description":"For all your dependency graph needs","archived":false,"fork":false,"pushed_at":"2023-08-29T22:45:41.000Z","size":31,"stargazers_count":28,"open_issues_count":1,"forks_count":2,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-05-21T04:40:13.884Z","etag":null,"topics":["dependency-graph","directed-acyclic-graph","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rewindio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2020-08-24T14:13:42.000Z","updated_at":"2025-01-15T01:54:10.000Z","dependencies_parsed_at":"2023-02-14T10:31:20.160Z","dependency_job_id":null,"html_url":"https://github.com/rewindio/dagwood","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rewindio/dagwood","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewindio%2Fdagwood","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewindio%2Fdagwood/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewindio%2Fdagwood/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewindio%2Fdagwood/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rewindio","download_url":"https://codeload.github.com/rewindio/dagwood/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewindio%2Fdagwood/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267368645,"owners_count":24076074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependency-graph","directed-acyclic-graph","ruby","ruby-gem"],"created_at":"2024-12-04T03:09:25.931Z","updated_at":"2025-07-29T18:31:00.367Z","avatar_url":"https://github.com/rewindio.png","language":"Ruby","readme":"# 🥪 Dagwood\n\nDagwood allows you to determine the resolution order of dependencies, using a [topologically sorted directed acyclic graph](https://en.wikipedia.org/wiki/Topological_sorting) (DAG - get it?).\n\nWhat does this mean? Let's use an example. When making a sandwich, it is important to follow a specific order of operations. We know that the bread needs to be sliced before we can put the mustard on it, just like we know there is no point closing the sandwich before putting the smoked meat in it. By stating all these dependencies (e.g. `add_mustard` depends on `slice_bread`), we can determine the full, correct order in which we should make our sandwich. We call this a `DependencyGraph`.\n\nSee the features listed below for ways in which we can use this information.\n\nDagwood might be useful for scheduling Sidekiq jobs to run in a specific order, determining the order in which software packages must be installed on a server, figuring out how long a project might take based on which steps need to be completed first, and many more use cases.\n\n#### Features:\n**Serial ordering of dependencies**\n\nThe basic case. Determine the order of dependencies, one item at a time. The `order` method returns an array of dependencies, in the order they need to be resolved.\n```ruby\ngraph = Dagwood::DependencyGraph.new(add_mustard: [:slice_bread], add_smoked_meat: [:slice_bread], close_sandwich: [:add_mustard, :add_smoked_meat])\ngraph.order\n=\u003e [:slice_bread, :add_mustard, :add_smoked_meat, :close_sandwich]\n```\n\n**Parallel ordering of dependencies**\n\nSometimes certain dependencies can be resolved at the same time. For example, a friend is helping you make your sandwich and you can both complete certain steps at the same time. The `parallel_order` method functions very similarly to `order`, except the items in the array are \"groups\" of dependencies which can be resolved in parallel (in this example, `add_smoked_meat` and `add_mustard` can be done at the same time).\n\n```ruby\ngraph = Dagwood::DependencyGraph.new(add_mustard: [:slice_bread], add_smoked_meat: [:slice_bread], close_sandwich: [:add_mustard, :add_smoked_meat])\ngraph.parallel_order\n=\u003e [[:slice_bread], [:add_mustard, :add_smoked_meat], [:close_sandwich]]\n```\n\n**Reverse ordering of dependencies**\n\nThe `reverse_order` method can be useful in cases where you'd like to apply the opposite order of operations.\n\n```ruby\ngraph = Dagwood::DependencyGraph.new(add_mustard: [:slice_bread], add_smoked_meat: [:slice_bread], close_sandwich: [:add_mustard, :add_smoked_meat])\ngraph.reverse_order\n=\u003e [:close_sandwich, :add_smoked_meat, :add_mustard, :slice_bread]\n```\n\n**Subgraphs**\n\nPerhaps you only care about what is needed to perform the `add_mustard` operation. The `subgraph` method allows you to grab a slice of the DependencyGraph, based on the given node.\n\n\n```ruby\ngraph = Dagwood::DependencyGraph.new(add_mustard: [:slice_bread], add_smoked_meat: [:slice_bread], close_sandwich: [:add_mustard, :add_smoked_meat])\nsubgraph = graph.subgraph :add_mustard\nsubgraph.order\n=\u003e [:slice_bread, :add_mustard]\n```\n\n**Graph merging**\n\nThe `merge` method allows you to take two DependencyGraphs and merge them. If your two most beloved restaurants have really good sandwich recipes, perhaps you'd like to attempt creating the Ultimate Sandwich by combining the steps for making both?\n\n```ruby\nrecipe1 = Dagwood::DependencyGraph.new(add_mustard: [:slice_bread], add_smoked_meat: [:slice_bread], close_sandwich: [:add_mustard, :add_smoked_meat])\nrecipe2 = Dagwood::DependencyGraph.new(add_mayo: [:slice_bread], add_turkey: [:slice_bread], close_sandwich: [:add_mayo, :add_turkey, :add_pickles])\n\nultimate_recipe = recipe1.merge(recipe2)\nultimate_recipe.order\n=\u003e [:slice_bread, :add_mustard, :add_smoked_meat, :add_mayo, :add_pickles, :add_turkey, :close_sandwich]\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'dagwood'\n```\n\nor this line to your gem's gemspec:\n\n```ruby\nspec.add_dependency 'dagwood'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install dagwood\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the spec. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at [https://github.com/rewindio/dagwood](https://github.com/rewindio/dagwood).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frewindio%2Fdagwood","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frewindio%2Fdagwood","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frewindio%2Fdagwood/lists"}