summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-01-22 16:52:43 -0600
committerSamuel Giddins <segiddins@segiddins.me>2016-01-22 19:46:06 -0600
commit23c16cae35057e2eae141715500b15776da6dfd5 (patch)
treea9a2ea1633f79d53554f2532c39e71913cb9d4d0
parenta2d40cdde33186ab3bdd42c5080321ae89218a7b (diff)
downloadbundler-seg-code-climate.tar.gz
Setup CodeClimateseg-code-climate
-rw-r--r--.travis.yml8
-rw-r--r--Rakefile7
-rw-r--r--spec/spec_helper.rb2
-rw-r--r--spec/support/code_climate.rb11
-rw-r--r--spec/support/rubygems_ext.rb32
5 files changed, 46 insertions, 14 deletions
diff --git a/.travis.yml b/.travis.yml
index 357403e762..e7ed9cf495 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,6 +20,11 @@ notifications:
rooms:
- secure: JxBi7DDJGkIF/7f/FSN/HUHpvV4EKfQccZHTPd1b2pNJn3GXo6u+tNVbAw2WjxYzPyPQI3ZcYBCU9SEXp/i7VmG8uMzh8Kyildw+miSKYKVb90uYqcsXWzbxwyNBgJLvyDkzST45H5lgnyAicee3WkFes/WDZikIajbH7ztdb04=
+addons:
+ code_climate:
+ repo_token:
+ secure: "TrzIv116JLGUxm6PAUskCYrv8KTDguncKROVwbnjVPKTGDAgoDderd8JUdDEXrKoZ9qGLD2TPYKExt9/QDl71E+qHdWnVqWv4HKCUk2P9z/VLKzHuggOUBkCXiJUhjywUieCJhI3N92bfq2EjSBbu2/OFHqWOjLQ+QCooTEBjv8="
+
rvm:
- 2.2
- 2.1
@@ -94,8 +99,7 @@ matrix:
# Ruby-head with enabled frozen string literal
- rvm: ruby-head
env:
- - RGV=master
- - RUBYOPT="--enable-frozen-string-literal --debug=frozen-string-literal"
+ - RGV=master RUBYOPT="--enable-frozen-string-literal --debug=frozen-string-literal"
allow_failures:
- rvm: 1.8.7
env: RGV=v2.1.11
diff --git a/Rakefile b/Rakefile
index b4a52bf1a9..332e5e9da4 100644
--- a/Rakefile
+++ b/Rakefile
@@ -71,7 +71,12 @@ namespace :spec do
# https://github.com/rubygems/rubygems/issues/813
sh "gem update --system 2.2.0"
end
- # Install the other gem deps, etc.
+
+ $LOAD_PATH.unshift("./spec")
+ require "support/rubygems_ext"
+ Spec::Rubygems::DEPS["codeclimate-test-reporter"] = nil if RUBY_VERSION >= "2.2.0"
+
+ # Install the other gem deps, etc
Rake::Task["spec:deps"].invoke
end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 8150b0bbce..c392b4f1bb 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -44,6 +44,8 @@ ENV["BUNDLE_SPEC_RUN"] = "true"
# Don't wrap output in tests
ENV["THOR_COLUMNS"] = "10000"
+Spec::CodeClimate.setup
+
RSpec.configure do |config|
config.include Spec::Builders
config.include Spec::Helpers
diff --git a/spec/support/code_climate.rb b/spec/support/code_climate.rb
new file mode 100644
index 0000000000..af9bff25b4
--- /dev/null
+++ b/spec/support/code_climate.rb
@@ -0,0 +1,11 @@
+module Spec
+ module CodeClimate
+ def self.setup
+ require "codeclimate-test-reporter"
+ ::CodeClimate::TestReporter.start
+ rescue LoadError
+ # it's fine if CodeClimate isn't set up
+ nil
+ end
+ end
+end
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index 07f89bd212..8ccb48ae69 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -3,6 +3,20 @@ require "support/path" unless defined?(Spec::Path)
module Spec
module Rubygems
+ DEPS = begin
+ deps = {
+ "fakeweb artifice rack" => nil,
+ "sinatra" => "1.2.7",
+ # Rake version has to be consistent for tests to pass
+ "rake" => "10.0.2",
+ # 3.0.0 breaks 1.9.2 specs
+ "builder" => "2.1.2"
+ }
+ # ruby-graphviz is used by the viz tests
+ deps["ruby-graphviz"] = nil if RUBY_VERSION >= "1.9.3"
+ deps
+ end
+
def self.setup
Gem.clear_paths
@@ -10,19 +24,15 @@ module Spec
ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gems.to_s
ENV["PATH"] = ["#{Path.root}/exe", "#{Path.system_gem_path}/bin", ENV["PATH"]].join(File::PATH_SEPARATOR)
- unless File.exist?("#{Path.base_system_gems}")
+ manifest = DEPS.to_a.sort_by(&:first).map {|k, v| "#{k} => #{v}\n" }
+ manifest_path = "#{Path.base_system_gems}/manifest.txt"
+ # it's OK if there are extra gems
+ if !File.exist?(manifest_path) || !(manifest - File.readlines(manifest_path)).empty?
+ FileUtils.rm_rf(Path.base_system_gems)
FileUtils.mkdir_p(Path.base_system_gems)
+ File.open(manifest_path, "w") {|f| f << manifest.join }
puts "installing gems for the tests to use..."
- %w(fakeweb artifice rack).each {|n| install_gem(n) }
- {
- "sinatra" => "1.2.7",
- # Rake version has to be consistent for tests to pass
- "rake" => "10.0.2",
- # 3.0.0 breaks 1.9.2 specs
- "builder" => "2.1.2"
- }.each {|n, v| install_gem(n, v) }
- # ruby-graphviz is used by the viz tests
- install_gem("ruby-graphviz") if RUBY_VERSION >= "1.9.3"
+ DEPS.each {|n, v| install_gem(n, v) }
end
ENV["HOME"] = Path.home.to_s