Sha256: fb5abc7c620dd60bb97b052955c0db703a70f85dcf0ad4738ca5e47f7bfad3c7

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

namespace 'culerity' do
  namespace 'rails' do
    desc "Starts a rails server for cucumber/culerity tests"
    task :start do
      port = ENV['PORT'] || 3001
      environment = ENV["RAILS_ENV"] || 'culerity_development'
      pid_file = RAILS_ROOT + "/tmp/culerity_rails_server.pid"
      if File.exists?(pid_file)
        puts "culerity rails server already running; if not, delete tmp/culerity_rails_server.pid and try again"
        exit 1
      end
      rails_server = IO.popen("script/server -e #{environment} -p #{port}", 'r+')
      File.open(pid_file, "w") { |file| file << rails_server.pid }
    end

    desc "Stops the running rails server for cucumber/culerity tests"
    task :stop do
      pid_file = RAILS_ROOT + "/tmp/culerity_rails_server.pid"
      if File.exists?(pid_file)
        pid = File.read(pid_file).to_i
        Process.kill(6, pid)
        File.delete(pid_file)
      else
        puts "No culerity rails server running. Doing nothing."
      end
    end

    desc "Restarts the rails server for cucumber/culerity tests"
    task :restart => [:stop, :start]
  end
  
  desc "Install required gems into jruby"
  task :install do
    jgem_cmd = `which jruby`.strip
    raise "ERROR: You need to install jruby to use culerity and celerity." if jgem_cmd.blank?
    sh "#{jgem_cmd} -S gem install jarib-celerity --source=http://gems.github.com"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
culerity-0.2.4 rails_generators/culerity/templates/lib/tasks/culerity.rake