eco-rake 0.1.4 → 0.1.5

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: 074016c49dcad11008927bbd2463b93b5f8f8b9fd78735c74ec5b1d67f8091a3
4
- data.tar.gz: 42793537149d86f4c5761cc74370a47c7fa1943259ec32426d26db6feb20d64f
3
+ metadata.gz: 7a95738d0726a071fd9302ea5644ae019f0417577e0b9df2debf9d8e1c06b94f
4
+ data.tar.gz: eb1655d1f8cbc09ca84bc22be350170b122958a37bbbb70a969f038ee5e2afee
5
5
  SHA512:
6
- metadata.gz: f4f737b509802574d297f50494f2998c2babfb496d23a5b1420e3f00342f8ea49439f59b74e8c3644b048e99a871b3e93b225a1cedeb9baf5982e49cecac5854
7
- data.tar.gz: 7b6240f0d0e6206051767b957d3b83fbe9673e96aed98e07584508fda034fde4849cc8a2df8c6d1e56e75feaf90a5c13252dbaf32d24f3540f60e2e933aa40c4
6
+ metadata.gz: 6cb03e0ca5be560bd0e579851eb4476175e56eff2db1c37f41d2f9b07dfd536284c9cce1bf9ab06ff5b9a70d3f4ad3083f6b8ba81b7cfe0d764f00a7317dd23b
7
+ data.tar.gz: 85c9dda526770a38a72512a593e4d883895056a06073a79fb9f7bd3a4176fada22b98da712636f13ec3f95e5b1d07e47e00b0bce0f713b3eb33631944473a84c
data/CHANGELOG.md CHANGED
@@ -1,10 +1,18 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.1.4] - 2023-07-xx
4
+ ## [0.1.6] - 2024-02-xx
5
5
 
6
6
  ### Added
7
7
  ### Fixed
8
+ ### Changed
9
+
10
+ ## [0.1.5] - 2024-02-xx
11
+
12
+ ### Added
13
+ - new options for file pattern const and remote subfolder for the SFTP task
14
+
15
+ ### Fixed
8
16
 
9
17
  ### Changed
10
18
 
@@ -8,7 +8,9 @@ class EcoRake
8
8
  list: '-list',
9
9
  get_last: '-get-last',
10
10
  get: '-get',
11
- archive: '-archive'
11
+ archive: '-archive',
12
+ file_pattern: ->(str) { "-file-pattern-const #{str}"},
13
+ remote_subfolder: ->(sub) { "-remote-subfolder #{sub}"}
12
14
  }.freeze
13
15
 
14
16
  options_with_defaults true
@@ -19,6 +21,8 @@ class EcoRake
19
21
  option '-g', '--get', TrueClass, desc: 'Gets all available CSV feed files'
20
22
  option '-t', '--get-last', TrueClass, desc: 'Gets the last available CSV feed file'
21
23
  option '-a', '--archive', TrueClass, desc: "Moves the remote CSV feed files to the '/Archive' folder"
24
+ option '-p', '--file-pattern CONST', String, desc: "Specifies a const to use as the target file pattern"
25
+ option '-r', '--remote-subfolder SUBFOLDER', String, desc: "Remote subfolder of the env (at the top of the enviro folder)"
22
26
 
23
27
  option_forwarding(**FORWARD_RULES)
24
28
 
@@ -35,6 +39,7 @@ class EcoRake
35
39
  cmd = [base_command]
36
40
  cmd << forward_option(:folder)
37
41
  cmd << forward_options(:list, :get_last, :get, :archive).compact.first || '-list'
42
+ cmd.push(*forward_options(:remote_subfolder, :file_pattern).compact)
38
43
  cmd << '-no-people'
39
44
  cmd = yield(cmd) if block_given?
40
45
  string_cmd(*cmd)
@@ -9,6 +9,7 @@ class EcoRake
9
9
  option '-o', '--only-stats', TrueClass, desc: 'To display only stats in the feedback'
10
10
  option '-b', '--no-policy', FalseClass, desc: 'To skip the batch policy'
11
11
  option '-n', '--no-get', FalseClass, desc: 'Skip get people step'
12
+ option '-p', '--file-pattern', TrueClass, desc: "Specifies the target file pattern (can use a const)"
12
13
  end
13
14
  end
14
15
  end
@@ -4,6 +4,7 @@ class EcoRake
4
4
  # The top level task that organizes all the people sync
5
5
  class SyncProcess < EcoRake::Lib::People::SyncRely
6
6
  attr_const :do_decrypt, default: false
7
+ attr_const :pull_driver, default: 'sftp'
7
8
  attr_const :target_task
8
9
 
9
10
  attr_const :target_enviro, required: true
@@ -16,23 +17,36 @@ class EcoRake
16
17
 
17
18
  def task(*_args)
18
19
  upsert_local_dir(options[:folder])
19
- sh_continue rake_sftp_get
20
+ sh_continue pull_file
20
21
  if do_decrypt
21
22
  failed_decryption_notify unless 0 == sh_continue(rake_decrypt)
22
23
  end
23
24
  sh_continue rake_sync_command
24
25
  return if options[:simulate]
25
- sh_continue rake_sftp_archive
26
+ sh_continue rake_sftp_archive if pull_driver == 'sftp'
26
27
  sh_continue rake_files_purge('cache')
27
28
  sh_continue rake_files_purge('requests')
28
29
  end
29
30
 
30
31
  private
31
32
 
33
+ def pull_file
34
+ case pull_driver
35
+ when 'sftp'
36
+ rake_sftp_get
37
+ when 'url'
38
+ rake_url_get
39
+ end
40
+ end
41
+
32
42
  def rake_sftp_get
33
43
  rake_command('csv:sftp', *forward_options(:enviro, :folder), '-t')
34
44
  end
35
45
 
46
+ def rake_url_get
47
+ rake_command("csv:#{options[:enviro]}:url", *forward_options(:folder))
48
+ end
49
+
36
50
  def rake_sftp_archive
37
51
  rake_command('csv:sftp', *forward_options(:enviro, :folder), '-a')
38
52
  end
@@ -1,5 +1,5 @@
1
1
  require 'rake-commander'
2
2
 
3
3
  class EcoRake < RakeCommander
4
- VERSION = '0.1.4'.freeze
4
+ VERSION = '0.1.5'.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.1.4
4
+ version: 0.1.5
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-22 00:00:00.000000000 Z
11
+ date: 2024-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler