eac_ruby_base0 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eac_ruby_base0/jobs_runner.rb +31 -0
- data/lib/eac_ruby_base0/patches.rb +4 -0
- data/lib/eac_ruby_base0/patches/class.rb +4 -0
- data/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
- data/lib/eac_ruby_base0/patches/object.rb +5 -0
- data/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
- data/lib/eac_ruby_base0/runner_with.rb +9 -0
- data/lib/eac_ruby_base0/runner_with/confirmable.rb +21 -0
- data/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
- data/lib/eac_ruby_base0/version.rb +1 -1
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ad8bc5524c7a5a892a367e2fe2a0173688afa05799590aa3c9364ddf8c87034
|
4
|
+
data.tar.gz: 04a2b83c83718d7de6f7a23e885778acc2dcf93778eaf03b79e0d9855a54df24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c77a3d7f5adba2effcd1bd023f0458feb9077d73e8c87f31e7e36079d72f660f51dc89007e7cc84a0463f0e7df3f617d2c63a275df5ebccbcc87c8f0a6533de
|
7
|
+
data.tar.gz: b7f7c86079c6ecbaae2862330759d0a96f942025febcae14e73989196570c301f71f84117b3e784b078b82454706d6cb56a60a1cad3a95cc2f023717f2192316
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/console/speaker'
|
4
|
+
require 'eac_ruby_utils/settings_provider'
|
5
|
+
|
6
|
+
module EacRubyBase0
|
7
|
+
module JobsRunner
|
8
|
+
common_concern do
|
9
|
+
include ::EacRubyUtils::Console::Speaker
|
10
|
+
include ::EacRubyUtils::SettingsProvider
|
11
|
+
end
|
12
|
+
|
13
|
+
def run_job(job)
|
14
|
+
return unless run_job?(job)
|
15
|
+
|
16
|
+
infom "Running job \"#{job}\"..."
|
17
|
+
send(job)
|
18
|
+
end
|
19
|
+
|
20
|
+
def run_job?(job)
|
21
|
+
the_method = "run_#{job}?"
|
22
|
+
respond_to?(the_method, true) ? send(the_method) : true
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_jobs(*jobs)
|
26
|
+
jobs = setting_value(:jobs) if jobs.empty?
|
27
|
+
jobs.each { |job| run_job(job) }
|
28
|
+
success 'Done'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner'
|
4
|
+
require 'eac_ruby_utils/fs/traversable'
|
5
|
+
|
6
|
+
module EacRubyBase0
|
7
|
+
module RunnerWith
|
8
|
+
module Confirmable
|
9
|
+
extend ::ActiveSupport::Concern
|
10
|
+
|
11
|
+
included do
|
12
|
+
include ::EacCli::Runner
|
13
|
+
runner_definition do
|
14
|
+
bool_opt '-c', '--confirm', 'Confirm changes.'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
delegate :confirm?, to: :parsed
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_ruby_utils/fs/traversable'
|
6
|
+
require 'eac_ruby_utils/settings_provider'
|
7
|
+
|
8
|
+
module EacRubyBase0
|
9
|
+
module RunnerWith
|
10
|
+
module FilesystemTraverser
|
11
|
+
DEFAULT_DEFAULT_TRAVERSER_RECURSIVE = false
|
12
|
+
|
13
|
+
common_concern do
|
14
|
+
include ::EacCli::Runner
|
15
|
+
include ::EacRubyUtils::Fs::Traversable
|
16
|
+
enable_settings_provider
|
17
|
+
include TopMethods
|
18
|
+
runner_definition do
|
19
|
+
bool_opt '-R', '--recursive', 'Recursive.'
|
20
|
+
bool_opt '--no-recursive', 'No recursive.'
|
21
|
+
pos_arg :paths, optional: true, repeat: true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module TopMethods
|
26
|
+
def on_none_path_informed
|
27
|
+
infom 'Warning: none path informed'
|
28
|
+
end
|
29
|
+
|
30
|
+
def paths
|
31
|
+
parsed.paths.map(&:to_pathname)
|
32
|
+
end
|
33
|
+
|
34
|
+
def run_filesystem_traverser
|
35
|
+
if parsed.paths.any?
|
36
|
+
parsed.paths.each { |path| traverser_check_path(path) }
|
37
|
+
else
|
38
|
+
on_none_path_informed
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def traverser_recursive
|
43
|
+
return false if parsed.no_recursive?
|
44
|
+
return true if parsed.recursive?
|
45
|
+
|
46
|
+
setting_value(:default_traverser_recursive, required: false)
|
47
|
+
.if_not_nil(DEFAULT_DEFAULT_TRAVERSER_RECURSIVE)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_ruby_base0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_cli
|
@@ -86,8 +86,17 @@ extra_rdoc_files: []
|
|
86
86
|
files:
|
87
87
|
- lib/eac_ruby_base0.rb
|
88
88
|
- lib/eac_ruby_base0/application.rb
|
89
|
+
- lib/eac_ruby_base0/jobs_runner.rb
|
90
|
+
- lib/eac_ruby_base0/patches.rb
|
91
|
+
- lib/eac_ruby_base0/patches/class.rb
|
92
|
+
- lib/eac_ruby_base0/patches/class/jobs_runner.rb
|
93
|
+
- lib/eac_ruby_base0/patches/object.rb
|
94
|
+
- lib/eac_ruby_base0/patches/object/runner_with.rb
|
89
95
|
- lib/eac_ruby_base0/runner.rb
|
90
96
|
- lib/eac_ruby_base0/runner/test_all.rb
|
97
|
+
- lib/eac_ruby_base0/runner_with.rb
|
98
|
+
- lib/eac_ruby_base0/runner_with/confirmable.rb
|
99
|
+
- lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
|
91
100
|
- lib/eac_ruby_base0/version.rb
|
92
101
|
homepage:
|
93
102
|
licenses: []
|