lib/eco/api/session.rb in eco-helpers-1.1.2 vs lib/eco/api/session.rb in eco-helpers-1.1.3
- old
+ new
@@ -199,33 +199,43 @@
def jobs_launch(simulate: false)
job_groups.launch(simulate: simulate)
end
+ def summary
+ job_groups.summary
+ end
+
# Sends an email
# @see Eco::API::Common::Session::Mailer#mail
- def mail_to(**kargs)
- mail.mail(**kargs)
+ def mail(**kargs)
+ mailer.mail(**kargs)
end
# Uploads content into a file, a file or a directory to S3
# @see Eco::API::Common::Session::S3Uploader#upload
# @see Eco::API::Common::Session::S3Uploader#upload_file
# @see Eco::API::Common::Session::S3Uploader#upload_directory
# @param content [String] content to be uploaded (requires `file`)
# @param file [String] name of the file to be uploaded
# @param directory [String] name of source directory to be uploaded
- # @return [String, Array<String>] paths to S3
- def s3upload(content: nil, file: nil, directory: nil)
- if content && file
- s3uploader.upload(file, content)
+ # @param recurse [Boolean] used with `directory`: deepen in the folder structure? (`false`: default)
+ # @param link [Boolean] **return** _link(s)_ (`true`) or _path(s)_ (`false`: default)
+ # @return [String, Array<String>] either paths to S3 objects if `link` is `false`, or _link_ otherwise
+ def s3upload(content: nil, file: nil, directory: nil, recurse: false, link: false)
+ if content == :target
+ path = self.do.s3upload_targets
+ elsif content && file
+ path = s3uploader.upload(file, content)
elsif file
- s3uploader.upload_file(file)
+ path = s3uploader.upload_file(file)
elsif directory
- s3uploader.upload_directory(directory)
+ path = s3uploader.upload_directory(directory, recurse: recurse)
else
logger.error("To use Session.s3upload, you must specify either directory, file or content and file name")
end
+ return path unless link
+ s3uploader.link(path)
end
private
# Helper to state the abilities that a person should have with given their usergroups