Class: CircleCI::CLI::Command::BaseCommand
- Inherits:
-
Object
- Object
- CircleCI::CLI::Command::BaseCommand
show all
- Defined in:
- lib/circleci/cli/command/base_command.rb
Class Method Summary
collapse
Class Method Details
.build_number(options) ⇒ Object
34
35
36
|
# File 'lib/circleci/cli/command/base_command.rb', line 34
def build_number(options)
options.build || ask('Input build number')
end
|
.project_name(options) ⇒ Object
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/circleci/cli/command/base_command.rb', line 14
def project_name(options)
if options.project
options.project
elsif reponame
reponame
else
say Printer::ProjectPrinter.new(Response::Project.all).to_s
ask('Input user-name/project-name :')
end
end
|
.reponame ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/circleci/cli/command/base_command.rb', line 25
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
8
9
10
11
12
|
# File 'lib/circleci/cli/command/base_command.rb', line 8
def setup_token
CircleCi.configure do |config|
config.token = ENV['CIRCLE_CI_TOKEN'] || ask('Circle CI token ? :')
end
end
|
.should_be_pretty(options) ⇒ Object
38
39
40
|
# File 'lib/circleci/cli/command/base_command.rb', line 38
def should_be_pretty(options)
options['format'] != 'simple'
end
|