Parent

Syckle::Plugins::Grancher

Grancher Plugin

This plugin copies designated files to a git branch. This is useful for dealing with situations like GitHub’s gh-pages branch for hosting project websites.

1

A poor design copied from the Git project itself.

Attributes

branch[RW]

The brach into which to save the files.

keep[RW]

List of any files/directory to not overwrite in branch.

keep_all[RW]

Do not overwrite anything. Defaults to trial setting.

remote[RW]

The remote to use (defaults to ‘origin’).

sitemap[RW]

List of directories and files to transfer. If a single directory entry is given then the contents of that directory will be transfered.

Public Instance Methods

grancher() click to toggle source
# File lib/plugins/syckle/grancher.rb, line 64
def grancher
  @grancher ||= ::Grancher.new do |g|
    g.branch  = branch
    g.push_to = remote

    #g.repo   = repo if repo  # defaults to '.'

    g.keep(*keep) if keep
    g.keep_all    if keep_all

    #g.message = (quiet? ? '' : 'Tranferred site files to #{branch}.')

    sitemap.each do |(src, dest)|
      trace "transfer: #{src} => #{dest}"
      dest = nil if dest == '.'
      if directory?(src)
        dest ? g.directory(src, dest) : g.directory(src)
      else
        dest ? g.file(src, dest)      : g.file(src)
      end
    end
  end
end
release() click to toggle source
# File lib/plugins/syckle/grancher.rb, line 97
def release
  require 'grancher'
  grancher.push
  report "Pushed site files to #{remote}."
end
sitemap=(entries) click to toggle source
# File lib/plugins/syckle/grancher.rb, line 55
def sitemap=(entries)
  case entries
  when String, Symbol
    @sitemap = [entries]
  else
    @sitemap = entries
  end
end
transfer() click to toggle source
# File lib/plugins/syckle/grancher.rb, line 89
def transfer
  sleep 1  # FIXME: had to pause so grancher will not bomb!
  require 'grancher'
  grancher.commit
  report "Tranferred site files to #{branch}."
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.