/
rakefile
36 lines (30 loc) · 928 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
34
35
36
#To deploy the site, run rake deploy
#To deploy a different environment, run rake deploy env=production
#The same applies for launch:
#rake launch
#rake launch env=production
#This command will open the environment in your default browser
begin
require 'rubygems'
require 'bundler'
require 'yaml'
rescue LoadError
raise "Could not load the bundler gem. Install it with `gem install bundler`."
end
begin
Bundler.setup
rescue Bundler::GemNotFound
raise RuntimeError, "Bundler couldn't find some gems. Did you run `bundle install`?"
end
config_file = '_config.yml'
config = YAML.load_file(config_file)
task :default => :launch
task :deploy do
env = ENV['env'] || 'stage'
sh "jekyll --url #{config['environments'][env]['url']}"
sh "open #{config['environments'][env]['url']}"
end
task :launch do
env = ENV['env'] || 'development'
sh "jekyll serve --watch --url #{config['environments'][env]['url']}"
end