Skip to content
This repository
Newer
Older
100644 139 lines (117 sloc) 4.978 kb
091ef1c6 » dbloete
2010-05-26 Use Bundler for dependency management
1 require "rubygems"
8698a276 »
2011-05-30 Cleaned out public from repository, updated gitignore, added syntax
2 require "bundler/setup"
091ef1c6 » dbloete
2010-05-26 Use Bundler for dependency management
3
a2ab1d48 »
2011-06-22 1. Reordered configs in Rakefile based on importance.
4 ## -- Rsync Deploy config -- ##
5 # Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
6 ssh_user = "mathisweb@imathis.com"
7 document_root = "~/dev.octopress.org/"
8
9 ## -- Misc Configs, you probably have no reason to changes these -- ##
10
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
11 public_dir = "public" # compiled site directory
12 source_dir = "source" # source file directory
13 deploy_dir = "_deploy" # deploy directory (for Github pages deployment)
14 stash_dir = "_stash" # directory to stash posts for speedy generation
15 posts_dir = "_posts" # directory for blog files
eefe29e5 »
2010-03-10 now Octopress uses partials
16 post_format = "markdown" # file format for new posts when using the post rake task
399fe77f »
2009-11-24 updated rakefile to support github user pages, and github project pag…
17
cc8985df »
2009-10-31 fixed a few issues with the rakefile, and updated the readme
18
d8b796ac »
2011-06-07 Another massive commit:
19 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]"
20 task :install, :theme do |t, args|
21 # copy theme into working Jekyll directories
22 theme = args.theme || 'classic'
23 puts "## Copying "+theme+" theme to Jekyll paths"
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
24 system "mkdir -p #{source_dir}; cp -R themes/"+theme+"/source/ #{source_dir}/"
913fa105 »
2011-06-11 1. Moved _plugins into themes/classic/_plugins
25 system "mkdir -p sass; cp -R themes/"+theme+"/sass/ sass/"
26 system "mkdir -p _plugins; cp -R themes/"+theme+"/_plugins/ _plugins/"
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
27 system "mkdir -p #{source_dir}/#{posts_dir}";
28 puts "## Layouts, images, and javascritps from the #{theme} theme have been installed into ./#{source_dir}"
913fa105 »
2011-06-11 1. Moved _plugins into themes/classic/_plugins
29 puts "## Sass stylesheet sources from the #{theme} theme have been installed into ./sass"
30 puts "## Plugins from the #{theme} theme have been installed into ./_plugins"
d8b796ac »
2011-06-07 Another massive commit:
31 end
32
14ba4cfd »
2011-06-11 1. Reduced dependencies and updated the gemfile
33 #######################
34 # Working with Jekyll #
35 #######################
eefe29e5 »
2010-03-10 now Octopress uses partials
36
14ba4cfd »
2011-06-11 1. Reduced dependencies and updated the gemfile
37 desc "Watch the site and regenerate when it changes"
38 task :watch do
39 system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; wait"
af719fb4 »
2009-11-25 fixed default deploy task
40 end
41
14ba4cfd »
2011-06-11 1. Reduced dependencies and updated the gemfile
42 desc "preview the site in a web browser"
43 task :preview do
44 system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto --server & jekyllPid=$!; compass watch & compassPid=$!; wait"
145f8104 »
2009-11-05 updated rake file, reorganized stylesheets, added google site search,…
45 end
46
a6262dcb »
2009-12-07 added a rake task for creating a new post
47 # usage rake post[my-new-post] or rake post['my new post'] or rake post (defaults to "new-post")
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
48 desc "Begin a new post in #{source_dir}/_posts"
a6262dcb »
2009-12-07 added a rake task for creating a new post
49 task :post, :filename do |t, args|
e4c2d579 »
2011-04-17 irrisponsibly massive commit
50 require './_plugins/titlecase.rb'
a6262dcb »
2009-12-07 added a rake task for creating a new post
51 args.with_defaults(:filename => 'new-post')
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
52 open("#{source_dir}/_posts/#{Time.now.strftime('%Y-%m-%d')}-#{args.filename.downcase.gsub(/[ _]/, '-')}.#{post_format}", 'w') do |post|
53 system "mkdir -p #{source_dir}/#{posts_dir}";
a6262dcb »
2009-12-07 added a rake task for creating a new post
54 post.puts "---"
21813059 »
2011-06-17 1. Replaced Rdiscount in favor of Kramdown (better html5 support) for…
55 post.puts "title: #{args.filename.gsub(/[-_]/, ' ').titlecase}"
e4c2d579 »
2011-04-17 irrisponsibly massive commit
56 post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
57 post.puts "layout: post"
a6262dcb »
2009-12-07 added a rake task for creating a new post
58 post.puts "---"
59 end
60 end
61
2f415171 » rwdaigle
2010-01-23 Update to rakefile to allow working on a single post at a time (and s…
62 # usage rake isolate[my-post]
63 desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much quicker."
64 task :isolate, :filename do |t, args|
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
65 stash_dir = "#{source_dir}/#{stash_dir}"
2f415171 » rwdaigle
2010-01-23 Update to rakefile to allow working on a single post at a time (and s…
66 FileUtils.mkdir(stash_dir) unless File.exist?(stash_dir)
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
67 Dir.glob("#{source_dir}/#{posts_dir}/*.*") do |post|
2f415171 » rwdaigle
2010-01-23 Update to rakefile to allow working on a single post at a time (and s…
68 FileUtils.mv post, stash_dir unless post.include?(args.filename)
69 end
70 end
71
72 desc "Move all stashed posts back into the posts directory, ready for site generation."
73 task :integrate do
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
74 FileUtils.mv Dir.glob("#{source_dir}/#{stash_dir}/*.*"), "#{source_dir}/#{posts_dir}/"
2f415171 » rwdaigle
2010-01-23 Update to rakefile to allow working on a single post at a time (and s…
75 end
76
21813059 »
2011-06-17 1. Replaced Rdiscount in favor of Kramdown (better html5 support) for…
77 desc "Clean out caches: _code_cache, _gist_cache, .sass-cache"
78 task :clean do
79 system "rm -rf _code_cache/** _gist_cache/** .sass-cache/**"
80 end
81
14ba4cfd »
2011-06-11 1. Reduced dependencies and updated the gemfile
82 ##############
83 # Deploying #
84 ##############
85
86 ## if you're deploying with github, change the default deploy to push_github
87 desc "default push task"
88 task :push => [:push_rsync] do
82d0251d »
2009-10-18 improved starting point
89 end
90
14ba4cfd »
2011-06-11 1. Reduced dependencies and updated the gemfile
91 desc "Generate and deploy task"
92 multitask :deploy => [:integrate, :generate, :push] do
93 end
94
95 desc "Generate jekyll site"
96 task :generate do
97 puts "## Generating Site with Jekyll"
98 system "jekyll"
dafeb04f »
2009-10-31 updated rakefile to use FSSM in `rake watch`, generate a sitemap, and…
99 end
100
14ba4cfd »
2011-06-11 1. Reduced dependencies and updated the gemfile
101 def ok_failed(condition)
102 if (condition)
103 puts "OK"
104 else
105 puts "FAILED"
106 end
107 end
108
109 desc "Deploy website via rsync"
110 task :push_rsync do
d8b796ac »
2011-06-07 Another massive commit:
111 puts "## Deploying website via Rsync"
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
112 ok_failed system("rsync -avz --delete #{public_dir}/ #{ssh_user}:#{document_root}")
82d0251d »
2009-10-18 improved starting point
113 end
114
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
115 desc "deploy public directory to github pages"
e4c2d579 »
2011-04-17 irrisponsibly massive commit
116 multitask :push_github do
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
117 puts "## Deploying branch to Github Pages "
118 (Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) }
119 system "cp -R #{public_dir}/ #{deploy_dir}"
120 puts "\n## copying #{public_dir} to #{deploy_dir}"
121 cd "#{deploy_dir}" do
122 system "git add ."
123 system "git add -u"
124 puts "\n## Commiting: Site updated at #{Time.now.utc}"
125 message = "Site updated at #{Time.now.utc}"
126 system "git commit -m '#{message}'"
127 puts "\n## Pushing generated #{deploy_dir} website"
128 system "git push"
129 puts "\n## Github Pages deploy complete"
130 end
54766a0c »
2009-11-24 updated rakefile to support github pages deployments
131 end
132
82d0251d »
2009-10-18 improved starting point
133
134
14ba4cfd »
2011-06-11 1. Reduced dependencies and updated the gemfile
135 desc "list tasks"
136 task :list do
137 puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}"
138 puts "(type rake -T for more detail)\n\n"
9bd71339 » gisikw
2010-08-03 Fixed 'rake preview on fails vanilla install' bug
139 end
b9b9eb09 »
2011-06-21 improved rake tasks for deployment, updated .gitignore
140
Something went wrong with that request. Please try again.