capistrano-ops 0.2.12 → 0.2.13
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/README.md +28 -0
- data/lib/capistrano/ops/capistrano/tasks/wkhtmltopdf.rake +48 -0
- data/lib/capistrano/ops/version.rb +1 -1
- data/lib/capistrano/ops/wkhtmltopdf.rb +3 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cec4486500e5ddac70640e6f3d074b51b361d649079e98f9ef6d337712c3de23
|
4
|
+
data.tar.gz: ac8df454d33822890a673e800db7492bc7d4d2a7f54c0fe91378648fa163a2f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c97bd7b0f7b0f9968b30d81a8807da57d690a4700e6674596f64b970727e4d99606af7ac8e192691fae63a0e5cf67ee54936bda0d1d06d935c37e068b3afdf41
|
7
|
+
data.tar.gz: aac3a0d13aa1c8f78ab77f5943b2ee5944c561829831c117afd8dc1cfd0e0e638406c9bcda52f92c1cc53b1f8eeef455e9d62e1929ffe984e3408812a22de4eb
|
data/README.md
CHANGED
@@ -264,6 +264,34 @@ sudo apt-get install logrotate
|
|
264
264
|
|
265
265
|
Once logrotate is installed, you can use the capistrano-ops tasks to manage it.
|
266
266
|
|
267
|
+
## Wkhtmltopdf Setup
|
268
|
+
|
269
|
+
This script is used to setup `wkhtmltopdf-binary` in your deployment environment. It is designed to work with Capistrano.
|
270
|
+
|
271
|
+
The main task `setup` is hooked to run after the `deploy:symlink:release` task.
|
272
|
+
It performs the following operations:
|
273
|
+
|
274
|
+
- unzip the necessary binary file
|
275
|
+
|
276
|
+
- set the binary file permissions
|
277
|
+
|
278
|
+
The script assumes, that you have a intializer file for `wicked_pdf` gem, which sets the path to the binary file.
|
279
|
+
for example:
|
280
|
+
|
281
|
+
```ruby
|
282
|
+
# config/initializers/wicked_pdf.rb
|
283
|
+
WickedPdf.config = {
|
284
|
+
exe_path: "#{Bundler.bundle_path}/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf_ubuntu_18.04_amd64",
|
285
|
+
}
|
286
|
+
```
|
287
|
+
|
288
|
+
To use this script, include it in your Capistrano tasks and it will automatically run during deployment.
|
289
|
+
|
290
|
+
```ruby
|
291
|
+
# Capfile
|
292
|
+
require 'capistrano/ops/wkhtmltopdf'
|
293
|
+
```
|
294
|
+
|
267
295
|
## Contributing
|
268
296
|
|
269
297
|
1. Fork it ( https://github.com/zauberware/capistrano-ops/fork )
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :wkhtmltopdf do
|
4
|
+
after 'deploy:symlink:release', 'wkhtmltopdf:setup'
|
5
|
+
|
6
|
+
desc 'unzip wkhtmltopdf if necessary'
|
7
|
+
task :setup do
|
8
|
+
on roles(:app) do
|
9
|
+
within release_path do
|
10
|
+
binary_path, version = binary_path_and_version
|
11
|
+
info("setup wkhtmltopdf version #{version}")
|
12
|
+
check_file_and_permissions(binary_path, version)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
def binary_path_and_version
|
18
|
+
# get the binary path of wkhtmltopdf-binary
|
19
|
+
gem_path = capture(:bundle, 'show', 'wkhtmltopdf-binary').strip
|
20
|
+
binary_path = "#{gem_path}/bin"
|
21
|
+
|
22
|
+
# get the use wkhtmltopdf_ubuntu version from the wicked_pdf initializer
|
23
|
+
version = capture(:cat, 'config/initializers/wicked_pdf.rb').scan(/wkhtmltopdf_ubuntu_(\d+\.\d+)_amd64/).flatten.first
|
24
|
+
|
25
|
+
[binary_path, version]
|
26
|
+
end
|
27
|
+
|
28
|
+
def check_file_and_permissions(binary_path, version)
|
29
|
+
binary_file = "#{binary_path}/wkhtmltopdf_ubuntu_#{version}_amd64"
|
30
|
+
|
31
|
+
if test("[ -f #{binary_file} ]")
|
32
|
+
info('wkhtmltopdf binary already extracted')
|
33
|
+
|
34
|
+
if test("[ $(stat -c '%a' #{binary_file}) = '777' ]")
|
35
|
+
info('wkhtmltopdf binary has already the right permissions')
|
36
|
+
else
|
37
|
+
info('adding right permissions to wkhtmltopdf binary')
|
38
|
+
execute("chmod 777 #{binary_file}")
|
39
|
+
end
|
40
|
+
else
|
41
|
+
info('extracting wkhtmltopdf binary')
|
42
|
+
# extract the binary but keep the gzip file
|
43
|
+
execute("cd #{binary_path} && gzip -dk wkhtmltopdf_ubuntu_#{version}_amd64.gz")
|
44
|
+
# add execute permission to the binary
|
45
|
+
execute("chmod 777 #{binary_file}")
|
46
|
+
end
|
47
|
+
info('wkhtmltopdf setup finished')
|
48
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-ops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Crusius
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/capistrano/ops/backup/s3.rb
|
121
121
|
- lib/capistrano/ops/backup/s3_helper.rb
|
122
122
|
- lib/capistrano/ops/capistrano.rb
|
123
|
+
- lib/capistrano/ops/capistrano/tasks/wkhtmltopdf.rake
|
123
124
|
- lib/capistrano/ops/capistrano/v3/tasks/backup.rake
|
124
125
|
- lib/capistrano/ops/capistrano/v3/tasks/backup/backup_helper.rb
|
125
126
|
- lib/capistrano/ops/capistrano/v3/tasks/backup/database/create.rake
|
@@ -147,6 +148,7 @@ files:
|
|
147
148
|
- lib/capistrano/ops/tasks/storage/backup.rake
|
148
149
|
- lib/capistrano/ops/tasks/storage/remove_old_backups.rake
|
149
150
|
- lib/capistrano/ops/version.rb
|
151
|
+
- lib/capistrano/ops/wkhtmltopdf.rb
|
150
152
|
homepage: https://github.com/zauberware/capistrano-ops
|
151
153
|
licenses:
|
152
154
|
- MIT
|