forked from danchoi/soywiki
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
59 lines (49 loc) · 1.66 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
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
require 'yaml'
require 'json'
require 'rake'
require 'rake/testtask'
require 'bundler'
require 'soywiki'
Bundler::GemHelper.install_tasks
desc "release and build and push new website"
task :push => [:release, :web]
desc "Bumps version number up one and git commits"
task :bump do
basefile = "lib/soywiki.rb"
file = File.read(basefile)
oldver = file[/VERSION = '(\d.\d.\d)'/, 1]
newver_i = oldver.gsub(".", '').to_i + 1
newver = ("%.3d" % newver_i).split(//).join('.')
puts oldver
puts newver
puts "Bumping version: #{oldver} => #{newver}"
newfile = file.gsub("VERSION = '#{oldver}'", "VERSION = '#{newver}'")
File.open(basefile, 'w') {|f| f.write newfile}
`git commit -am 'Bump'`
end
desc "build and push website"
task :web => :build_webpage do
puts "Building and pushing website"
Dir.chdir "../project-webpages" do
`scp out/soywiki.html [email protected]:~/danielchoi.com/public/software/`
`rsync -avz out/images-soywiki [email protected]:~/danielchoi.com/public/software/`
`rsync -avz out/stylesheets [email protected]:~/danielchoi.com/public/software/`
`rsync -avz out/lightbox2 [email protected]:~/danielchoi.com/public/software/`
end
`open http://danielchoi.com/software/soywiki.html`
end
desc "build webpage"
task :build_webpage do
`cp README.markdown ../project-webpages/src/soywiki.README.markdown`
Dir.chdir "../project-webpages" do
puts `ruby gen.rb soywiki #{Soywiki::VERSION}`
#`open out/soywiki.html`
end
end
desc "Run tests"
task :test do
$:.unshift File.expand_path("test")
MiniTest::Unit.autorun
end
task :default => :test