capistrano-ops 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capistrano/ops/version.rb +1 -1
- data/lib/capistrano/ops/wkhtmltopdf/helpers.rb +33 -31
- metadata +1 -1
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
|
@@ -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
|