Sha256: 60cb30a0963d2e0f48d3f59ab4cdd0fe5ad8c51176e45f7744a9233a9a746e84

Contents?: true

Size: 943 Bytes

Versions: 2

Compression:

Stored size: 943 Bytes

Contents

$stdout.sync = true

$: << File.join(File.dirname(__FILE__), './lib')

begin
  require 'rspec/core/rake_task'
  desc 'Run Rspec unit tests'
  RSpec::Core::RakeTask.new(:spec) do |t|
    t.pattern = 'spec/**/*_spec.rb'
  end

  task default: :spec
rescue LoadError
end

def require_jobfiles(args)
  require 'pushpop'
  if jobfile = args[:jobfile]
    load "#{File.dirname(__FILE__)}/#{jobfile}"
  else
    Dir.glob("#{File.dirname(__FILE__)}/jobs/**/*.rb").each { |file|
      require file
    }
  end
end

namespace :jobs do
  desc 'Describe jobs'
  task :describe, :jobfile do |_, args|
    require_jobfiles(args)
    Pushpop.jobs.each do |job|
      puts job.name
    end
  end

  desc 'Run each job once'
  task :run_once, :jobfile do |_, args|
    require_jobfiles(args)
    Pushpop.run
  end

  desc 'Run jobs ongoing'
  task :run, :jobfile do |_, args|
    require_jobfiles(args)
    Pushpop.schedule
    Clockwork.manager.run
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pushpop-0.1.1 Rakefile
pushpop-0.1.0 Rakefile