13
13
HOST = 'www.ruby-lang.org'
14
14
LANGUAGES = %w[ bg de en es fr id it ja ko pl pt ru tr vi zh_cn zh_tw ]
15
15
16
- task :default => [ :generate ]
16
+ task :default => [ :build ]
17
17
18
- desc "Generates the Jekyll site"
19
- task :generate do
18
+ desc "Build the Jekyll site"
19
+ task :build do
20
20
require 'jekyll'
21
21
# workaround for LANG=C environment
22
22
module Jekyll ::Convertible
23
23
Encoding . default_external = Encoding ::UTF_8
24
24
end
25
25
26
- options = Jekyll . configuration ( { 'auto' => false , 'server' => false } )
26
+ options = Jekyll . configuration
27
27
puts "Building site: #{ options [ 'source' ] } -> #{ options [ 'destination' ] } "
28
28
$stdout. flush
29
29
Jekyll ::Site . new ( options ) . process
30
30
end
31
31
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"
33
38
task :serve do
34
39
sh "rackup config.ru"
35
40
end
36
41
37
- task :preview => [ :serve ]
38
-
39
42
namespace :new_post do
40
43
41
44
def create_template ( lang )
@@ -74,7 +77,7 @@ namespace :new_post do
74
77
end
75
78
end
76
79
77
- desc "Creates a news post template for language `lang'"
80
+ desc "Create a news post template for language `lang'"
78
81
task :lang do
79
82
puts 'Please specify one of the valid language codes:'
80
83
puts LANGUAGES . join ( ', ' ) << '.'
@@ -114,7 +117,7 @@ namespace :check do
114
117
date ? date . getutc . strftime ( '%Y/%m/%d' ) : nil
115
118
end
116
119
117
- desc "Checks for missing author variables in news posts"
120
+ desc "Check for missing author variables in news posts"
118
121
task :author do
119
122
print "Checking for missing author variables in news posts..."
120
123
@@ -129,7 +132,7 @@ namespace :check do
129
132
end
130
133
end
131
134
132
- desc "Checks for missing lang variables in markdown files"
135
+ desc "Check for missing lang variables in markdown files"
133
136
task :lang do
134
137
print "Checking for missing lang variables in markdown files..."
135
138
@@ -149,7 +152,7 @@ namespace :check do
149
152
end
150
153
end
151
154
152
- desc "Checks publication dates (UTC) for consistency with filename"
155
+ desc "Check publication dates (UTC) for consistency with filename"
153
156
task :pubdates do
154
157
print "Checking for date mismatch in posts (filename / YAML front matter)..."
155
158
@@ -173,7 +176,7 @@ namespace :check do
173
176
174
177
localport = 9292
175
178
176
- desc "Checks for broken links on http://localhost:#{ localport } /"
179
+ desc "Check for broken links on http://localhost:#{ localport } /"
177
180
task :links do
178
181
gem 'spidr' , '~> 0.4'
179
182
require 'spidr'
@@ -210,15 +213,16 @@ namespace :check do
210
213
end
211
214
end
212
215
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
216
220
Dir . chdir ( '_site' ) do
217
221
system ( "validate-website-static --site '#{ options [ 'url' ] } /' --quiet" )
218
222
exit ( $?. exitstatus )
219
223
end
220
224
end
221
225
end
222
226
223
- desc "Carries out some tests"
227
+ desc "Run some tests (lang, author, pubdates) "
224
228
task :check => [ 'check:lang' , 'check:author' , 'check:pubdates' ]
0 commit comments