Class: Circler::BaseCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/circler/command/base_command.rb

Class Method Summary collapse

Class Method Details

.build_number(options) ⇒ Object



28
29
30
# File 'lib/circler/command/base_command.rb', line 28

def build_number(options)
  options.build || ask('Input build number')
end

.project_name(options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/circler/command/base_command.rb', line 10

def project_name(options)
  if options.project
    options.project
  elsif self.reponame
    self.reponame
  else
    say ProjectPrinter.new(Project.all)
    ask('Input user-name/project-name :')
  end
end

.reponameObject



21
22
23
24
25
26
# File 'lib/circler/command/base_command.rb', line 21

def reponame
  repository = Rugged::Repository.new('.')
  origin = repository.remotes.find { |r| r.name == 'origin' }
  return $1 if origin.url =~ %r{[email protected]:([\w_-]+/[\w_-]+)\.git}
  nil
end

.setup_tokenObject



4
5
6
7
8
# File 'lib/circler/command/base_command.rb', line 4

def setup_token()
  CircleCi.configure do |config|
    config.token = ENV['CIRCLE_CI_TOKEN'] || ask('Circle CI token ? :')
  end
end