Browse files

make simple_cov and yard optional

  • Loading branch information...
1 parent e407868 commit 21f1ea95570fa056b4fcf6d62be78f47d2cfd963 @oriolgual oriolgual committed Jun 12, 2011
Showing with 43 additions and 48 deletions.
  1. +2 −10 Gemfile.lock
  2. +33 −30 Rakefile
  3. +0 −5 date_validator.gemspec
  4. +8 −3 test/test_helper.rb
View
12 Gemfile.lock
@@ -12,25 +12,17 @@ GEM
builder (~> 2.1.2)
i18n (~> 0.4.1)
activesupport (3.0.0)
- bluecloth (2.0.11)
builder (2.1.2)
i18n (0.4.2)
minitest (2.2.2)
- simplecov (0.3.6)
- simplecov-html (>= 0.3.7)
- simplecov-html (0.3.8)
tzinfo (0.3.23)
- yard (0.6.4)
PLATFORMS
java
ruby
DEPENDENCIES
- activesupport (~> 3.0.0)
- bluecloth
+ activesupport (< 3.2.0, >= 3.0.0)
date_validator!
- minitest (~> 2.2)
- simplecov
+ minitest
tzinfo (~> 0.3.0)
- yard
View
63 Rakefile
@@ -8,38 +8,41 @@ Rake::TestTask.new do |t|
t.verbose = true
end
-require 'yard'
-YARD::Rake::YardocTask.new(:docs) do |t|
- t.files = ['lib/**/*.rb']
- t.options = ['-m', 'markdown', '--no-private', '-r', 'Readme.md', '--title', 'Date Validator documentation']
-end
+begin
+ require 'yard'
+ YARD::Rake::YardocTask.new(:docs) do |t|
+ t.files = ['lib/**/*.rb']
+ t.options = ['-m', 'markdown', '--no-private', '-r', 'Readme.md', '--title', 'Date Validator documentation']
+ end
-site = 'doc'
-source_branch = 'master'
-deploy_branch = 'gh-pages'
+ site = 'doc'
+ source_branch = 'master'
+ deploy_branch = 'gh-pages'
-desc "generate and deploy documentation website to github pages"
-multitask :pages do
- puts ">>> Deploying #{deploy_branch} branch to Github Pages <<<"
- require 'git'
- repo = Git.open('.')
- puts "\n>>> Checking out #{deploy_branch} branch <<<\n"
- repo.branch("#{deploy_branch}").checkout
- (Dir["*"] - [site]).each { |f| rm_rf(f) }
- Dir["#{site}/*"].each {|f| mv(f, "./")}
- rm_rf(site)
- puts "\n>>> Moving generated site files <<<\n"
- Dir["**/*"].each {|f| repo.add(f) }
- repo.status.deleted.each {|f, s| repo.remove(f)}
- puts "\n>>> Commiting: Site updated at #{Time.now.utc} <<<\n"
- message = ENV["MESSAGE"] || "Site updated at #{Time.now.utc}"
- repo.commit(message)
- puts "\n>>> Pushing generated site to #{deploy_branch} branch <<<\n"
- repo.push
- puts "\n>>> Github Pages deploy complete <<<\n"
- repo.branch("#{source_branch}").checkout
-end
+ desc "generate and deploy documentation website to github pages"
+ multitask :pages do
+ puts ">>> Deploying #{deploy_branch} branch to Github Pages <<<"
+ require 'git'
+ repo = Git.open('.')
+ puts "\n>>> Checking out #{deploy_branch} branch <<<\n"
+ repo.branch("#{deploy_branch}").checkout
+ (Dir["*"] - [site]).each { |f| rm_rf(f) }
+ Dir["#{site}/*"].each {|f| mv(f, "./")}
+ rm_rf(site)
+ puts "\n>>> Moving generated site files <<<\n"
+ Dir["**/*"].each {|f| repo.add(f) }
+ repo.status.deleted.each {|f, s| repo.remove(f)}
+ puts "\n>>> Commiting: Site updated at #{Time.now.utc} <<<\n"
+ message = ENV["MESSAGE"] || "Site updated at #{Time.now.utc}"
+ repo.commit(message)
+ puts "\n>>> Pushing generated site to #{deploy_branch} branch <<<\n"
+ repo.push
+ puts "\n>>> Github Pages deploy complete <<<\n"
+ repo.branch("#{source_branch}").checkout
+ end
-task :doc => [:docs]
+ task :doc => [:docs]
+rescue LoadError
+end
task :default => :test
View
5 date_validator.gemspec
@@ -17,14 +17,9 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'activemodel', ['>= 3.0.0', '< 3.2.0']
s.add_development_dependency 'minitest'
- s.add_development_dependency 'simplecov'
s.add_development_dependency 'activesupport', ['>= 3.0.0', '< 3.2.0']
-
s.add_development_dependency 'tzinfo', '~> 0.3.0'
- s.add_development_dependency 'yard'
- s.add_development_dependency 'bluecloth'
-
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
View
11 test/test_helper.rb
@@ -1,8 +1,13 @@
-require 'simplecov'
-SimpleCov.start do
- add_group "Lib", "lib"
+begin
+ require 'simplecov';
+ SimpleCov.start do
+ add_group "Lib", 'lib'
+ end
+rescue LoadError
end
+begin; require 'turn'; rescue LoadError; end
+
require 'minitest/spec'
require 'minitest/autorun'

0 comments on commit 21f1ea9

Please sign in to comment.