capistrano-ops 1.0.0 → 1.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/README.md +2 -1
- data/lib/capistrano/ops/version.rb +1 -1
- data/lib/capistrano/ops/wkhtmltopdf/helpers.rb +33 -31
- data/lib/capistrano/ops/wkhtmltopdf.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e337322ee460de5e0abca9879513190ccb1eaf57ebf338b5575efcd4f7eb33
|
4
|
+
data.tar.gz: 59f16b666897fdd8f93f21d0d7d91590e394fdfa4f9c942accb84be8720c94d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aafa5d8ed0745ac496462fb42840381dd3104478b77eac904b19b1959f94ea14d3d06fc7cccc62cbfa072aa0a7a36c945d49acd4eef6e23322a12a2e45b55247
|
7
|
+
data.tar.gz: b1c212fcf862c2635b9a079cf3c2eb72095b2f6a4c26d918dd971db550e7a2f5f2a55a27495042b66622a64931dab6059038bba66011dfa50bc82f4f532ddf80
|
data/README.md
CHANGED
@@ -352,7 +352,7 @@ Once logrotate is installed, you can use the capistrano-ops tasks to manage it.
|
|
352
352
|
|
353
353
|
## Wkhtmltopdf Setup
|
354
354
|
|
355
|
-
This script is used to setup `wkhtmltopdf-binary` in your deployment environment
|
355
|
+
This script is used to setup `wkhtmltopdf-binary` in your deployment environment for `WickedPdf`. It is designed to work with Capistrano.
|
356
356
|
|
357
357
|
The main task `setup` is hooked to run after the `deploy:symlink:release` task.
|
358
358
|
It performs the following operations:
|
@@ -368,6 +368,7 @@ for example:
|
|
368
368
|
# config/initializers/wicked_pdf.rb
|
369
369
|
WickedPdf.config = {
|
370
370
|
exe_path: "#{Bundler.bundle_path}/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf_ubuntu_18.04_amd64",
|
371
|
+
# Attention: set the used binary file version also in the Gemfile
|
371
372
|
}
|
372
373
|
```
|
373
374
|
|
@@ -2,48 +2,50 @@
|
|
2
2
|
|
3
3
|
module Capistrano
|
4
4
|
module Ops
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
module Wkhtmltopdf
|
6
|
+
module Helpers
|
7
|
+
def binary_path
|
8
|
+
gem_path = capture(:bundle, 'show', 'wkhtmltopdf-binary').strip
|
9
|
+
"#{gem_path}/bin"
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def gem_version
|
13
|
+
capture(:cat, 'config/initializers/wicked_pdf.rb').scan(/wkhtmltopdf_ubuntu_(\d+\.\d+)_amd64/).flatten.first
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
def binary_path_and_version
|
17
|
+
[binary_path, gem_version]
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def file_existing?(file)
|
21
|
+
test("[ -f #{file} ]")
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
def right_permissions?(file)
|
25
|
+
test("[ $(stat -c '%a' #{file}) = '777' ]")
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
def check_file_and_permissions(binary_path, version)
|
29
|
+
binary_file = "#{binary_path}/wkhtmltopdf_ubuntu_#{version}_amd64"
|
29
30
|
|
30
|
-
|
31
|
-
|
31
|
+
if file_existing?(binary_file)
|
32
|
+
info('wkhtmltopdf binary already extracted')
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
if right_permissions?(binary_file)
|
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
|
35
40
|
else
|
36
|
-
info('
|
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
|
37
45
|
execute("chmod 777 #{binary_file}")
|
38
46
|
end
|
39
|
-
|
40
|
-
info('extracting wkhtmltopdf binary')
|
41
|
-
# extract the binary but keep the gzip file
|
42
|
-
execute("cd #{binary_path} && gzip -dk wkhtmltopdf_ubuntu_#{version}_amd64.gz")
|
43
|
-
# add execute permission to the binary
|
44
|
-
execute("chmod 777 #{binary_file}")
|
47
|
+
info('wkhtmltopdf setup finished')
|
45
48
|
end
|
46
|
-
info('wkhtmltopdf setup finished')
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
@@ -15,5 +15,5 @@ module TaskLoader
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
TaskLoader.load_tasks_if_gem_present('
|
18
|
+
TaskLoader.load_tasks_if_gem_present('wicked_pdf', 'wkhtmltopdf/tasks',
|
19
19
|
'WARNING: Gemfile does not include wkhtmltopdf-binary gem which is required for wkhtmltopdf tasks')
|
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: 1.0.
|
4
|
+
version: 1.0.2
|
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-07-
|
11
|
+
date: 2024-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|