Sha256: ca26237c90e36936d63d995ae46b6ade37345af94ba811eec8a6a4420a6a9d39

Contents?: true

Size: 695 Bytes

Versions: 4

Compression:

Stored size: 695 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 { |row|
        Tagger::Event.new(name: row[1])
      }.select { |event|
        event.valid?
      }

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ai_tagger-0.4.1 lib/tagger/cli.rb
ai_tagger-0.4.0 lib/tagger/cli.rb
ai_tagger-0.3.1 lib/tagger/cli.rb
ai_tagger-0.3.0 lib/tagger/cli.rb