lib/eco/api/session/config.rb in eco-helpers-3.0.4 vs lib/eco/api/session/config.rb in eco-helpers-3.0.5
- old
+ new
@@ -12,15 +12,13 @@
# @!group Config instance pure methods
def clone(name)
keys.each_with_object(self.class.new(name)) do |key, cnf|
- begin
- cnf[key] = self[key].clone(config: cnf)
- rescue ArgumentError
- cnf[key] = self[key].clone
- end
+ cnf[key] = self[key].clone(config: cnf)
+ rescue ArgumentError
+ cnf[key] = self[key].clone
end
end
def reopen
yield(self)
@@ -30,11 +28,11 @@
# @!group Additional resources
# Helper to manage `SFTP` files and folders.
# @return [Eco::API::Session::Config::SFTP]
def sftp
- self["sftp"] ||= Eco::API::Session::Config::SFTP.new(config: self)
+ self["sftp"] ||= Eco::API::Session::Config::SFTP.new(config: self)
end
# Helper to upload files and folders to `S3`.
# @return [Eco::API::Session::Config::S3Storage]
def s3storage
@@ -42,11 +40,11 @@
end
# Helper to send emails.
# @return [Eco::API::Session::Config::Mailer]
def mailer
- self["mailer"] ||= Eco::API::Session::Config::Mailer.new(config: self)
+ self["mailer"] ||= Eco::API::Session::Config::Mailer.new(config: self)
end
# Helper scope reporting structures.
# @return [Eco::API::Session::Config::TagTree]
def tagtree_config
@@ -56,11 +54,11 @@
# @!group Logger
# @return [Eco::API::Session::Config::Logger]
def logger
- self["logger"] ||= Eco::API::Session::Config::Logger.new(config: self)
+ self["logger"] ||= Eco::API::Session::Config::Logger.new(config: self)
end
def log_console_level=(value)
logger.console_level= value
end
@@ -84,11 +82,11 @@
# @!group Session and API
# @return [Eco::API::Session] the `session` linked to this `config`
def session
- @session ||= Eco::API::Session.new(self)
+ @session ||= Eco::API::Session.new(self)
end
# @return [Eco::API::Session::Config::Apis]
def apis
self["apis"] ||= Eco::API::Session::Config::Apis.new(config: self)
@@ -155,11 +153,11 @@
# @!group Files
# @return [Eco::API::Session::Config::Files]
def files
- self["files"] ||= Eco::API::Session::Config::Files.new(config: self)
+ self["files"] ||= Eco::API::Session::Config::Files.new(config: self)
end
# Defines in the base folder from where files are expected to be found when relative paths are used
def working_directory=(path)
files.working_directory = path
@@ -190,26 +188,22 @@
def file_manager
Eco::API::Common::Session::FileManager.new(self)
end
def require(file = nil, match: nil)
- begin
- if match
- file_manager.dir.dir_files(pattern: match).each do |file|
- require_relative File.expand_path(file)
- end
- else
- target = File.expand_path(file_manager.dir.file(file))
- require_relative target
+ if match
+ file_manager.dir.dir_files(pattern: match).each do |file|
+ require_relative File.expand_path(file)
end
- rescue LoadError => e
- if apis.active_api.one_off?
- pp e.to_s
- else
- raise
- end
+ else
+ target = File.expand_path(file_manager.dir.file(file))
+ require_relative target
end
+ rescue LoadError => err
+ raise unless apis.active_api.one_off?
+
+ pp err.to_s
end
# @!endgroup
# @!group Organization related shortcuts
def org
@@ -401,11 +395,11 @@
end
end
# @return [Eco::API::Session::Config::Workflow]
def workflow
- @workflow = self["workflow"] ||= Eco::API::Session::Config::Workflow.new(config: self)
+ @workflow = self["workflow"] ||= Eco::API::Session::Config::Workflow.new(config: self)
@workflow.tap do |wf|
yield(wf) if block_given?
end
end
@@ -419,10 +413,9 @@
def delay_between_job_groups(seconds = nil)
self["delay_between_job_groups"] = seconds if seconds
self["delay_between_job_groups"]
end
# @!endgroup
-
end
end
end
end