{"id":22117721,"url":"https://github.com/kineticcafe/cartage-rack","last_synced_at":"2025-07-25T11:32:39.851Z","repository":{"id":29133108,"uuid":"32663053","full_name":"KineticCafe/cartage-rack","owner":"KineticCafe","description":"Show the release_hashref file from a Cartage package","archived":false,"fork":false,"pushed_at":"2022-12-16T20:08:00.000Z","size":43,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":17,"default_branch":"main","last_synced_at":"2024-11-18T00:29:05.422Z","etag":null,"topics":["deprecated","packager","rack","ruby"],"latest_commit_sha":null,"homepage":"","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/KineticCafe.png","metadata":{"files":{"readme":"README.rdoc","changelog":"History.md","contributing":"Contributing.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-22T05:22:20.000Z","updated_at":"2023-11-29T14:32:08.000Z","dependencies_parsed_at":"2023-01-14T14:12:59.057Z","dependency_job_id":null,"html_url":"https://github.com/KineticCafe/cartage-rack","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KineticCafe%2Fcartage-rack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KineticCafe%2Fcartage-rack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KineticCafe%2Fcartage-rack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KineticCafe%2Fcartage-rack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KineticCafe","download_url":"https://codeload.github.com/KineticCafe/cartage-rack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227570064,"owners_count":17787844,"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":["deprecated","packager","rack","ruby"],"created_at":"2024-12-01T13:38:53.996Z","updated_at":"2024-12-01T13:38:56.863Z","avatar_url":"https://github.com/KineticCafe.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= cartage-rack by Kinetic Cafe\n\ncode :: https://github.com/KineticCafe/cartage-rack/\nissues :: https://github.com/KineticCafe/cartage-rack/issues\ncontinuous integration :: {\u003cimg src=\"https://travis-ci.org/KineticCafe/cartage-rack.png\" /\u003e}[https://travis-ci.org/KineticCafe/cartage-rack]\n\n== Description\n\nThis release is the *last* version of cartage-rack. It will be replaced with\na different tool in the future, but this release will allow installation in\nmodern Ruby versions.\n\ncartage-rack is a plug-in for\n{cartage}[https://github.com/KineticCafe/cartage] to provide a Rack\napplication that reports on release metadata.\n\nCartage provides a repeatable means to create a package for a Rails\napplication that can be used in deployment with a configuration tool like\nAnsible, Chef, Puppet, or Salt. The package is created with its dependencies\nbundled in +vendor/bundle+, so it can be deployed in environments with strict\naccess control rules and without requiring development tool access.\n\n== Synopsis\n\ncartage-rack provides a generator method that instantiates a Rack application\nthat reports on release metadata, which will assist in verifying application\ndeploys.\n\nTo add the default generator to a Rails application, simply mount it in\n+config/routes.rb+:\n\n    require 'cartage/rack'\n\n    Rails.application.routes.draw do\n      get '/release' =\u003e Cartage::Rack::Simple(Rails.root)\n    end\n\nTo map it in a normal Rack application in +config.ru+:\n\n    require 'cartage/rack'\n    map('/release') do\n      run Cartage::Rack::Simple(Dir.pwd)\n    end\n\nOnce mounted, it can then be queried easily:\n\n    % rails start\n    % curl localhost:3000/release\n    development: (git) main\n    % curl localhost:3000/release.json | jq .\n    {\n      \"env\" : \"development\",\n      \"release_hashref\" : \"(git) main\"\n    }\n\n== \\Metadata\n\nThe core of cartage-rack is Cartage::Rack::Metadata, which collects data from\n\u003ctt\u003erelease-metadata.json\u003c/tt\u003e, +release_hashref+, or the runtime environment\n(if Cartage::Rack.require_metadata is +false+). You may instantiate the class\nyourself if you wish to have a different sort of report for the release.\n\n== \\Metadata Reporters\n\nThere are two \\Rack applications provided in cartage-rack 2.0 to report on\nrelease metadata. \\Metadata is pulled from \u003ctt\u003erelease-metadata.json\u003c/tt\u003e,\n+release_hashref+, or the current environment (which allows Cartage::Rack\nverification in development).\n\nWhen reading +release_hashref+, the first line is the hashref of the release; a\nsecond line, if present, is the Cartage timestamp of the release (an integer\nvalue of the form +YYYYmmddHHMMSS+).\n\nIf a metadata file (\u003ctt\u003erelease-metadata.json\u003c/tt\u003e or \u003ctt\u003erelease_hashref\u003c/tt\u003e)\nexists, it will be read on application creation and cached for the lifetime of\nthe Rack application. cartage-rack may be configured to throw an exception if a\nmetadata file cannot be found:\n\n   Cartage::Rack.require_metadata false\n\nAll reporters support JSON and plain text formats.\n\n=== Cartage::Rack\n\nA full metadata reporter. This reporter may include information that is\nconsidered *private* (including the source repository URL), so it is only\nrecommended for use on protected endpoints. The default report format is JSON.\n\nThe data returned is what is recorded in \u003ctt\u003erelease-metadata.json\u003c/tt\u003e, plus\nthe name of the environment.\n\n    {\n      \"env\": {\n        \"name\": \"production\",\n      },\n      \"package\": {\n        \"name\": \"package-name\",\n        \"repo\": {\n          \"type\": \"git\",\n          \"url\": \"git:git@github.com/KineticCafe/cartage-rack.git\"\n        },\n        hashref: \"decafbad\",\n        timestamp: \"19851027024200\"\n      }\n    }\n\nMount this reporter with \u003ctt\u003eCartage::Rack(Rails.root)\u003c/tt\u003e. The data may be\nfiltered out by providing a block to \u003ctt\u003eCartage::Rack()\u003c/tt\u003e which modifies\nthe +metadata+ in place.\n\n    Cartage::Rack(Rails.root) do |metadata|\n      unless Rails.env.development?\n        # Remove the repo data before returning\n        metadata[:package].delete(:repo)\n      end\n    end\n\n=== Cartage::Rack::Simple\n\nA simplified metadata reporter, including only the information that was\nprovided in cartage-rack 1.x (the environment, the hashref, and optionally a\ntimestamp). The default report format is plain text.\n\nMount this reporter with \u003ctt\u003eCartage::Rack::Simple(Rails.root)\u003c/tt\u003e. For\nbackwards compatibility, this reporter may also be mounted with\n\u003ctt\u003eCartage::Rack.mount(Rails.root)\u003c/tt\u003e. The Simple reporter does not support\nfiltering.\n\n== Install\n\nAdd cartage-rack to your Gemfile:\n\n    gem 'cartage-rack', '~\u003e 2.0'\n\nOr manually install:\n\n  % gem install cartage-rack\n\ncartage-rack should be in the main section of your Gemfile, unlike Cartage\nitself.\n\n== cartage-rack Semantic Versioning\n\ncartage-rack uses a {Semantic Versioning}[http://semver.org/] scheme with one\nchange:\n\n* When PATCH is zero (+0+), it will be omitted from version references.\n\ncartage-rack will generally track cartage for major versions to ensure plugin API\ncompatibility.\n\n== Community and Contributing\n\ncartage-rack welcomes your contributions as described in\n{Contributing.md}[https://github.com/KineticCafe/cartage-rack/blob/master/Contributing.md].\nThis project, like all Kinetic Cafe {open source\nprojects}[https://github.com/KineticCafe], is under the Kinetic Cafe Open\nSource {Code of Conduct}[https://github.com/KineticCafe/code-of-conduct].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkineticcafe%2Fcartage-rack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkineticcafe%2Fcartage-rack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkineticcafe%2Fcartage-rack/lists"}