coveralls 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,16 +3,48 @@ module Coveralls
3
3
 
4
4
  class CommandLine < Thor
5
5
 
6
- desc "rspec", "Runs your specs and pushes the coverage results to Coveralls."
7
- def rspec
6
+ desc "push", "Runs your test suite and pushes the coverage results to Coveralls."
7
+ def push
8
8
  return unless ensure_can_run_locally!
9
9
  ENV["COVERALLS_RUN_LOCALLY"] = "true"
10
- exec "bundle exec rspec"
10
+ exec "bundle exec rake"
11
11
  ENV["COVERALLS_RUN_LOCALLY"] = nil
12
12
  end
13
13
 
14
+ desc "report", "Runs your test suite locally and displays coverage statistics."
15
+ def report
16
+ ENV["COVERALLS_NOISY"] = "true"
17
+ exec "bundle exec rake"
18
+ ENV["COVERALLS_NOISY"] = nil
19
+ end
20
+
21
+ desc "open", "View this repository on Coveralls."
22
+ def open
23
+ open_token_based_url "https://coveralls.io/repos/%@"
24
+ end
25
+
26
+ desc "service", "View this repository on your CI service's website."
27
+ def service
28
+ open_token_based_url "https://coveralls.io/repos/%@/service"
29
+ end
30
+
31
+ desc "last", "View the last build for this repository on Coveralls."
32
+ def last
33
+ open_token_based_url "https://coveralls.io/repos/%@/last_build"
34
+ end
35
+
14
36
  private
15
37
 
38
+ def open_token_based_url url
39
+ config = Coveralls::Configuration.configuration
40
+ if config[:repo_token]
41
+ url = url.gsub("%@", config[:repo_token])
42
+ `open #{url}`
43
+ else
44
+ puts "No repo_token configured."
45
+ end
46
+ end
47
+
16
48
  def ensure_can_run_locally!
17
49
  config = Coveralls::Configuration.configuration
18
50
  if config[:repo_token].nil?
@@ -4,19 +4,18 @@ module Coveralls
4
4
  require 'yaml'
5
5
 
6
6
  def self.configuration
7
- yaml_config = nil
8
- if self.configuration_path && File.exists?(self.configuration_path)
9
- yaml_config = YAML::load_file(self.configuration_path)
10
- end
11
7
  config = {
12
8
  :environment => self.relevant_env,
13
- :configuration => yaml_config,
14
- :repo_token => yaml_config ? yaml_config['repo_secret_token'] : nil,
15
9
  :git => git
16
10
  }
11
+ yml = self.yaml_config
12
+ if yml
13
+ config[:configuration] = yml
14
+ config[:repo_token] = yml['repo_token'] || yml['repo_secret_token']
15
+ end
17
16
  if ENV['TRAVIS']
18
17
  config[:service_job_id] = ENV['TRAVIS_JOB_ID']
19
- config[:service_name] = (yaml_config ? yaml_config['service_name'] : nil) || 'travis-ci'
18
+ config[:service_name] = (yml ? yml['service_name'] : nil) || 'travis-ci'
20
19
  end
21
20
  if ENV["COVERALLS_RUN_LOCALLY"]
22
21
  config[:service_job_id] = nil
@@ -26,6 +25,12 @@ module Coveralls
26
25
  config
27
26
  end
28
27
 
28
+ def self.yaml_config
29
+ if self.configuration_path && File.exists?(self.configuration_path)
30
+ YAML::load_file(self.configuration_path)
31
+ end
32
+ end
33
+
29
34
  def self.configuration_path
30
35
  File.expand_path(File.join(self.root, ".coveralls.yml")) if self.root
31
36
  end
@@ -5,25 +5,27 @@ module Coveralls
5
5
  def format(result)
6
6
 
7
7
  unless Coveralls.should_run?
8
- # Log which files would be submitted.
9
- if result.files.length > 0
10
- puts "[Coveralls] We suspect you're in a development environment, here's some handy coverage stats:"
11
- else
12
- puts "[Coveralls] There are no covered files.".yellow
13
- end
14
- result.files.each do |f|
15
- print " * "
16
- print "#{short_filename(f.filename)}".cyan
17
- print " => ".white
18
- cov = "#{f.covered_percent.round}%"
19
- if f.covered_percent > 90
20
- print cov.green
21
- elsif f.covered_percent > 80
22
- print cov.yellow
8
+ if ENV["COVERALLS_NOISY"]
9
+ # Log which files would be submitted.
10
+ if result.files.length > 0
11
+ puts "[Coveralls] Some handy coverage stats:"
23
12
  else
24
- print cov.red
13
+ puts "[Coveralls] There are no covered files.".yellow
14
+ end
15
+ result.files.each do |f|
16
+ print " * "
17
+ print "#{short_filename(f.filename)}".cyan
18
+ print " => ".white
19
+ cov = "#{f.covered_percent.round}%"
20
+ if f.covered_percent > 90
21
+ print cov.green
22
+ elsif f.covered_percent > 80
23
+ print cov.yellow
24
+ else
25
+ print cov.red
26
+ end
27
+ puts ""
25
28
  end
26
- puts ""
27
29
  end
28
30
  return
29
31
  end
@@ -1,3 +1,3 @@
1
1
  module Coveralls
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coveralls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
12
+ date: 2012-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  segments:
166
166
  - 0
167
- hash: -1044931547748599466
167
+ hash: -3652613290606229431
168
168
  required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  none: false
170
170
  requirements:
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  segments:
175
175
  - 0
176
- hash: -1044931547748599466
176
+ hash: -3652613290606229431
177
177
  requirements: []
178
178
  rubyforge_project:
179
179
  rubygems_version: 1.8.24