lib/eco/api/session/config.rb in eco-helpers-2.0.15 vs lib/eco/api/session/config.rb in eco-helpers-2.0.16
- old
+ new
@@ -157,10 +157,12 @@
def working_directory=(path)
files.working_directory = path
end
def working_directory(mode: nil)
+ return files.working_directory if apis.active_api&.one_off?
+
unless mode
wd = files.working_directory
return wd unless wd.to_s.strip.empty?
end
@@ -181,15 +183,24 @@
def file_manager
Eco::API::Common::Session::FileManager.new(self)
end
def require(file = nil, match: nil)
- if match
- file_manager.dir.dir_files(pattern: match).each do |file|
- require_relative File.expand_path(file)
+ 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
end
- else
- require_relative "#{File.expand_path(file_manager.dir.file(file))}"
+ rescue LoadError => e
+ if apis.active_api.one_off?
+ pp e.to_s
+ else
+ raise
+ end
end
end
# @!endgroup
# @!group Organization related shortcuts