Sha256: c952b064659e1b77aac44e0974dc17512ed849a536445c6b77f6d012c55a44f8
Contents?: true
Size: 926 Bytes
Versions: 3
Compression:
Stored size: 926 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) downloader.download_and_write() # Parse CSV raw_file = CSV.read("tmp/raw.csv", headers: true) events = raw_file.map do |row| event_name = row[1] if event_name.nil? nil else param_names = row.headers[(3)..-1] param_values = row[(3)..-1] Tagger::Event.new(event_name, param_values.compact.size == 0 ? nil : Hash[param_names.zip param_values]) end end.compact generator = Tagger::Generator.new(events, options[:platform].to_sym) generator.generate(options[:out]) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ai_tagger-0.1.2 | lib/tagger/cli.rb |
ai_tagger-0.1.1 | lib/tagger/cli.rb |
ai_tagger-0.1.0 | lib/tagger/cli.rb |