{"id":21202494,"url":"https://github.com/infrablocks/rake_dependencies","last_synced_at":"2025-08-12T01:06:59.411Z","repository":{"id":16720572,"uuid":"80478936","full_name":"infrablocks/rake_dependencies","owner":"infrablocks","description":"Rake tasks for managing build dependencies.","archived":false,"fork":false,"pushed_at":"2025-08-06T03:43:45.000Z","size":476,"stargazers_count":6,"open_issues_count":4,"forks_count":0,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-08-09T20:57:41.846Z","etag":null,"topics":["build","dependencies","download","infrablocks","rake","rake-task","rake-taskset","ruby","ruby-gem","rubygem","taskset"],"latest_commit_sha":null,"homepage":null,"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/infrablocks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-01-31T00:48:18.000Z","updated_at":"2025-06-02T03:55:59.000Z","dependencies_parsed_at":"2023-11-13T04:24:28.392Z","dependency_job_id":"cc006319-2521-42f3-a2f2-9c27aabb7779","html_url":"https://github.com/infrablocks/rake_dependencies","commit_stats":{"total_commits":254,"total_committers":5,"mean_commits":50.8,"dds":0.5078740157480315,"last_synced_commit":"b33388dfce0d08aaa5ead106a7e8222a01666fad"},"previous_names":["tobyclemson/rake_dependencies"],"tags_count":98,"template":false,"template_full_name":null,"purl":"pkg:github/infrablocks/rake_dependencies","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infrablocks%2Frake_dependencies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infrablocks%2Frake_dependencies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infrablocks%2Frake_dependencies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infrablocks%2Frake_dependencies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infrablocks","download_url":"https://codeload.github.com/infrablocks/rake_dependencies/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infrablocks%2Frake_dependencies/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269827189,"owners_count":24481486,"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-08-11T02:00:10.019Z","response_time":75,"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":["build","dependencies","download","infrablocks","rake","rake-task","rake-taskset","ruby","ruby-gem","rubygem","taskset"],"created_at":"2024-11-20T20:16:12.077Z","updated_at":"2025-08-12T01:06:59.383Z","avatar_url":"https://github.com/infrablocks.png","language":"Ruby","readme":"# RakeDependencies\n\nRake tasks for managing binary dependencies used within a build.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'rake_dependencies'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install rake_dependencies\n\n## Usage\n\nRakeDependencies provides a suite of tasklibs for downloading and extracting a\ndistribution of some dependency. The simplest way to configure all of these\ntasks is via the `RakeDependencies::Tasks::All` tasklib. The following provides\nan example usage with terraform as the target dependency:\n\n```ruby\nRakeDependencies::Tasks::All.new do |t|\n  t.namespace = :terraform\n  t.dependency = 'terraform'\n  t.version = '0.9.0'\n  t.path = File.join('vendor', 'terraform')\n  t.type = :zip\n\n  t.platform_os_names = { darwin: 'darwin', linux: 'linux' }\n  t.platform_cpu_names = { x86_64: 'amd64', arm64: 'arm64' }\n\n  t.uri_template =\n    'https://releases.hashicorp.com/terraform/\u003c%= @version %\u003e/' +\n      'terraform_\u003c%= @version %\u003e_' +\n      '\u003c%= @platform_os_name %\u003e_\u003c%= @platform_cpu_name %\u003e\u003c%= @ext %\u003e'\n  t.file_name_template =\n    'terraform_\u003c%= @version %\u003e_' +\n      '\u003c%= @platform_os_name %\u003e_\u003c%= @platform_cpu_name %\u003e\u003c%= @ext %\u003e'\n\n  t.needs_fetch = lambda do |parameters|\n    terraform_binary = File.join(\n      parameters[:path], parameters[:binary_directory], 'terraform')\n\n    !(File.exist?(terraform_binary) \u0026\u0026\n      `#{terraform_binary} -version`.lines.first =~ /#{parameters[:version]}/)\n  end\nend\n```\n\nWith this in place, a number of tasks will be defined:\n\n```bash\n\u003e rake -T\nrake terraform:clean     # Clean vendored terraform\nrake terraform:download  # Download terraform distribution\nrake terraform:ensure    # Ensure terraform present\nrake terraform:extract   # Extract terraform archive\nrake terraform:fetch     # Fetch terraform\n```\n\nThe tasks perform the following:\n\n* `\u003cns\u003e:clean` - recursively deletes the directory containing the dependency\n* `\u003cns\u003e:download` - downloads the distribution from the provided path into the\n  dependency directory\n* `\u003cns\u003e:extract` - extracts, in the case of a compressed archive, or copies, in\n  the case of an uncompressed distribution, the binaries into the binary\n  directory under the dependency directory\n* `\u003cns\u003e:fetch` - downloads then extracts\n* `\u003cns\u003e:ensure` - checks whether the dependency needs to be fetched and cleans\n  and fetches if necessary\n\nWith these tasks defined, any task that requires the dependency to be present\nshould depend on `\u003cns\u003e:ensure`. Continuing the terraform example:\n\n```ruby\ntask :provision_database =\u003e ['terraform:ensure'] do\n  sh('vendor/terraform/bin/terraform apply infra/database')\nend\n```\n\nIf the `installation_directory` attribute is supplied, an additional `install`\ntask will be defined:\n\n```ruby\n RakeDependencies::Tasks::All.new do |t|\n  t.namespace = :terraform\n  t.dependency = 'terraform'\n\n  # ...\n  t.installation_directory = \"#{ENV['HOME']}/bin\"\n  # ...\nend\n```\n\nThen:\n\n```bash\n\u003e rake -T\nrake terraform:clean     # Clean vendored terraform\nrake terraform:download  # Download terraform distribution\nrake terraform:ensure    # Ensure terraform present\nrake terraform:extract   # Extract terraform archive\nrake terraform:fetch     # Fetch terraform\nrake terraform:install   # Install terraform\n```\n\nThe `\u003cns\u003e:install` task copies the binary into the defined installation\ndirectory which can be anywhere on the filesystem.\n\nThe `RakeDependencies::Tasks::All` tasklib supports the following configuration\nparameters:\n\n| Name                          | Description                                                                                                        | Default                                | Required |\n|-------------------------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------|:--------:|\n| `namespace`                   | The namespace in which to define the tasks                                                                         | -                                      | no       |\n| `dependency`                  | The name of the dependency, used in status reporting and as the default binary name                                | -                                      | yes      |\n| `version`                     | The version of the dependency to manage, only required if used in templates or `needs_fetch`                       | -                                      | no       |\n| `path`                        | The path in which to install the dependency                                                                        | -                                      | yes      |\n| `type`                        | The archive type of the distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed`                          | `:zip`                                 | yes      |\n| `platform_os_names`           | A map of platform OS identifiers to OS names to use in templates                                                   | `RakeDependencies::PlatformNames::OS`  | yes      |\n| `platform_cpu_names`          | A map of platform CPU identifiers to CPU names to use in templates                                                 | `RakeDependencies::PlatformNames::CPU` | yes      |\n| `distribution_directory`      | The name of the directory under the supplied path into which to download the distribution                          | `'dist'`                               | yes      |\n| `binary_directory`            | The name of the directory under the supplied path into which to extract/copy the binaries                          | `'bin'`                                | yes      |\n| `installation_directory`      | The name of the directory into which to install the binaries, anywhere on the file system                          | -                                      | no       |\n| `uri_template`                | A template for the URI of the distribution                                                                         | -                                      | yes      |\n| `file_name_template`          | A template for the name of the downloaded file                                                                     | -                                      | yes      |\n| `source_binary_name_template` | A template for the name of the binary before rename after extraction/copying                                       | -                                      | no       |\n| `target_binary_name_template` | A template for the name to rename the binary to after extraction/copying                                           | -                                      | no       |\n| `strip_path_template`         | A template for the path to strip within an archive before extracting                                               | -                                      | no       |\n| `needs_fetch`                 | A lambda taking a parameter map that should return `true` if the dependency needs to be fetched, `false` otherwise | Will always return `true`              | no       |\n| `clean_task_name`             | The name of the clean task, required if it should be different from the default                                    | `:clean`                               | yes      |\n| `download_task_name`          | The name of the download task, required if it should be different from the default                                 | `:download`                            | yes      |\n| `extract_task_name`           | The name of the extract task, required if it should be different from the default                                  | `:extract`                             | yes      |\n| `install_task_name`           | The name of the install task, required if it should be different from the default                                  | `:install`                             | no       |\n| `fetch_task_name`             | The name of the fetch task, required if it should be different from the default                                    | `:fetch`                               | yes      |\n| `ensure_task_name`            | The name of the ensure task, required if it should be different from the default                                   | `:ensure`                              | yes      |\n\nNotes:\n\n* Each of the templates will have the following instance variables in scope when\n  rendered:\n    * `@version`: the supplied version string\n    * `@platform`: the `Gem::Platform` on which the task is executing\n    * `@platform_os_name`: the OS name derived from the platform on which the\n      task is executing and the provided `platform_os_names` map\n    * `@platform_cpu_name`: the CPU name derived from the platform on which the\n      task is executing and the provided `platform_cpu_names` map\n    * `@ext`: the file extension corresponding to the provided `type`, one of\n      `.zip`, `.tar.gz`, `.tgz` or empty string for uncompressed files\n* The `needs_fetch` lambda will receive a map with the following entries:\n    * `path`: the supplied path\n    * `version`: the supplied version string\n    * `binary_directory`: the supplied or default binary directory\n\nThe `RakeDependencies::Tasks::All` tasklib uses each of the following tasklibs\nin its definition:\n\n* `RakeDependencies::Tasks::Clean`\n* `RakeDependencies::Tasks::Download`\n* `RakeDependencies::Tasks::Extract`\n* `RakeDependencies::Tasks::Install`\n* `RakeDependencies::Tasks::Fetch`\n* `RakeDependencies::Tasks::Ensure`\n\n### `RakeDependencies::Tasks::Clean`\n\nThe `RakeDependencies::Tasks::Clean` tasklib supports the following\nconfiguration parameters:\n\n| Name         | Description                                                               | Default                          | Required |\n|--------------|---------------------------------------------------------------------------|----------------------------------|:--------:|\n| `name`       | The name of the task, required if it should be different from the default | `:clean`                         | yes      |\n| `path`       | The path in which the dependency is installed                             | -                                | yes      |\n| `dependency` | The name of the dependency, used in status reporting                      | -                                | yes      |\n\n### `RakeDependencies::Tasks::Download`\n\nThe `RakeDependencies::Tasks::Download` tasklib supports the following\nconfiguration parameters:\n\n| Name                          | Description                                                                                       | Default                                | Required |\n|-------------------------------|---------------------------------------------------------------------------------------------------|----------------------------------------|:--------:|\n| `name`                        | The name of the task, required if it should be different from the default                         | `:download`                            | yes      |\n| `dependency`                  | The name of the dependency, used in status reporting                                              | -                                      | yes      |\n| `version`                     | The version of the dependency to manage, only required if used in templates                       | -                                      | no       |\n| `path`                        | The path in which to install the dependency                                                       | -                                      | yes      |\n| `type`                        | The archive type of the distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed`         | `:zip`                                 | yes      |\n| `platform_os_names`           | A map of platform OS identifiers to OS names to use in templates                                  | `RakeDependencies::PlatformNames::OS`  | yes      |\n| `platform_cpu_names`          | A map of platform CPU identifiers to CPU names to use in templates                                | `RakeDependencies::PlatformNames::CPU` | yes      |\n| `distribution_directory`      | The name of the directory under the supplied path into which to download the distribution         | `'dist'`                               | yes      |\n| `uri_template`                | A template for the URI of the distribution                                                        | -                                      | yes      |\n| `file_name_template`          | A template for the name of the downloaded file                                                    | -                                      | yes      |\n\nNotes:\n\n* The templates have the same instance variables in scope when rendered as\n  mentioned above.\n\n### `RakeDependencies::Tasks::Extract`\n\nThe `RakeDependencies::Tasks::Extract` tasklib supports the following\nconfiguration parameters:\n\n| Name                          | Description                                                                                  | Default                                | Required |\n|-------------------------------|----------------------------------------------------------------------------------------------|----------------------------------------|:--------:|\n| `name`                        | The name of the task, required if it should be different from the default                    | `:extract`                             | yes      |\n| `dependency`                  | The name of the dependency, used in status reporting                                         | -                                      | yes      |\n| `version`                     | The version of the dependency to manage, only required if used in templates                  | -                                      | no       |\n| `path`                        | The path in which to install the dependency                                                  | -                                      | yes      |\n| `type`                        | The archive type of the distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed`    | `:zip`                                 | yes      |\n| `platform_os_names`           | A map of platform OS identifiers to OS names to use in templates                             | `RakeDependencies::PlatformNames::OS`  | yes      |\n| `platform_cpu_names`          | A map of platform CPU identifiers to CPU names to use in templates                           | `RakeDependencies::PlatformNames::CPU` | yes      |\n| `extractors`                  | A map of archive types to extractor classes, see notes for further details                   | Extractors for all supported types     | yes      |\n| `distribution_directory`      | The name of the directory under the supplied path into which the distribution was downloaded | `'dist'`                               | yes      |\n| `binary_directory`            | The name of the directory under the supplied path into which to extract/copy the binaries    | `'bin'`                                | yes      |\n| `file_name_template`          | A template for the name of the downloaded file                                               | -                                      | yes      |\n| `source_binary_name_template` | A template for the name of the binary before rename after extraction/copying                 | -                                      | no       |\n| `target_binary_name_template` | A template for the name to rename the binary to after extraction/copying                     | -                                      | no       |\n| `strip_path_template`         | A template for the path to strip within an archive before extracting                         | -                                      | no       |\n\nNotes:\n\n* The templates have the same instance variables in scope when rendered as\n  mentioned above.\n* The extractors map has entries for the following keys:\n    * `:zip`: An extractor class for zip files\n    * `:tar_gz`: An extractor class for tar.gz files\n    * `:tgz`: An alias for `:tar_gz` using the same extractor class\n    * `:uncompressed`: An extractor class that copies the source to the\n      destination\n* The extractor map can be overridden but should include entries for all of the\n  above.\n\n### `RakeDependencies::Tasks::Install`\n\nThe `RakeDependencies::Tasks::Install` tasklib supports the following\nconfiguration parameters:\n\n| Name                     | Description                                                                                        | Default                                | Required |\n|--------------------------|----------------------------------------------------------------------------------------------------|----------------------------------------|:--------:|\n| `name`                   | The name of the task, required if it should be different from the default                          | `:install`                             | yes      |\n| `dependency`             | The name of the dependency, used in status reporting                                               | -                                      | yes      |\n| `version`                | The version of the dependency to manage, only required if used in templates                        | -                                      | no       |\n| `path`                   | The path in which to install the dependency                                                        | -                                      | yes      |\n| `type`                   | The archive type of the original distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed` | `:zip`                                 | yes      |\n| `platform_os_names`      | A map of platform OS identifiers to OS names to use in templates                                   | `RakeDependencies::PlatformNames::OS`  | yes      |\n| `platform_cpu_names`     | A map of platform CPU identifiers to CPU names to use in templates                                 | `RakeDependencies::PlatformNames::CPU` | yes      |\n| `binary_directory`       | The name of the directory under the supplied path into which to extract/copy the binaries          | `'bin'`                                | yes      |\n| `installation_directory` | The name of the directory into which the binary should be installed                                | -                                      | yes      |\n| `binary_name_template`   | A template for the name of the binary                                                              | -                                      | yes      |\n\nNotes:\n\n* The templates have the same instance variables in scope when rendered as\n  mentioned above.\n\n### `RakeDependencies::Tasks::Fetch`\n\nThe `RakeDependencies::Tasks::Fetch` tasklib supports the following\nconfiguration parameters:\n\n| Name                | Description                                                               | Default                        | Required |\n|---------------------|---------------------------------------------------------------------------|--------------------------------|:--------:|\n| `name`              | The name of the task, required if it should be different from the default | `:fetch`                       | yes      |\n| `dependency`        | The name of the dependency, used in status reporting                      | -                              | yes      |\n| `download_task`     | The full name including namespaces of the download task                   | `\u003ccurrent-namespace\u003e:download` | yes      |\n| `extract_task`      | The full name including namespaces of the extract task                    | `\u003ccurrent-namespace\u003e:extract`  | yes      |\n\n### `RakeDependencies::Tasks::Ensure`\n\nThe `RakeDependencies::Tasks::Fetch` tasklib supports the following\nconfiguration parameters:\n\n| Name               | Description                                                                                                           | Default                        | Required |\n|--------------------|-----------------------------------------------------------------------------------------------------------------------|--------------------------------|:--------:|\n| `name`             | The name of the task, required if it should be different from the default                                             | `:fetch`                       | yes      |\n| `dependency`       | The name of the dependency, used in status reporting                                                                  | -                              | yes      |\n| `version`          | The version of the dependency to manage, only required if used in templates                                           | -                              | no       |\n| `path`             | The path in which to install the dependency                                                                           | -                              | yes      |\n| `binary_directory` | The name of the directory under the supplied path into which to extract/copy the binaries                             | `'bin'`                        | yes      |\n| `needs_fetch`      | A lambda taking a parameter map that should return `true` if the dependency needs to be fetched, `false` otherwise    | Will always return `true`      | no       |\n| `clean_task`       | The full name including namespaces of the clean task                                                                  | `\u003ccurrent-namespace\u003e:clean`    | yes      |\n| `download_task`    | The full name including namespaces of the download task                                                               | `\u003ccurrent-namespace\u003e:download` | yes      |\n| `extract_task`     | The full name including namespaces of the extract task                                                                | `\u003ccurrent-namespace\u003e:extract`  | yes      |\n| `install_task`     | The full name including namespaces of the install task                                                                | `\u003ccurrent-namespace\u003e:install`  | yes      |\n\nNotes:\n\n* The templates have the same instance variables in scope when rendered as\n  mentioned above.\n* The needs_fetch method receives the same parameter map as mentioned above.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then,\nrun `rake spec` to run the tests. You can also run `bin/console` for an\ninteractive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To\nrelease a new version, update the version number in `version.rb`, and then run\n`bundle exec rake release`, which will create a git tag for the version, push\ngit commits and tags, and push the `.gem` file to\n[rubygems.org](https://rubygems.org).\n\n### Managing CircleCI keys\n\nTo encrypt a GPG key for use by CircleCI:\n\n```bash\nopenssl aes-256-cbc \\\n  -e \\\n  -md sha1 \\\n  -in ./config/secrets/ci/gpg.private \\\n  -out ./.circleci/gpg.private.enc \\\n  -k \"\u003cpassphrase\u003e\"\n```\n\nTo check decryption is working correctly:\n\n```bash\nopenssl aes-256-cbc \\\n  -d \\\n  -md sha1 \\\n  -in ./.circleci/gpg.private.enc \\\n  -k \"\u003cpassphrase\u003e\"\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/infrablocks/rake_dependencies. This project is intended to be\na safe, welcoming space for collaboration, and contributors are expected to\nadhere to the [Contributor Covenant](http://contributor-covenant.org) code of\nconduct.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfrablocks%2Frake_dependencies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfrablocks%2Frake_dependencies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfrablocks%2Frake_dependencies/lists"}