Sha256: ee3f50b8593a9526574181eb98988e1d03e62d88c52cd130c6fb6311251d9568

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require 'fastlane'
require 'gym'

module Flow::Cli
  class IosBuildStepGenerator
    attr_accessor :config
    attr_accessor :debug
    def initialize(default_config = nil)
      if default_config.nil? && ENV["FLOW_CLI_TEST"] != "TRUE"
        Gym.config = FastlaneCore::Configuration.create(Gym::Options.available_options, {})
        config = Gym.config.values(ask: false).reject { |_k, v| v.nil? }
        allowed_params = %i[workspace project scheme clean output_name configuration
                            codesigning_identity include_symbols include_bitcode
                            export_method export_options export_xcargs]
        default_config = config.select { |k, _v| allowed_params.include? k }
      else
        default_config = {}
      end

      self.config = default_config
    end

    def generate_gym_script(category = 'ad-hoc', force = false)
      set_export_params(category, force)
      "fastlane gym build #{build_gym_params}"
    end

    # 返回 由 gym 调用的 core 的生成的相关参数
    def set_export_params(category = 'ad-hoc', force = false)
      raise ParamsError, "#{category} not exists" unless %w[app-store ad-hoc package enterprise development
                                                            developer-id].include? category
      return config if config[:export_method] && force == false

      config[:export_method] = category
      config
    end

    def build_gym_params
      config.map { |k, v| "--#{k} #{v}" }.join(' ')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flow-cli-0.0.1 lib/flow/cli/ios_build_step_generator.rb