eco-rake 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -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 +11 -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: 2267520b8e3a96d2a5f0c6b44aafb129f7d75592b090991d9738f0824f4a397e
|
4
|
+
data.tar.gz: 75d8139d6dbe8be2a853b083cab99d98f6145b1b5e3ad73620b4569579ae7952
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5724ff6fd5ab51f0851783bd04850b972ca5a01f58674e4c02adef49b5c17d30b379d5644a4a2d66925ffa028094c28c727a651b4e22271f295c382c137ed8c
|
7
|
+
data.tar.gz: edd52995662c0346519bdc764a7241c55213349c9b5d32355333320ea4812496587090a88a041927cf715c082c041e717ec33ff170eb0f51e46b48fef08323da
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,22 @@
|
|
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.3] - 2023-06-xx
|
5
5
|
|
6
6
|
### Added
|
7
7
|
### Fixed
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
## [0.1.4] - 2023-06-xx
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
- Type in `EcoRake::Utils::Mailing#email`
|
15
|
+
|
16
|
+
## [0.1.2] - 2023-06-09
|
17
|
+
|
8
18
|
### Changed
|
19
|
+
- Notify when file decryption fails
|
9
20
|
|
10
21
|
## [0.1.1] - 2023-06-06
|
11
22
|
|
@@ -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,19 @@ class EcoRake
|
|
6
6
|
@mailer ||= EcoRake::Utils::Mailer.new
|
7
7
|
end
|
8
8
|
|
9
|
+
def email(subject:, body:, to:, enviro: nil)
|
10
|
+
has_enviro = subject && subject.downcase.include?(enviro.downcase)
|
11
|
+
subject = "#{enviro.upcase} - #{subject}" unless !enviro && has_enviro
|
12
|
+
mailer.mail(**{
|
13
|
+
to: to,
|
14
|
+
subject: subject,
|
15
|
+
body: body
|
16
|
+
})
|
17
|
+
end
|
18
|
+
|
9
19
|
# Helper to notify that there are no files to be processed
|
10
20
|
def email_missing_files(enviro:, to:)
|
11
|
-
|
21
|
+
email(**{
|
12
22
|
to: to,
|
13
23
|
subject: "#{enviro.upcase} (No files to be processed)",
|
14
24
|
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.3
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|