{"id":18513368,"url":"https://github.com/jbox-web/capistrano-template","last_synced_at":"2025-05-14T12:20:43.932Z","repository":{"id":220405314,"uuid":"751554131","full_name":"jbox-web/capistrano-template","owner":"jbox-web","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-01T23:43:15.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-25T21:10:02.903Z","etag":null,"topics":[],"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/jbox-web.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-01T20:49:44.000Z","updated_at":"2024-02-01T20:50:32.000Z","dependencies_parsed_at":"2024-11-06T15:45:12.752Z","dependency_job_id":null,"html_url":"https://github.com/jbox-web/capistrano-template","commit_stats":null,"previous_names":["jbox-web/capistrano-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbox-web%2Fcapistrano-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbox-web%2Fcapistrano-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbox-web%2Fcapistrano-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbox-web%2Fcapistrano-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbox-web","download_url":"https://codeload.github.com/jbox-web/capistrano-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239226424,"owners_count":19603262,"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":[],"created_at":"2024-11-06T15:37:53.425Z","updated_at":"2025-02-17T03:21:05.750Z","avatar_url":"https://github.com/jbox-web.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/jbox-web/capistrano-template/actions/workflows/ci.yml/badge.svg)](https://github.com/jbox-web/capistrano-template/actions/workflows/ci.yml)\n[![Maintainability](https://api.codeclimate.com/v1/badges/271160c6d549c0aae8c2/maintainability)](https://codeclimate.com/github/jbox-web/capistrano-template/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/271160c6d549c0aae8c2/test_coverage)](https://codeclimate.com/github/jbox-web/capistrano-template/test_coverage)\n\n# Capistrano::Template \n\nA capistrano 3 plugin that aids in rendering erb templates and\nuploads the content to the server if the file does not exists at\nthe remote host or the content did change. \n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'capistrano-template'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install capistrano-template\n\n## Usage example\n\nIn your Capfile:\n\n```ruby\nrequire 'capistrano/capistrano_plugin_template'\n```\n \nIn your task or stage file:\n\n```ruby\ndesc 'Upload a rendered erb-template'\ntask :setup do\n  on roles :all do\n    # searchs for template assets.host.site.erb in :templating_paths\n    # renders the template and upload it to \"#{release_path}/assets.host.site\" on all hosts\n    # when the new rendered content is changed or the remote file does not exists\n    template 'assets.host.site', locals: { 'local1' =\u003e 'value local 1'}\n  end\n\n  on roles :all do\n    # searchs for template other.template.name.erb in :templating_paths\n    # renders the template and upload it to \"~/execute_some_thing.sh\" on all hosts\n    # when the new rendered content is changed or the remote file does not exists\n    # after this the mode is changed to 0750\n    # owner is changed to \"deployer:www-run\"\n    # keep in mind chown and chgrp needs sudo privileges\n\n    template 'other.template.name', '~/execute_some_thing.sh', 0750, 'deployer', 'www-run' ,locals: { 'local1' =\u003e 'value local 1'}\n  end\nend\n```\n\nIn your config/deploy/templates/shared/assets.host.site.erb\n \n```ruby\n# generated by capistrano\n##########################\n\nserver {\n  listen 80;\n\n  client_max_body_size 4G;\n  keepalive_timeout 10;\n\n  error_page 500 502 504 /500.html;\n  error_page 503 @503;\n\n  server_name \u003c%= host.properties.fetch(:host_server_name) %\u003e;\n  root \u003c%= remote_path_for(current_path) %\u003e/public;\n\n  \u003c%= render 'partial.conf', indent: 2, locals: { 'other_local' =\u003e 'other local value' } %\u003e\n\n  location ^~ /assets/ {\n    gzip_static on;\n    expires max;\n    add_header Cache-Control public;\n\n    if ($request_filename ~* ^.*?\\.(eot)|(ttf)|(woff)|(svg)|(otf)$){\n      add_header Access-Control-Allow-Origin *;\n    }\n  }\n\n  location = /50x.html {\n    root html;\n  }\n\n  location = /404.html {\n    root html;\n  }\n\n  if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS)$ ){\n    return 405;\n  }\n\n  if (-f $document_root/system/maintenance.html) {\n    return 503;\n  }\n\n  location ~ \\.(php|html)$ {\n    return 405;\n  }\n}\n```\n\n## Settings\n\nThis settings can be changed in your Capfile, deploy.rb or stage file.\n\n| Variable                  | Default                               | Description                           |\n|---------------------------|---------------------------------------|---------------------------------------|\n|`templating_digester`      | \u003ccode\u003e -\u0026gt;(data){ OpenSSL::Digest::MD5.hexdigest(data)} \u003c/code\u003e | Checksum algorithm for rendered template to check for remote diffs |\n|`templating_digest_cmd`    | \u003ccode\u003e%Q{test \"Z$(openssl md5 %\u0026lt;path\u0026gt;s \u0026#124; sed 's/^.*= *//')\" = \"Z%\u0026lt;digest\u0026gt;s\" }\u003c/code\u003e | Remote command to validate a digest. Format placeholders path is replaces by full `path` to the remote file and `digest` with the digest calculated in capistrano. |\n|`templating_mode_test_cmd` | \u003ccode\u003e%Q{ \u0026#91; \"Z$(printf \"%%.4o\" 0$(stat -c \"%%a\" %\u0026lt;path\u0026gt;s 2\u0026gt;/dev/null \u0026#124;\u0026#124;  stat -f \"%%A\" %\u0026lt;path\u0026gt;s))\" != \"Z%\u0026lt;mode\u0026gt;s\" \u0026#93; }\u003c/code\u003e | Test command to check the remote file permissions. |\n|`templating_user_test_cmd` | \u003ccode\u003e%Q{ \u0026#91; \"Z$(stat -c \"%%U\" %\u0026lt;path\u0026gt;s 2\u0026gt;/dev/null)\" != \"Z%\u0026lt;user\u0026gt;s\" \u0026#93; }\u003c/code\u003e | Test command to check the remote file permissions. |\n|`templating_paths`         | \u003ccode\u003e\u0026#91;\"config/deploy/templates/#{fetch(:stage)}/%\u0026lt;host\u0026gt;s\",\u003c/code\u003e \u003cbr\u003e \u003ccode\u003e \"config/deploy/templates/#{fetch(:stage)}\",\u003c/code\u003e \u003cbr\u003e \u003ccode\u003e \"config/deploy/templates/shared/%\u0026lt;host\u0026gt;s\",\u003c/code\u003e \u003cbr\u003e \u003ccode\u003e \"config/deploy/templates/shared\"\u0026#93;\u003c/code\u003e| Folder to look for a template to render. `\u003chost\u003e` is replaced by the actual host. |\n\n\n## Contributing\n\n1. Fork it ( http://github.com/faber-lotto/capistrano-template/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbox-web%2Fcapistrano-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbox-web%2Fcapistrano-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbox-web%2Fcapistrano-template/lists"}