Class: Circle::CLI::Repo

Inherits:
Object
  • Object
show all
Defined in:
lib/circle/cli/repo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Repo

Returns a new instance of Repo.



9
10
11
# File 'lib/circle/cli/repo.rb', line 9

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



7
8
9
# File 'lib/circle/cli/repo.rb', line 7

def errors
  @errors
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/circle/cli/repo.rb', line 7

def options
  @options
end

Instance Method Details

#branch_nameObject



25
26
27
# File 'lib/circle/cli/repo.rb', line 25

def branch_name
  options.fetch('branch') { repo.current_branch }
end

#circle_tokenObject



29
30
31
32
# File 'lib/circle/cli/repo.rb', line 29

def circle_token
  token = repo.config('circleci.token') || ENV['CIRCLE_CLI_TOKEN']
  token if token && !token.empty?
end

#circle_token=(token) ⇒ Object



34
35
36
# File 'lib/circle/cli/repo.rb', line 34

def circle_token=(token)
  repo.config('circleci.token', token)
end

#projectObject



21
22
23
# File 'lib/circle/cli/repo.rb', line 21

def project
  uri.project_name
end

#uriObject



13
14
15
# File 'lib/circle/cli/repo.rb', line 13

def uri
  Gitable::URI.parse(origin.url)
end

#user_nameObject



17
18
19
# File 'lib/circle/cli/repo.rb', line 17

def user_name
  uri.path[/^(\/?)(.+)\//, 2]
end