Skip to content

Commit

Permalink
Resolves issue-4 and issue-5 See:
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamcat4 committed Apr 4, 2010
1 parent 94cb3a2 commit 7ca29d5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/grancher.rb
Expand Up @@ -66,7 +66,7 @@
#
#
class Grancher
attr_accessor :branch, :push_to, :repo, :message
attr_accessor :branch, :refspec, :push_to, :repo, :message
attr_reader :gash, :files, :directories

def initialize(&blk)
Expand Down Expand Up @@ -100,17 +100,27 @@ def file(from, to = nil)

# Keeps the files (or directories) given.
def keep(*files)
@keep.concat(files)
@keep.concat(files.flatten)
end

# Keep all the files in the branch.
def keep_all
@keep_all = true
end

def refspec=(refspec)
@branch = refspec.match(/^\+?(.*)\:/)[1] || "master"
@refspec = refspec
end

def branch=(branch)
@refspec = "#{branch}:refs/heads/#{branch}"
@branch = branch
end

# Pushes the branch to the remote.
def push
gash.send(:git, 'push', @push_to, @branch + ':refs/heads/' + @branch)
gash.send(:git, 'push', @push_to, @refspec)
end

# Commits the changes.
Expand Down

0 comments on commit 7ca29d5

Please sign in to comment.