{"id":22980975,"url":"https://github.com/rubyworks/rulebow","last_synced_at":"2025-10-09T03:33:24.263Z","repository":{"id":748662,"uuid":"400741","full_name":"rubyworks/rulebow","owner":"rubyworks","description":"Autological Build Tool","archived":false,"fork":false,"pushed_at":"2015-03-01T22:05:32.000Z","size":516,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-02T09:47:18.037Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://rubyworks.github.com/rulebow","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rubyworks.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-12-05T18:15:01.000Z","updated_at":"2019-03-24T18:46:53.000Z","dependencies_parsed_at":"2022-07-18T12:48:14.396Z","dependency_job_id":null,"html_url":"https://github.com/rubyworks/rulebow","commit_stats":null,"previous_names":["rubyworks/ergo","rubyworks/fire"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rubyworks/rulebow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Frulebow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Frulebow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Frulebow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Frulebow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubyworks","download_url":"https://codeload.github.com/rubyworks/rulebow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Frulebow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278891912,"owners_count":26063894,"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-10-08T02:00:06.501Z","response_time":56,"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":[],"created_at":"2024-12-15T01:46:24.886Z","updated_at":"2025-10-09T03:33:24.248Z","avatar_url":"https://github.com/rubyworks.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RULEBOW\n\n[Homepage](http://rubyworks.github.com/rulebow) -\n[Report Issue](http://github.com/rubyworks/rulebow/issues) -\n[Source Code](http://github.com/rubyworks/rulebow) -\n[IRC Channel](http://chat.us.freenode.net/rubyworks)\n\n***\"Hey, you got logic in my build tool!\"***\n\nRulebow is a build tool that promotes continuous integration via logic\nprogramming. With Rulebow, the Ruby developer defines *rules* and state\nconditions called *facts*. The rules are applied when their conditions\nare met. Through repetitive application, this allows a project to all\nbut manage itself.\n\nRulebow is not complicated. It does not require a bazillion plug-ins.\nAlthough some external tools can be helpful and used with it, and\nit makes some procedures more convenient. For example, it makes\nFileUtils methods directly available in the build script context.\nMostly it just trusts the developer to know how to write the build\nscripts they need.\n\nBelow you will find a brief \"Hot Minute\" guide for getting up and\nrunning with Rulebow quickly. It's just enough to give you familiarity\nthe basic ideas of Rulebow and how to start putting it to good use.\nFor more detailed instruction, explanation of terms and how the\ndickens does it work under-the-hood, please consider any of the\nfollowing resources.\n\n* [Overview of Rulebow](https://github.com/rubyworks/rulebow/wiki/Overview)\n* [Helpful FAQs](https://github.com/rubyworks/rulebow/wiki/FAQ)\n* [Rulebow Recepies](https://github.com/rubyworks/rulebow/wiki/Recipes)\n* [API Documentation](http://rubydoc.info/gems/rulebow/frames)\n\n\n## Rulebow in a Hot Minute\n\nTo install, either use RubyGems directly:\n\n```\n  $ gem install rulebow\n```\n\nOr add `gem \"rulebow\"` to your Gemfile and run:\n\n```\n  $ bundle\n```\n\nCreat a `Rulebook` file in your project.\n\n```\n  $ vi Rulebook\n```\n\nAnd add the following example script to the file.\n\n```ruby\nruleset :default =\u003e [:manifest, :test]\n\nruleset :manifest do\n  desc \"update manifest\"\n\n  globs = %w[bin/**/* lib/**/* *.md]\n\n  fact :need_manifest? do\n    if File.exist?('MANIFEST')\n      files = globs.map{ |d| Dir[d] }.flatten\n      saved = File.readlines('MANIFEST').map{ |f| f.strip }\n      files != saved\n    else\n      true\n    end\n  end\n\n  rule :need_manifest? do\n    files = globs.map{ |d| Dir[d] }.flatten\n    File.open('MANIFEST', 'w'){ |f| f \u003c\u003c files.join(\"\\n\") }\n  end\nend\n\nruleset :test do\n  desc \"run my minitests\"\n\n  rule 'lib/**/*.rb' do |libs|\n    $: \u003c\u003c 'lib'\n    files = Dir.glob('test/**/*_test.rb') \n    files.each{|file| require \"./\" + file}\n  end\n```\n\nNow run it with:\n\n    $ bow\n\nAnd there you go. Rulebow, in a hot minute!\n\n\n## A Few More Minutes\n\nAs the capable Ruby programmer, it probable doesn't require much explanation\nto understand the above code and what happened when you ran it. Just the\nsame, it can help to go over it with the proper terminology. Of course,\nthe rules in our example are simplistic and they make some basic\nassumptions about a project, so you will want to modify these to suite your\nneeds (or dispose of them and write fresh). Nonetheless, this example\nprovides some clear examples of the basics of writing Rulebow scripts.\n\nThe first line in the script defines the defauly ruleset. This is the\nruleset the is executes when no specific ruleset is designated on\nthe command line. In this case we see that it simply depends on two\nother rulesets, `test` and `manifest`.\n\nNex in the example we create the `manifest` ruleset. In it we first\ncreate a *state* called `update_manifest?`. It simply checks to see\nif the list of files in the project's MANIFEST file matches the project\nfiles expected to be there. Notice it returns a boolean value, true or\nfalse. Along with this state we create a *rule* that uses the state by\ncalling the `update_manifest?` method. This method was created by the\nstate definition above. The *rule procedure* updates the MANIFEST file\nwhenever the state returns `true`, i.e. the manifest does not have the\nexpected content.\n\nAt the end of our example script we create an additional ruleset. This\none does not reference a defined state. Instead it creates a *file state*\nimplicitly by passing a string argument to `rule`. A file state has a\nvery simple and very useful definition. It returns `true` whenever a\nmatching file has changed from one execution of `rulebow` to the next.\nIn other words, per this example, whenever a Ruby file in the `lib` \ndirectory changes, Rulebow is going to run the units tests in the `test` \ndirectory.\n\nOkay, so now we have an example rulebook and have a basic grasp of\nhow it works. And we know we can run the rules simple by invoking the\n`rulebow` command on the command line. But if we want to have rulebow run\nautomatically periodically, we can pass it the number of seconds to\nwait between runs via the `-a/--auto` option.\n\n    $ bow -a 180\n\nSee it pays to read all the way to the end ;)\n\n\n## Contributing\n\nThe Rulebow [repository](http://github.com/rubyworks/rulebow) is hosted on GitHub.\nIf you would like to contribute to the project (and we would be over joyed\nif you did!) the rules of engagements are very simple.\n\n1. Fork the repo.\n2. Branch the repo.\n3. Code and test.\n4. Push the branch.\n4. Submit pull request.\n\n\n## Copyrights\n\nRulebow is copyrighted open-source software.\n\n    Copyright (c) 2011 Rubyworks. All rights reserved.\n\nIt is modifiable and redistributable under the terms of the\n[BSD-2-Clause](http::/spdx.org/licenses/BSD-2-Clause) license.\n\nSee the enclosed LICENSE.txt file for details.\n\n(火 由)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyworks%2Frulebow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubyworks%2Frulebow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyworks%2Frulebow/lists"}