capistrano-template 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: faa377bf5341fbaf19e2ed802e16c0dd4f3de2d5
4
- data.tar.gz: 56b1b85e124ed8bdf19d5fcc342d4cf400228c3e
3
+ metadata.gz: d22bbf4b677ef6f6caf5a392ef945d42d7c9f10d
4
+ data.tar.gz: d1593087344132c09a1272469c3dcb085a7194f2
5
5
  SHA512:
6
- metadata.gz: 8157f5434421031a4c750d53f7039e0e4ea1d76783f49ef054aa7d63cdd33686ec66742cac9f51fec9c0f2f334561f9765acbf29e4f2d24b8b3f593b9fefd9a5
7
- data.tar.gz: 3c101ff655bbf32d6205faf1d96bb54d63753978408eda07462739284f0cb910d776c5f8c94e6b73354b6575024dc8f26dbc838a8966f78873227e328816aa86
6
+ metadata.gz: a5ef31f7beb2748c98a3d8f29931a11599d8ca0f7658e7092024ae74bc2b68c711dcd6f0174b0d08ec7bdc97a76484c8bcb2eb609c64eaa2c0a9eb5810383ea2
7
+ data.tar.gz: ab00f8c7da4d40f4ab97a35f72759ce8e60c220d24943d34c0b15eb07ce74f0c971f488521f8319f6f3003207ad63469712e4c8860d95513d195d2aa1b7fb867
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/capistrano-template.svg)](http://badge.fury.io/rb/capistrano-template)
2
2
  [![Build Status](https://travis-ci.org/faber-lotto/capistrano-template.svg?branch=master)](https://travis-ci.org/faber-lotto/capistrano-template)
3
3
  [![Code Climate](https://codeclimate.com/github/faber-lotto/capistrano-template.png)](https://codeclimate.com/github/faber-lotto/capistrano-template)
4
+ [![Coverage Status](https://coveralls.io/repos/faber-lotto/capistrano-template/badge.png?branch=master)](https://coveralls.io/r/faber-lotto/capistrano-template?branch=master)
4
5
 
5
6
  # Capistrano::Template
6
7
 
@@ -116,7 +117,7 @@ This settings can be changed in your Capfile, deploy.rb or stage file.
116
117
  | Variable | Default | Description |
117
118
  |-----------------------|---------------------------------------|---------------------------------------|
118
119
  |`templating_digster` | <code> -&gt;(data){ Digest::MD5.hexdigest(data)} </code> | Checksum algorythmous for rendered template to check for remote diffs |
119
- |`templating_digest_cmd`| <code>%Q{test "Z$(openssl md5 %&lt;path&gt;s &#124; sed "s/^.*= *//")" = "Z%&lt;digest&gt;s" }</code> | 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. |
120
+ |`templating_digest_cmd`| <code>%Q{test "Z$(openssl md5 %&lt;path&gt;s &#124; sed 's/^.*= *//')" = "Z%&lt;digest&gt;s" }</code> | 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. |
120
121
  |`templating_mode_test_cmd` | <code>%Q{ &#91; "Z$(printf "%%.4o" 0$(stat -c "%%a" %&lt;path&gt;s 2&gt;/dev/null &#124;&#124; stat -f "%%A" %&lt;path&gt;s))" != "Z%&lt;mode&gt;s" &#93; }</code> | Test command to check the remote file permissions. |
121
122
  | `templating_paths` | <code>&#91;"config/deploy/templates/#{fetch(:stage)}/%&lt;host&gt;s",</code> <br> <code> "config/deploy/templates/#{fetch(:stage)}",</code> <br> <code> "config/deploy/templates/shared/%&lt;host&gt;s",</code> <br> <code> "config/deploy/templates/shared"&#93;</code>| Folder to look for a template to render. `<host>` is replaced by the actual host. |
122
123
 
@@ -1,5 +1,9 @@
1
1
  require 'capistrano/template'
2
+ require 'sshkit/all'
2
3
 
3
- include Capistrano::Template::Helpers::DSL
4
+ # don't pollute global namespace
5
+ extend Capistrano::Template::Helpers::DSL
6
+
7
+ SSHKit::Backend::Netssh.send(:include, Capistrano::Template::Helpers::DSL)
4
8
 
5
9
  import File.join(__dir__, 'template', 'tasks', 'template_defaults.rake')
@@ -47,7 +47,7 @@ module Capistrano
47
47
  path = File.dirname(path)
48
48
  end
49
49
 
50
- remote_path = capture("(cd #{path} && pwd -P) || readlink -sf #{path}").chomp
50
+ remote_path = capture("/bin/bash -c '(cd #{path} && pwd -P) || readlink -sf #{path}'").chomp
51
51
 
52
52
  includes_filename ? File.join(remote_path, filename) : remote_path
53
53
  end
@@ -55,6 +55,14 @@ module Capistrano
55
55
  def _template_factory
56
56
  ->(from, context, digester) {TemplateDigester.new(Renderer.new(from, context), digester) }
57
57
  end
58
+
59
+ def method_missing(method_name, *args)
60
+ if self.class.respond_to? method_name
61
+ self.class.send(method_name, *args)
62
+ else
63
+ super
64
+ end
65
+ end
58
66
  end
59
67
  end
60
68
  end
@@ -1,7 +1,7 @@
1
1
  namespace :load do
2
2
  task :defaults do
3
3
  set :templating_digster, ->{ ->(data){ Digest::MD5.hexdigest(data)} }
4
- set :templating_digest_cmd, %Q{test "Z$(openssl md5 %<path>s| sed "s/^.*= *//")" = "Z%<digest>s" } # alternative %Q{echo "%<digest>s %<path>s" | md5sum -c --status } should return true when the file content is the same
4
+ set :templating_digest_cmd, %Q{test "Z$(openssl md5 %<path>s| sed 's/^.*= *//')" = "Z%<digest>s" } # alternative %Q{echo "%<digest>s %<path>s" | md5sum -c --status } should return true when the file content is the same
5
5
  set :templating_mode_test_cmd, %Q{ [ "Z$(printf "%%.4o" 0$(stat -c "%%a" %<path>s 2>/dev/null || stat -f "%%A" %<path>s))" != "Z%<mode>s" ] } # mac uses different mode formatter
6
6
  set :templating_paths , ->{ ["config/deploy/templates/#{fetch(:stage)}/%<host>s",
7
7
  "config/deploy/templates/#{fetch(:stage)}",
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Template
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dieter Späth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-27 00:00:00.000000000 Z
11
+ date: 2014-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano