Sha256: 64f21527b9d237be539d54179ccff5f7d1257a78a0e5553a9ee685d5b487f53e

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

require "rubygems"
require "bundler/setup"
require 'bundler/gem_tasks'

require 'rake'

namespace :gems do
  
  desc 'Install required gems'
  task :install do |task|
    system 'bundle install'
  end
  
end

namespace :test do
  
  desc 'Run feature tests for the given feature file or all features files if no argument is provided'
  task :features, :file do |task, arguments|
    system("bundle exec cucumber --format pretty #{arguments.file}")
  end
  
  desc 'Run RSpec tests'
  task :specs, :file, :line do |task, arguments|
    if arguments.file
      if arguments.line
        system("bundle exec rspec #{arguments.file} --line_number=#{arguments.line} --format=documentation --colour")
      else
        system("bundle exec rspec #{arguments.file} --format=documentation --colour")
      end
    else
      system("bundle exec rspec spec/ --format=documentation --colour")
    end
  end

  desc 'Run all tests'
  task :all => ['test:specs',
                'test:features'] 

end

desc 'Translate the application'
task :translate do |task|\
  require 'ftools'
  File.copy('./lib/rubyapp/translations/en.yml', './lib/rubyapp/translations/en.bak')
  system 'bundle exec babelphish -y ./lib/rubyapp/translations/en.yml -o'
  Dir.glob('./lib/rubyapp/translations/*.yml').each do |file|
    unless File.basename(file) == 'en.yml'
      puts("Substituting patterns in #{file}")
      system "sed 's/% 1/ %1/' < #{file} | sed 's/% 2/ %2/' | sed 's/1%/%1/' | sed 's/2%/%2/' > #{file}.out"
      File.delete(file)
      File.rename("#{file}.out", file)
    end
  end
end

desc 'Run the application'
task :run do |task|
  system 'clear; bundle exec rackup lib/rubyapp/config.ru'
end

desc 'Monitor the log'
task :monitor do |task|
  system 'rm log/*; touch log/application.log; clear; tail -f log/application.log'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
_rubyapp-0.0.3 Rakefile