Sha256: 63537fe9ac7cd1d22e00acb1433990d39021c0d109c054c10662457bf8e8c5e0

Contents?: true

Size: 853 Bytes

Versions: 1

Compression:

Stored size: 853 Bytes

Contents

require "thor"

module GoldenRose
  module CLI
    class App < Thor
      DEFAULT_OUTPUT_DIR = 'goldenrose'

      desc "generate <path_to_folder_or_zip>", "Generate report from a folder"
      method_option :output, type: :string, aliases: "-o"
      method_option "force-save", type: :boolean, aliases: "-f"

      def generate(folder_path)
        say("Started formatting report...")
        GoldenRose::generate(folder_path, output, options['force-save'])
        say("Report generated in #{options[:output] || Dir.pwd + '/' + DEFAULT_OUTPUT_DIR}/index.html", :green)
      rescue GoldenRose::GeneratingError => e
        say(e.message, :yellow)
      rescue StandardError => e
        say("Error during running generator.", :red)
      end

      private

      def output
        options[:output] || DEFAULT_OUTPUT_DIR
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
golden_rose-1.0.0.pre lib/golden_rose/cli/app.rb