Class: Spaceship::CommandsGenerator

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
spaceship/lib/spaceship/commands_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



14
15
16
# File 'spaceship/lib/spaceship/commands_generator.rb', line 14

def self.start
  self.new.run
end

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'spaceship/lib/spaceship/commands_generator.rb', line 18

def run
  program :name, 'spaceship'
  program :version, Fastlane::VERSION
  program :description, Spaceship::DESCRIPTION
  program :help, 'Author', 'Felix Krause <[email protected]>'
  program :help, 'Website', 'https://fastlane.tools'
  program :help, 'GitHub', 'https://github.com/fastlane/fastlane/tree/master/spaceship'
  program :help_formatter, FastlaneCore::HelpFormatter

  global_option('-u', '--user USERNAME', 'Specify the Apple ID you want to log in with')
  global_option('--verbose') { FastlaneCore::Globals.verbose = true }
  global_option('--env STRING[,STRING2]', String, 'Add environment(s) to use with `dotenv`')

  command :playground do |c|
    c.syntax = 'fastlane spaceship playground'
    c.description = 'Run an interactive shell that connects you to Apple web services'

    c.action do |args, options|
      Spaceship::Playground.new(username: options.user).run
    end
  end

  command :spaceauth do |c|
    c.syntax = 'fastlane spaceship spaceauth'
    c.description = 'Authentication helper for spaceship/fastlane to work with Apple 2-Step/2FA'
    c.option('--copy_to_clipboard', 'Whether the session string should be copied to clipboard. For more info see https://docs.fastlane.tools/best-practices/continuous-integration/#storing-a-manually-verified-session-using-spaceauth`')
    c.option('--check_session', 'Check to see if there is a valid session (either in the cache or via FASTLANE_SESSION). Sets the exit code to 0 if the session is valid or 1 if not.') { Spaceship::Globals.check_session = true }
    c.action do |args, options|
      Spaceship::SpaceauthRunner.new(username: options.user, copy_to_clipboard: options.copy_to_clipboard).run
    end
  end

  default_command(:playground)

  run!
end