class Capkin::CLI

Capking Command Line

Public Class Methods

check_capkin_file() click to toggle source

Check config file

# File lib/capkin/cli.rb, line 9
def check_capkin_file
  return if File.exist?('Capkin')
  puts Paint['Creating Capkin file...', :red]
  FileUtils.cp File.join(File.dirname(__FILE__), 'Capkin'), '.'
  puts Paint['✓ Config file `Capkin` created, edit and re-run.', :green]
  exit
end
read_file() click to toggle source
# File lib/capkin/cli.rb, line 17
def read_file
  @config = YAML.load_file('Capkin')
  msg = "✓ Config file OK! '#{@config['app']}'"
  puts Paint[msg, :green]
end
work!(params) click to toggle source
# File lib/capkin/cli.rb, line 23
def work!(params)
  check_capkin_file
  read_file

  robot = Capkin::Robot.new(@config, params)
  case params.join
  when 'list' then robot.list
  when 'info' then robot.info
  else
    puts Paint["Publishing new APK: ./#{source} ➔ '#{@stage}'", :blue]
    robot.upload_apk!
  end
end