Sha256: bfffcc67af97c5497d6215f41782d99a58349a050c07f4a77e878abc24e49f65

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

module Tagger
  class CLI < Thor
    desc "generate", "an AnlayticsEvent file"
    option :platform, required: true
    option :out, required: true
    def generate(url)
      puts "Generate AnalyticsEvent.#{options[:platform] == 'ios' ? 'swift' : 'kotlin'}"

      # Download as CSV
      downloader = Tagger::Downloader.new(url)
      csv = downloader.download()

      # Parse CSV
      raw_file = CSV.parse(csv, headers: true)
      events = raw_file.map do |row|
        event_name = row[1]
        if event_name.nil?
          nil
        else
          Tagger::Event.new(event_name)
        end
      end.compact

      generator = Tagger::Generator.new(events, options[:platform].to_sym)
      generator.generate(options[:out])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ai_tagger-0.2.1 lib/tagger/cli.rb