Skip to content

Commit ce8399b

Browse files
committed
Merge branch 'rake-tasks'
2 parents 67f9c97 + c61c1b7 commit ce8399b

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ your commits and PRs should look like.
6161
Generate the website with
6262

6363
``` sh
64-
bundle exec rake generate
64+
bundle exec rake build
6565
```
6666

6767
Then start a local web server with

Rakefile

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,32 @@ end
1313
HOST = 'www.ruby-lang.org'
1414
LANGUAGES = %w[bg de en es fr id it ja ko pl pt ru tr vi zh_cn zh_tw]
1515

16-
task :default => [:generate]
16+
task :default => [:build]
1717

18-
desc "Generates the Jekyll site"
19-
task :generate do
18+
desc "Build the Jekyll site"
19+
task :build do
2020
require 'jekyll'
2121
# workaround for LANG=C environment
2222
module Jekyll::Convertible
2323
Encoding.default_external = Encoding::UTF_8
2424
end
2525

26-
options = Jekyll.configuration({'auto' => false, 'server' => false})
26+
options = Jekyll.configuration
2727
puts "Building site: #{options['source']} -> #{options['destination']}"
2828
$stdout.flush
2929
Jekyll::Site.new(options).process
3030
end
3131

32-
desc "Serves the Jekyll site locally"
32+
task :generate do
33+
warn "Warning: The `generate' task is deprecated, use `build' instead."
34+
Rake::Task[:build].invoke
35+
end
36+
37+
desc "Serve the Jekyll site locally"
3338
task :serve do
3439
sh "rackup config.ru"
3540
end
3641

37-
task :preview => [:serve]
38-
3942
namespace :new_post do
4043

4144
def create_template(lang)
@@ -74,7 +77,7 @@ namespace :new_post do
7477
end
7578
end
7679

77-
desc "Creates a news post template for language `lang'"
80+
desc "Create a news post template for language `lang'"
7881
task :lang do
7982
puts 'Please specify one of the valid language codes:'
8083
puts LANGUAGES.join(', ') << '.'
@@ -114,7 +117,7 @@ namespace :check do
114117
date ? date.getutc.strftime('%Y/%m/%d') : nil
115118
end
116119

117-
desc "Checks for missing author variables in news posts"
120+
desc "Check for missing author variables in news posts"
118121
task :author do
119122
print "Checking for missing author variables in news posts..."
120123

@@ -129,7 +132,7 @@ namespace :check do
129132
end
130133
end
131134

132-
desc "Checks for missing lang variables in markdown files"
135+
desc "Check for missing lang variables in markdown files"
133136
task :lang do
134137
print "Checking for missing lang variables in markdown files..."
135138

@@ -149,7 +152,7 @@ namespace :check do
149152
end
150153
end
151154

152-
desc "Checks publication dates (UTC) for consistency with filename"
155+
desc "Check publication dates (UTC) for consistency with filename"
153156
task :pubdates do
154157
print "Checking for date mismatch in posts (filename / YAML front matter)..."
155158

@@ -173,7 +176,7 @@ namespace :check do
173176

174177
localport = 9292
175178

176-
desc "Checks for broken links on http://localhost:#{localport}/"
179+
desc "Check for broken links on http://localhost:#{localport}/"
177180
task :links do
178181
gem 'spidr', '~> 0.4'
179182
require 'spidr'
@@ -210,15 +213,16 @@ namespace :check do
210213
end
211214
end
212215

213-
desc 'validate _site markup with validate-website'
214-
task :markup => :generate do
215-
options = Jekyll.configuration({'auto' => false, 'server' => false})
216+
desc 'Validate _site markup with validate-website'
217+
task :markup => :build do
218+
require 'jekyll'
219+
options = Jekyll.configuration
216220
Dir.chdir('_site') do
217221
system("validate-website-static --site '#{options['url']}/' --quiet")
218222
exit($?.exitstatus)
219223
end
220224
end
221225
end
222226

223-
desc "Carries out some tests"
227+
desc "Run some tests (lang, author, pubdates)"
224228
task :check => ['check:lang', 'check:author', 'check:pubdates']

0 commit comments

Comments
 (0)