Browse Source

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.
unreleased_contents
Brandon Mathis 14 years ago
parent
commit
14ba4cfd3c
  1. 2
      .gitignore
  2. 3
      Gemfile
  3. 28
      Gemfile.lock
  4. 96
      Rakefile

2
.gitignore

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

3
Gemfile

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

28
Gemfile.lock

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

96
Rakefile

@ -9,25 +9,16 @@ posts = "_posts" # directory for blog files
post_format = "markdown" # file format for new posts when using the post rake task
## -- 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
document_root = "~/document_root/" # for rsync deployment
## ---- ##
## -- Github Pages deploy config -- ##
# 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
# If you're not using this, you can remove it
# You can deploy to github pages with `rake push_github` or change the default push task to :push_github
source_branch = "source" # this compiles to your deploy branch
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]"
task :install, :theme do |t, args|
@ -36,22 +27,21 @@ task :install, :theme do |t, args|
puts "## Copying "+theme+" theme to Jekyll paths"
system "cp -R themes/"+theme+"/source source"
system "cp -R themes/"+theme+"/sass sass"
system "cp -R themes/"+theme+"/_plugins/ _plugins/"
# system "cp -R themes/"+theme+"/_plugins/ _plugins/"
end
## if you're deploying with github, change the default deploy to push_github
desc "default push task"
task :push => [:push_rsync] do
end
#######################
# Working with Jekyll #
#######################
desc "Generate and deploy task"
task :deploy => [:integrate, :generate, :push] 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
desc "Generate jekyll site"
task :generate do
puts "## Generating Site with Jekyll"
system "jekyll"
desc "preview the site in a web browser"
task :preview do
system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto --server & jekyllPid=$!; compass watch & compassPid=$!; wait"
end
# 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}/"
end
desc "list tasks"
task :list do
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}"
puts "(type rake -T for more detail)\n\n"
##############
# Deploying #
##############
## if you're deploying with github, change the default deploy to push_github
desc "default push task"
task :push => [:push_rsync] do
end
desc "Watch the site and regenerate when it changes"
task :watch do
system "trap 'kill $jekyllPid $guardPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; guard & guardPid=$!; wait"
desc "Generate and deploy task"
multitask :deploy => [:integrate, :generate, :push] do
end
desc "Generate jekyll site"
task :generate do
puts "## Generating Site with Jekyll"
system "jekyll"
end
desc "generate and deploy website via rsync"
multitask :push_rsync do
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"
ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}")
end
desc "deploy website to github user pages"
desc "deploy website to github pages"
multitask :push_github do
puts "## Deploying #{deploy_branch} branch to Github Pages "
require 'git'
@ -122,28 +128,10 @@ multitask :push_github do
repo.branch("#{source_branch}").checkout
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"
task :preview 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"
desc "list tasks"
task :list do
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}"
puts "(type rake -T for more detail)\n\n"
end

Loading…
Cancel
Save