nocode 0.0.6 → 0.0.7

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: bb204abe5d0c62fce45c1c9afd052fe90e21c9f422020b7acb497dd3e226c22b
4
- data.tar.gz: dedd69881e903e5a1778303ea5adcd114fdcba10fbadbe2605c7e72b867beb83
3
+ metadata.gz: 73aa9b620a2823a96b00c4b38f5a8e0fc8f5f040b5100e255e5f3df546263544
4
+ data.tar.gz: d5dbacadf0759e59ddd279c7446f679052ff89b4f2d3ea8d49378173368bd28f
5
5
  SHA512:
6
- metadata.gz: 1e36a07d157d207d70606a067561cbfd049fab0842c124ebb252ef7e15d2bf1e397f5e683b17cead76f92e75112596038d627189ad9e37372bf7236341d500ef
7
- data.tar.gz: dfb6f8759f55c3234fc04bae3e1701679b59d6e2678ae12d81190d9775f22a1f87beb6de63e0e58da5e7454d47ba72e3ec3791df66ce43a4e015a6ab8892878a
6
+ metadata.gz: 5fe2d5363d14bb6d035072629e280d6e87717a3a16e3d28d69e520ea6a8aa21d1ad330f554c94c6d6c5113c8acbb665fc3d4b9f8bde74d7652e8b14d3c1b42c8
7
+ data.tar.gz: c8f2c04683439abecfc3de0c63a909cc1b52686f2741f1936f03ea152bef263a41c4613d26e2ae46c732c6f879a6cfe40e62eed6d8922cb7b862a87329624b45
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ #### 0.0.7 - February 13th, 2022
2
+
3
+ * Move shared logging logic to context (until a first class log writer emerges).
4
+ * Provide type_prefix option for class_registry
5
+
1
6
  #### 0.0.6 - February 13th, 2022
2
7
 
3
8
  * Expose registers to main YAML configuration.
@@ -33,5 +33,13 @@ module Nocode
33
33
  PARAMETERS_KEY => parameters
34
34
  }
35
35
  end
36
+
37
+ def log_line
38
+ log('-' * 50)
39
+ end
40
+
41
+ def log(msg)
42
+ io.puts(msg)
43
+ end
36
44
  end
37
45
  end
@@ -31,33 +31,25 @@ module Nocode
31
31
  registers: registers
32
32
  )
33
33
 
34
- log_title
34
+ log_title(context)
35
35
 
36
36
  StepsExecutor.new(context: context, steps: steps).execute
37
37
 
38
- log("Ended: #{DateTime.now}")
39
- log_line
38
+ context.log("Ended: #{DateTime.now}")
39
+ context.log_line
40
40
 
41
41
  context
42
42
  end
43
43
 
44
44
  private
45
45
 
46
- def log_title
47
- log_line
46
+ def log_title(context)
47
+ context.log_line
48
48
 
49
- log('Nocode Execution')
50
- log("Started: #{DateTime.now}")
49
+ context.log('Nocode Execution')
50
+ context.log("Started: #{DateTime.now}")
51
51
 
52
- log_line
53
- end
54
-
55
- def log_line
56
- log('-' * 50)
57
- end
58
-
59
- def log(msg)
60
- io.puts(msg)
52
+ context.log_line
61
53
  end
62
54
  end
63
55
  end
@@ -10,8 +10,8 @@ module Nocode
10
10
  class StepRegistry < Util::ClassRegistry
11
11
  include Singleton
12
12
 
13
- PREFIX = 'Nocode::Steps::'
14
- DIR = File.join(__dir__, 'steps')
13
+ CLASS_PREFIX = 'Nocode::Steps::'
14
+ DIR = File.join(__dir__, 'steps')
15
15
 
16
16
  class << self
17
17
  extend Forwardable
@@ -27,7 +27,7 @@ module Nocode
27
27
  files_loaded = Util::ClassLoader.new(DIR).load!
28
28
 
29
29
  # Class the parent to load up the registry with the files we found.
30
- load(files_loaded, PREFIX)
30
+ load(files_loaded, class_prefix: CLASS_PREFIX)
31
31
  end
32
32
  end
33
33
 
@@ -13,7 +13,7 @@ module Nocode
13
13
 
14
14
  attr_reader :context, :steps
15
15
 
16
- def_delegators :context, :io
16
+ def_delegators :context, :log_line, :log
17
17
 
18
18
  def initialize(context:, steps:)
19
19
  @context = context
@@ -32,9 +32,6 @@ module Nocode
32
32
 
33
33
  private
34
34
 
35
- # TODO: It could be better encapsulated to move the evaluation logic into the step itself
36
- # and let it deal with compilation. This may call for re-working the lifecycle of the Step
37
- # class so I will temporarily defer this refactoring.
38
35
  def make_step(step)
39
36
  evaluated_step = Util::ObjectTemplate.new(step).evaluate(context.to_h)
40
37
  type = evaluated_step[TYPE_KEY].to_s
@@ -67,13 +64,5 @@ module Nocode
67
64
 
68
65
  log_line
69
66
  end
70
-
71
- def log_line
72
- log('-' * 50)
73
- end
74
-
75
- def log(msg)
76
- io.puts(msg)
77
- end
78
67
  end
79
68
  end
@@ -20,13 +20,13 @@ module Nocode
20
20
  freeze
21
21
  end
22
22
 
23
- def load(types, prefix = '')
23
+ def load(types, class_prefix: '', type_prefix: '')
24
24
  types.each do |type|
25
25
  pascal_cased = type.split(File::SEPARATOR).map do |part|
26
26
  part.split('_').collect(&:capitalize).join
27
27
  end.join('::')
28
28
 
29
- register(type, "#{prefix}#{pascal_cased}")
29
+ register("#{type_prefix}#{type}", "#{class_prefix}#{pascal_cased}")
30
30
  end
31
31
 
32
32
  self
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nocode
4
- VERSION = '0.0.6'
4
+ VERSION = '0.0.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nocode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio