Sha256: d29c077207518d131e824ea2fd52d7a36b17e2b1a596ea81540358973f522f15

Contents?: true

Size: 1.78 KB

Versions: 16

Compression:

Stored size: 1.78 KB

Contents

require "commander"
require "fastlane_core"

HighLine.track_eof = false

module Gym
  class CommandsGenerator
    include Commander::Methods

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

    def self.start
      FastlaneCore::UpdateChecker.start_looking_for_update("gym")
      new.run
    ensure
      FastlaneCore::UpdateChecker.show_update_status("gym", Gym::VERSION)
    end

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

    def run
      program :version, Gym::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/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|
          raise "Gymfile already exists" if File.exist?(Gym.gymfile_name)
          template = File.read("#{Helper.gem_path('gym')}/lib/assets/GymfileTemplate")
          File.write(Gym.gymfile_name, template)
          Helper.log.info "Successfully created '#{Gym.gymfile_name}'. Open the file using a code editor.".green
        end
      end

      default_command :build

      run!
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
gym-0.8.5 lib/gym/commands_generator.rb
gym-0.8.4 lib/gym/commands_generator.rb
gym-0.8.3 lib/gym/commands_generator.rb
gym-0.8.2 lib/gym/commands_generator.rb
gym-0.8.1 lib/gym/commands_generator.rb
gym-0.8.0 lib/gym/commands_generator.rb
gym-0.7.3 lib/gym/commands_generator.rb
gym-0.7.2 lib/gym/commands_generator.rb
gym-0.7.1 lib/gym/commands_generator.rb
gym-0.7.0 lib/gym/commands_generator.rb
gym-0.6.2 lib/gym/commands_generator.rb
gym-0.6.1 lib/gym/commands_generator.rb
gym-0.6.0 lib/gym/commands_generator.rb
gym-0.5.0 lib/gym/commands_generator.rb
gym-0.4.6 lib/gym/commands_generator.rb
gym-0.4.5 lib/gym/commands_generator.rb