Sha256: ab613a2aa0acd324e8dfdc7178b2d1ce2cbee80709553fe56b97dd7eda2e7cbe

Contents?: true

Size: 999 Bytes

Versions: 4

Compression:

Stored size: 999 Bytes

Contents

namespace :docs do
  desc "Generate the latest docs from the source code and add to gh-pages"
  task :generate do
    ensure_clean_git
    run "git checkout #{branch}"
    run "docco lib/**/*.rb"
    run "git commit -am 'Updated documentation'"
    run "git checkout gh-pages"
    run "git checkout #{branch} -- docs/" # Copy docs changes across and stage
    run "git commit -am 'Updated docs on gh-pages'"
    run "git checkout #{branch}"
  end

  desc "Deploy docs to GitHub pages"
  task :deploy do
    ensure_clean_git
    run "git checkout gh-pages"
    run "git push origin gh-pages"
    run "git checkout #{branch}"
  end
end

def branch
  @branch ||= `git symbolic-ref HEAD 2> /dev/null`.gsub("refs/heads/", "").strip
end

def git_dirty?
  `[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]`
  dirty = $?.success?
end

def ensure_clean_git
  if git_dirty?
    raise "Can't deploy without a clean git status."
  end
end

def run(command)
  puts "  #{command}"
  %x{#{command}}
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bcx-0.3.0 lib/tasks/docs.rake
bcx-0.2.1 lib/tasks/docs.rake
bcx-0.2.0 lib/tasks/docs.rake
bcx-0.1.1 lib/tasks/docs.rake