Sha256: f321464b15ee6481c689385ce5850c68d40c1375e41f0fd2e4ad9732d84b69e4

Contents?: true

Size: 885 Bytes

Versions: 4

Compression:

Stored size: 885 Bytes

Contents

require_relative './ios_build_step_generator'

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

4 entries across 4 versions & 1 rubygems

Version Path
flow-cli-0.0.4 lib/flow/cli/project_analytics.rb
flow-cli-0.0.3 lib/flow/cli/project_analytics.rb
flow-cli-0.0.2 lib/flow/cli/project_analytics.rb
flow-cli-0.0.1 lib/flow/cli/project_analytics.rb