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 |
# File 'lib/circle/cli/repo.rb', line 25 def branch_name .fetch('branch') { repo.current_branch } end |
#circle_token ⇒ Object
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 |
#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 |