class Coveralls::CommandLine

Public Instance Methods

last() click to toggle source
# File lib/coveralls/command.rb, line 36
def last
  open_token_based_url "https://coveralls.io/repos/%@/last_build"
end
open() click to toggle source
# File lib/coveralls/command.rb, line 26
def open
  open_token_based_url "https://coveralls.io/repos/%@"
end
push() click to toggle source
# File lib/coveralls/command.rb, line 7
def push
  return unless ensure_can_run_locally!
  ENV["COVERALLS_RUN_LOCALLY"] = "true"
  cmd = "bundle exec rake"
  if File.exist?('.travis.yml')
    cmd = YAML.load_file('.travis.yml')["script"] || cmd rescue cmd
  end
  exec cmd
  ENV["COVERALLS_RUN_LOCALLY"] = nil
end
report() click to toggle source
# File lib/coveralls/command.rb, line 19
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 31
def service
  open_token_based_url "https://coveralls.io/repos/%@/service"
end
version() click to toggle source
# File lib/coveralls/command.rb, line 41
def version
  Coveralls::Output.puts Coveralls::VERSION
end

Private Instance Methods

ensure_can_run_locally!() click to toggle source
# File lib/coveralls/command.rb, line 57
def ensure_can_run_locally!
  config = Coveralls::Configuration.configuration
  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 47
def open_token_based_url url
  config = Coveralls::Configuration.configuration
  if config[:repo_token]
    url = url.gsub("%@", config[:repo_token])
    %x`open #{url}`
  else
    Coveralls::Output.puts "No repo_token configured."
  end
end