Class: Circle::CLI::Repo
- Inherits:
-
Object
- Object
- Circle::CLI::Repo
- Defined in:
- lib/circle/cli/repo.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #branch_name ⇒ Object
- #circle_token ⇒ Object
- #circle_token=(token) ⇒ Object
-
#initialize(options = {}) ⇒ Repo
constructor
A new instance of Repo.
- #project ⇒ Object
- #uri ⇒ Object
- #user_name ⇒ Object
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 = end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'lib/circle/cli/repo.rb', line 7 def errors @errors end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/circle/cli/repo.rb', line 7 def @options end |
Instance Method Details
#branch_name ⇒ Object
25 26 27 28 29 |
# File 'lib/circle/cli/repo.rb', line 25 def branch_name .fetch 'branch' do repo.head.name.sub(/^refs\/heads\//, '') end end |
#circle_token ⇒ Object
31 32 33 |
# File 'lib/circle/cli/repo.rb', line 31 def circle_token repo.config['circleci.token'] || ENV['CIRCLE_CLI_TOKEN'] end |
#circle_token=(token) ⇒ Object
35 36 37 |
# File 'lib/circle/cli/repo.rb', line 35 def circle_token=(token) repo.config['circleci.token'] = token end |
#project ⇒ Object
21 22 23 |
# File 'lib/circle/cli/repo.rb', line 21 def project uri.project_name end |
#uri ⇒ Object
13 14 15 |
# File 'lib/circle/cli/repo.rb', line 13 def uri Gitable::URI.parse(origin.url) end |
#user_name ⇒ Object
17 18 19 |
# File 'lib/circle/cli/repo.rb', line 17 def user_name uri.path[/^(\/?)(.+)\//, 2] end |