Sha256: 4c531eebd22465590dfc0d13952a3c584901c08c332254870336ba9a3da49bf3

Contents?: true

Size: 838 Bytes

Versions: 3

Compression:

Stored size: 838 Bytes

Contents

module Flow::Cli
  class ProjectAnalytics
    attr_accessor :config
    def initialize(config = {})
      # 要 env
      config[:flow_language] = language
      self.config = config
    end

    def language
      case platform
      when "ios"
        "objc"
      when "android"
        "android"
      end
    end

    def platform
      raise ConflictPlatformError, "conflict platforms" if ios? && android?
      return "ios" if ios?
      return "android" if android?
      raise ConflictPlatformError, "conflict, unknown platform"
    end

    private

    def ios?
      (Dir["#{base_path}*.xcodeproj"] + Dir["#{base_path}*.xcworkspace"]).count > 0
    end

    def android?
      Dir["#{base_path}*.gradle"].count > 0
    end

    def base_path
      return './' if config.nil?
      config[:workspace] || './'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flow-cli-0.0.7 lib/flow/cli/project_analytics.rb
flow-cli-0.0.6 lib/flow/cli/project_analytics.rb
flow-cli-0.0.5 lib/flow/cli/project_analytics.rb