-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
63 lines (57 loc) · 1.48 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
require "rubygems"
require "tmpdir"
require 'open-uri'
require "bundler/setup"
require "jekyll"
# Change your GitHub reponame
GITHUB_REPONAME = "pastisrb/pastisrb.github.io"
desc "Generate blog files"
task :generate do
Jekyll::Site.new(Jekyll.configuration({
"source" => ".",
"destination" => "_site"
})).process
end
desc "Create .ics"
task :ics, [:date, :pastis_n] do |t, args|
file_path = "downloads/ics/pastis_rb##{args[:pastis_n]}.ics"
content = <<eos
BEGIN:VCALENDAR
PRODID:You-Must-Not-Know
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART:#{args[:date]}T183000Z
DTEND:#{args[:date]}T235900Z
URL:https://maps.google.fr/maps?hl=fr&q=La+Boate
CREATED:#{Time.now.strftime('%Y%m%d%H%M%S')}Z
DESCRIPTION:
LAST-MODIFIED:#{Time.now.strftime('%Y%m%d%H%M%S')}Z
LOCATION:La Boate
SEQUENCE:6
STATUS:CONFIRMED
SUMMARY:pastis.rb édition ##{args[:pastis_n]}
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
eos
ics = File.new(file_path, "w")
ics.write(content)
ics.close
system "echo /#{URI::encode(file_path)} | pbcopy"
puts 'path to ics copyed to clipboard'
end
desc "Generate and publish blog to gh-pages"
task :publish => [:generate] do
Dir.mktmpdir do |tmp|
cp_r "_site/.", tmp
Dir.chdir tmp
system "git init"
system "git add ."
message = "Site updated at #{Time.now.utc}"
system "git commit -m #{message.inspect}"
system "git remote add origin [email protected]:#{GITHUB_REPONAME}.git"
system "git push origin master --force"
end
end