Sha256: 1d19d3674dcfdcf39b272b91ab7222a0ad01218cbf235d513c1e6da5431b038c

Contents?: true

Size: 1.59 KB

Versions: 5

Compression:

Stored size: 1.59 KB

Contents

#!/usr/bin/env rake
require "bundler/gem_tasks"

desc 'Default: Run all tests.'
task :default => 'tests:run' # now you can run the tests by just typing "rake" into your console


desc 'Update the "Steps" section of the README'
task :update_readme do
  require 'support/documentation_generator'
  readme = File.read('README.md')
  start_of_steps_section = readme =~ /^## Steps/
  length_of_steps_section = (readme[(start_of_steps_section+1)..-1] =~ /^##[^#]/) || readme.size - start_of_steps_section
  readme[start_of_steps_section, length_of_steps_section] = "## Steps\n\n" + DocumentationGenerator::StepDefinitionsDirectory.new('lib/spreewald').format
  File.open('README.md', 'w') { |f| f.write(readme) }
end

namespace :tests do

  desc "Run tests on all test apps"
  task :run do # to run the tests type "rake tests:run" into your console
    success = true
    for_each_directory_of('tests/**/Rakefile') do |directory|
      env = "SPEC=../../#{ENV['SPEC']} " if ENV['SPEC']
      success &= system("cd #{directory} && #{env} bundle exec rake features")
    end
    fail "Tests failed" unless success
  end

  desc "Bundle all test apps"
  task :bundle do
    for_each_directory_of('tests/**/Gemfile') do |directory|
      system("cd #{directory} && bundle install")
    end
  end

  desc 'Shortcut for creating a database'
  task :create_database do
    system("mysql -uroot -p -e 'create database spreewald_test;'")
  end

end

def for_each_directory_of(path, &block)
  Dir[path].sort.each do |rakefile|
    directory = File.dirname(rakefile)
    puts '', "\033[44m#{directory}\033[0m", ''
    block.call(directory)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spreewald-0.5.16 Rakefile
spreewald-0.5.15 Rakefile
spreewald-0.5.14 Rakefile
spreewald-0.5.13 Rakefile
spreewald-0.5.12 Rakefile