mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-11-01 07:45:01 -04:00
Merge branch 'master' into site
This commit is contained in:
commit
3bede9ab87
@ -6,5 +6,5 @@
|
|||||||
<time datetime="{{ date | datetime }}" pubdate {% if updated %} updated {% endif %}>{{ date | ordinalize }}</time>
|
<time datetime="{{ date | datetime }}" pubdate {% if updated %} updated {% endif %}>{{ date | ordinalize }}</time>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if was_updated != '0' %}
|
{% if was_updated != '0' %}
|
||||||
<time class="updated" datetime="{{ updated | datetime }}"></time>
|
<time class="updated" datetime="{{ updated | datetime }}">{{ updated | ordinalize }}</time>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
54
Rakefile
54
Rakefile
@ -44,23 +44,49 @@ end
|
|||||||
|
|
||||||
desc "Generate jekyll site"
|
desc "Generate jekyll site"
|
||||||
task :generate do
|
task :generate do
|
||||||
|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
|
||||||
puts "## Generating Site with Jekyll"
|
puts "## Generating Site with Jekyll"
|
||||||
system "jekyll"
|
system "jekyll"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Watch the site and regenerate when it changes"
|
desc "Watch the site and regenerate when it changes"
|
||||||
task :watch do
|
task :watch do
|
||||||
system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; wait"
|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
|
||||||
|
puts "Starting to watch source with Jekyll and Compass."
|
||||||
|
jekyllPid = spawn("jekyll --auto")
|
||||||
|
compassPid = spawn("compass watch")
|
||||||
|
|
||||||
|
trap("INT") {
|
||||||
|
Process.kill(9, jekyllPid)
|
||||||
|
Process.kill(9, compassPid)
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Process.wait
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "preview the site in a web browser"
|
desc "preview the site in a web browser"
|
||||||
task :preview do
|
task :preview do
|
||||||
system "trap 'kill $jekyllPid $compassPid $rackPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; rackup --port #{server_port} & rackPid=$!; wait"
|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
|
||||||
|
puts "Starting to watch source with Jekyll and Compass. Starting Rack on port #{server_port}"
|
||||||
|
jekyllPid = spawn("jekyll --auto")
|
||||||
|
compassPid = spawn("compass watch")
|
||||||
|
rackupPid = spawn("rackup --port #{server_port}")
|
||||||
|
|
||||||
|
trap("INT") {
|
||||||
|
Process.kill(9, jekyllPid)
|
||||||
|
Process.kill(9, compassPid)
|
||||||
|
Process.kill(9, rackupPid)
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Process.wait
|
||||||
end
|
end
|
||||||
|
|
||||||
# usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post")
|
# usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post")
|
||||||
desc "Begin a new post in #{source_dir}/#{posts_dir}"
|
desc "Begin a new post in #{source_dir}/#{posts_dir}"
|
||||||
task :new_post, :title do |t, args|
|
task :new_post, :title do |t, args|
|
||||||
|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
|
||||||
require './plugins/titlecase.rb'
|
require './plugins/titlecase.rb'
|
||||||
mkdir_p "#{source_dir}/#{posts_dir}"
|
mkdir_p "#{source_dir}/#{posts_dir}"
|
||||||
args.with_defaults(:title => 'new-post')
|
args.with_defaults(:title => 'new-post')
|
||||||
@ -82,6 +108,7 @@ end
|
|||||||
# usage rake new_page[my-new-page] or rake new_page[my-new-page.html] or rake new_page (defaults to "new-page.markdown")
|
# usage rake new_page[my-new-page] or rake new_page[my-new-page.html] or rake new_page (defaults to "new-page.markdown")
|
||||||
desc "Create a new page in #{source_dir}/(filename)/index.#{new_page_ext}"
|
desc "Create a new page in #{source_dir}/(filename)/index.#{new_page_ext}"
|
||||||
task :new_page, :filename do |t, args|
|
task :new_page, :filename do |t, args|
|
||||||
|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
|
||||||
require './plugins/titlecase.rb'
|
require './plugins/titlecase.rb'
|
||||||
args.with_defaults(:filename => 'new-page')
|
args.with_defaults(:filename => 'new-page')
|
||||||
page_dir = source_dir
|
page_dir = source_dir
|
||||||
@ -125,7 +152,7 @@ end
|
|||||||
|
|
||||||
desc "Clean out caches: _code_cache, _gist_cache, .sass-cache"
|
desc "Clean out caches: _code_cache, _gist_cache, .sass-cache"
|
||||||
task :clean do
|
task :clean do
|
||||||
system "rm -rf _code_cache/** _gist_cache/** .sass-cache/** source/stylesheets/screen.css"
|
rm_rf ["_code_cache/**", "_gist_cache/**", ".sass-cache/**", "source/stylesheets/screen.css"]
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom"
|
desc "Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom"
|
||||||
@ -133,11 +160,11 @@ task :update_style, :theme do |t, args|
|
|||||||
theme = args.theme || 'classic'
|
theme = args.theme || 'classic'
|
||||||
if File.directory?("sass.old")
|
if File.directory?("sass.old")
|
||||||
puts "removed existing sass.old directory"
|
puts "removed existing sass.old directory"
|
||||||
system "rm -r sass.old"
|
rm_r "sass.old", :secure=>true
|
||||||
end
|
end
|
||||||
system "mv sass sass.old"
|
mv "sass", "sass.old"
|
||||||
puts "## Moved styles into sass.old/"
|
puts "## Moved styles into sass.old/"
|
||||||
system "mkdir -p sass; cp -R #{themes_dir}/"+theme+"/sass/ sass/"
|
cp_r "#{themes_dir}/"+theme+"/sass/", "sass"
|
||||||
cp_r "sass.old/custom/.", "sass/custom"
|
cp_r "sass.old/custom/.", "sass/custom"
|
||||||
puts "## Updated Sass ##"
|
puts "## Updated Sass ##"
|
||||||
end
|
end
|
||||||
@ -147,15 +174,16 @@ task :update_source, :theme do |t, args|
|
|||||||
theme = args.theme || 'classic'
|
theme = args.theme || 'classic'
|
||||||
if File.directory?("#{source_dir}.old")
|
if File.directory?("#{source_dir}.old")
|
||||||
puts "removed existing #{source_dir}.old directory"
|
puts "removed existing #{source_dir}.old directory"
|
||||||
system "rm -r #{source_dir}.old"
|
rm_r "#{source_dir}.old", :secure=>true
|
||||||
end
|
end
|
||||||
system "mv #{source_dir} #{source_dir}.old"
|
mv source_dir, "#{source_dir}.old"
|
||||||
puts "moved #{source_dir} into #{source_dir}.old/"
|
puts "moved #{source_dir} into #{source_dir}.old/"
|
||||||
system "mkdir -p #{source_dir}; cp -R #{themes_dir}/"+theme+"/source/. #{source_dir}"
|
mkdir_p source_dir
|
||||||
system "cp -Rn #{source_dir}.old/. #{source_dir}"
|
cp_r "#{themes_dir}/"+theme+"/source/.", source_dir
|
||||||
system "cp -Rf #{source_dir}.old/_includes/custom/. #{source_dir}/_includes/custom/"
|
cp_r "#{source_dir}.old/.", source_dir, :preserve=>true
|
||||||
system "mv -f #{source_dir}/index.html #{blog_index_dir}" if blog_index_dir != source_dir
|
cp_r "#{source_dir}.old/_includes/custom/.", "#{source_dir}/_includes/custom/"
|
||||||
system "cp -f #{source_dir}.old/index.html #{source_dir}" if blog_index_dir != source_dir
|
mv "#{source_dir}/index.html", "#{blog_index_dir}", :force=>true if blog_index_dir != source_dir
|
||||||
|
cp "#{source_dir}.old/index.html", source_dir if blog_index_dir != source_dir
|
||||||
puts "## Updated #{source_dir} ##"
|
puts "## Updated #{source_dir} ##"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
# Modified for Octopress by John W. Long
|
# Modified for Octopress by John W. Long
|
||||||
#
|
#
|
||||||
require 'rexml/document'
|
require 'rexml/document'
|
||||||
|
require 'fileutils'
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
|
|
||||||
@ -122,6 +123,9 @@ module Jekyll
|
|||||||
sitemap.add_element(urlset)
|
sitemap.add_element(urlset)
|
||||||
|
|
||||||
# File I/O: create sitemap.xml file and write out pretty-printed XML
|
# File I/O: create sitemap.xml file and write out pretty-printed XML
|
||||||
|
unless File.exists?(site.dest)
|
||||||
|
FileUtils.mkdir_p(site.dest)
|
||||||
|
end
|
||||||
file = File.new(File.join(site.dest, SITEMAP_FILE_NAME), "w")
|
file = File.new(File.join(site.dest, SITEMAP_FILE_NAME), "w")
|
||||||
formatter = REXML::Formatters::Pretty.new(4)
|
formatter = REXML::Formatters::Pretty.new(4)
|
||||||
formatter.compact = true
|
formatter.compact = true
|
||||||
|
Loading…
Reference in New Issue
Block a user