forked from icco/resume
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Rakefile
116 lines (100 loc) · 3.08 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
require 'rake/testtask'
require 'fileutils'
task :default => ['test']
GEM_NAME = "danmayer-resume"
desc "run sintra server locally"
task :run do
exec "ruby resume.rb"
end
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = GEM_NAME
gemspec.summary = "Resume gem"
gemspec.description = "A gem for Dan Mayer's resume"
gemspec.email = "[email protected]"
gemspec.homepage = "http://github.com/danmayer/Resume"
gemspec.authors = ["Dan Mayer"]
gemspec.executables = [GEM_NAME]
gemspec.add_development_dependency "jeweler"
gemspec.add_dependency "main"
gemspec.add_dependency "maruku"
gemspec.add_dependency "sinatra", '~> 1.0'
gemspec.add_dependency "erubis"
gemspec.add_dependency 'less'
gemspec.add_dependency 'launchy'
gemspec.add_dependency 'rdiscount'
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"
end
task :build => [:generate_exe]
desc "generate the gem executable"
task :generate_exe do
puts "making bin folder if it doesn't exist"
bin_folder = File.join(File.dirname(__FILE__), 'bin')
FileUtils.mkdir_p(bin_folder) unless File.exists?(bin_folder)
puts "copying executable from template"
`cp lib/resume_exe bin/#{GEM_NAME}`
puts "giving new file chmod +x"
`chmod o+x bin/#{GEM_NAME}`
end
desc "run all tests"
task :test do
Rake::Task['test:rack'].invoke
Rake::Task['test:unit'].invoke
end
namespace :test do
desc "run rack tests"
Rake::TestTask.new(:rack) do |t|
t.libs << "test"
t.pattern = "test/rack/**/*_test.rb"
t.verbose = true
end
desc "run unit tests"
Rake::TestTask.new(:unit) do |t|
t.libs << "test"
t.pattern = "test/unit/**/*_test.rb"
t.verbose = true
end
end
desc "render github index page, which can be displayed at user.github.com"
task :render_for_github do
require File.join(File.dirname(__FILE__), 'lib', 'resume_gem')
resume = Resume.new('resume.yml')
resume.write_html_and_css_to_disk('./')
end
namespace :heroku do
desc "create a heroku project for your resume"
task :create do
unless ENV.include?("name")
raise "usage: rake heroku:create name=PROJECT_NAME # example danmayer-resume\n"
end
project_name = ENV['name']
puts "creating heroku project #{project_name}"
puts `heroku create #{project_name}`
end
end
namespace :deploy do
desc "Deploy to Heroku."
task :heroku do
`git push heroku master`
end
desc "Deploy to Github pages."
task :github => [:render_for_github] do
# this assumes you have made a remote called github
# `git remote add github [email protected]:username/username.github.com.git`
# this should push your resume to http://username.github.com
`git push github master`
end
end
namespace :github do
desc "render github index page, which can be displayed at user.github.com"
task :render_pages do
require File.join(File.dirname(__FILE__), 'lib', 'resume_gem')
resume = Resume.new('resume.yml')
puts "writing resume github index files to disk"
resume.write_html_and_css_to_disk('./')
end
end