Sha256: 99f7e3e1fe3afaa75d020b997164cac394c00bcc543eadd08c4f8385e26ef84e

Contents?: true

Size: 1.78 KB

Versions: 15

Compression:

Stored size: 1.78 KB

Contents

require "commander"
require "fastlane_core"

HighLine.track_eof = false

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

    FastlaneCore::CommanderGenerator.new.generate(Gym::Options.available_options)

    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") { $verbose = true }

      command :build do |c|
        c.syntax = "gym"
        c.description = "Just builds your app"
        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 = "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

15 entries across 15 versions & 1 rubygems

Version Path
fastlane-2.6.0 gym/lib/gym/commands_generator.rb
fastlane-2.5.0 gym/lib/gym/commands_generator.rb
fastlane-2.4.0 gym/lib/gym/commands_generator.rb
fastlane-2.3.1 gym/lib/gym/commands_generator.rb
fastlane-2.3.0 gym/lib/gym/commands_generator.rb
fastlane-2.2.0 gym/lib/gym/commands_generator.rb
fastlane-2.1.3 gym/lib/gym/commands_generator.rb
fastlane-2.1.2 gym/lib/gym/commands_generator.rb
fastlane-2.1.1 gym/lib/gym/commands_generator.rb
fastlane-2.1.0 gym/lib/gym/commands_generator.rb
fastlane-2.0.5 gym/lib/gym/commands_generator.rb
fastlane-2.0.4 gym/lib/gym/commands_generator.rb
fastlane-2.0.3 gym/lib/gym/commands_generator.rb
fastlane-2.0.2 gym/lib/gym/commands_generator.rb
fastlane-2.0.1 gym/lib/gym/commands_generator.rb