Class: CircleCI::CLI::Runner

Inherits:
Thor
  • Object
show all
Defined in:
lib/circleci/cli.rb

Overview

rubocop:disable Metrics/ClassLength

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.branch_nameObject



35
36
37
38
39
40
41
42
# File 'lib/circleci/cli.rb', line 35

def branch_name
  repository = Rugged::Repository.new('.')
  head = repository.head

  return nil unless head.branch?

  head.name.sub(%r{\Arefs/heads/}, '')
end

.projectObject



26
27
28
29
30
31
32
33
# File 'lib/circleci/cli.rb', line 26

def project
  repository = Rugged::Repository.new('.')
  origin = repository.remotes.find { |r| r.name == 'origin' }
  regexp = %r{(?:git@|https://)github.com(?::|/)([\w_-]+/[.\w_-]+?)(?:\.git)*$}
  return Regexp.last_match(1) if origin.url =~ regexp

  nil
end

Instance Method Details

#browseObject



100
101
102
# File 'lib/circleci/cli.rb', line 100

def browse
  Command::BrowseCommand.run(options)
end

#buildObject



84
85
86
# File 'lib/circleci/cli.rb', line 84

def build
  Command::BuildCommand.run(options)
end

#buildsObject



70
71
72
# File 'lib/circleci/cli.rb', line 70

def builds
  Command::BuildsCommand.run(options)
end

#cancelObject



132
133
134
# File 'lib/circleci/cli.rb', line 132

def cancel
  Command::CancelCommand.run(options)
end

#projectsObject



47
48
49
# File 'lib/circleci/cli.rb', line 47

def projects
  Command::ProjectsCommand.run(options)
end

#retryObject



117
118
119
# File 'lib/circleci/cli.rb', line 117

def retry
  Command::RetryCommand.run(options)
end

#versionObject



165
166
167
# File 'lib/circleci/cli.rb', line 165

def version
  say CircleCI::CLI::VERSION
end

#watchObject



160
161
162
# File 'lib/circleci/cli.rb', line 160

def watch
  Command::WatchCommand.run(options)
end