class Circler::BaseCommand

Public Class Methods

build_number(options) click to toggle source
# File lib/circler/command/base_command.rb, line 32
def build_number(options)
  options.build || ask('Input build number')
end
project_name(options) click to toggle source
# File lib/circler/command/base_command.rb, line 12
def project_name(options)
  if options.project
    options.project
  elsif reponame
    reponame
  else
    say ProjectPrinter.new(Project.all).to_s
    ask('Input user-name/project-name :')
  end
end
reponame() click to toggle source
# File lib/circler/command/base_command.rb, line 23
def reponame
  repository = Rugged::Repository.new('.')
  origin = repository.remotes.find { |r| r.name == 'origin' }
  regexp = %r{git@github.com(?::|/)([\w_-]+/[\w_-]+)(?:\.git)*}
  return Regexp.last_match(1) if origin.url =~ regexp

  nil
end
setup_token() click to toggle source
# File lib/circler/command/base_command.rb, line 6
def setup_token
  CircleCi.configure do |config|
    config.token = ENV['CIRCLE_CI_TOKEN'] || ask('Circle CI token ? :')
  end
end
should_be_pretty(options) click to toggle source
# File lib/circler/command/base_command.rb, line 36
def should_be_pretty(options)
  options['format'] != 'simple'
end