octopress 3.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.editorconfig +22 -0
- data/.gitattributes +1 -0
- data/.gitignore +20 -0
- data/.powrc +4 -0
- data/.rspec +5 -0
- data/.rubocop.yml +119 -0
- data/.slugignore +3 -0
- data/.themes/classic/.editorconfig +44 -0
- data/.themes/classic/_config/adn-timeline.yml +10 -0
- data/.themes/classic/_config/delicious-feed.yml +4 -0
- data/.themes/classic/_config/deploy/gh_pages.yml +9 -0
- data/.themes/classic/_config/deploy/rsync.yml +14 -0
- data/.themes/classic/_config/disqus.yml +11 -0
- data/.themes/classic/_config/facebook-like.yml +2 -0
- data/.themes/classic/_config/gauges-analytics.yml +6 -0
- data/.themes/classic/_config/github-repos.yml +24 -0
- data/.themes/classic/_config/google-analytics.yml +6 -0
- data/.themes/classic/_config/google-plus.yml +13 -0
- data/.themes/classic/_config/jekyll.yml +37 -0
- data/.themes/classic/_config/pinboard-feed.yml +4 -0
- data/.themes/classic/_config/require-js.yml +19 -0
- data/.themes/classic/_config/theme.yml +54 -0
- data/.themes/classic/_config/twitter-timeline.yml +9 -0
- data/.themes/classic/assets/javascripts/lib/ios-rotate-scaling-fix.js +18 -0
- data/.themes/classic/assets/javascripts/lib/jquery.cookie.js +92 -0
- data/.themes/classic/assets/javascripts/lib/modernizr.js +447 -0
- data/.themes/classic/assets/javascripts/lib/octopress.js +83 -0
- data/.themes/classic/assets/javascripts/modules/adn-timeline.coffee +68 -0
- data/.themes/classic/assets/javascripts/modules/delicious-feed.coffee +38 -0
- data/.themes/classic/assets/javascripts/modules/github-repos.coffee +60 -0
- data/.themes/classic/assets/javascripts/modules/github.coffee +60 -0
- data/.themes/classic/assets/javascripts/modules/helpers.coffee +96 -0
- data/.themes/classic/assets/javascripts/modules/pinboard-feed.coffee +42 -0
- data/.themes/classic/assets/javascripts/modules/site.coffee +11 -0
- data/.themes/classic/assets/stylesheets/_base.scss +5 -0
- data/.themes/classic/assets/stylesheets/_partials.scss +8 -0
- data/.themes/classic/assets/stylesheets/base/_layout.scss +191 -0
- data/.themes/classic/assets/stylesheets/base/_solarized.scss +75 -0
- data/.themes/classic/assets/stylesheets/base/_theme.scss +92 -0
- data/.themes/classic/assets/stylesheets/base/_typography.scss +168 -0
- data/.themes/classic/assets/stylesheets/base/_utilities.scss +27 -0
- data/.themes/classic/assets/stylesheets/custom/_colors.scss +49 -0
- data/.themes/classic/assets/stylesheets/custom/_fonts.scss +10 -0
- data/.themes/classic/assets/stylesheets/custom/_layout.scss +17 -0
- data/.themes/classic/assets/stylesheets/custom/_styles.scss +2 -0
- data/.themes/classic/assets/stylesheets/partials/_archive.scss +77 -0
- data/.themes/classic/assets/stylesheets/partials/_blog.scss +165 -0
- data/.themes/classic/assets/stylesheets/partials/_footer.scss +19 -0
- data/.themes/classic/assets/stylesheets/partials/_header.scss +18 -0
- data/.themes/classic/assets/stylesheets/partials/_navigation.scss +136 -0
- data/.themes/classic/assets/stylesheets/partials/_sharing.scss +73 -0
- data/.themes/classic/assets/stylesheets/partials/_sidebar.scss +4 -0
- data/.themes/classic/assets/stylesheets/partials/_syntax.scss +234 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_base.scss +106 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_delicious.scss +4 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_googleplus.scss +26 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_pinboard.scss +12 -0
- data/.themes/classic/assets/stylesheets/plugins/_plugins.scss +5 -0
- data/.themes/classic/assets/stylesheets/screen.scss +11 -0
- data/.themes/classic/source/404.markdown +9 -0
- data/.themes/classic/source/_includes/after_footer.html +7 -0
- data/.themes/classic/source/_includes/archive_post.html +12 -0
- data/.themes/classic/source/_includes/article.html +23 -0
- data/.themes/classic/source/_includes/comments.html +9 -0
- data/.themes/classic/source/_includes/custom/after_footer.html +3 -0
- data/.themes/classic/source/_includes/custom/after_page.html +1 -0
- data/.themes/classic/source/_includes/custom/after_post.html +0 -0
- data/.themes/classic/source/_includes/custom/comments.html +5 -0
- data/.themes/classic/source/_includes/custom/footer.html +4 -0
- data/.themes/classic/source/_includes/custom/head.html +7 -0
- data/.themes/classic/source/_includes/custom/header.html +6 -0
- data/.themes/classic/source/_includes/custom/navigation.html +4 -0
- data/.themes/classic/source/_includes/custom/page_meta.html +1 -0
- data/.themes/classic/source/_includes/custom/post_meta.html +1 -0
- data/.themes/classic/source/_includes/custom/sharing.html +3 -0
- data/.themes/classic/source/_includes/disqus.html +22 -0
- data/.themes/classic/source/_includes/facebook_like.html +10 -0
- data/.themes/classic/source/_includes/feed_entry.xml +10 -0
- data/.themes/classic/source/_includes/footer.html +1 -0
- data/.themes/classic/source/_includes/gauges_analytics.html +15 -0
- data/.themes/classic/source/_includes/google_analytics.html +13 -0
- data/.themes/classic/source/_includes/google_plus_one.html +9 -0
- data/.themes/classic/source/_includes/head.html +33 -0
- data/.themes/classic/source/_includes/header.html +1 -0
- data/.themes/classic/source/_includes/navigation.html +15 -0
- data/.themes/classic/source/_includes/post/author.html +8 -0
- data/.themes/classic/source/_includes/post/categories.html +10 -0
- data/.themes/classic/source/_includes/post/date.html +15 -0
- data/.themes/classic/source/_includes/post/disqus_thread.html +1 -0
- data/.themes/classic/source/_includes/post/meta.html +3 -0
- data/.themes/classic/source/_includes/post/sharing.html +36 -0
- data/.themes/classic/source/_includes/post/title.html +5 -0
- data/.themes/classic/source/_includes/post/variables.html +14 -0
- data/.themes/classic/source/_includes/sidebars/blog_index_default.html +3 -0
- data/.themes/classic/source/_includes/sidebars/page_default.html +4 -0
- data/.themes/classic/source/_includes/sidebars/post_default.html +4 -0
- data/.themes/classic/source/_includes/sidebars/sections/delicious.html +8 -0
- data/.themes/classic/source/_includes/sidebars/sections/github.html +9 -0
- data/.themes/classic/source/_includes/sidebars/sections/google_plus.html +5 -0
- data/.themes/classic/source/_includes/sidebars/sections/pinboard.html +17 -0
- data/.themes/classic/source/_includes/sidebars/sections/recent_posts.html +10 -0
- data/.themes/classic/source/_includes/twitter_sharing.html +11 -0
- data/.themes/classic/source/_layouts/category_feed.xml +24 -0
- data/.themes/classic/source/_layouts/category_index.html +19 -0
- data/.themes/classic/source/_layouts/default.html +14 -0
- data/.themes/classic/source/_layouts/page.html +34 -0
- data/.themes/classic/source/_layouts/post.html +39 -0
- data/.themes/classic/source/archives/index.html +20 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/background.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/blankButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/divider.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/fullscreenButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/fullscreenButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/muteButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/muteButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/normalscreenButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/normalscreenButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/pauseButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/pauseButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/playButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/playButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderBuffer.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderCapLeft.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderCapRight.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderProgress.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderRail.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/unmuteButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/unmuteButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/background.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/bufferIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/muteIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/playIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/dock/button.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/glow.xml +115 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/item.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/itemOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderCapBottom.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderCapTop.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderRail.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderThumb.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/embedIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/embedScreen.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/shareIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/shareScreen.png +0 -0
- data/.themes/classic/source/assets/jwplayer/player.swf +0 -0
- data/.themes/classic/source/atom.xml +23 -0
- data/.themes/classic/source/images/bird_32_gray.png +0 -0
- data/.themes/classic/source/images/bird_32_gray_fail.png +0 -0
- data/.themes/classic/source/images/code_bg.png +0 -0
- data/.themes/classic/source/images/dotted-border.png +0 -0
- data/.themes/classic/source/images/email.png +0 -0
- data/.themes/classic/source/images/icon/facebook.png +0 -0
- data/.themes/classic/source/images/icon/github.png +0 -0
- data/.themes/classic/source/images/icon/googleplus.png +0 -0
- data/.themes/classic/source/images/icon/twitter-bird.png +0 -0
- data/.themes/classic/source/images/icon/twitter.png +0 -0
- data/.themes/classic/source/images/line-tile.png +0 -0
- data/.themes/classic/source/images/noise.png +0 -0
- data/.themes/classic/source/images/rss.png +0 -0
- data/.themes/classic/source/images/search.png +0 -0
- data/.themes/classic/source/index.html +30 -0
- data/.themes/classic/source/javascripts/jquery.min.js +5 -0
- data/.themes/classic/source/octopress-favicon.png +0 -0
- data/.themes/classic/source/robots.txt +7 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.markdown +46 -0
- data/CONTRIBUTING.markdown +17 -0
- data/Gemfile +2 -0
- data/README.markdown +37 -0
- data/Rakefile +76 -0
- data/bin/octopress +66 -0
- data/lib/console +17 -0
- data/lib/guard/jekyll.rb +33 -0
- data/lib/octopress.rb +89 -0
- data/lib/octopress/command.rb +9 -0
- data/lib/octopress/commands.rb +14 -0
- data/lib/octopress/commands/build.rb +17 -0
- data/lib/octopress/commands/build_javascripts.rb +11 -0
- data/lib/octopress/commands/build_jekyll.rb +25 -0
- data/lib/octopress/commands/build_stylesheets.rb +13 -0
- data/lib/octopress/commands/install.rb +45 -0
- data/lib/octopress/commands/new.rb +21 -0
- data/lib/octopress/commands/scaffold.rb +101 -0
- data/lib/octopress/commands/serve.rb +25 -0
- data/lib/octopress/configuration.rb +231 -0
- data/lib/octopress/core_ext.rb +44 -0
- data/lib/octopress/dependency_installer.rb +287 -0
- data/lib/octopress/errors.rb +3 -0
- data/lib/octopress/filters/content.rb +66 -0
- data/lib/octopress/filters/date.rb +46 -0
- data/lib/octopress/filters/post.rb +175 -0
- data/lib/octopress/filters/url.rb +34 -0
- data/lib/octopress/formatters.rb +9 -0
- data/lib/octopress/formatters/base_formatter.rb +17 -0
- data/lib/octopress/formatters/simple_formatter.rb +9 -0
- data/lib/octopress/formatters/verbose_formatter.rb +9 -0
- data/lib/octopress/generators/category_generator.rb +196 -0
- data/lib/octopress/generators/sitemap_generator.rb +308 -0
- data/lib/octopress/guardfile +43 -0
- data/lib/octopress/helpers/titlecase.rb +37 -0
- data/lib/octopress/ink.rb +12 -0
- data/lib/octopress/inquirable_string.rb +12 -0
- data/lib/octopress/installer.rb +92 -0
- data/lib/octopress/js_asset_manager.rb +98 -0
- data/lib/octopress/liquid_helpers/conditional.rb +36 -0
- data/lib/octopress/liquid_helpers/config.rb +58 -0
- data/lib/octopress/liquid_helpers/include.rb +33 -0
- data/lib/octopress/liquid_helpers/url.rb +29 -0
- data/lib/octopress/liquid_helpers/vars.rb +30 -0
- data/lib/octopress/plugin.rb +33 -0
- data/lib/octopress/rake.rb +16 -0
- data/lib/octopress/scaffold/.gitignore +18 -0
- data/lib/octopress/scaffold/site/Gemfile +3 -0
- data/lib/octopress/scaffold/site/config/compass.rb +27 -0
- data/lib/octopress/scaffold/site/config/rack.rb +25 -0
- data/lib/octopress/scaffold/site/config/site.yml +0 -0
- data/lib/octopress/scaffold/site/javascripts/lib/ios-rotate-scaling-fix.js +19 -0
- data/lib/octopress/scaffold/site/javascripts/lib/jquery-1.9.1.js +9598 -0
- data/lib/octopress/scaffold/site/javascripts/lib/jquery.cookie.js +93 -0
- data/lib/octopress/scaffold/site/stylesheets/_config.scss +1 -0
- data/lib/octopress/scaffold/site/stylesheets/_style.scss +1 -0
- data/lib/octopress/scaffold/site/stylesheets/site.scss +16 -0
- data/lib/octopress/tags/assign.rb +34 -0
- data/lib/octopress/tags/capture.rb +31 -0
- data/lib/octopress/tags/config-tag.rb +23 -0
- data/lib/octopress/tags/include.rb +63 -0
- data/lib/octopress/tags/js-assets.rb +23 -0
- data/lib/octopress/tags/puts.rb +39 -0
- data/lib/octopress/tags/render-partial.rb +89 -0
- data/lib/octopress/tags/return.rb +21 -0
- data/lib/octopress/version.rb +3 -0
- data/lib/rake/clean.rake +8 -0
- data/lib/rake/clobber.rake +5 -0
- data/lib/rake/console.rake +5 -0
- data/lib/rake/deploy.rake +4 -0
- data/lib/rake/gen_deploy.rake +2 -0
- data/lib/rake/generate.rake +4 -0
- data/lib/rake/generate_only.rake +14 -0
- data/lib/rake/hygiene.rake +29 -0
- data/lib/rake/install.rake +8 -0
- data/lib/rake/integrate.rake +4 -0
- data/lib/rake/isolate.rake +13 -0
- data/lib/rake/list_drafts.rake +7 -0
- data/lib/rake/new.rake +7 -0
- data/lib/rake/new_page.rake +49 -0
- data/lib/rake/new_post.rake +32 -0
- data/lib/rake/nuke.rake +4 -0
- data/lib/rake/preview.rake +4 -0
- data/lib/rake/push.rake +37 -0
- data/lib/rake/rsync.rake +20 -0
- data/lib/rake/set_root_dir.rake +35 -0
- data/lib/rake/setup_github_pages.rake +115 -0
- data/lib/rake/watch.rake +11 -0
- data/lib/scaffold/Rakefile +142 -0
- data/lib/scaffold/plugin-name.gemspec +43 -0
- data/lib/spec/fixtures/env/defaults/classic.yml +2 -0
- data/lib/spec/fixtures/no_override/defaults/classic.yml +11 -0
- data/lib/spec/fixtures/override/defaults/classic.yml +11 -0
- data/lib/spec/fixtures/override/site.yml +11 -0
- data/lib/spec/octopress/configuration_spec.rb +67 -0
- data/lib/spec/octopress/dependency_installer_spec.rb +66 -0
- data/lib/spec/octopress/ink_spec.rb +10 -0
- data/lib/spec/octopress/octopress_spec.rb +97 -0
- data/lib/spec/spec_helper.rb +22 -0
- data/lib/spec/support/env.rb +36 -0
- data/lib/spec/support/simplecov.rb +52 -0
- data/octopress.gemspec +52 -0
- metadata +697 -0
data/lib/rake/clean.rake
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
desc "Clean out caches: .pygments-cache, .gist-cache, .sass-cache, and Compass-generated files."
|
2
|
+
task :clean do
|
3
|
+
rm_rf [".pygments-cache", ".gist-cache", File.join(Octopress.configuration[:source], "javascripts", "build")]
|
4
|
+
if Dir.exists? "stylesheets"
|
5
|
+
system "compass clean"
|
6
|
+
puts "## Cleaned Compass-generated files, and various caches ##"
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# usage rake generate_only[my-post]
|
2
|
+
desc "Generate only the specified post (much faster)"
|
3
|
+
task :generate_only, :filename do |t, args|
|
4
|
+
if args.filename
|
5
|
+
filename = args.filename
|
6
|
+
else
|
7
|
+
filename = get_stdin("Enter a post file name: ")
|
8
|
+
end
|
9
|
+
puts "## Stashing other posts"
|
10
|
+
Rake::Task["isolate"].invoke(filename)
|
11
|
+
Rake::Task["generate"].execute
|
12
|
+
puts "## Restoring stashed posts"
|
13
|
+
Rake::Task["integrate"].execute
|
14
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
namespace :hygiene do
|
2
|
+
desc "Tidy up whitespace in all non-vendored files."
|
3
|
+
task :whitespace do
|
4
|
+
FileList[
|
5
|
+
"lib/**/*.{rb,rake,ru,feature,yml,md,markdown}",
|
6
|
+
"{Gemfile,Rakefile,*.md,*.markdown,*.ru,*.rb,.powrc,.rspec,.travis.yml,.slugignore,.gitignore,.gitattributes,.editorconfig}"
|
7
|
+
].each do |fname|
|
8
|
+
next if(File.directory?(fname))
|
9
|
+
printf "Processing #{fname}..."
|
10
|
+
raw_contents = File.read(fname)
|
11
|
+
new_contents = raw_contents.
|
12
|
+
rstrip. # Strip ALL trailing newlines.
|
13
|
+
split(/\n/). # Now look at it per-line...
|
14
|
+
map(&:rstrip). # ... strip trailing WS per-line.
|
15
|
+
join("\n") + # Now put it back together into one string.
|
16
|
+
"\n" # And ensure EXACTLY one trailing newline.
|
17
|
+
if(raw_contents != new_contents)
|
18
|
+
printf " Cleaned!"
|
19
|
+
File.open(fname, "w") { |fh| fh.write(new_contents) }
|
20
|
+
end
|
21
|
+
printf "\n"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Run the Rubocop static analyzer against Cthulhu."
|
26
|
+
task :rubocop do
|
27
|
+
sh 'rubocop -d Rakefile Gemfile lib'
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
desc "Initial setup for Octopress: copies the default theme into the path of Jekyll's generator. Rake install defaults to rake install[classic] to install a different theme run rake install[some_theme_name]"
|
2
|
+
task :install, :plugin do |t, args|
|
3
|
+
plugin = args.plugin
|
4
|
+
if plugin.nil? || plugin == ""
|
5
|
+
plugin = "classic-theme"
|
6
|
+
end
|
7
|
+
Octopress::DependencyInstaller.install_all(plugin)
|
8
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# usage rake isolate[my-post]
|
2
|
+
desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much more quickly."
|
3
|
+
task :isolate, :filename do |t, args|
|
4
|
+
if args.filename
|
5
|
+
filename = args.filename
|
6
|
+
else
|
7
|
+
filename = get_stdin("Enter a post file name: ")
|
8
|
+
end
|
9
|
+
FileUtils.mkdir(full_stash_dir) unless File.exist?(full_stash_dir)
|
10
|
+
Dir.glob("#{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}/*.*") do |post|
|
11
|
+
FileUtils.mv post, full_stash_dir unless post.include?(filename)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# usage rake list_posts or rake list_posts[pub|unpub]
|
2
|
+
desc "List all unpublished/draft posts"
|
3
|
+
task :list_drafts do
|
4
|
+
posts = Dir.glob("#{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}/*.*")
|
5
|
+
unpublished = get_unpublished(posts)
|
6
|
+
puts unpublished.empty? ? "There are no posts currently in draft" : unpublished
|
7
|
+
end
|
data/lib/rake/new.rake
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# usage rake new_page[my-new-page] or rake new_page[my-new-page.html] or rake new_page (defaults to "new-page/index.html")
|
2
|
+
desc "Create a new page in #{Octopress.configuration[:source]}/(filename)/index.#{Octopress.configuration[:new_page_ext]}"
|
3
|
+
task :new_page, :filename do |t, args|
|
4
|
+
args.with_defaults(:filename => 'new-page')
|
5
|
+
|
6
|
+
if args.filename.downcase =~ /(^.+\/)?(.+?)\/?$/
|
7
|
+
page_dir = [Octopress.configuration[:source]]
|
8
|
+
filename, dot, extension = $2.rpartition('.').reject(&:empty?) # Get filename and extension
|
9
|
+
page_dir.concat($1.downcase.sub(/^\//, '').split('/')) unless $1.nil? # Add path to page_dir Array
|
10
|
+
title = filename
|
11
|
+
|
12
|
+
if extension.nil?
|
13
|
+
page_dir << filename
|
14
|
+
filename = "index"
|
15
|
+
end
|
16
|
+
|
17
|
+
page_dir = page_dir.map! { |d| d = d.to_url }.join('/') # Sanitize path
|
18
|
+
filename = filename.downcase.to_url
|
19
|
+
|
20
|
+
page_template = Octopress.configuration[:templates][:page]
|
21
|
+
ext = page_template.delete :extension
|
22
|
+
|
23
|
+
extension ||= ext
|
24
|
+
|
25
|
+
file = "#{page_dir}/#{filename}.#{extension}"
|
26
|
+
|
27
|
+
if File.exist?(file)
|
28
|
+
abort("rake aborted!") if ask("#{file} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
|
29
|
+
end
|
30
|
+
|
31
|
+
mkdir_p page_dir unless Dir.exists? page_dir
|
32
|
+
|
33
|
+
page_template[:date] = time.iso8601 if page_template[:date]
|
34
|
+
page_template[:title] = title.gsub(/&/,'&') if page_template[:title]
|
35
|
+
|
36
|
+
begin
|
37
|
+
time = now_in_timezone(Octopress.configuration[:timezone])
|
38
|
+
open(file, 'w') do |page|
|
39
|
+
page.puts page_template.to_yaml.gsub(/^:/m,'')
|
40
|
+
page.puts "---"
|
41
|
+
end
|
42
|
+
rescue
|
43
|
+
raise "Failed to create page: #{filename}"
|
44
|
+
end
|
45
|
+
puts "New page created: #{file}"
|
46
|
+
else
|
47
|
+
puts "Syntax error: #{args.filename} contains unsupported characters"
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post")
|
2
|
+
desc "Begin a new post in #{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}"
|
3
|
+
task :new_post, :title do |t, args|
|
4
|
+
if args.title
|
5
|
+
title = args.title
|
6
|
+
else
|
7
|
+
title = get_stdin("Enter a title for your post: ")
|
8
|
+
end
|
9
|
+
title = title.titlecase if Octopress.configuration[:titlecase]
|
10
|
+
time = now_in_timezone(Octopress.configuration[:timezone])
|
11
|
+
|
12
|
+
posts_dir = "#{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}"
|
13
|
+
mkdir_p posts_dir unless Dir.exists? posts_dir
|
14
|
+
post_template = Octopress.configuration[:templates][:post]
|
15
|
+
filename = "#{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}/#{time.strftime('%Y-%m-%d')}-#{title.to_url}.#{post_template.delete(:extension)}"
|
16
|
+
|
17
|
+
if File.exist?(filename)
|
18
|
+
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
|
19
|
+
end
|
20
|
+
|
21
|
+
begin
|
22
|
+
post_template[:date] = time.iso8601 if post_template[:date]
|
23
|
+
post_template[:title] = title.gsub(/&/,'&') if post_template[:title]
|
24
|
+
open(filename, 'w') do |post|
|
25
|
+
post.puts post_template.to_yaml.gsub(/^:/m,'')
|
26
|
+
post.puts "---"
|
27
|
+
end
|
28
|
+
rescue
|
29
|
+
Raise "Failed to create post: #{filename}"
|
30
|
+
end
|
31
|
+
puts "Created new post: #{filename}"
|
32
|
+
end
|
data/lib/rake/nuke.rake
ADDED
data/lib/rake/push.rake
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
desc "deploy public directory to github pages"
|
2
|
+
multitask :push do
|
3
|
+
if File.directory?(Octopress.configuration[:deploy_dir])
|
4
|
+
puts "## Deploying branch to GitHub Pages "
|
5
|
+
(Dir["#{Octopress.configuration[:deploy_dir]}/*"]).each { |f| rm_rf(f) }
|
6
|
+
puts "Attempting pull, to sync local deployment repository"
|
7
|
+
cd "#{Octopress.configuration[:deploy_dir]}" do
|
8
|
+
system "git pull origin #{Octopress.configuration[:deploy_branch]}"
|
9
|
+
end
|
10
|
+
puts "\n## copying #{Octopress.configuration[:destination]} to #{Octopress.configuration[:deploy_dir]}"
|
11
|
+
cp_r "#{Octopress.configuration[:destination]}/.", Octopress.configuration[:deploy_dir]
|
12
|
+
cd "#{Octopress.configuration[:deploy_dir]}" do
|
13
|
+
File.new(".nojekyll", "w").close
|
14
|
+
system "git add -A"
|
15
|
+
message = "Site updated at #{Time.now.utc}"
|
16
|
+
puts "\n## Committing: #{message}"
|
17
|
+
system "git commit -m \"#{message}\""
|
18
|
+
puts "\n## Pushing generated #{Octopress.configuration[:deploy_dir]} website"
|
19
|
+
if system "git push origin #{Octopress.configuration[:deploy_branch]}"
|
20
|
+
puts "\n## GitHub Pages deploy complete"
|
21
|
+
else
|
22
|
+
remote = `git remote -v`
|
23
|
+
repo_url = case remote
|
24
|
+
when /(http[^\s]+)/
|
25
|
+
$1
|
26
|
+
when /(git@[^\s]+)/
|
27
|
+
$1
|
28
|
+
else
|
29
|
+
""
|
30
|
+
end
|
31
|
+
raise "\n## Octopress could not push to #{repo_url}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
else
|
35
|
+
puts "This project isn't configured for deploying to GitHub Pages\nPlease run `rake setup_github_pages[your-deployment-repo-url]`."
|
36
|
+
end
|
37
|
+
end
|
data/lib/rake/rsync.rake
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
desc "Deploy website via rsync"
|
2
|
+
task :rsync do
|
3
|
+
exclude = ""
|
4
|
+
if File.exists?('./rsync-exclude')
|
5
|
+
exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'"
|
6
|
+
end
|
7
|
+
puts "## Deploying website via Rsync"
|
8
|
+
ssh_key = if(!Octopress.configuration[:ssh_key].nil? && !Octopress.configuration[:ssh_key].empty?)
|
9
|
+
"-i #{ENV['HOME']}/.ssh/#{Octopress.configuration[:ssh_key]}"
|
10
|
+
else
|
11
|
+
""
|
12
|
+
end
|
13
|
+
document_root = ensure_trailing_slash(Octopress.configuration[:document_root])
|
14
|
+
exit system("rsync -avze 'ssh -p #{Octopress.configuration[:ssh_port]} #{ssh_key}' #{exclude} #{Octopress.configuration[:rsync_args]} #{"--delete-after" unless !Octopress.configuration[:rsync_delete]} #{ensure_trailing_slash(Octopress.configuration[:destination])} #{Octopress.configuration[:ssh_user]}:#{document_root}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def ensure_trailing_slash(val)
|
18
|
+
val = "#{val}/" unless(val.end_with?('/'))
|
19
|
+
return val
|
20
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
desc "Update configurations to support publishing to root or sub directory"
|
2
|
+
task :set_root_dir, :dir do |t, args|
|
3
|
+
path = args.dir || nil
|
4
|
+
if path.nil?
|
5
|
+
path = get_stdin("Please provide a directory: ")
|
6
|
+
end
|
7
|
+
if path
|
8
|
+
if path == "/"
|
9
|
+
path = ""
|
10
|
+
else
|
11
|
+
path = "/" + path.sub(/(\/*)(.+)/, "\\2").sub(/\/$/, '');
|
12
|
+
end
|
13
|
+
# update personal configuration
|
14
|
+
site_configs = Octopress.configurator.read_config('site.yml')
|
15
|
+
site_configs[:destination] = "public#{path}"
|
16
|
+
root = "/#{path.sub(/^\//, '')}"
|
17
|
+
url = $1 if site_configs[:url] =~ /(https?:\/\/[^\/]+)/i
|
18
|
+
site_configs[:url] = url + path
|
19
|
+
site_configs[:subscribe_rss] = "#{path}/atom.xml"
|
20
|
+
site_configs[:root] = "#{root}"
|
21
|
+
Octopress.configurator.write_config('site.yml', site_configs)
|
22
|
+
|
23
|
+
rm_rf Octopress.configuration[:destination]
|
24
|
+
mkdir_p site_configs[:destination]
|
25
|
+
puts "\nYour _config/site.yml has been updated to the following"
|
26
|
+
output = <<-EOF
|
27
|
+
|
28
|
+
url: #{url + path}
|
29
|
+
destination: public#{path}
|
30
|
+
subscribe_rss: #{path}/atom.xml
|
31
|
+
root: #{root}
|
32
|
+
EOF
|
33
|
+
puts output.yellow
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
desc "Set up _deploy folder and deploy branch for GitHub Pages deployment"
|
2
|
+
task :setup_github_pages, :repo do |t, args|
|
3
|
+
puts Octopress.configuration
|
4
|
+
if args.repo
|
5
|
+
repo_url = args.repo
|
6
|
+
else
|
7
|
+
puts "Enter the read/write url for your repository"
|
8
|
+
puts "(For example, 'git@github.com:your_username/your_username.github.io)"
|
9
|
+
repo_url = get_stdin("Repository url: ")
|
10
|
+
end
|
11
|
+
unless repo_url[-4..-1] == ".git"
|
12
|
+
repo_url << ".git"
|
13
|
+
end
|
14
|
+
raise "!! The repo URL that was input was malformed." unless (repo_url =~ /https:\/\/github\.(?:io|com)\/[^\/]+\/[^\/]+/).nil? or (repo_url =~ /git@github\.(?:io|com):[^\/]+\/[^\/]+/).nil?
|
15
|
+
user_match = repo_url.match(/(:([^\/]+)|(github\.(?:io|com)\/([^\/]+)))/)
|
16
|
+
user = user_match[2] || user_match[4]
|
17
|
+
branch = (repo_url =~ /\/[\w-]+\.github\.(?:io|com)/).nil? ? 'gh-pages' : 'master'
|
18
|
+
project = (branch == 'gh-pages') ? repo_url.match(/\/(.+)(\.git)/)[1] : ''
|
19
|
+
url = "http://#{user}.github.io"
|
20
|
+
url += "/#{project}" unless project == ''
|
21
|
+
unless (`git remote -v` =~ /origin.+?octopress(?:\.git)?/).nil?
|
22
|
+
# If octopress is still the origin remote (from cloning) rename it to octopress
|
23
|
+
system "git remote rename origin octopress"
|
24
|
+
if branch == 'master'
|
25
|
+
# If this is a user/organization pages repository, add the correct origin remote
|
26
|
+
# and checkout the source branch for committing changes to the website's source.
|
27
|
+
system "git remote add origin #{repo_url}"
|
28
|
+
puts "Added remote #{repo_url} as origin"
|
29
|
+
system "git config branch.master.remote origin"
|
30
|
+
puts "Set origin as default remote"
|
31
|
+
system "git branch -m master source"
|
32
|
+
puts "Master branch renamed to 'source' for committing your website's source files"
|
33
|
+
else
|
34
|
+
unless !Octopress.configuration[:destination].match("#{project}").nil?
|
35
|
+
Rake::Task[:set_root_dir].invoke(project)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Configure deployment repository
|
41
|
+
rm_rf Octopress.configuration[:deploy_dir], :verbose=>false
|
42
|
+
cmd = "git clone #{repo_url} --branch #{branch} #{Octopress.configuration[:deploy_dir]}"
|
43
|
+
Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
|
44
|
+
exit_status = wait_thr.value
|
45
|
+
unless exit_status.success?
|
46
|
+
error = ''
|
47
|
+
while line = stdout_err.gets do error << line end
|
48
|
+
puts "Be sure your repo (#{repo_url}) is set up properly and try again".red
|
49
|
+
abort error
|
50
|
+
end
|
51
|
+
end
|
52
|
+
cd "#{Octopress.configuration[:deploy_dir]}", :verbose=>false do
|
53
|
+
unless File.exist?('index.html')
|
54
|
+
`echo 'My Octopress Page is coming soon …' > index.html`
|
55
|
+
`git add . && git commit -m 'Octopress init'`
|
56
|
+
`git branch -m gh-pages` unless branch == 'master'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Configure deployment setup in deploy.yml
|
61
|
+
deploy_configuration = Octopress.configurator.read_config('deploy.yml')
|
62
|
+
config_message = ""
|
63
|
+
|
64
|
+
unless deploy_configuration[:deploy_default] == "push"
|
65
|
+
deploy_configuration[:deploy_default] = "push"
|
66
|
+
config_message << "\n deploy_default: push"
|
67
|
+
end
|
68
|
+
|
69
|
+
unless deploy_configuration[:deploy_branch] == branch
|
70
|
+
deploy_configuration[:deploy_branch] = branch
|
71
|
+
config_message << "\n deploy_branch: #{branch}"
|
72
|
+
end
|
73
|
+
|
74
|
+
# Mention updated configs if any
|
75
|
+
unless config_message.empty?
|
76
|
+
deploy_configuration = Octopress.configurator.read_config('defaults/deploy/gh_pages.yml').deep_merge(deploy_configuration)
|
77
|
+
Octopress.configurator.write_config('deploy.yml', deploy_configuration)
|
78
|
+
puts "\nYour deployment configuration (_config/deploy.yml) has been updated to:"
|
79
|
+
puts config_msg.yellow
|
80
|
+
end
|
81
|
+
|
82
|
+
# Configure published url
|
83
|
+
site_configuration = Octopress.configurator.read_config('site.yml')
|
84
|
+
if !site_configuration.has_key?(:url) or site_configuration[:url] == 'http://yoursite.com'
|
85
|
+
site_configuration[:url] = url
|
86
|
+
Octopress.configurator.write_config('site.yml', site_configuration)
|
87
|
+
puts "\nYour site configuration (_config/site.yml) has been updated to:"
|
88
|
+
puts "\n url: #{url}".yellow
|
89
|
+
end
|
90
|
+
jekyll_configuration = Octopress.configurator.read_config('defaults/jekyll.yml').deep_merge(site_configuration)
|
91
|
+
|
92
|
+
cname_path = "#{jekyll_configuration[:source]}/CNAME"
|
93
|
+
has_cname = File.exists?(cname_path)
|
94
|
+
output = ""
|
95
|
+
if has_cname
|
96
|
+
cname = IO.read(cname_path).chomp
|
97
|
+
current_url = site_configuration[:url]
|
98
|
+
if cname != current_short_url
|
99
|
+
output << "\nYour CNAME points to #{cname} but your _config/site.yml is setting the url to #{current_short_url}".red
|
100
|
+
output << "\nIf you need help, get it here: https://help.github.com/articles/setting-up-a-custom-domain-with-pages"
|
101
|
+
else
|
102
|
+
url = cname
|
103
|
+
end
|
104
|
+
else
|
105
|
+
output << "\nTo use a custom domain:".bold
|
106
|
+
output << "\n Follow this guide: https://help.github.com/articles/setting-up-a-custom-domain-with-pages"
|
107
|
+
output << "\n Then remember to update the url in _config/site.yml from #{url} to http://your-domain.com"
|
108
|
+
end
|
109
|
+
|
110
|
+
puts "Configured successfully:".green.bold
|
111
|
+
puts " Github Pages will host your site at #{url}.".green
|
112
|
+
puts "\nTo deploy:".bold
|
113
|
+
puts " Run `rake deploy` which will copy your site to _deploy/, commit then push to #{repo_url}"
|
114
|
+
puts output
|
115
|
+
end
|