Sha256: 31b6d842d9fc8fa2236164ece876336eec83748da306da421bd64f8a912d946e

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

require 'fastlane'
require 'gym'

module Flow::Cli
  class IosBuildStepGenerator
    attr_accessor :cli_config
    def initialize(cli_config = {})
      self.cli_config = cli_config
      if 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]
        @gym_config = config.select { |k, _v| allowed_params.include? k }
      else
        @gym_config = {}
      end
    end

    def generate_gym_script
      merge_user_cli_gym_config
      "fastlane gym build #{build_gym_params}"
    end

    # 返回 由 gym 调用的 core 的生成的相关参数
    def merge_user_cli_gym_config
      user_gym_config = { export_method: 'ad-hoc' }.merge(cli_config[:gym_config] || {} )
      @gym_config.merge!(user_gym_config)
      @gym_config
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

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