eco-rake 0.2.3 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dc9d64b6854dfde4e8764a08703e518db2f1bf4f169f3efd3198a25f256b069
4
- data.tar.gz: a6ffb1baec26ca343d162c99da57e72510966672382a62b94ca93579c6d9a5a9
3
+ metadata.gz: 62670eef7e735906c2b7c85ce0ec355809e56388c81c62b7829c0615c5ac02a6
4
+ data.tar.gz: b8061d3eec87948c8320d9320c09ed1a97426402893b6320e114310d2600dcba
5
5
  SHA512:
6
- metadata.gz: 1ab30187fed8829d464e2c40499d425277e1f438003c60b4dc6f836003117d88bacdd89c61c62533dca0162f805a3f653f6ead4d898ea40828663097810fd89b
7
- data.tar.gz: 937ad4cf1f0bc6e37722ce6687a40e0430def5f231130725aa9712c1a943da92d5292ac186df14f174604d3b8d67af27ee8ce88ecc97cbb58022ce388ae4bb1a
6
+ metadata.gz: 73653313c3f6ca4be1ea38c22b77496921b7fb99d171cc876d2667cf38b0d41b99958df47ad760aeff4809613d881922ef4dc3145e152c35ef623363aaba21fe
7
+ data.tar.gz: c8365601b42e4ac8c36f696d1c657d2455355d92d9376cc32d16f7cb2e24e4ef0ac56fbfd7b0b2eeb480f266ad6090f359dc3ad36f487f6b077ea272ba3ca4ee
data/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [0.2.4] - 2024-08-22
5
+ ## [0.2.4] - 2024-09-xx
6
6
 
7
7
  ### Added
8
8
 
@@ -10,6 +10,24 @@ All notable changes to this project will be documented in this file.
10
10
 
11
11
  ### Changed
12
12
 
13
+ ## [0.2.4] - 2024-09-05
14
+
15
+ ### Added
16
+
17
+ - `EcoRake::Shell::Command#sh_exit_on_fail`
18
+ - It exists when the command failed.
19
+ - This requires that any notification is handled by the logic of the command that was invoked itself.
20
+ - Please observe that using this approach could miss a notification.
21
+
22
+ ### Changed
23
+
24
+ - `EcoRake::Lib::Peope::SyncLaunch#process_full_file`
25
+ - `people_get` won't raise a `RunTimeError` but just exit with status `1`
26
+ - `EcoRake::Lib::Task::RunnerRely#task`
27
+ - `command` won't raise a `RunTimeError` but just exit with status `1`
28
+ - `EcoRake::Lib::Files::Sftp#task`
29
+ - `sftp_command` won't raise a `RunTimeError` but just exit with status `1`
30
+
13
31
  ## [0.2.3] - 2024-08-22
14
32
 
15
33
  ### Fixed
@@ -30,7 +30,7 @@ class EcoRake
30
30
  # option_reopen :enviro, default_lookup: :target_enviro
31
31
 
32
32
  def task(*_args)
33
- sh sftp_command
33
+ sh_exit_on_fail sftp_command
34
34
  end
35
35
 
36
36
  private
@@ -35,7 +35,7 @@ class EcoRake
35
35
  private
36
36
 
37
37
  def process_full_file
38
- sh people_get_command unless options[:no_get] || delta_last?
38
+ sh_exit_on_fail people_get_command unless options[:no_get] || delta_last?
39
39
  sh_continue sync_command(latest_file)
40
40
  clear_files unless options[:simulate]
41
41
  end
@@ -13,7 +13,7 @@ class EcoRake
13
13
  option_forwarding(**FORWARD_RULES)
14
14
 
15
15
  def task(*_args)
16
- sh_continue command
16
+ sh_exit_on_fail command
17
17
  end
18
18
 
19
19
  private
@@ -42,6 +42,18 @@ class EcoRake
42
42
  sh(comm, &sh_default_block(comm, &block))
43
43
  end
44
44
 
45
+ # It exits if there is an error
46
+ # @note if doesn't raise (prevents) a RuntimeError
47
+ # @param comm [String] the command line
48
+ def sh_exit_on_fail(comm)
49
+ callback = middlewared_callback(sh_default_block(comm)) do |ok, res|
50
+ next if ok
51
+
52
+ exit(1)
53
+ end
54
+ sh(comm, &callback)
55
+ end
56
+
45
57
  # Returns the default block for `sh` native method.
46
58
  # @note it wraps `block` if given
47
59
  # @return [Proc]
@@ -55,6 +67,14 @@ class EcoRake
55
67
  res.exitstatus
56
68
  end
57
69
  end
70
+
71
+ def middlewared_callback(original)
72
+ proc do |*args, **kargs|
73
+ yield(*args, **kargs)
74
+ ensure
75
+ original.call(*args, **kargs)
76
+ end
77
+ end
58
78
  end
59
79
  end
60
80
  end
@@ -1,5 +1,5 @@
1
1
  require 'rake-commander'
2
2
 
3
3
  class EcoRake < RakeCommander
4
- VERSION = '0.2.3'.freeze
4
+ VERSION = '0.2.4'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura Samper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-23 00:00:00.000000000 Z
11
+ date: 2024-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  - !ruby/object:Gem::Version
256
256
  version: '0'
257
257
  requirements: []
258
- rubygems_version: 3.5.6
258
+ rubygems_version: 3.5.18
259
259
  signing_key:
260
260
  specification_version: 4
261
261
  summary: A set of helpers to build re-usable `rake` integration helpers.