1. Reduced dependencies and updated the gemfile

2. Added whole vendor directory to .gitignore for `bundle package` users
3. Removed guard tasks and replaced serve tasks in Rakefile.
3. Reorganized rake tasks and cleaned up the Rakefile.
This commit is contained in:
Brandon Mathis 2011-06-11 07:56:04 -04:00
parent 8d3731e0dc
commit 14ba4cfd3c
4 changed files with 44 additions and 87 deletions

2
.gitignore vendored
View File

@ -5,4 +5,4 @@
_cache _cache
public public
source/_stash source/_stash
vendor/ruby vendor

View File

@ -7,6 +7,3 @@ gem 'RedCloth'
gem 'haml', '>= 3.1' gem 'haml', '>= 3.1'
gem 'compass', '>= 0.11' gem 'compass', '>= 0.11'
gem 'rubypants' gem 'rubypants'
gem 'rb-fsevent'
gem 'guard-livereload'
gem 'serve'

View File

@ -2,8 +2,6 @@ GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
RedCloth (4.2.7) RedCloth (4.2.7)
activesupport (3.0.7)
addressable (2.2.6)
chunky_png (1.2.0) chunky_png (1.2.0)
classifier (1.3.3) classifier (1.3.3)
fast-stemmer (>= 1.0.0) fast-stemmer (>= 1.0.0)
@ -12,45 +10,22 @@ GEM
fssm (>= 0.2.7) fssm (>= 0.2.7)
sass (~> 3.1) sass (~> 3.1)
directory_watcher (1.4.0) directory_watcher (1.4.0)
em-websocket (0.2.1)
addressable (>= 2.1.1)
eventmachine (>= 0.12.9)
eventmachine (0.12.10)
fast-stemmer (1.0.0) fast-stemmer (1.0.0)
fssm (0.2.7) fssm (0.2.7)
guard (0.3.4)
thor (~> 0.14.6)
guard-livereload (0.1.11)
em-websocket (~> 0.2.0)
guard (>= 0.2.2)
json (~> 1.5.1)
haml (3.1.1) haml (3.1.1)
i18n (0.6.0)
jekyll (0.10.0) jekyll (0.10.0)
classifier (>= 1.3.1) classifier (>= 1.3.1)
directory_watcher (>= 1.1.1) directory_watcher (>= 1.1.1)
liquid (>= 1.9.0) liquid (>= 1.9.0)
maruku (>= 0.5.9) maruku (>= 0.5.9)
json (1.5.1)
liquid (2.2.2) liquid (2.2.2)
maruku (0.6.0) maruku (0.6.0)
syntax (>= 1.0.0) syntax (>= 1.0.0)
rack (1.3.0)
rake (0.9.0) rake (0.9.0)
rb-fsevent (0.4.0)
rdiscount (1.6.8) rdiscount (1.6.8)
rubypants (0.2.0) rubypants (0.2.0)
sass (3.1.1) sass (3.1.1)
serve (1.1.0)
activesupport (~> 3.0.7)
i18n (~> 0.6.0)
rack (~> 1.3.0)
tilt (~> 1.3.1)
tzinfo (~> 0.3.27)
syntax (1.0.0) syntax (1.0.0)
thor (0.14.6)
tilt (1.3.2)
tzinfo (0.3.27)
PLATFORMS PLATFORMS
ruby ruby
@ -58,11 +33,8 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
RedCloth RedCloth
compass (>= 0.11) compass (>= 0.11)
guard-livereload
haml (>= 3.1) haml (>= 3.1)
jekyll jekyll
rake rake
rb-fsevent
rdiscount rdiscount
rubypants rubypants
serve

View File

