lucy_dockerunner 0.1.5 → 0.1.6
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/.rubocop.yml +8 -1
- data/Gemfile.lock +1 -1
- data/lib/lucy_dockerunner/version.rb +1 -1
- data/lib/rake/lucyd_hooks.rb +6 -26
- data/lib/tasks/compose.rake +5 -3
- data/lib/tasks/compose_assets.rake +1 -1
- data/lib/tasks/compose_db.rake +1 -1
- data/lib/tasks/compose_logs.rake +1 -1
- data/lib/tasks/compose_prod.rake +7 -4
- data/lib/tasks/compose_test.rake +1 -1
- data/lib/tasks/task_helpers/compose_taskhelper.rb +4 -3
- data/lib/tasks/task_helpers/taskhelper.rb +7 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed51fadc53b795aa23350c7ce49b87d25234cee22ed9a65d310815077f5b8972
|
4
|
+
data.tar.gz: ca61bacb4fc54f6432ddb5bca8167343881410ac2ae4eb7198c824dd91c5d20d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a4f5083d80a651b373d23cac7edead9f248defe9a2590c8653ed3f9bfc63094ed8dc8ba6d12f6bf1c107bd816442398bcf18b88164fe96657377cbdf03a9e6e
|
7
|
+
data.tar.gz: c9be619deded43389003507a4c2893cb602be2fd35511c2c6873c00ca36a6d9f20c4d24ec05b630f1104d3544b653f3805d3a7d36b0f54c96469cc5b922fedd3
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.6
|
3
|
+
SuggestExtensions: false
|
4
|
+
NewCops: enable
|
3
5
|
|
4
6
|
Style/StringLiterals:
|
5
7
|
Enabled: true
|
@@ -10,4 +12,9 @@ Style/StringLiteralsInInterpolation:
|
|
10
12
|
EnforcedStyle: double_quotes
|
11
13
|
|
12
14
|
Layout/LineLength:
|
13
|
-
Max:
|
15
|
+
Max: 180
|
16
|
+
|
17
|
+
Metrics/BlockLength:
|
18
|
+
Exclude:
|
19
|
+
- 'spec/**/*'
|
20
|
+
- 'lib/tasks/**/*'
|
data/Gemfile.lock
CHANGED
data/lib/rake/lucyd_hooks.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
3
|
+
# from https://github.com/guillermo/rake-hooks, authors Guillermo Iguaran, Joel Moss
|
4
4
|
module Rake
|
5
|
+
# module Rake::Hooks
|
5
6
|
module LucydHooks
|
6
|
-
def
|
7
|
+
def bef(*task_names, &new_task)
|
7
8
|
task_names.each do |task_name|
|
8
9
|
old_task = Rake.application.instance_variable_get("@tasks").delete(task_name.to_s)
|
9
10
|
next unless old_task
|
@@ -15,29 +16,8 @@ module Rake
|
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
18
|
-
|
19
|
-
def after(*task_names, &new_task)
|
20
|
-
options = task_names.last.is_a?(Hash) ? task_names.pop : {}
|
21
|
-
ignore_exceptions = options.delete(:ignore_exceptions) || false
|
22
|
-
|
23
|
-
task_names.each do |task_name|
|
24
|
-
old_task = Rake.application.instance_variable_get("@tasks").delete(task_name.to_s)
|
25
|
-
next unless old_task
|
26
|
-
|
27
|
-
desc old_task.full_comment if old_task.respond_to?(:full_comment)
|
28
|
-
task task_name => old_task.prerequisites do
|
29
|
-
begin
|
30
|
-
old_task.invoke
|
31
|
-
rescue StandardError
|
32
|
-
raise unless ignore_exceptions
|
33
|
-
end
|
34
|
-
|
35
|
-
new_task.call
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
19
|
end
|
40
|
-
end
|
41
20
|
|
42
|
-
Rake::DSL.include Rake::LucydHooks if defined?(Rake::DSL)
|
43
|
-
include Rake::LucydHooks unless self.class.included_modules.include?(Rake::LucydHooks)
|
21
|
+
Rake::DSL.include Rake::LucydHooks if defined?(Rake::DSL)
|
22
|
+
include Rake::LucydHooks unless self.class.included_modules.include?(Rake::LucydHooks)
|
23
|
+
end
|
data/lib/tasks/compose.rake
CHANGED
@@ -187,8 +187,10 @@ end
|
|
187
187
|
|
188
188
|
tasks_names.each do |task|
|
189
189
|
before_action = "#{namesp}:#{task}"
|
190
|
-
|
191
|
-
|
192
|
-
|
190
|
+
bef before_action do
|
191
|
+
docker_abort_error = "Dockerfile not found.\nYou must have a Dockerfile file."
|
192
|
+
compose_abort_error = "Compose file not found.\nFor development, you must have a #{dev_compose_file} file."
|
193
|
+
dockerfile_checker ? abort(docker_abort_error) : puts("Dockerfile found.")
|
194
|
+
compose_checker ? abort(compose_abort_error) : puts("Compose file found.")
|
193
195
|
end
|
194
196
|
end
|
data/lib/tasks/compose_db.rake
CHANGED
data/lib/tasks/compose_logs.rake
CHANGED
data/lib/tasks/compose_prod.rake
CHANGED
@@ -38,7 +38,8 @@ namespace :compose_prod do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
task :install do
|
41
|
-
puts "Installing Blockchain and Database Containers \
|
41
|
+
puts "Installing Blockchain and Database Containers \n
|
42
|
+
WARNING: This will delete all your data, and you are running this in production"
|
42
43
|
# ask in terminal if you want to continue
|
43
44
|
choice = ask("Are you sure you want to continue? (y/n)")
|
44
45
|
if choice == "y"
|
@@ -241,8 +242,10 @@ end
|
|
241
242
|
|
242
243
|
tasks_names.each do |task|
|
243
244
|
before_action = "#{namesp}:#{task}"
|
244
|
-
|
245
|
-
|
246
|
-
|
245
|
+
bef before_action do
|
246
|
+
docker_abort_error = "Dockerfile not found.\nYou must have a Dockerfile file."
|
247
|
+
compose_abort_error = "Compose file not found.\nYou must have a docker-compose.prod.yml file."
|
248
|
+
dockerfile_checker ? abort(docker_abort_error) : puts("Dockerfile found")
|
249
|
+
compose_checker ? abort(compose_abort_error) : puts("Compose Production file found")
|
247
250
|
end
|
248
251
|
end
|
data/lib/tasks/compose_test.rake
CHANGED
@@ -4,9 +4,10 @@ require "English"
|
|
4
4
|
require_relative "taskhelper"
|
5
5
|
|
6
6
|
module TaskHelpers
|
7
|
+
# ComposeTaskhelper
|
7
8
|
class ComposeTaskhelper < TaskHelpers::Taskhelper
|
8
9
|
def compose_command
|
9
|
-
@
|
10
|
+
@compose_command ||= compose_command_finder
|
10
11
|
end
|
11
12
|
|
12
13
|
private
|
@@ -17,9 +18,9 @@ module TaskHelpers
|
|
17
18
|
system "#{command} --version > /dev/null 2>&1"
|
18
19
|
return command if $CHILD_STATUS.success?
|
19
20
|
|
20
|
-
command = false
|
21
|
+
command = false
|
22
|
+
raise ComposeError if command == false
|
21
23
|
end
|
22
|
-
raise ComposeError unless command == false
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module TaskHelpers
|
4
|
+
# Taskhelper
|
4
5
|
class Taskhelper
|
6
|
+
# Compose Error
|
5
7
|
class ComposeError < StandardError
|
6
8
|
def initialize(message = "Docker Compose is not installed")
|
7
9
|
super
|
@@ -10,15 +12,16 @@ module TaskHelpers
|
|
10
12
|
|
11
13
|
private
|
12
14
|
|
13
|
-
def dev_error(
|
15
|
+
def dev_error(error)
|
14
16
|
return unless env_acceptable?
|
15
17
|
|
16
|
-
puts "#{
|
17
|
-
puts
|
18
|
+
puts "#{error.class}: #{error.message}"
|
19
|
+
puts error.backtrace
|
18
20
|
end
|
19
21
|
|
20
22
|
def env_acceptable?
|
21
|
-
Rails.env.development? || Rails.env.test?
|
23
|
+
# Rails.env.development? || Rails.env.test?
|
24
|
+
true
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucy_dockerunner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JesusGautamah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
This gem is a tool to run docker containers with rake commands, good for CI/CD and Rails projects.
|
@@ -51,6 +51,7 @@ metadata:
|
|
51
51
|
homepage_uri: https://github.com/JesusGautamah/lucy_dockerunner
|
52
52
|
source_code_uri: https://github.com/JesusGautamah/lucy_dockerunner
|
53
53
|
changelog_uri: https://github.com/JesusGautamah/lucy_dockerunner/blob/master/CHANGELOG.md
|
54
|
+
rubygems_mfa_required: 'true'
|
54
55
|
post_install_message:
|
55
56
|
rdoc_options: []
|
56
57
|
require_paths:
|
@@ -66,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
67
|
- !ruby/object:Gem::Version
|
67
68
|
version: '0'
|
68
69
|
requirements: []
|
69
|
-
rubygems_version: 3.
|
70
|
+
rubygems_version: 3.4.1
|
70
71
|
signing_key:
|
71
72
|
specification_version: 4
|
72
73
|
summary: This gem is a tool to run docker containers with rake commands, good for
|