{"id":18544047,"url":"https://github.com/swagdevops/ruby-grouik","last_synced_at":"2025-05-15T05:31:11.318Z","repository":{"id":56875381,"uuid":"80648392","full_name":"SwagDevOps/ruby-grouik","owner":"SwagDevOps","description":"Programmable Inclusions Generator","archived":false,"fork":false,"pushed_at":"2017-04-23T19:47:49.000Z","size":133,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-29T00:51:40.040Z","etag":null,"topics":["cli","rake","require","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/grouik","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwagDevOps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-01T18:08:25.000Z","updated_at":"2018-05-13T17:34:51.000Z","dependencies_parsed_at":"2022-08-20T22:00:39.680Z","dependency_job_id":null,"html_url":"https://github.com/SwagDevOps/ruby-grouik","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagDevOps%2Fruby-grouik","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagDevOps%2Fruby-grouik/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagDevOps%2Fruby-grouik/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagDevOps%2Fruby-grouik/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwagDevOps","download_url":"https://codeload.github.com/SwagDevOps/ruby-grouik/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254281789,"owners_count":22045021,"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","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":["cli","rake","require","ruby"],"created_at":"2024-11-06T20:15:12.115Z","updated_at":"2025-05-15T05:31:11.297Z","avatar_url":"https://github.com/SwagDevOps.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Adopt a Pig (Programmable Inclusions Generator)\n\nGrouik is a french onomatopoeia of a pig's shriek.\n\nTired to require your own library file transversally from one file to\nanother? If so, you should give a try to ``Grouik``. It will allow you\nto completely automate this task.\n\n``Grouik`` eliminates the drudgery of handcrafting `require`\nstatements for each Ruby source code file in your project.\n\nA CLI (Command Line Interface) is provided.\nThe CLI should be seen as a shortcut to discover the power of ``Grouik``.\nIn the other hand, ``grouik`` can easily be used through\n[``ruby/rake``](https://github.com/ruby/rake),\n[``erikhuda/thor``](https://github.com/erikhuda/thor)\nor any other command-line interface.\n\n## Command Line Interface\n\n```\nUsage: grouik [OPTION]... [FILE]...\n        --basedir=BASEDIR            Basedir [.]\n    -o, --output=OUTPUT              Output [/dev/stdout]\n    -r, --require=REQUIRE            Required file on startup\n        --ignores x,y,z              Ignores\n        --paths x,y,z                Paths\n        --[no-]stats                 Display some stats\n```\n\nNo options are required, no arguments are required. Easy (and safe) to use.\n\nCLI can also use [YAML](https://fr.wikipedia.org/wiki/YAML)\nconfiguration files, as arguments. They use the following structure:\n\n```\nbasedir: src\npaths:   [lib]\noutput:  src/awesome.rb\nrequire: src/config/init\nignores: [^useless$, ^pointless$]\ntemplate: src/awesome.tpl\n```\n\nNote: configurations can be overriden by options given on the command-line.\n\n## Sample of (programmatic) use\n\n``Grouik`` can be programmatically used through\n[``Rake``](http://rake.rubyforge.org/) tasks:\n\n```ruby\nGrouik.process do |process|\n    process.basedir   = 'src'\n    process.paths     = ['lib']\n    process.ignores   = [/^useless$/, /^pointless$/]\n    process.output    = 'lib/awesome.rb'\n    process.template  = 'lib/awesome.tpl'\n    process.bootstrap = nil\nend.on_failure { exit Errno::ECANCELED::Errno }\n```\n\n``Grouik::Process`` provides methods to be executed on ``success``/``failure``.\n\n## Templating\n\n```ruby\n$:.unshift \"#{__dir__}/lib\"\n\n#{@requirement.call}\n```\n\nGrouik uses [``Tenjin``](http://www.kuwata-lab.com/tenjin/) as template engine.\nAs a result, the following preprocessing statement:\n\n```ruby\n#{@requirement.call}\n```\n\nwill be rendered in as many ``require`` statement as necessary,\nincluding each source file listed during the process,\nordered by successful loading order.\n\n## Principles\n\nGrouik will attempt ``(n^2)+1`` times before failing.\nSuccess is defined by a complete (without error) loading of all entries.\nOn failure, CLI __SHOULD__ exit with a ``125`` (``ECANCELED``) return code.\n\nThe output file is overwritten when the process is a success.\n\n## Installation\n\n```\nsudo gem install grouik\n```\n\nalternatively, install a development version (from github):\n\n```\ngit clone https://github.com/SwagDevOps/ruby-grouik grouik\ncd !$\nbundle install --path vendor/bundle\nrake gem:install\n```\n\n## Alternatives\n\n* [Autoloaded](https://njonsson.github.io/autoloaded/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswagdevops%2Fruby-grouik","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswagdevops%2Fruby-grouik","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswagdevops%2Fruby-grouik/lists"}