mirror of
https://github.com/ms-ati/docile
synced 2023-03-27 23:21:52 -04:00
Extract simple platform checks from Rakefile, gemspec, spec_helper
As a first step to updating dependencies while maintaining compatibility, extract common simple platform detection helpers.
This commit is contained in:
parent
27995824d9
commit
fd38f46903
4 changed files with 29 additions and 8 deletions
14
Rakefile
14
Rakefile
|
@ -1,6 +1,7 @@
|
|||
require 'rake/clean'
|
||||
require 'bundler/gem_tasks'
|
||||
require 'rspec/core/rake_task'
|
||||
require File.expand_path('on_what', File.dirname(__FILE__))
|
||||
|
||||
# Default task for `rake` is to run rspec
|
||||
task :default => [:spec]
|
||||
|
@ -11,12 +12,13 @@ RSpec::Core::RakeTask.new
|
|||
# Configure `rake clobber` to delete all generated files
|
||||
CLOBBER.include('pkg', 'doc', 'coverage')
|
||||
|
||||
# Only configure yard doc generation when *not* on Travis
|
||||
if ENV['CI'] != 'true'
|
||||
require "github/markup"
|
||||
require "redcarpet"
|
||||
require "yard"
|
||||
require "yard/rake/yardoc_task"
|
||||
# To limit needed compatibility with versions of dependencies, only configure
|
||||
# yard doc generation when *not* on Travis, JRuby, or 1.8
|
||||
if !on_travis? && !on_jruby? && !on_1_8?
|
||||
require 'github/markup'
|
||||
require 'redcarpet'
|
||||
require 'yard'
|
||||
require 'yard/rake/yardoc_task'
|
||||
|
||||
YARD::Rake::YardocTask.new do |t|
|
||||
OTHER_PATHS = %w()
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require File.expand_path('on_what', File.dirname(__FILE__))
|
||||
$:.push File.expand_path('../lib', __FILE__)
|
||||
require 'docile/version'
|
||||
|
||||
|
@ -23,7 +24,9 @@ Gem::Specification.new do |s|
|
|||
s.add_development_dependency 'rspec', '~> 2.14.0'
|
||||
s.add_development_dependency 'mime-types', '~> 1.25.1'
|
||||
|
||||
if !(defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
|
||||
# To limit needed compatibility with versions of dependencies, only configure
|
||||
# yard doc generation when *not* on Travis, JRuby, or 1.8
|
||||
if !on_travis? && !on_jruby? && !on_1_8?
|
||||
# Github flavored markdown in YARD documentation
|
||||
# http://blog.nikosd.com/2011/11/github-flavored-markdown-in-yard.html
|
||||
s.add_development_dependency 'yard'
|
||||
|
|
14
on_what.rb
Normal file
14
on_what.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
# NOTE: Very simple tests for what system we are on, extracted for sharing
|
||||
# between Rakefile, gemspec, and spec_helper. Not for use in actual library.
|
||||
|
||||
def on_travis?
|
||||
ENV['CI'] == 'true'
|
||||
end
|
||||
|
||||
def on_jruby?
|
||||
(defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
|
||||
end
|
||||
|
||||
def on_1_8?
|
||||
RUBY_VERSION.start_with? '1.8'
|
||||
end
|
|
@ -1,9 +1,11 @@
|
|||
require File.expand_path('on_what', File.dirname(File.dirname(__FILE__)))
|
||||
|
||||
begin
|
||||
require 'simplecov'
|
||||
require 'coveralls'
|
||||
|
||||
# On Ruby 1.9+ use SimpleCov and publish to Coveralls.io
|
||||
if !RUBY_VERSION.start_with? '1.8'
|
||||
if !on_1_8?
|
||||
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
||||
SimpleCov::Formatter::HTMLFormatter,
|
||||
Coveralls::SimpleCov::Formatter
|
||||
|
|
Loading…
Add table
Reference in a new issue