class Coveralls::CommandLine

Public Instance Methods

last() click to toggle source
# File lib/coveralls/command.rb, line 47
def last
  open_token_based_url 'https://coveralls.io/repos/%@/last_build'
end
open() click to toggle source
# File lib/coveralls/command.rb, line 37
def open
  open_token_based_url 'https://coveralls.io/repos/%@'
end
push() click to toggle source
# File lib/coveralls/command.rb, line 8
def push
  return unless ensure_can_run_locally!

  ENV['COVERALLS_RUN_LOCALLY'] = 'true'
  cmds = ['bundle exec rake']

  if File.exist?('.travis.yml')
    cmds = begin
      YAML.load_file('.travis.yml')['script'] || cmds
    rescue StandardError
      cmds
    end
  end

  cmds.each { |cmd| system cmd }

  ENV['COVERALLS_RUN_LOCALLY'] = nil
end
report() click to toggle source
# File lib/coveralls/command.rb, line 28
def report
  ENV['COVERALLS_NOISY'] = 'true'

  exec 'bundle exec rake'

  ENV['COVERALLS_NOISY'] = nil
end
service() click to toggle source
# File lib/coveralls/command.rb, line 42
def service
  open_token_based_url 'https://coveralls.io/repos/%@/service'
end
version() click to toggle source
# File lib/coveralls/command.rb, line 52
def version
  Coveralls::Output.puts Coveralls::VERSION
end

Private Instance Methods

config() click to toggle source
# File lib/coveralls/command.rb, line 58
def config
  Coveralls::Configuration.configuration
end
ensure_can_run_locally!() click to toggle source
# File lib/coveralls/command.rb, line 71
def ensure_can_run_locally!
  if config[:repo_token].nil?
    Coveralls::Output.puts 'Coveralls cannot run locally because no repo_secret_token is set in .coveralls.yml', color: 'red'
    Coveralls::Output.puts 'Please try again when you get your act together.', color: 'red'

    return false
  end

  true
end
open_token_based_url(url) click to toggle source
# File lib/coveralls/command.rb, line 62
def open_token_based_url(url)
  if config[:repo_token]
    url = url.gsub('%@', config[:repo_token])
    `open #{url}`
  else
    Coveralls::Output.puts 'No repo_token configured.'
  end
end