Sha256: 7d623a3b93fb2bde5d63a8aa643e4f921ad542d73326c87a81b09bb9ff7c7271

Contents?: true

Size: 1.84 KB

Versions: 227

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 = FastlaneCore::Helper.fastlane_enabled_folder_path
          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

227 entries across 227 versions & 1 rubygems

Version Path
fastlane-2.61.0.beta.20171005010003 gym/lib/gym/commands_generator.rb
fastlane-2.61.0.beta.20171004010004 gym/lib/gym/commands_generator.rb
fastlane-2.60.1 gym/lib/gym/commands_generator.rb
fastlane-2.60.0 gym/lib/gym/commands_generator.rb
fastlane-2.60.0.beta.20171003010003 gym/lib/gym/commands_generator.rb
fastlane-2.60.0.beta.20171002010004 gym/lib/gym/commands_generator.rb
fastlane-2.60.0.beta.20171001010003 gym/lib/gym/commands_generator.rb
fastlane-2.60.0.beta.20170930010003 gym/lib/gym/commands_generator.rb
fastlane-2.60.0.beta.20170929010003 gym/lib/gym/commands_generator.rb
fastlane-2.60.0.beta.20170928010003 gym/lib/gym/commands_generator.rb
fastlane-2.60.0.beta.20170927010003 gym/lib/gym/commands_generator.rb
fastlane-2.60.0.beta.20170926010004 gym/lib/gym/commands_generator.rb
fastlane-2.59.0 gym/lib/gym/commands_generator.rb
fastlane-2.59.0.beta.20170925010002 gym/lib/gym/commands_generator.rb
fastlane-2.59.0.beta.20170924010003 gym/lib/gym/commands_generator.rb
fastlane-2.59.0.beta.20170923010003 gym/lib/gym/commands_generator.rb
fastlane-2.59.0.beta.20170922010003 gym/lib/gym/commands_generator.rb
fastlane-2.59.0.beta.20170921010003 gym/lib/gym/commands_generator.rb
fastlane-2.58.0 gym/lib/gym/commands_generator.rb
fastlane-2.58.0.beta.20170920010003 gym/lib/gym/commands_generator.rb