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"
|
||||
end
|
||||
|
||||
def docs_folder
|
||||
"site"
|
||||
end
|
||||
|
||||
def gemspec_file
|
||||
"#{name}.gemspec"
|
||||
end
|
||||
|
@ -102,7 +106,7 @@ def siteify_file(file, overrides_front_matter = {})
|
|||
"note" => "This file is autogenerated. Edit /#{file} instead."
|
||||
}.merge(overrides_front_matter)
|
||||
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
|
||||
|
||||
def content_for(file)
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace :site do
|
|||
# Generate the site in server mode.
|
||||
puts "Running Jekyll..."
|
||||
options = {
|
||||
"source" => File.expand_path("site"),
|
||||
"destination" => File.expand_path("site/_site"),
|
||||
"source" => File.expand_path(docs_folder),
|
||||
"destination" => File.expand_path("#{docs_folder}/_site"),
|
||||
"watch" => true,
|
||||
"serving" => true
|
||||
}
|
||||
|
@ -37,15 +37,15 @@ namespace :site do
|
|||
require "jekyll"
|
||||
Jekyll::Commands::Build.process({
|
||||
"profile" => true,
|
||||
"source" => File.expand_path("site"),
|
||||
"destination" => File.expand_path("site/_site")
|
||||
"source" => File.expand_path(docs_folder),
|
||||
"destination" => File.expand_path("#{docs_folder}/_site")
|
||||
})
|
||||
end
|
||||
task :build => :generate
|
||||
|
||||
desc "Update normalize.css library to the latest version and minify"
|
||||
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 'sass "normalize.scss":"_normalize.scss" --style compressed'
|
||||
rm ['normalize.scss', Dir.glob('*.map')].flatten
|
||||
|
@ -84,7 +84,7 @@ namespace :site do
|
|||
ENV['JEKYLL_ENV'] = 'production'
|
||||
require "jekyll"
|
||||
Jekyll::Commands::Build.process({
|
||||
"source" => File.expand_path("site"),
|
||||
"source" => File.expand_path(docs_folder),
|
||||
"destination" => File.expand_path("gh-pages"),
|
||||
"sass" => { "style" => "compressed" }
|
||||
})
|
||||
|
@ -132,7 +132,7 @@ namespace :site do
|
|||
raise "Specify a version: rake site:releases:new['1.2.3']" unless args.version
|
||||
today = Time.new.strftime('%Y-%m-%d')
|
||||
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|
|
||||
post.puts("---")
|
||||
|
|
Loading…
Reference in New Issue