capistrano-template 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9069d7f7aba60eb93dbe6cd252321ae37b76fc0
4
- data.tar.gz: e78c5df43dc90a425fe35c65b4a8314ef98a8156
3
+ metadata.gz: faa377bf5341fbaf19e2ed802e16c0dd4f3de2d5
4
+ data.tar.gz: 56b1b85e124ed8bdf19d5fcc342d4cf400228c3e
5
5
  SHA512:
6
- metadata.gz: 70f3144f5b14657ee87859ec9033872329c20ee8f2630090f236082e5e59d10f267cacee5a826fd132a499c34332d82ec4ca147b403b2b932ac74f35990748b5
7
- data.tar.gz: 8c9b1a43320b332d7daa5a7071d02954e73b28acedd4abdda0af71c1acd0fc304f079015bb1177029c7ab44172b62da9e72244589b7c0610ad1fd48ed0d67710
6
+ metadata.gz: 8157f5434421031a4c750d53f7039e0e4ea1d76783f49ef054aa7d63cdd33686ec66742cac9f51fec9c0f2f334561f9765acbf29e4f2d24b8b3f593b9fefd9a5
7
+ data.tar.gz: 3c101ff655bbf32d6205faf1d96bb54d63753978408eda07462739284f0cb910d776c5f8c94e6b73354b6575024dc8f26dbc838a8966f78873227e328816aa86
@@ -2,3 +2,5 @@ language: ruby
2
2
  rvm:
3
3
  - 2.1
4
4
  - 2.0
