capistrano-ops 0.2.13 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/README.md +121 -29
- data/capistrano-ops.gemspec +2 -0
- data/lib/capistrano/ops/backup/helper.rb +56 -0
- data/lib/capistrano/ops/{capistrano/v3/tasks/backup → backup/tasks}/database/create.rake +1 -2
- data/lib/capistrano/ops/{capistrano/v3/tasks/backup → backup/tasks}/database/pull.rake +1 -2
- data/lib/capistrano/ops/{capistrano/v3/tasks/backup → backup/tasks}/storage/create.rake +1 -2
- data/lib/capistrano/ops/{capistrano/v3/tasks/backup → backup/tasks}/storage/pull.rake +1 -2
- data/lib/capistrano/ops/backup.rb +14 -4
- data/lib/capistrano/ops/capistrano.rb +7 -10
- data/lib/capistrano/ops/figaro_yml/helpers.rb +184 -0
- data/lib/capistrano/ops/figaro_yml/paths.rb +19 -0
- data/lib/capistrano/ops/figaro_yml/tasks/backup.rake +26 -0
- data/lib/capistrano/ops/figaro_yml/tasks/check.rake +12 -0
- data/lib/capistrano/ops/figaro_yml/tasks/check_config_present.rake +12 -0
- data/lib/capistrano/ops/figaro_yml/tasks/check_figaro_file_exists.rake +12 -0
- data/lib/capistrano/ops/figaro_yml/tasks/check_git_tracking.rake +12 -0
- data/lib/capistrano/ops/figaro_yml/tasks/compare.rake +53 -0
- data/lib/capistrano/ops/figaro_yml/tasks/create_local.rake +27 -0
- data/lib/capistrano/ops/figaro_yml/tasks/figaro_yml_symlink.rake +10 -0
- data/lib/capistrano/ops/figaro_yml/tasks/get.rake +45 -0
- data/lib/capistrano/ops/figaro_yml/tasks/get_stage.rake +15 -0
- data/lib/capistrano/ops/figaro_yml/tasks/load.rake +10 -0
- data/lib/capistrano/ops/figaro_yml/tasks/rollback.rake +22 -0
- data/lib/capistrano/ops/figaro_yml/tasks/setup.rake +16 -0
- data/lib/capistrano/ops/figaro_yml/tasks/sort_local.rake +18 -0
- data/lib/capistrano/ops/figaro_yml.rb +29 -0
- data/lib/capistrano/ops/helper.rb +14 -0
- data/lib/capistrano/ops/invoke/tasks/invoke.rake +25 -0
- data/lib/capistrano/ops/invoke.rb +3 -0
- data/lib/capistrano/ops/logrotate/helpers.rb +50 -0
- data/lib/capistrano/ops/logrotate/paths.rb +47 -0
- data/lib/capistrano/ops/{capistrano/v3/tasks/logrotate → logrotate/tasks}/check.rake +3 -5
- data/lib/capistrano/ops/{capistrano/v3/tasks/logrotate → logrotate/tasks}/disable.rake +2 -5
- data/lib/capistrano/ops/logrotate/tasks/enable.rake +28 -0
- data/lib/capistrano/ops/logrotate/tasks/load.rake +10 -0
- data/lib/capistrano/ops/logrotate.rb +19 -0
- data/lib/capistrano/ops/logs/helpers.rb +16 -0
- data/lib/capistrano/ops/logs/paths.rb +23 -0
- data/lib/capistrano/ops/logs/tasks/load.rake +9 -0
- data/lib/capistrano/ops/logs/tasks/rails.rake +18 -0
- data/lib/capistrano/ops/logs/tasks/sidekiq.rake +42 -0
- data/lib/capistrano/ops/logs.rb +18 -0
- data/lib/capistrano/ops/{backup → rails/lib/backup}/s3.rb +1 -1
- data/lib/capistrano/ops/rails/lib/backup.rb +6 -0
- data/lib/capistrano/ops/rails/lib/notification.rb +9 -0
- data/lib/capistrano/ops/rails/lib/railtie.rb +17 -0
- data/lib/capistrano/ops/{tasks → rails/lib/tasks}/pg/postgres_helper.rb +1 -1
- data/lib/capistrano/ops/version.rb +1 -1
- data/lib/capistrano/ops/{capistrano/v3/tasks/whenever.rake → whenever/tasks/show_crontab.rake} +1 -3
- data/lib/capistrano/ops/whenever.rb +17 -0
- data/lib/capistrano/ops/wkhtmltopdf/helpers.rb +50 -0
- data/lib/capistrano/ops/wkhtmltopdf/tasks/setup.rake +17 -0
- data/lib/capistrano/ops/wkhtmltopdf.rb +17 -1
- data/lib/capistrano/ops.rb +4 -3
- metadata +88 -31
- data/lib/capistrano/ops/capistrano/tasks/wkhtmltopdf.rake +0 -48
- data/lib/capistrano/ops/capistrano/v3/tasks/backup/backup_helper.rb +0 -50
- data/lib/capistrano/ops/capistrano/v3/tasks/figaro_yml.rake +0 -139
- data/lib/capistrano/ops/capistrano/v3/tasks/invoke.rake +0 -23
- data/lib/capistrano/ops/capistrano/v3/tasks/logrotate/enable.rake +0 -24
- data/lib/capistrano/ops/capistrano/v3/tasks/logrotate/logrotate_helper.rb +0 -68
- data/lib/capistrano/ops/capistrano/v3/tasks/logs/rails.rake +0 -16
- data/lib/capistrano/ops/notification.rb +0 -9
- data/lib/capistrano/ops/railtie.rb +0 -15
- /data/lib/capistrano/ops/{capistrano/v3/tasks/logrotate → logrotate/tasks}/templates/logrotate.conf.erb +0 -0
- /data/lib/capistrano/ops/{capistrano/v3/tasks/logrotate → logrotate/tasks}/templates/schedule.rb.erb +0 -0
- /data/lib/capistrano/ops/{backup → rails/lib/backup}/api.rb +0 -0
- /data/lib/capistrano/ops/{backup → rails/lib/backup}/s3_helper.rb +0 -0
- /data/lib/capistrano/ops/{notification → rails/lib/notification}/api.rb +0 -0
- /data/lib/capistrano/ops/{notification → rails/lib/notification}/slack.rb +0 -0
- /data/lib/capistrano/ops/{notification → rails/lib/notification}/webhook.rb +0 -0
- /data/lib/capistrano/ops/{tasks → rails/lib/tasks}/pg/dump.rake +0 -0
- /data/lib/capistrano/ops/{tasks → rails/lib/tasks}/pg/remove_old_dumps.rake +0 -0
- /data/lib/capistrano/ops/{tasks → rails/lib/tasks}/storage/backup.rake +0 -0
- /data/lib/capistrano/ops/{tasks → rails/lib/tasks}/storage/remove_old_backups.rake +0 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module Capistrano
|
4
|
+
module Ops
|
5
|
+
module Logrotate
|
6
|
+
module Paths
|
7
|
+
# local paths
|
8
|
+
def logrotate_config_file_template
|
9
|
+
Pathname.new fetch(:logrotate_config_file_template)
|
10
|
+
end
|
11
|
+
|
12
|
+
def logrotate_schedule_file_template
|
13
|
+
Pathname.new fetch(:logrotate_schedule_file_template)
|
14
|
+
end
|
15
|
+
|
16
|
+
# remote paths
|
17
|
+
def logrotate_basepath
|
18
|
+
shared_path.join fetch(:logrotate_basepath)
|
19
|
+
end
|
20
|
+
|
21
|
+
def logrotate_config_path
|
22
|
+
shared_path.join fetch(:logrotate_config_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
def logrotate_config_file_path
|
26
|
+
logrotate_basepath.join logrotate_config_filename
|
27
|
+
end
|
28
|
+
|
29
|
+
def logrotate_schedule_file_path
|
30
|
+
logrotate_basepath.join logrotate_schedule_filename
|
31
|
+
end
|
32
|
+
|
33
|
+
def log_file_path
|
34
|
+
shared_path.join fetch(:log_file_path)
|
35
|
+
end
|
36
|
+
|
37
|
+
def logrotate_schedule_filename
|
38
|
+
File.basename(logrotate_schedule_file_template, '.erb')
|
39
|
+
end
|
40
|
+
|
41
|
+
def logrotate_config_filename
|
42
|
+
File.basename(logrotate_config_file_template, '.erb')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -1,18 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative 'logrotate_helper'
|
4
|
-
|
5
3
|
namespace :logrotate do
|
6
|
-
include
|
4
|
+
include Capistrano::Ops::Logrotate::Helpers
|
5
|
+
include Capistrano::Ops::Logrotate::Paths
|
7
6
|
|
8
7
|
desc 'show logrotate state and config'
|
9
8
|
task :check do
|
10
9
|
on roles(:app) do
|
11
10
|
within release_path do
|
12
|
-
set_config
|
13
11
|
if logrotate_enabled
|
14
12
|
puts "logrotate running with config\n========================="
|
15
|
-
puts capture "cat #{
|
13
|
+
puts capture "cat #{logrotate_config_file_path}"
|
16
14
|
else
|
17
15
|
puts 'logrotate disabled'
|
18
16
|
end
|
@@ -1,15 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative 'logrotate_helper'
|
4
|
-
|
5
3
|
namespace :logrotate do
|
6
|
-
include
|
7
|
-
|
4
|
+
include Capistrano::Ops::Logrotate::Paths
|
5
|
+
include Capistrano::Ops::Logrotate::Helpers
|
8
6
|
desc 'disable logrotate'
|
9
7
|
task :disable do
|
10
8
|
on roles(:app) do
|
11
9
|
within release_path do
|
12
|
-
set_config
|
13
10
|
if logrotate_disabled
|
14
11
|
puts 'logrotate already disabled'
|
15
12
|
else
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :logrotate do
|
4
|
+
include Capistrano::Ops::Logrotate::Helpers
|
5
|
+
include Capistrano::Ops::Logrotate::Paths
|
6
|
+
|
7
|
+
desc 'Enable logrotate for the application'
|
8
|
+
task :enable do
|
9
|
+
on roles(:app) do
|
10
|
+
within release_path do
|
11
|
+
@log_file_path = log_file_path
|
12
|
+
@shared_path = shared_path
|
13
|
+
|
14
|
+
if logrotate_enabled
|
15
|
+
puts "logrotate already enabled:\n========================="
|
16
|
+
puts capture "cat #{logrotate_config_file_path}"
|
17
|
+
else
|
18
|
+
puts config_template
|
19
|
+
puts schedule_template
|
20
|
+
make_basepath
|
21
|
+
upload! StringIO.new(config_template), logrotate_config_file_path
|
22
|
+
upload! StringIO.new(schedule_template), logrotate_schedule_file_path
|
23
|
+
whenever 'update' if logrotate_enabled
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :load do
|
4
|
+
task :defaults do
|
5
|
+
set :logrotate_config_file_template, File.expand_path('templates/logrotate.conf.erb', __dir__)
|
6
|
+
set :logrotate_schedule_file_template, File.expand_path('templates/schedule.rb.erb', __dir__)
|
7
|
+
set :logrotate_basepath, 'logrotate'
|
8
|
+
set :log_file_path, 'log'
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'capistrano/ops/helper'
|
4
|
+
require 'capistrano/ops/logrotate/helpers'
|
5
|
+
require 'capistrano/ops/logrotate/paths'
|
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
|
+
TaskLoader.load_tasks_if_gem_present('whenever', 'logrotate/tasks', 'WARNING: Gemfile does not include whenever gem which is required for logrotate tasks')
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
module Capistrano
|
6
|
+
module Ops
|
7
|
+
module Logs
|
8
|
+
module Paths
|
9
|
+
def rails_log_file_path
|
10
|
+
shared_path.join fetch(:rails_log_file_name) || "log/#{fetch(:rails_env)}.log"
|
11
|
+
end
|
12
|
+
|
13
|
+
def sidekiq_log_file_path
|
14
|
+
shared_path.join fetch(:sidekiq_log_file_name) || 'log/sidekiq.log'
|
15
|
+
end
|
16
|
+
|
17
|
+
def sidekiq_error_log_file_path
|
18
|
+
shared_path.join fetch(:sidekiq_error_log_file_name) || 'log/sidekiq.error.log'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :logs do
|
4
|
+
include Capistrano::Ops::Logs::Paths
|
5
|
+
include Capistrano::Ops::Logs::Helpers
|
6
|
+
|
7
|
+
desc 'Tail Rails logs'
|
8
|
+
task :rails do
|
9
|
+
on roles(fetch(:rake_roles, :app)) do
|
10
|
+
trap_interrupt
|
11
|
+
|
12
|
+
execute "tail -f #{rails_log_file_path}" do |_channel, stream, data|
|
13
|
+
puts data
|
14
|
+
break if stream == :err
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :logs do
|
4
|
+
include Capistrano::Ops::Logs::Paths
|
5
|
+
include Capistrano::Ops::Logs::Helpers
|
6
|
+
|
7
|
+
desc 'Tail Rails info logs'
|
8
|
+
task 'sidekiq:info' do
|
9
|
+
on roles(fetch(:rake_roles, :app)) do
|
10
|
+
trap_interrupt
|
11
|
+
|
12
|
+
execute "tail -f #{sidekiq_log_file_path}" do |_channel, stream, data|
|
13
|
+
puts data
|
14
|
+
break if stream == :err
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'Tail Sidekiq error logs'
|
20
|
+
task 'sidekiq:errors' do
|
21
|
+
on roles(fetch(:rake_roles, :app)) do
|
22
|
+
trap_interrupt
|
23
|
+
|
24
|
+
execute "tail -f #{sidekiq_error_log_file_path}" do |_channel, stream, data|
|
25
|
+
puts data
|
26
|
+
break if stream == :err
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'Tail all Sidekiq logs'
|
32
|
+
task :sidekiq do
|
33
|
+
on roles(fetch(:rake_roles, :app)) do
|
34
|
+
trap_interrupt
|
35
|
+
|
36
|
+
execute "tail -f #{sidekiq_log_file_path} & tail -f #{sidekiq_error_log_file_path}" do |_channel, stream, data|
|
37
|
+
puts data
|
38
|
+
break if stream == :err
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'capistrano/ops/helper'
|
4
|
+
require 'capistrano/ops/logs/paths'
|
5
|
+
require 'capistrano/ops/logs/helpers'
|
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
|
+
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,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'capistrano/ops/rails/lib/notification/api'
|
4
|
+
require 'capistrano/ops/rails/lib/notification/slack'
|
5
|
+
require 'capistrano/ops/rails/lib/notification/webhook'
|
6
|
+
|
7
|
+
module Notification
|
8
|
+
class Error < StandardError; end
|
9
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails'
|
4
|
+
# require 'capistrano/ops'
|
5
|
+
module Capistrano
|
6
|
+
module Ops
|
7
|
+
module Libs
|
8
|
+
class Railtie < ::Rails::Railtie
|
9
|
+
railtie_name :ops
|
10
|
+
rake_tasks do
|
11
|
+
path = File.expand_path(__dir__)
|
12
|
+
Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -54,7 +54,7 @@ module PostgresHelper
|
|
54
54
|
commandlist = []
|
55
55
|
commandlist << "export PGPASSWORD='#{@password}'"
|
56
56
|
commandlist << "cd #{@backup_path}"
|
57
|
-
commandlist << "pg_dump -
|
57
|
+
commandlist << "pg_dump --no-acl --no-owner #{options.join('')} > #{@filename}"
|
58
58
|
commandlist.join(' && ')
|
59
59
|
end
|
60
60
|
|
data/lib/capistrano/ops/{capistrano/v3/tasks/whenever.rake → whenever/tasks/show_crontab.rake}
RENAMED
@@ -1,11 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
namespace :whenever do
|
4
|
-
# Default to :app role
|
5
|
-
rake_roles = fetch(:rake_roles, :app)
|
6
4
|
desc 'show crontab'
|
7
5
|
task :show_crontab do
|
8
|
-
on roles(rake_roles) do
|
6
|
+
on roles(fetch(:rake_roles, :app)) do
|
9
7
|
puts capture 'crontab -l'
|
10
8
|
end
|
11
9
|
end
|
@@ -0,0 +1,17 @@
|
|
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
|
+
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')
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Capistrano
|
4
|
+
module Ops
|
5
|
+
module Helper
|
6
|
+
def binary_path
|
7
|
+
gem_path = capture(:bundle, 'show', 'wkhtmltopdf-binary').strip
|
8
|
+
"#{gem_path}/bin"
|
9
|
+
end
|
10
|
+
|
11
|
+
def gem_version
|
12
|
+
capture(:cat, 'config/initializers/wicked_pdf.rb').scan(/wkhtmltopdf_ubuntu_(\d+\.\d+)_amd64/).flatten.first
|
13
|
+
end
|
14
|
+
|
15
|
+
def binary_path_and_version
|
16
|
+
[binary_path, gem_version]
|
17
|
+
end
|
18
|
+
|
19
|
+
def file_existing?(file)
|
20
|
+
test("[ -f #{file} ]")
|
21
|
+
end
|
22
|
+
|
23
|
+
def right_permissions?(file)
|
24
|
+
test("[ $(stat -c '%a' #{file}) = '777' ]")
|
25
|
+
end
|
26
|
+
|
27
|
+
def check_file_and_permissions(binary_path, version)
|
28
|
+
binary_file = "#{binary_path}/wkhtmltopdf_ubuntu_#{version}_amd64"
|
29
|
+
|
30
|
+
if file_existing?(binary_file)
|
31
|
+
info('wkhtmltopdf binary already extracted')
|
32
|
+
|
33
|
+
if right_permissions?(binary_file)
|
34
|
+
info('wkhtmltopdf binary has already the right permissions')
|
35
|
+
else
|
36
|
+
info('adding right permissions to wkhtmltopdf binary')
|
37
|
+
execute("chmod 777 #{binary_file}")
|
38
|
+
end
|
39
|
+
else
|
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}")
|
45
|
+
end
|
46
|
+
info('wkhtmltopdf setup finished')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :wkhtmltopdf do
|
4
|
+
include Capistrano::Ops::Wkhtmltopdf::Helpers
|
5
|
+
after 'deploy:symlink:release', 'wkhtmltopdf:setup'
|
6
|
+
|
7
|
+
desc 'unzip wkhtmltopdf if necessary'
|
8
|
+
task :setup do
|
9
|
+
on roles(:app) do
|
10
|
+
within release_path do
|
11
|
+
binary_path, version = binary_path_and_version
|
12
|
+
info("setup wkhtmltopdf version #{version}")
|
13
|
+
check_file_and_permissions(binary_path, version)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,3 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require 'capistrano/ops/helper'
|
4
|
+
require 'capistrano/ops/wkhtmltopdf/helpers'
|
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
|
+
TaskLoader.load_tasks_if_gem_present('wicked-pdf', 'wkhtmltopdf/tasks',
|
19
|
+
'WARNING: Gemfile does not include wkhtmltopdf-binary gem which is required for wkhtmltopdf tasks')
|
data/lib/capistrano/ops.rb
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
module Capistrano
|
4
4
|
module Ops
|
5
|
-
require 'capistrano/ops/backup'
|
6
|
-
require 'capistrano/ops/notification'
|
7
|
-
require 'capistrano/ops/railtie' if defined?(Rails)
|
5
|
+
require 'capistrano/ops/rails/lib/backup'
|
6
|
+
require 'capistrano/ops/rails/lib/notification'
|
7
|
+
require 'capistrano/ops/rails/lib/railtie' if defined?(Rails)
|
8
8
|
require 'capistrano/ops/capistrano' if defined?(Capistrano::VERSION)
|
9
|
+
|
9
10
|
def self.path
|
10
11
|
Dir.pwd
|
11
12
|
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.
|
4
|
+
version: 1.0.0
|
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-
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -94,6 +94,34 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.56.2
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.56.2
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-performance
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.19.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.19.0
|
97
125
|
description: A collection of devops tasks for rails applications
|
98
126
|
email:
|
99
127
|
- florian@zauberware.com
|
@@ -116,39 +144,68 @@ files:
|
|
116
144
|
- capistrano-ops.gemspec
|
117
145
|
- lib/capistrano/ops.rb
|
118
146
|
- lib/capistrano/ops/backup.rb
|
119
|
-
- lib/capistrano/ops/backup/
|
120
|
-
- lib/capistrano/ops/backup/
|
121
|
-
- lib/capistrano/ops/backup/
|
147
|
+
- lib/capistrano/ops/backup/helper.rb
|
148
|
+
- lib/capistrano/ops/backup/tasks/database/create.rake
|
149
|
+
- lib/capistrano/ops/backup/tasks/database/pull.rake
|
150
|
+
- lib/capistrano/ops/backup/tasks/storage/create.rake
|
151
|
+
- lib/capistrano/ops/backup/tasks/storage/pull.rake
|
122
152
|
- lib/capistrano/ops/capistrano.rb
|
123
|
-
- lib/capistrano/ops/capistrano/tasks/wkhtmltopdf.rake
|
124
153
|
- lib/capistrano/ops/capistrano/v3/tasks/backup.rake
|
125
|
-
- lib/capistrano/ops/
|
126
|
-
- lib/capistrano/ops/
|
127
|
-
- lib/capistrano/ops/
|
128
|
-
- lib/capistrano/ops/
|
129
|
-
- lib/capistrano/ops/
|
130
|
-
- lib/capistrano/ops/
|
131
|
-
- lib/capistrano/ops/
|
132
|
-
- lib/capistrano/ops/
|
133
|
-
- lib/capistrano/ops/
|
134
|
-
- lib/capistrano/ops/
|
135
|
-
- lib/capistrano/ops/
|
136
|
-
- lib/capistrano/ops/
|
137
|
-
- lib/capistrano/ops/
|
138
|
-
- lib/capistrano/ops/
|
139
|
-
- lib/capistrano/ops/
|
140
|
-
- lib/capistrano/ops/
|
141
|
-
- lib/capistrano/ops/
|
142
|
-
- lib/capistrano/ops/
|
143
|
-
- lib/capistrano/ops/
|
144
|
-
- lib/capistrano/ops/
|
145
|
-
- lib/capistrano/ops/
|
146
|
-
- lib/capistrano/ops/
|
147
|
-
- lib/capistrano/ops/
|
148
|
-
- lib/capistrano/ops/tasks/
|
149
|
-
- lib/capistrano/ops/tasks/
|
154
|
+
- lib/capistrano/ops/figaro_yml.rb
|
155
|
+
- lib/capistrano/ops/figaro_yml/helpers.rb
|
156
|
+
- lib/capistrano/ops/figaro_yml/paths.rb
|
157
|
+
- lib/capistrano/ops/figaro_yml/tasks/backup.rake
|
158
|
+
- lib/capistrano/ops/figaro_yml/tasks/check.rake
|
159
|
+
- lib/capistrano/ops/figaro_yml/tasks/check_config_present.rake
|
160
|
+
- lib/capistrano/ops/figaro_yml/tasks/check_figaro_file_exists.rake
|
161
|
+
- lib/capistrano/ops/figaro_yml/tasks/check_git_tracking.rake
|
162
|
+
- lib/capistrano/ops/figaro_yml/tasks/compare.rake
|
163
|
+
- lib/capistrano/ops/figaro_yml/tasks/create_local.rake
|
164
|
+
- lib/capistrano/ops/figaro_yml/tasks/figaro_yml_symlink.rake
|
165
|
+
- lib/capistrano/ops/figaro_yml/tasks/get.rake
|
166
|
+
- lib/capistrano/ops/figaro_yml/tasks/get_stage.rake
|
167
|
+
- lib/capistrano/ops/figaro_yml/tasks/load.rake
|
168
|
+
- lib/capistrano/ops/figaro_yml/tasks/rollback.rake
|
169
|
+
- lib/capistrano/ops/figaro_yml/tasks/setup.rake
|
170
|
+
- lib/capistrano/ops/figaro_yml/tasks/sort_local.rake
|
171
|
+
- lib/capistrano/ops/helper.rb
|
172
|
+
- lib/capistrano/ops/invoke.rb
|
173
|
+
- lib/capistrano/ops/invoke/tasks/invoke.rake
|
174
|
+
- lib/capistrano/ops/logrotate.rb
|
175
|
+
- lib/capistrano/ops/logrotate/helpers.rb
|
176
|
+
- lib/capistrano/ops/logrotate/paths.rb
|
177
|
+
- lib/capistrano/ops/logrotate/tasks/check.rake
|
178
|
+
- lib/capistrano/ops/logrotate/tasks/disable.rake
|
179
|
+
- lib/capistrano/ops/logrotate/tasks/enable.rake
|
180
|
+
- lib/capistrano/ops/logrotate/tasks/load.rake
|
181
|
+
- lib/capistrano/ops/logrotate/tasks/templates/logrotate.conf.erb
|
182
|
+
- lib/capistrano/ops/logrotate/tasks/templates/schedule.rb.erb
|
183
|
+
- lib/capistrano/ops/logs.rb
|
184
|
+
- lib/capistrano/ops/logs/helpers.rb
|
185
|
+
- lib/capistrano/ops/logs/paths.rb
|
186
|
+
- lib/capistrano/ops/logs/tasks/load.rake
|
187
|
+
- lib/capistrano/ops/logs/tasks/rails.rake
|
188
|
+
- lib/capistrano/ops/logs/tasks/sidekiq.rake
|
189
|
+
- lib/capistrano/ops/rails/lib/backup.rb
|
190
|
+
- lib/capistrano/ops/rails/lib/backup/api.rb
|
191
|
+
- lib/capistrano/ops/rails/lib/backup/s3.rb
|
192
|
+
- lib/capistrano/ops/rails/lib/backup/s3_helper.rb
|
193
|
+
- lib/capistrano/ops/rails/lib/notification.rb
|
194
|
+
- lib/capistrano/ops/rails/lib/notification/api.rb
|
195
|
+
- lib/capistrano/ops/rails/lib/notification/slack.rb
|
196
|
+
- lib/capistrano/ops/rails/lib/notification/webhook.rb
|
197
|
+
- lib/capistrano/ops/rails/lib/railtie.rb
|
198
|
+
- lib/capistrano/ops/rails/lib/tasks/pg/dump.rake
|
199
|
+
- lib/capistrano/ops/rails/lib/tasks/pg/postgres_helper.rb
|
200
|
+
- lib/capistrano/ops/rails/lib/tasks/pg/remove_old_dumps.rake
|
201
|
+
- lib/capistrano/ops/rails/lib/tasks/storage/backup.rake
|
202
|
+
- lib/capistrano/ops/rails/lib/tasks/storage/remove_old_backups.rake
|
150
203
|
- lib/capistrano/ops/version.rb
|
204
|
+
- lib/capistrano/ops/whenever.rb
|
205
|
+
- lib/capistrano/ops/whenever/tasks/show_crontab.rake
|
151
206
|
- lib/capistrano/ops/wkhtmltopdf.rb
|
207
|
+
- lib/capistrano/ops/wkhtmltopdf/helpers.rb
|
208
|
+
- lib/capistrano/ops/wkhtmltopdf/tasks/setup.rake
|
152
209
|
homepage: https://github.com/zauberware/capistrano-ops
|
153
210
|
licenses:
|
154
211
|
- MIT
|