capistrano-ops 1.0.1 → 1.0.3
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/lib/capistrano/ops/backup.rb +1 -13
- data/lib/capistrano/ops/figaro_yml.rb +1 -23
- data/lib/capistrano/ops/helper.rb +6 -6
- data/lib/capistrano/ops/logrotate.rb +1 -13
- data/lib/capistrano/ops/logs.rb +1 -12
- data/lib/capistrano/ops/task_loader.rb +23 -0
- data/lib/capistrano/ops/version.rb +1 -1
- data/lib/capistrano/ops/whenever.rb +2 -14
- data/lib/capistrano/ops/wkhtmltopdf/helpers.rb +33 -31
- data/lib/capistrano/ops/wkhtmltopdf.rb +1 -13
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7944bee1bc903f6dc873cac78ac255e7811341c1c8bf291de8cf0c2bc2a01a4
|
4
|
+
data.tar.gz: 49afc833c49c3b2d01009c2a7f13fa5a59e04b70691d9baac51ac292f6101240
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b02060e7adb1a90050839b35cb86e3e19d1b5a32b09b723ce9f10933afb99a347b9a83ed0cea99e344c972262ba01db9f455f668385c493f2cf919e29bd9a5ab
|
7
|
+
data.tar.gz: d2e61ed960c9a4c37411b23e63f4e05faeb9047c613a1038ac38bf5eab5a5ae50d220dabec34c6f2bca539f9190180fc3d426e248273ecf27655dc5eb36bee4a
|
@@ -1,18 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'capistrano/ops/
|
3
|
+
require 'capistrano/ops/task_loader'
|
4
4
|
require 'capistrano/ops/backup/helper'
|
5
5
|
|
6
|
-
module TaskLoader
|
7
|
-
extend Capistrano::Ops::Helper
|
8
|
-
|
9
|
-
def self.load_tasks_if_gem_present(gem_name, task_path, warning_message)
|
10
|
-
if gem_in_gemfile?(gem_name)
|
11
|
-
Dir.glob("#{File.expand_path(__dir__)}/#{task_path}/**/*.rake").each { |f| load f }
|
12
|
-
else
|
13
|
-
puts warning_message
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
6
|
TaskLoader.load_tasks_if_gem_present('rails', 'backup/tasks', 'WARNING: Gemfile does not include rails gem which is required for backup tasks')
|
@@ -1,29 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'capistrano/ops/
|
3
|
+
require 'capistrano/ops/task_loader'
|
4
4
|
require 'capistrano/ops/figaro_yml/paths'
|
5
5
|
require 'capistrano/ops/figaro_yml/helpers'
|
6
6
|
|
7
|
-
module TaskLoader
|
8
|
-
extend Capistrano::Ops::Helper
|
9
|
-
|
10
|
-
def self.load_tasks_if_gem_present(gem_name, task_path, warning_message)
|
11
|
-
if gem_in_gemfile?(gem_name)
|
12
|
-
Dir.glob("#{File.expand_path(__dir__)}/#{task_path}/**/*.rake").each { |f| load f }
|
13
|
-
else
|
14
|
-
puts warning_message
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
7
|
TaskLoader.load_tasks_if_gem_present('figaro', 'figaro_yml/tasks', 'WARNING: Gemfile does not include figaro gem which is required for figaro_yml tasks')
|
20
|
-
# include Capistrano::Ops::Helper
|
21
|
-
|
22
|
-
# Dir.glob("#{File.expand_path(__dir__)}/figaro_yml/tasks/*.rake").each { |f| load f }
|
23
|
-
|
24
|
-
# # gem 'figaro' is required for figaro_yml tasks
|
25
|
-
|
26
|
-
# figaro_gem = gem_in_gemfile?('figaro')
|
27
|
-
|
28
|
-
# # check if Gemfile environment includes figaro gem and warn user if not found
|
29
|
-
# puts 'WARNING: Gemfile does not include figaro gem which is required for figaro_yml tasks' unless figaro_gem
|
@@ -1,13 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Capistrano
|
2
4
|
module Ops
|
3
5
|
module Helper
|
4
6
|
def gem_in_gemfile?(gem_name)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
false
|
7
|
+
return false unless File.exist?('Gemfile')
|
8
|
+
|
9
|
+
regex = Regexp.new("^\s*gem\s+['\"]#{gem_name}['\"].*?(?=#|$)", Regexp::MULTILINE)
|
10
|
+
File.read('Gemfile').match?(regex)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -1,19 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'capistrano/ops/
|
3
|
+
require 'capistrano/ops/task_loader'
|
4
4
|
require 'capistrano/ops/logrotate/helpers'
|
5
5
|
require 'capistrano/ops/logrotate/paths'
|
6
6
|
|
7
|
-
module TaskLoader
|
8
|
-
extend Capistrano::Ops::Helper
|
9
|
-
|
10
|
-
def self.load_tasks_if_gem_present(gem_name, task_path, warning_message)
|
11
|
-
if gem_in_gemfile?(gem_name)
|
12
|
-
Dir.glob("#{File.expand_path(__dir__)}/#{task_path}/**/*.rake").each { |f| load f }
|
13
|
-
else
|
14
|
-
puts warning_message
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
7
|
TaskLoader.load_tasks_if_gem_present('whenever', 'logrotate/tasks', 'WARNING: Gemfile does not include whenever gem which is required for logrotate tasks')
|
data/lib/capistrano/ops/logs.rb
CHANGED
@@ -1,18 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'capistrano/ops/
|
3
|
+
require 'capistrano/ops/task_loader'
|
4
4
|
require 'capistrano/ops/logs/paths'
|
5
5
|
require 'capistrano/ops/logs/helpers'
|
6
6
|
|
7
|
-
module TaskLoader
|
8
|
-
extend Capistrano::Ops::Helper
|
9
|
-
def self.load_tasks_if_gem_present(gem_name, task_path, warning_message)
|
10
|
-
if gem_in_gemfile?(gem_name)
|
11
|
-
Dir.glob("#{File.expand_path(__dir__)}/#{task_path}/**/*.rake").each { |f| load f }
|
12
|
-
else
|
13
|
-
puts warning_message
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
7
|
TaskLoader.load_tasks_if_gem_present('rails', 'logs/tasks', 'WARNING: Gemfile does not include rails gem which is required for logs tasks')
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'capistrano/ops/helper'
|
4
|
+
|
5
|
+
module TaskLoader
|
6
|
+
extend Capistrano::Ops::Helper
|
7
|
+
|
8
|
+
def self.load_tasks_if_gem_present(gem_name, task_path, warning_message)
|
9
|
+
unless gem_in_gemfile?(gem_name)
|
10
|
+
warn warning_message
|
11
|
+
return
|
12
|
+
end
|
13
|
+
|
14
|
+
base_path = File.expand_path(__dir__)
|
15
|
+
task_files = Dir.glob("#{base_path}/#{task_path}/**/*.rake")
|
16
|
+
|
17
|
+
task_files.each do |file|
|
18
|
+
load file
|
19
|
+
rescue StandardError => e
|
20
|
+
puts "Failed to load #{file}: #{e.message}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,17 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'capistrano/ops/
|
3
|
+
require 'capistrano/ops/task_loader'
|
4
4
|
|
5
|
-
|
6
|
-
extend Capistrano::Ops::Helper
|
7
|
-
|
8
|
-
def self.load_tasks_if_gem_present(gem_name, task_path, warning_message)
|
9
|
-
if gem_in_gemfile?(gem_name)
|
10
|
-
Dir.glob("#{File.expand_path(__dir__)}/#{task_path}/**/*.rake").each { |f| load f }
|
11
|
-
else
|
12
|
-
puts warning_message
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
TaskLoader.load_tasks_if_gem_present('whenever', 'whenever/tasks', 'WARNING: Gemfile does not include whenever gem which is required for logrotate tasks')
|
5
|
+
TaskLoader.load_tasks_if_gem_present('whenever', 'whenever/tasks', 'WARNING: Gemfile does not include whenever gem which is required for whenever tasks')
|
@@ -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
|
@@ -1,19 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'capistrano/ops/
|
3
|
+
require 'capistrano/ops/task_loader'
|
4
4
|
require 'capistrano/ops/wkhtmltopdf/helpers'
|
5
5
|
|
6
|
-
module TaskLoader
|
7
|
-
extend Capistrano::Ops::Helper
|
8
|
-
|
9
|
-
def self.load_tasks_if_gem_present(gem_name, task_path, warning_message)
|
10
|
-
if gem_in_gemfile?(gem_name)
|
11
|
-
Dir.glob("#{File.expand_path(__dir__)}/#{task_path}/**/*.rake").each { |f| load f }
|
12
|
-
else
|
13
|
-
puts warning_message
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
6
|
TaskLoader.load_tasks_if_gem_present('wicked_pdf', 'wkhtmltopdf/tasks',
|
19
7
|
'WARNING: Gemfile does not include wkhtmltopdf-binary gem which is required for wkhtmltopdf tasks')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Crusius
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- lib/capistrano/ops/rails/lib/tasks/pg/remove_old_dumps.rake
|
201
201
|
- lib/capistrano/ops/rails/lib/tasks/storage/backup.rake
|
202
202
|
- lib/capistrano/ops/rails/lib/tasks/storage/remove_old_backups.rake
|
203
|
+
- lib/capistrano/ops/task_loader.rb
|
203
204
|
- lib/capistrano/ops/version.rb
|
204
205
|
- lib/capistrano/ops/whenever.rb
|
205
206
|
- lib/capistrano/ops/whenever/tasks/show_crontab.rake
|