Sha256: 74c3af56e501866e771cbd85bcf133528ec85775c162d8c29169ea932517f1b7

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 Bytes

Contents

module Tagger
  class CLI < Thor
    desc "generate", "an AnlayticsEvent file illest"
    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 { |row|
        Tagger::Event.new(name: row[1], firebase: row[2].downcase, appsflyer: row[3].downcase)
      }.select { |event|
        event.valid?
      }

      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.4.3 lib/tagger/cli.rb