module Twit
This module exposes twit commands as methods.
Constants
- VERSION
Gem version
Public Class Methods
current_branch()
click to toggle source
See {Twit::Repo#current_branch}.
# File lib/twit.rb, line 79 def self.current_branch self.repo.current_branch end
discard()
click to toggle source
See {Twit::Repo#discard}. (WARNING: PERMANENTLY DESTROYS DATA!)
# File lib/twit.rb, line 59 def self.discard self.repo.discard end
init(dir = nil)
click to toggle source
Initialize a git repository in a directory. Return a Twit::Repo
object representing the new repository.
If no argument is supplied, use the working directory.
If init is called on a directory that is already part of a repository, simply do nothing.
# File lib/twit.rb, line 23 def self.init dir = nil dir ||= Dir.getwd if is_repo? dir return end Rugged::Repository.init_at(dir) Repo.new dir end
is_repo?(dir = nil)
click to toggle source
Check if a given directory is a git repository.
If no argument is supplied, use the working directory.
# File lib/twit.rb, line 38 def self.is_repo? dir = nil dir ||= Dir.getwd begin root = Rugged::Repository.discover(dir) rescue Rugged::RepositoryError return false end return true end
list()
click to toggle source
See {Twit::Repo#list}.
# File lib/twit.rb, line 74 def self.list self.repo.list end
nothing_to_commit?()
click to toggle source
See {Twit::Repo#nothing_to_commit?}.
# File lib/twit.rb, line 84 def self.nothing_to_commit? self.repo.nothing_to_commit? end
open(branch)
click to toggle source
See {Twit::Repo#open}.
# File lib/twit.rb, line 64 def self.open branch self.repo.open branch end
repo()
click to toggle source
Get a {Twit::Repo} representing the repository for the current working directory.
# File lib/twit.rb, line 12 def self.repo Twit::Repo.new end
rewind(amount)
click to toggle source
See {Twit::Repo#rewind}.
# File lib/twit.rb, line 69 def self.rewind amount self.repo.rewind amount end
save(message)
click to toggle source
See {Twit::Repo#save}.
# File lib/twit.rb, line 49 def self.save message self.repo.save message end
saveas(branch, message = nil)
click to toggle source
See {Twit::Repo#saveas}.
# File lib/twit.rb, line 54 def self.saveas branch, message = nil self.repo.saveas branch, message end