Class: Circler::BaseCommand
- Inherits:
-
Object
- Object
- Circler::BaseCommand
show all
- Defined in:
- lib/circler/command/base_command.rb
Class Method Summary
collapse
Class Method Details
.build_number(options) ⇒ Object
32
33
34
|
# File 'lib/circler/command/base_command.rb', line 32
def build_number(options)
options.build || ask('Input build number')
end
|
.project_name(options) ⇒ Object
12
13
14
15
16
17
18
19
20
21
|
# 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 ⇒ Object
23
24
25
26
27
28
29
30
|
# 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{[email protected](?::|/)([\w_-]+/[\w_-]+)(?:\.git)*}
return Regexp.last_match(1) if origin.url =~ regexp
nil
end
|
.setup_token ⇒ Object
6
7
8
9
10
|
# 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) ⇒ Object
36
37
38
|
# File 'lib/circler/command/base_command.rb', line 36
def should_be_pretty(options)
options['format'] != 'simple'
end
|