@ -9,25 +9,16 @@ posts = "_posts" # directory for blog files
post_format = "markdown" # file format for new posts when using the post rake task post_format = "markdown" # file format for new posts when using the post rake task
## -- Rsync Deploy config -- ## ## -- Rsync Deploy config -- ##
# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
ssh_user = "user@host.com" # for rsync deployment ssh_user = "user@host.com" # for rsync deployment
document_root = "~/document_root/" # for rsync deployment document_root = "~/document_root/" # for rsync deployment
## ---- ##
## -- Github Pages deploy config -- ## ## -- Github Pages deploy config -- ##
# Read http://pages.github.com for guidance # Read http://pages.github.com for guidance
# You can deploy to github pages with `rake push_github` or change the default push task below to :push_github # You can deploy to github pages with `rake push_github` or change the default push task to :push_github
# If you're not using this, you can remove it
source_branch = "source" # this compiles to your deploy branch source_branch = "source" # this compiles to your deploy branch
deploy_branch = "master" # For user pages, use "master" for project pages use "gh-pages" deploy_branch = "master" # For user pages, use "master" for project pages use "gh-pages"
## ---- ##
def ok_failed(condition)
if (condition)
puts "OK"
else
puts "FAILED"
end
end
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]" 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]"
task :install, :theme do |t, args| task :install, :theme do |t, args|
@ -36,22 +27,21 @@ task :install, :theme do |t, args|
puts "## Copying "+theme+" theme to Jekyll paths" puts "## Copying "+theme+" theme to Jekyll paths"
system "cp -R themes/"+theme+"/source source" system "cp -R themes/"+theme+"/source source"
system "cp -R themes/"+theme+"/sass sass" system "cp -R themes/"+theme+"/sass sass"
system "cp -R themes/"+theme+"/_plugins/ _plugins/" # system "cp -R themes/"+theme+"/_plugins/ _plugins/"
end end
## if you're deploying with github, change the default deploy to push_github #######################
desc "default push task" # Working with Jekyll #
task :push => [:push_rsync] do #######################
desc "Watch the site and regenerate when it changes"
task :watch do
system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; wait"
end end
desc "Generate and deploy task" desc "preview the site in a web browser"
task :deploy => [:integrate, :generate, :push] do task :preview do
end system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto --server & jekyllPid=$!; compass watch & compassPid=$!; wait"
desc "Generate jekyll site"
task :generate do
puts "## Generating Site with Jekyll"
system "jekyll"
end end
# usage rake post[my-new-post] or rake post['my new post'] or rake post (defaults to "new-post") # usage rake post[my-new-post] or rake post['my new post'] or rake post (defaults to "new-post")
@ -83,24 +73,40 @@ task :integrate do
FileUtils.mv Dir.glob("#{source}/#{stash}/*.*"), "#{source}/#{posts}/" FileUtils.mv Dir.glob("#{source}/#{stash}/*.*"), "#{source}/#{posts}/"
end end
desc "list tasks" ##############
task :list do # Deploying #
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}" ##############
puts "(type rake -T for more detail)\n\n"
## if you're deploying with github, change the default deploy to push_github
desc "default push task"
task :push => [:push_rsync] do
end end
desc "Watch the site and regenerate when it changes" desc "Generate and deploy task"
task :watch do multitask :deploy => [:integrate, :generate, :push] do
system "trap 'kill $jekyllPid $guardPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; guard & guardPid=$!; wait"
end end
desc "generate and deploy website via rsync" desc "Generate jekyll site"
multitask :push_rsync do task :generate do
puts "## Generating Site with Jekyll"
system "jekyll"
end
def ok_failed(condition)
if (condition)
puts "OK"
else
puts "FAILED"
end
end
desc "Deploy website via rsync"
task :push_rsync do
puts "## Deploying website via Rsync" puts "## Deploying website via Rsync"
ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}") ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}")
end end
desc "deploy website to github user pages" desc "deploy website to github pages"
multitask :push_github do multitask :push_github do
puts "## Deploying #{deploy_branch} branch to Github Pages " puts "## Deploying #{deploy_branch} branch to Github Pages "
require 'git' require 'git'
@ -122,28 +128,10 @@ multitask :push_github do
repo.branch("#{source_branch}").checkout repo.branch("#{source_branch}").checkout
end end
desc "start up a web server on the output files"
task :start_server => :stop_server do
print "## Starting serve..."
system("serve #{site} #{port} > /dev/null 2>&1 &")
sleep 1
pid = `ps auxw | awk '/bin\\/serve #{site} #{port}/ { print $2 }'`.strip
ok_failed !pid.empty?
system "open http://localhost:#{port}" unless pid.empty?
end
desc "stop the web server"
task :stop_server do
pid = `ps auxw | awk '/bin\\/serve #{site} #{port}/ { print $2 }'`.strip
if pid.empty?
puts "## Adsf is not running"
else
print "## Stoping adsf..."
ok_failed system("kill -9 #{pid}")
end
end
desc "preview the site in a web browser" desc "list tasks"
task :preview do task :list do
system "trap 'kill $servePid $jekyllPid $guardPid' Exit; serve #{site} #{port} > /dev/null 2>&1 & servePid=$!; jekyll --auto & jekyllPid=$!; guard & guardPid=$!; compass compile; open http://localhost:#{port}; wait" puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}"
puts "(type rake -T for more detail)\n\n"
end end