abstract site directory to variable
This commit is contained in:
parent
16217b2ed7
commit
3eedfd8fe0
6
Rakefile
6
Rakefile
|
@ -27,6 +27,10 @@ def docs_name
|
||||||
"#{name}-docs"
|
"#{name}-docs"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def docs_folder
|
||||||
|
"site"
|
||||||
|
end
|
||||||
|
|
||||||
def gemspec_file
|
def gemspec_file
|
||||||
"#{name}.gemspec"
|
"#{name}.gemspec"
|
||||||
end
|
end
|
||||||
|
@ -102,7 +106,7 @@ def siteify_file(file, overrides_front_matter = {})
|
||||||
"note" => "This file is autogenerated. Edit /#{file} instead."
|
"note" => "This file is autogenerated. Edit /#{file} instead."
|
||||||
}.merge(overrides_front_matter)
|
}.merge(overrides_front_matter)
|
||||||
contents = "#{front_matter.to_yaml}---\n\n#{content_for(file)}"
|
contents = "#{front_matter.to_yaml}---\n\n#{content_for(file)}"
|
||||||
File.write("site/_docs/#{slug}.md", contents)
|
File.write("#{docs_folder}/_docs/#{slug}.md", contents)
|
||||||
end
|
end
|
||||||
|
|
||||||
def content_for(file)
|
def content_for(file)
|
||||||
|
|
|
@ -23,8 +23,8 @@ namespace :site do
|
||||||
# Generate the site in server mode.
|
# Generate the site in server mode.
|
||||||
puts "Running Jekyll..."
|
puts "Running Jekyll..."
|
||||||
options = {
|
options = {
|
||||||
"source" => File.expand_path("site"),
|
"source" => File.expand_path(docs_folder),
|
||||||
"destination" => File.expand_path("site/_site"),
|
"destination" => File.expand_path("#{docs_folder}/_site"),
|
||||||
"watch" => true,
|
"watch" => true,
|
||||||
"serving" => true
|
"serving" => true
|
||||||
}
|
}
|
||||||
|
@ -37,15 +37,15 @@ namespace :site do
|
||||||
require "jekyll"
|
require "jekyll"
|
||||||
Jekyll::Commands::Build.process({
|
Jekyll::Commands::Build.process({
|
||||||
"profile" => true,
|
"profile" => true,
|
||||||
"source" => File.expand_path("site"),
|
"source" => File.expand_path(docs_folder),
|
||||||
"destination" => File.expand_path("site/_site")
|
"destination" => File.expand_path("#{docs_folder}/_site")
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
task :build => :generate
|
task :build => :generate
|
||||||
|
|
||||||
desc "Update normalize.css library to the latest version and minify"
|
desc "Update normalize.css library to the latest version and minify"
|
||||||
task :update_normalize_css do
|
task :update_normalize_css do
|
||||||
Dir.chdir("site/_sass") do
|
Dir.chdir("#{docs_folder}/_sass") do
|
||||||
sh 'curl "http://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"'
|
sh 'curl "http://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"'
|
||||||
sh 'sass "normalize.scss":"_normalize.scss" --style compressed'
|
sh 'sass "normalize.scss":"_normalize.scss" --style compressed'
|
||||||
rm ['normalize.scss', Dir.glob('*.map')].flatten
|
rm ['normalize.scss', Dir.glob('*.map')].flatten
|
||||||
|
@ -84,7 +84,7 @@ namespace :site do
|
||||||
ENV['JEKYLL_ENV'] = 'production'
|
ENV['JEKYLL_ENV'] = 'production'
|
||||||
require "jekyll"
|
require "jekyll"
|
||||||
Jekyll::Commands::Build.process({
|
Jekyll::Commands::Build.process({
|
||||||
"source" => File.expand_path("site"),
|
"source" => File.expand_path(docs_folder),
|
||||||
"destination" => File.expand_path("gh-pages"),
|
"destination" => File.expand_path("gh-pages"),
|
||||||
"sass" => { "style" => "compressed" }
|
"sass" => { "style" => "compressed" }
|
||||||
})
|
})
|
||||||
|
@ -132,7 +132,7 @@ namespace :site do
|
||||||
raise "Specify a version: rake site:releases:new['1.2.3']" unless args.version
|
raise "Specify a version: rake site:releases:new['1.2.3']" unless args.version
|
||||||
today = Time.new.strftime('%Y-%m-%d')
|
today = Time.new.strftime('%Y-%m-%d')
|
||||||
release = args.version.to_s
|
release = args.version.to_s
|
||||||
filename = "site/_posts/#{today}-jekyll-#{release.split('.').join('-')}-released.markdown"
|
filename = "#{docs_folder}/_posts/#{today}-jekyll-#{release.split('.').join('-')}-released.markdown"
|
||||||
|
|
||||||
File.open(filename, "wb") do |post|
|
File.open(filename, "wb") do |post|
|
||||||
post.puts("---")
|
post.puts("---")
|
||||||
|
|
Loading…
Reference in New Issue