Class: Gash
- Inherits:
-
Object
- Object
- Gash
- Defined in:
- lib/grancher.rb
Overview
What is Grancher?
With Grancher you can easily copy folders and files to a Git branch.
How?
As a library
require 'grancher'
grancher = Grancher.new do |g|
g.branch = 'gh-pages' # alternatively, g.refspec = 'ghpages:refs/heads/ghpages'
g.push_to = 'origin'
g.repo = 'some_repo' # defaults to '.'
g. = 'Updated website' # defaults to 'Updated files.'
# Put the website-directory in the root
g.directory 'website'
# doc -> doc
g.directory 'doc', 'doc'
# README -> README
g.file 'README'
# AUTHORS -> authors.txt
g.file 'AUTHORS', 'authors.txt'
# CHANGELOG -> doc/CHANGELOG
g.file 'CHANGELOG', 'doc/'
end
grancher.commit
grancher.push
As a Raketask
Instead of:
require 'grancher'
Grancher.new do |g|
...
end
Do:
require 'grancher/task'
Grancher::Task.new do |g|
...
end
See Grancher::Task for more information.
Keeping the files already in the branch
By default, Grancher will remove any files already in the branch. Use keep and keep_all to change this behaviour:
Grancher.new do |g|
# Only keep some files/folders:
g.keep 'index.html', 'test', 'lib/grancer'
# Keep all the files in the repo:
g.keep_all
end
Instance Method Summary collapse
Instance Method Details
#commit(msg, opts = {}) ⇒ Object
70 71 72 73 74 75 |
# File 'lib/grancher.rb', line 70 def commit(msg, opts={}) return unless changed? || opts[:force] commit = commit_tree(to_tree!, msg) @sha1 = git_tree_sha1 commit end |