eco-rake 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/eco-rake/lib/files/decrypt.rb +4 -1
- data/lib/eco-rake/lib/people/sync_process.rb +12 -1
- data/lib/eco-rake/shell/command.rb +1 -0
- data/lib/eco-rake/utils/mailing.rb +10 -1
- data/lib/eco-rake/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa7405fb06b10d3052ffacab860fb0025d531991d75bfc1a1b9459045b13d301
|
4
|
+
data.tar.gz: a8ee96250e7234e34308f0d713ec5353cee15f808bfd777587927409c407d5ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 951153395cdc3d54497af9dbc34b1c6a4814726de827c823f6d4a93215a86767f40d7c13b6a096890b65e9e2a9454c573414f30ff36ba59a98dc99413788c133
|
7
|
+
data.tar.gz: 18daed0a491aec28f760208eb48fde5675b00986574f78fe09a886ffd8ccb98cb71330129cc8a195780152f42a7c142f57497abddfedd666aabf0a3daf822bdb
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [0.1.
|
4
|
+
## [0.1.2] - 2023-06-xx
|
5
5
|
|
6
6
|
### Added
|
7
7
|
### Fixed
|
8
8
|
### Changed
|
9
|
+
- Notify when file decryption fails
|
10
|
+
|
11
|
+
## [0.1.2] - 2023-06-09
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- Notify when file decryption fails
|
9
15
|
|
10
16
|
## [0.1.1] - 2023-06-06
|
11
17
|
|
@@ -12,11 +12,14 @@ class EcoRake
|
|
12
12
|
def task(*_args)
|
13
13
|
return display_target_files if options[:list]
|
14
14
|
return warn_missing_file if target_files.empty?
|
15
|
+
status = 0
|
15
16
|
target_files.each do |file|
|
16
17
|
delete_file(gpg_to_csv_filename(file))
|
17
|
-
|
18
|
+
stat = sh_continue(decrypt_command(file, ignore_mdc_error: ignore_mdc_error))
|
19
|
+
status = stat unless stat == 0
|
18
20
|
end
|
19
21
|
delete_file(*target_files, message: "Deleting files from '#{source_folder}'") unless options[:simulate]
|
22
|
+
exit status unless status == 0
|
20
23
|
end
|
21
24
|
|
22
25
|
def display_target_files
|
@@ -17,7 +17,9 @@ class EcoRake
|
|
17
17
|
def task(*_args)
|
18
18
|
upsert_local_dir(options[:folder])
|
19
19
|
sh_continue rake_sftp_get
|
20
|
-
|
20
|
+
if do_decrypt
|
21
|
+
failed_decryption_notify unless 0 == sh_continue(rake_decrypt)
|
22
|
+
end
|
21
23
|
sh_continue rake_sync_command
|
22
24
|
return if options[:simulate]
|
23
25
|
sh_continue rake_sftp_archive
|
@@ -42,6 +44,15 @@ class EcoRake
|
|
42
44
|
def rake_files_purge(folder, operation: '--remove')
|
43
45
|
rake_command('logs:purge', *forward_options(:enviro), "-d #{folder}", operation)
|
44
46
|
end
|
47
|
+
|
48
|
+
def failed_decryption_notify
|
49
|
+
msg = 'File decryption failed'
|
50
|
+
puts msg
|
51
|
+
exit 1 if options[:simulate]
|
52
|
+
exit 1 unless inbox = mail_to
|
53
|
+
email(enviro: target_enviro, to: inbox, subject: msg, body: msg)
|
54
|
+
exit 1
|
55
|
+
end
|
45
56
|
end
|
46
57
|
end
|
47
58
|
end
|
@@ -6,9 +6,18 @@ class EcoRake
|
|
6
6
|
@mailer ||= EcoRake::Utils::Mailer.new
|
7
7
|
end
|
8
8
|
|
9
|
+
def email(subject:, body:, to:, enviro: nil)
|
10
|
+
subject = "#{enviro.upcase} - #{subject}" unless !enviro && subject.downcase.include?(enviro.downcase)
|
11
|
+
mailer.mail(**{
|
12
|
+
to: to,
|
13
|
+
subject: subject,
|
14
|
+
body: body
|
15
|
+
})
|
16
|
+
end
|
17
|
+
|
9
18
|
# Helper to notify that there are no files to be processed
|
10
19
|
def email_missing_files(enviro:, to:)
|
11
|
-
|
20
|
+
email(**{
|
12
21
|
to: to,
|
13
22
|
subject: "#{enviro.upcase} (No files to be processed)",
|
14
23
|
body: 'No files found to be processed. Aborting...'
|
data/lib/eco-rake/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.2
|
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: 2023-06-
|
11
|
+
date: 2023-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|