Sha256: e729a27e7484d1f2a7914d12b78b86ad3662682ba694b42c88a0059c7d34e39f
Contents?: true
Size: 1.11 KB
Versions: 17
Compression:
Stored size: 1.11 KB
Contents
class Eco::API::UseCases::Default::Locations::TagTreePaths < Eco::API::Common::Loaders::UseCase name "tagtree-paths" type :other require_relative 'cli/tagtree_paths_cli' OUT_FOLDER = "sftp".freeze OUT_TIME_FORMAT = '%Y%m%dT%H%M%S'.freeze OUT_FILENAME = "tag_paths".freeze def main(*_args) CSV.open(output_filename, "w") do |csv| csv << %w[Tag Path] tag_paths.each do |values| csv << values end end log(:info) { "Generated file '#{output_filename}'" } end private def tag_paths @tag_paths ||= tagtree.tags.reverse.map do |tag| [tag, tagtree.path(tag).join("|")] end end def tagtree session.tagtree end def output_file_format 'csv' end def output_filename(name = self.class::OUT_FILENAME) File.join(output_folder, "#{timestamp}_#{config.active_enviro}_#{name}.#{output_file_format}") end def output_folder "#{config.active_enviro}/#{self.class::OUT_FOLDER}" end def timestamp(date = Time.now) date.strftime(self.class::OUT_TIME_FORMAT) end end
Version data entries
17 entries across 17 versions & 1 rubygems