Sha256: 62490d261ebad5869c3da2fce6d00b7fcbbee50895027cf90a56eaa227dc4769

Contents?: true

Size: 1.84 KB

Versions: 124

Compression:

Stored size: 1.84 KB

Contents

require "commander"
require "fastlane_core"

HighLine.track_eof = false

module Gym
  class CommandsGenerator
    include Commander::Methods
    UI = FastlaneCore::UI

    def self.start
      new.run
    end

    def convert_options(options)
      o = options.__hash__.dup
      o.delete(:verbose)
      o
    end

    def run
      program :name, 'gym'
      program :version, Fastlane::VERSION
      program :description, Gym::DESCRIPTION
      program :help, "Author", "Felix Krause <gym@krausefx.com>"
      program :help, "Website", "https://fastlane.tools"
      program :help, "GitHub", "https://github.com/fastlane/fastlane/tree/master/gym"
      program :help_formatter, :compact

      global_option("--verbose") { FastlaneCore::Globals.verbose = true }

      command :build do |c|
        c.syntax = "fastlane gym"
        c.description = "Build your iOS/macOS app"

        FastlaneCore::CommanderGenerator.new.generate(Gym::Options.available_options, command: c)

        c.action do |_args, options|
          config = FastlaneCore::Configuration.create(Gym::Options.available_options,
                                                      convert_options(options))
          Gym::Manager.new.work(config)
        end
      end

      command :init do |c|
        c.syntax = "fastlane gym init"
        c.description = "Creates a new Gymfile for you"
        c.action do |_args, options|
          containing = (File.directory?("fastlane") ? 'fastlane' : '.')
          path = File.join(containing, Gym.gymfile_name)
          UI.user_error! "Gymfile already exists" if File.exist?(path)
          template = File.read("#{Gym::ROOT}/lib/assets/GymfileTemplate")
          File.write(path, template)
          UI.success "Successfully created '#{path}'. Open the file using a code editor."
        end
      end

      default_command :build

      run!
    end
  end
end

Version data entries

124 entries across 124 versions & 1 rubygems

Version Path
fastlane-2.39.0.beta.20170614010012 gym/lib/gym/commands_generator.rb
fastlane-2.39.0.beta.20170613010056 gym/lib/gym/commands_generator.rb
fastlane-2.38.1 gym/lib/gym/commands_generator.rb
fastlane-2.38.0 gym/lib/gym/commands_generator.rb
fastlane-2.38.0.beta.20170612010035 gym/lib/gym/commands_generator.rb
fastlane-2.38.0.beta.20170611010050 gym/lib/gym/commands_generator.rb
fastlane-2.38.0.beta.20170610010032 gym/lib/gym/commands_generator.rb
fastlane-2.38.0.beta.20170609010035 gym/lib/gym/commands_generator.rb
fastlane-2.38.0.beta.20170608010030 gym/lib/gym/commands_generator.rb
fastlane-2.38.0.beta.20170607010024 gym/lib/gym/commands_generator.rb
fastlane-2.38.0.beta.20170606010029 gym/lib/gym/commands_generator.rb
fastlane-2.37.0 gym/lib/gym/commands_generator.rb
fastlane-2.37.0.beta.20170605010054 gym/lib/gym/commands_generator.rb
fastlane-2.37.0.beta.20170604010021 gym/lib/gym/commands_generator.rb
fastlane-2.37.0.beta.20170603010102 gym/lib/gym/commands_generator.rb
fastlane-2.37.0.beta.20170602010027 gym/lib/gym/commands_generator.rb
fastlane-2.37.0.beta.20170601010043 gym/lib/gym/commands_generator.rb
fastlane-2.36.0 gym/lib/gym/commands_generator.rb
fastlane-2.36.0.beta.20170531010050 gym/lib/gym/commands_generator.rb
fastlane-2.36.0.beta.20170530010040 gym/lib/gym/commands_generator.rb