Sha256: 23876413b886048954d7ea325792a86e7d5745f8415c7279436faf3d2c6ca1ef

Contents?: true

Size: 1.95 KB

Versions: 2

Compression:

Stored size: 1.95 KB

Contents

require 'rspec/core'
require 'rspec/core/rake_task'
APP_ROOT="." # for jettywrapper
require 'jettywrapper'
ENV["RAILS_ROOT"] ||= 'spec/internal'

desc 'Spin up hydra-jetty and run specs'
task :ci => ['jetty:config'] do
  puts 'running continuous integration'
  jetty_params = Jettywrapper.load_config
  error = Jettywrapper.wrap(jetty_params) do
    Rake::Task['spec'].invoke
    Rake::Task['cucumber:all'].invoke
  end
  raise "test failures: #{error}" if error
end

desc "Run specs"
RSpec::Core::RakeTask.new(:spec => [:generate]) do |t|
  puts 'running specs'
  # if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/
  #   t.rcov = true
  #   t.rcov_opts = %w{--exclude spec\/*,gems\/*,ruby\/* --aggregate coverage.data}
  # end
  t.rspec_opts = "--colour"
end

desc "Load scholarsphere fixtures"
task :fixtures => :generate do# => ['sufia:fixtures:refresh'] do
  #NOTE do we need fixtures:create, fixtures:generate
  within_test_app do
    puts "Loading fixtures "
    ENV["RAILS_ENV"] = 'test'
    puts `rake sufia:fixtures:refresh`
  end
end


desc "Create the test rails app"
task :generate do
  unless File.exists?('spec/internal/Rakefile')
    puts "Generating rails app"
    `rails new spec/internal`
    puts "Copying gemfile"
    `cp spec/support/Gemfile spec/internal`
    puts "Copying generator"
    `cp -r spec/support/lib/generators spec/internal/lib`
    Bundler.with_clean_env do
      within_test_app do
        puts "Bundle install"
        `bundle install`
        puts "running test_app_generator"
        system "rails generate test_app"

        puts "running migrations"
        puts `rake db:migrate db:test:prepare`
      end
    end
  end
  puts "Done generating test app"
end

desc "Clean out the test rails app"
task :clean do
  puts "Removing sample rails app"
  `rm -rf spec/internal`
end

def within_test_app
  FileUtils.cd('spec/internal')
  yield
  FileUtils.cd('../..')
end

namespace :meme do
  desc "configure jetty to generate checksums"
  task :config do
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sufia-1.3.0 tasks/sufia-dev.rake
sufia-1.2.0 tasks/sufia-dev.rake