class Circle::CLI::Repo
Attributes
errors[R]
options[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/circle/cli/repo.rb, line 9 def initialize(options = {}) @options = options end
Public Instance Methods
branch_name()
click to toggle source
# File lib/circle/cli/repo.rb, line 25 def branch_name options.fetch('branch') { repo.current_branch } end
circle_token()
click to toggle source
# 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)
click to toggle source
# File lib/circle/cli/repo.rb, line 34 def circle_token=(token) repo.config('circleci.token', token) end
project()
click to toggle source
# File lib/circle/cli/repo.rb, line 21 def project uri.project_name end
uri()
click to toggle source
# File lib/circle/cli/repo.rb, line 13 def uri Gitable::URI.parse(origin.url) end
user_name()
click to toggle source
# File lib/circle/cli/repo.rb, line 17 def user_name uri.path[/^(\/?)(.+)\//, 2] end
Private Instance Methods
origin()
click to toggle source
# File lib/circle/cli/repo.rb, line 47 def origin @origin ||= repo.remote('origin') end
repo()
click to toggle source
# File lib/circle/cli/repo.rb, line 40 def repo @repo ||= Git.open(options[:repo]) rescue ArgumentError full_path = File.expand_path(options[:repo]) abort "#{full_path} is not a git repository." end