capistrano-template 0.0.1 → 0.0.2
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 +4 -4
- data/.travis.yml +2 -0
- data/README.md +74 -10
- data/capistrano-template.gemspec +1 -1
- data/lib/capistrano/capistrano_plugin_template.rb +1 -1
- data/lib/capistrano/template/tasks/{template_defaults.cap → template_defaults.rake} +0 -0
- data/lib/capistrano/template/version.rb +1 -1
- data/spec/integration/capistrano/template/helpers/dsl_spec.rb +1 -1
- data/spec/unit/capistrano/template/helpers/dsl_spec.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faa377bf5341fbaf19e2ed802e16c0dd4f3de2d5
|
4
|
+
data.tar.gz: 56b1b85e124ed8bdf19d5fcc342d4cf400228c3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8157f5434421031a4c750d53f7039e0e4ea1d76783f49ef054aa7d63cdd33686ec66742cac9f51fec9c0f2f334561f9765acbf29e4f2d24b8b3f593b9fefd9a5
|
7
|
+
data.tar.gz: 3c101ff655bbf32d6205faf1d96bb54d63753978408eda07462739284f0cb910d776c5f8c94e6b73354b6575024dc8f26dbc838a8966f78873227e328816aa86
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
[](http://badge.fury.io/rb/capistrano-template)
|
2
|
+
[](https://travis-ci.org/faber-lotto/capistrano-template)
|
3
|
+
[](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
|
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
|
53
|
-
|
54
|
-
|`templating_digster` |
|
55
|
-
|`templating_digest_cmd`|
|
56
|
-
|`templating_mode_test_cmd
|
57
|
-
| `templating_paths
|
116
|
+
| Variable | Default | Description |
|
117
|
+
|-----------------------|---------------------------------------|---------------------------------------|
|
118
|
+
|`templating_digster` | <code> ->(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 %<path>s | sed "s/^.*= *//")" = "Z%<digest>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{ [ "Z$(printf "%%.4o" 0$(stat -c "%%a" %<path>s 2>/dev/null || stat -f "%%A" %<path>s))" != "Z%<mode>s" ] }</code> | Test command to check the remote file permissions. |
|
121
|
+
| `templating_paths` | <code>["config/deploy/templates/#{fetch(:stage)}/%<host>s",</code> <br> <code> "config/deploy/templates/#{fetch(:stage)}",</code> <br> <code> "config/deploy/templates/shared/%<host>s",</code> <br> <code> "config/deploy/templates/shared"]</code>| Folder to look for a template to render. `<host>` is replaced by the actual host. |
|
58
122
|
|
59
123
|
|
60
124
|
## Contributing
|
data/capistrano-template.gemspec
CHANGED
@@ -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")
|
File without changes
|
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.
|
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-
|
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.
|
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: {}
|