Sha256: bd21c94aa8529101239e3c595d8b80a92f16654241e20901e7fa02792bad3994
Contents?: true
Size: 896 Bytes
Versions: 1
Compression:
Stored size: 896 Bytes
Contents
require 'gitable' require 'rugged' module Circle module CLI class Repo attr_reader :errors, :options def initialize(options = {}) @options = options end def uri Gitable::URI.parse(origin.url) end def user_name uri.path.split('/').first end def project uri.project_name end def branch_name options.fetch 'branch' do repo.head.name.sub(/^refs\/heads\//, '') end end def circle_token repo.config['circleci.token'] || ENV['CIRCLE_CLI_TOKEN'] end def circle_token=(token) repo.config['circleci.token'] = token end private def repo @repo ||= Rugged::Repository.new(options[:repo]) end def origin @origin ||= repo.remotes.find { |r| r.name == 'origin' } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
circle-cli-0.1.0 | lib/circle/cli/repo.rb |