lib/chronicle/etl/config.rb in chronicle-etl-0.4.1 vs lib/chronicle/etl/config.rb in chronicle-etl-0.4.2

- old
+ new

@@ -22,20 +22,18 @@ end end # Returns all jobs available in ~/.config/chronicle/etl/jobs/*.yml def available_jobs - job_directory = Runcom::Config.new('chronicle/etl/jobs').current - Dir.glob(File.join(job_directory, "*.yml")).map do |filename| + Dir.glob(File.join(config_directory("jobs"), "*.yml")).map do |filename| File.basename(filename, ".*") end end # Returns all available credentials available in ~/.config/chronicle/etl/credentials/*.yml def available_credentials - job_directory = Runcom::Config.new('chronicle/etl/credentials').current - Dir.glob(File.join(job_directory, "*.yml")).map do |filename| + Dir.glob(File.join(config_directory("credentials"), "*.yml")).map do |filename| File.basename(filename, ".*") end end # Load a job definition from job config directory @@ -45,9 +43,14 @@ definition end def load_credentials(name) config = self.load("chronicle/etl/credentials/#{name}.yml") + end + + def config_directory(type) + path = "chronicle/etl/#{type}" + Runcom::Config.new(path).current || raise(Chronicle::ETL::ConfigError, "Could not access config directory (#{path})") end end end end