5
+ script: bundle exec rake spec rubocop
6
+ cache: bundler
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # Capistrano::Template
1
+ [![Gem Version](https://badge.fury.io/rb/capistrano-template.svg)](http://badge.fury.io/rb/capistrano-template)
2
+ [![Build Status](https://travis-ci.org/faber-lotto/capistrano-template.svg?branch=master)](https://travis-ci.org/faber-lotto/capistrano-template)
3
+ [![Code Climate](https://codeclimate.com/github/faber-lotto/capistrano-template.png)](https://codeclimate.com/github/faber-lotto/capistrano-template)
4
+
5
+ # Capistrano::Template
2
6
 
3
7
  A capistrano 3 plugin that aids in rendering erb templates and
4
8
  uploads the content to the server if the file does not exists at
@@ -18,7 +22,7 @@ Or install it yourself as:
18
22
 
19
23
  $ gem install capistrano-template
20
24
 
21
- ## Usage
25
+ ## Usage example
22
26
 
23
27
  In your Capfile:
24
28
 
@@ -33,28 +37,88 @@ In your Capfile:
33
37
 
34
38
  desc 'Upload a rendered erb-template'
35
39
  task :setup do
36
- on roles :all
40
+ on roles :all
41
+ # searchs for template assets.host.site.erb in :templating_paths
42
+ # renders the template and upload it to "#{release_path}/assets.host.site" on all hosts
43
+ # when the new rendered content is changed or the remote file does not exists
37
44
  template 'assets.host.site'
38
45
  end
39
46
 
40
47
  on roles :all
41
- template 'other.template.name', 'execute_some_thing.sh', 0750
48
+ # searchs for template other.template.name.erb in :templating_paths
49
+ # renders the template and upload it to "~/execute_some_thing.sh" on all hosts
50
+ # when the new rendered content is changed or the remote file does not exists
51
+ # after this the mode is changed to 0750
52
+ template 'other.template.name', '~/execute_some_thing.sh', 0750
42
53
  end
43
54
 
44
55
  end
45
56
 
46
57
  ```
58
+
59
+ In your config/deploy/templates/shared/assets.host.site.erb
60
+
61
+ ```ruby
62
+ # generated by capistrano
63
+ ##########################
64
+
65
+ server {
66
+ listen 80;
67
+
68
+ client_max_body_size 4G;
69
+ keepalive_timeout 10;
70
+
71
+ error_page 500 502 504 /500.html;
72
+ error_page 503 @503;
73
+
74
+ server_name <%= host.properties.fetch(:host_server_name) %>;
75
+ root <%= remote_path_for(current_path) %>/public;
76
+
77
+ location ^~ /assets/ {
78
+ gzip_static on;
79
+ expires max;
80
+ add_header Cache-Control public;
81
+
82
+ if ($request_filename ~* ^.*?\.(eot)|(ttf)|(woff)|(svg)|(otf)$){
83
+ add_header Access-Control-Allow-Origin *;
84
+ }
85
+ }
86
+
87
+ location = /50x.html {
88
+ root html;
89
+ }
90
+
91
+ location = /404.html {
92
+ root html;
93
+ }
94
+
95
+
96
+ if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS)$ ){
97
+ return 405;
98
+ }
99
+
100
+ if (-f $document_root/system/maintenance.html) {
101
+ return 503;
102
+ }
103
+
104
+ location ~ \.(php|html)$ {
105
+ return 405;
106
+ }
107
+ }
108
+
109
+
110
+ ```
47
111
 
48
112
  ## Settings
49
113
 
50
114
  This settings can be changed in your Capfile, deploy.rb or stage file.
51
115
 
52
- | Variable | Default | Description |
53
- |-----------------------|:--------------------:|-----------------------------------------------------------------------|
54
- |`templating_digster` | `templating_digster` | Checksum algorythmous for rendered template to check for remote diffs |
55
- |`templating_digest_cmd`| `%Q{test "Z$(openssl md5 %<path>s| sed "s/^.*= *//")" = "Z%<digest>s" }` | 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. |
56
- |`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" ] } | Test command to check the remote file permissions. |
57
- | `templating_paths`| `["config/deploy/templates/#{fetch(:stage)}/%<host>s","config/deploy/templates/#{fetch(:stage)}", "config/deploy/templates/shared/%<host>s","config/deploy/templates/shared"]`| Folder to look for a template to render. |
116
+ | Variable | Default | Description |
117
+ |-----------------------|---------------------------------------|---------------------------------------|
118
+ |`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_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
+ | `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. |
58
122
 
59
123
 
60
124
  ## Contributing
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = %q(A capistrano 3 plugin that aids in rendering erb templates and
13
13
  uploads the content to the server if the file does not exists at
14
14
  the remote host or the content did change)
15
- spec.homepage = ''
15
+ spec.homepage = 'https://github.com/faber-lotto/capistrano-template'
16
16
  spec.license = 'MIT'
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0")
@@ -2,4 +2,4 @@ require 'capistrano/template'
2
2
 
3
3
  include Capistrano::Template::Helpers::DSL
4
4
 
5
- import File.join(__dir__, 'template', 'tasks', 'template_defaults.cap')
5
+ import File.join(__dir__, 'template', 'tasks', 'template_defaults.rake')
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Template
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
@@ -31,7 +31,7 @@ module Capistrano
31
31
  data.fetch(*args)
32
32
  end
33
33
 
34
- # sshkit metthods
34
+ # sshkit methods
35
35
 
36
36
  def host
37
37
  'localhost'
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  module Capistrano
4
4
  module Template
5
5
  module Helpers
6
- module Unit # prodect from other dummy classes
6
+ module Unit # protect from other dummy classes
7
7
  module DSLSpec
8
8
  class Dummy
9
9
  include DSL
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.1
4
+ version: 0.0.2
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-26 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -137,7 +137,7 @@ files:
137
137
  - lib/capistrano/template/helpers/renderer.rb
138
138
  - lib/capistrano/template/helpers/template_digester.rb
139
139
  - lib/capistrano/template/helpers/uploader.rb
140
- - lib/capistrano/template/tasks/template_defaults.cap
140
+ - lib/capistrano/template/tasks/template_defaults.rake
141
141
  - lib/capistrano/template/version.rb
142
142
  - spec/integration/capistrano/template/helpers/dsl_spec.rb
143
143
  - spec/integration/capistrano/template/helpers/paths_lookup_spec.rb
@@ -149,7 +149,7 @@ files:
149
149
  - spec/unit/capistrano/template/helpers/template_digester_spec.rb
150
150
  - spec/unit/capistrano/template/helpers/uploader_spec.rb
151
151
  - spec/unit/capistrano/template_spec.rb
152
- homepage: ''
152
+ homepage: https://github.com/faber-lotto/capistrano-template
153
153
  licenses:
154
154
  - MIT
155
155
  metadata: {}