lib/eco-rake/lib/files/sftp.rb in eco-rake-0.1.4 vs lib/eco-rake/lib/files/sftp.rb in eco-rake-0.1.5

- old
+ new

@@ -6,21 +6,25 @@ enviro: ->(enviro) { "-#{enviro}" }, folder: ->(folder) { "-local-folder #{folder}"}, list: '-list', get_last: '-get-last', get: '-get', - archive: '-archive' + archive: '-archive', + file_pattern: ->(str) { "-file-pattern-const #{str}"}, + remote_subfolder: ->(sub) { "-remote-subfolder #{sub}"} }.freeze options_with_defaults true option '-e', '--enviro ENVIRO', String, desc: 'Target environment to run against (i.e. org, live)', required: true option '-d', '--folder NAME', default: '.', desc: 'Source local folder' option '-l', '--list', TrueClass, desc: 'Lists available CSV feed files' option '-g', '--get', TrueClass, desc: 'Gets all available CSV feed files' option '-t', '--get-last', TrueClass, desc: 'Gets the last available CSV feed file' option '-a', '--archive', TrueClass, desc: "Moves the remote CSV feed files to the '/Archive' folder" + option '-p', '--file-pattern CONST', String, desc: "Specifies a const to use as the target file pattern" + option '-r', '--remote-subfolder SUBFOLDER', String, desc: "Remote subfolder of the env (at the top of the enviro folder)" option_forwarding(**FORWARD_RULES) # attr_const :target_enviro, required: true # option_reopen :enviro, default_lookup: :target_enviro @@ -33,9 +37,10 @@ def sftp_command cmd = [base_command] cmd << forward_option(:folder) cmd << forward_options(:list, :get_last, :get, :archive).compact.first || '-list' + cmd.push(*forward_options(:remote_subfolder, :file_pattern).compact) cmd << '-no-people' cmd = yield(cmd) if block_given? string_cmd(*cmd) end