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



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

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

  return nil unless head.branch?

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

.projectObject



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

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



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

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

#buildObject



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

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

#buildsObject



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

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

#cancelObject



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

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

#projectsObject



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

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

#retryObject



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

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

#versionObject



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

def version
  say CircleCI::CLI::VERSION
end

#watchObject



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

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