forked from ruby-conferences/rc-org-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
33 lines (28 loc) · 837 Bytes
/
Rakefile
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
require 'date'
require 'active_support'
require 'dotenv'
Dotenv.load
desc "Deploy site"
task :deploy do
system "middleman build --clean"
system "rsync -av -e ssh --delete build/ #{ENV['DEPLOY_TARGET']}"
end
desc "Create CFP posts, date should be yyyy-mm-dd"
task :cfp, :name, :date do |t, args|
event_name = args[:name]
cfp_date = Date.parse args[:date]
deadline = ActiveSupport::Inflector.ordinalize cfp_date.strftime("%B %d")
[
{ when: 'Soon', date: cfp_date - 7 },
{ when: 'Tomorrow', date: cfp_date - 1 }
].each do |post|
output = `middleman article '#{event_name} CFP Closes #{post[:when]}' --date #{post[:date]}`
filename = output.split.last
File.open(filename, 'a') do |f|
f << <<HERE
The #{event_name} [call for proprosals][cfp] closes #{deadline}.
[cfp]: LINK
HERE
end
end
end