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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '098a578b7ff115d76af5aef0a1f85e6dda6450b7391dbe5b3f61d8fd745afc85'
4
- data.tar.gz: f7fc2e46a25bc3787dbc9b87314a7012c92f07e6b649fdb684e31286c11faf0b
3
+ metadata.gz: 5ad8bc5524c7a5a892a367e2fe2a0173688afa05799590aa3c9364ddf8c87034
4
+ data.tar.gz: 04a2b83c83718d7de6f7a23e885778acc2dcf93778eaf03b79e0d9855a54df24
5
5
  SHA512:
6
- metadata.gz: 71993b13377519331ad2df3447ea909ff3295417c44f88d40286470f0691bf4a843084837011e058bb3163a0014010fef326de7912ef64a3f98eb5379fce36e8
7
- data.tar.gz: c79bb6be7404f84c25042158ddd5af2c3acf1a9f532b9b8315a89ae65cac574b55c7b99ddd91fdc73f06b611cbe35f750daf108df96f311878ad78062deeed4d
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,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_base0/jobs_runner'
4
+ require 'eac_ruby_utils/patch'
5
+
6
+ class Class
7
+ def enable_jobs_runner
8
+ ::EacRubyUtils.patch(self, ::EacRubyBase0::JobsRunner)
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Dir["#{File.dirname(__FILE__)}/#{::File.basename(__FILE__, '.*')}/*.rb"].sort.each do |path|
4
+ require path
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'eac_ruby_base0/runner_with'
5
+ ::EacCli::RunnerWithSet.default.add_namespace(::EacRubyBase0::RunnerWith)
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRubyBase0
6
+ module RunnerWith
7
+ require_sub __FILE__
8
+ end
9
+ 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyBase0
4
- VERSION = '0.3.3'
4
+ VERSION = '0.4.0'
5
5
  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.3.3
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-01-04 00:00:00.000000000 Z
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: []