summaryrefslogtreecommitdiff
path: root/fake-service/Rakefile
blob: 8b76359c1fc513b90daa368f03f0dca21737cf84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$: << "lib"

require 'rubygems'
require 'rakeup'
require 'pixelated_service'
require 'rake/packagetask'

RakeUp::ServerTask.new do |t|
  t.port = ENV['RACK_PORT'].nil? ? 4567 : ENV['RACK_PORT'].to_i
  t.host = '0.0.0.0'
  t.rackup_file = "config.ru"
  t.server = :webrick
  t.pid_file = ".server.pid"
end

namespace :server do
  desc "Reloading server"
  task :reloading do
    sh "shotgun"
  end
end


desc "Console"
task :console do
  require 'irb'
  require 'irb/completion'
  ARGV.clear
  IRB.start
end

task :default => :server

namespace :mailset do
  desc "Create new mailset"
  task :create, :name, :num, :with_tagging do |t, args|
    name = args[:name] || "newmailset"
    num = (args[:num] || "10").to_i
    tagging = args[:with_tagging] == "true"

    ms = PixelatedService::Mailset.create name, num, tagging
    ms.save!
  end
end

desc "Package"
Rake::PackageTask.new("archive", :noversion) do |p|
  p.need_zip = true
  p.package_dir = "artifacts"
  p.package_files.include("**/*")
end