mirror of
https://github.com/moparisthebest/www.moparscape.org
synced 2024-12-23 16:08:55 -05:00
1. Added rake task for simple configuration of subdirectory deployment.
2. Updated READEME documentation regarding deploying to subdirectories. 3. Fixed related mistake in pagination and header links
This commit is contained in:
parent
f81bdbc1a8
commit
1f9b596b82
@ -19,14 +19,14 @@
|
||||
<meta name="keywords" content="{{page.keywords}}"/>
|
||||
{% endif %}
|
||||
|
||||
<link href="{{ site.url }}/images/favicon.png" rel="shortcut icon" />
|
||||
<link href="{{ site.url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
|
||||
<script src="{{ site.url }}/javascripts/modernizr-2.0.js"></script>
|
||||
<link href="{{ site.root }}/images/favicon.png" rel="shortcut icon" />
|
||||
<link href="{{ site.root }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
|
||||
<script src="{{ site.root }}/javascripts/modernizr-2.0.js"></script>
|
||||
<script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script>
|
||||
<script src="{{ site.url }}/javascripts/octopress.js" type="text/javascript"></script>
|
||||
<script src="{{ site.root }}/javascripts/octopress.js" type="text/javascript"></script>
|
||||
<link href='http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
|
||||
<link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
|
||||
<link href="{{ site.url }}/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/>
|
||||
<link href="{{ site.root }}/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/>
|
||||
{% include google_analytics.html %}
|
||||
{% include google_plus_one.html %}
|
||||
{% include twitter_sharing.html %}
|
||||
|
@ -13,13 +13,13 @@ blog_index: true
|
||||
<nav role="pagination">
|
||||
<div>
|
||||
{% if paginator.next_page %}
|
||||
<a class="prev" href="/page{{paginator.next_page}}/">← Older</a>
|
||||
<a class="prev" href="{{ site.root }}/page{{paginator.next_page}}/">← Older</a>
|
||||
{% endif %}
|
||||
<a href="/blog/archives">Blog Archives</a>
|
||||
<a href="{{ site.root }}/blog/archives">Blog Archives</a>
|
||||
{% if paginator.previous_page and paginator.previous_page > 1 %}
|
||||
<a class="next" href="/page{{paginator.previous_page}}/">Newer →</a>
|
||||
<a class="next" href="{{ site.root }}/page{{paginator.previous_page}}/">Newer →</a>
|
||||
{% elsif paginator.previous_page %}
|
||||
<a class="next" href="/">Newer →</a>
|
||||
<a class="next" href="{{ site.root }}/">Newer →</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</nav>
|
||||
|
@ -118,22 +118,46 @@ The `config_deploy` rake task takes a branch name as an argument and creates a [
|
||||
This prepares your branch for easy deployment. The `rake deploy` task copies the generated blog from the `public` directory to the `_deploy` directory, adds new files, removes old files, sets a commit message, and pushes to Github.
|
||||
Github will queue your site for publishing (which usually occurs instantly or within minutes if it's your first commit).
|
||||
|
||||
**Please note,** Github's project pages will be published to a subdirectory and you'll have to make sure you set up your urls correctly in your configs.
|
||||
|
||||
For Octopress my cofigs would be set up like this:
|
||||
### Deploying to a Subdirectory (Github Project Pages does this)
|
||||
|
||||
# _config.yaml
|
||||
If you're deploying to a subdirectory on your site, or if you're using Github's project pages, make sure you set up your urls correctly in your configs.
|
||||
You can do this automatically:
|
||||
|
||||
rake set_root_dir[your/path]
|
||||
|
||||
# To go back to publishing to the document root
|
||||
rake set_root_dir[/]
|
||||
|
||||
Then update your `_config.yml` and `Rakefile` as follows:
|
||||
|
||||
# Change the url in _config.yml
|
||||
url: http://yoursite.com/your/path
|
||||
|
||||
# If deploying with rsync, update your Rakefile path
|
||||
document_root = "~/yoursite.com/your/path"
|
||||
|
||||
To manually configure deployment to a subdirectory, you'll change `_config.yml`, `config.rb` and `Rakefile`
|
||||
|
||||
# Example for deploying to Octopress's Github Pages
|
||||
|
||||
# _config.yml
|
||||
destination: public/octopress
|
||||
url: http://imathis.github.com/octopress
|
||||
subscribe_rss: /octopress/atom.xml
|
||||
root: /octopress
|
||||
|
||||
# config.rb
|
||||
# config.rb - for Compass & Sass
|
||||
http_path = "/octopress"
|
||||
http_images_path = "/octopress/images"
|
||||
http_fonts_path = "/octopress/fonts"
|
||||
css_dir = "public/octopress/stylesheets"
|
||||
|
||||
|
||||
# Rakefile
|
||||
public_dir = "public/octopress"
|
||||
|
||||
# If deploying with rsync, update your Rakefile path
|
||||
document_root = "~/yoursite.com/your/path"
|
||||
|
||||
## License
|
||||
(The MIT License)
|
||||
|
35
Rakefile
35
Rakefile
@ -124,7 +124,40 @@ task :push do
|
||||
end
|
||||
end
|
||||
|
||||
desc "setup _deploy folder and deploy branch"
|
||||
desc "Update configurations to support publishing to root or sub directory"
|
||||
task :set_root_dir, :dir do |t, args|
|
||||
puts ">>> !! Please provide a directory, eg. rake config_dir[publishing/subdirectory]" unless args.dir
|
||||
if args.dir
|
||||
if args.dir == "/"
|
||||
dir = ""
|
||||
else
|
||||
dir = "/" + args.dir.sub(/(\/*)(.+)/, "\\2").sub(/\/$/, '');
|
||||
end
|
||||
rakefile = IO.read(__FILE__)
|
||||
rakefile.sub!(/public_dir(\s*)=(\s*)(["'])[\w\-\/]*["']/, "public_dir\\1=\\2\\3public#{dir}\\3")
|
||||
File.open(__FILE__, 'w') do |f|
|
||||
f.write rakefile
|
||||
end
|
||||
compass_config = IO.read('config.rb')
|
||||
compass_config.sub!(/http_path(\s*)=(\s*)(["'])[\w\-\/]*["']/, "http_path\\1=\\2\\3#{dir}/\\3")
|
||||
compass_config.sub!(/http_images_path(\s*)=(\s*)(["'])[\w\-\/]*["']/, "http_images_path\\1=\\2\\3#{dir}/images\\3")
|
||||
compass_config.sub!(/http_fonts_path(\s*)=(\s*)(["'])[\w\-\/]*["']/, "http_fonts_path\\1=\\2\\3#{dir}/fonts\\3")
|
||||
compass_config.sub!(/css_dir(\s*)=(\s*)(["'])[\w\-\/]*["']/, "css_dir\\1=\\2\\3public#{dir}/stylesheets\\3")
|
||||
File.open('config.rb', 'w') do |f|
|
||||
f.write compass_config
|
||||
end
|
||||
jekyll_config = IO.read('_config.yml')
|
||||
jekyll_config.sub!(/^destination:.+$/, "destination: public#{dir}")
|
||||
jekyll_config.sub!(/^subscribe_rss:.+$/, "subscribe_rss: #{dir}/atom.xml")
|
||||
jekyll_config.sub!(/^root:.*$/, "root: #{dir}")
|
||||
File.open('_config.yml', 'w') do |f|
|
||||
f.write jekyll_config
|
||||
end
|
||||
mkdir_p "public#{dir}"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Setup _deploy folder and deploy branch"
|
||||
task :config_deploy, :branch do |t, args|
|
||||
puts "!! Please provide a deploy branch, eg. rake init_deploy[gh-pages] !!" unless args.branch
|
||||
puts "## Creating a clean #{args.branch} branch in ./#{deploy_dir} for Github pages deployment"
|
||||
|
@ -1,13 +1,16 @@
|
||||
# Require any additional compass plugins here.
|
||||
project_type = :stand_alone
|
||||
# Set this to the root of your project when deployed:
|
||||
|
||||
# Publishing paths
|
||||
http_path = "/"
|
||||
http_images_path = "/images"
|
||||
http_fonts_path = "/fonts"
|
||||
css_dir = "public/stylesheets"
|
||||
|
||||
# Local development paths
|
||||
sass_dir = "sass"
|
||||
images_dir = "source/images"
|
||||
http_images_dir = "images"
|
||||
fonts_dir = "source/fonts"
|
||||
http_fonts_dir = "fonts"
|
||||
|
||||
line_comments = false
|
||||
output_style = :compressed
|
||||
|
Loading…
Reference in New Issue
Block a user