Class: Gitti::GitProject

Inherits:
Object
  • Object
show all
Defined in:
lib/gitti/project.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ GitProject

Returns a new instance of GitProject.

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'lib/gitti/project.rb', line 8

def initialize( path )
  raise ArgumentError, "dir >#{path}< not found; dir MUST already exist for GitProject class - sorry"   unless Dir.exist?( path )
  raise ArgumentError, "dir >#{path}/.git< not found; dir MUST already be initialized with git for GitProject class - sorry"  unless Dir.exist?( "#{path}/.git" )
  @path = path
end

Class Method Details

.open(path, &blk) ⇒ Object



4
5
6
# File 'lib/gitti/project.rb', line 4

def self.open( path, &blk )
  new( path ).open( &blk )
end

Instance Method Details

#add(*pathspecs) ⇒ Object



38
# File 'lib/gitti/project.rb', line 38

def add( *pathspecs )         Git.add( *pathspecs ); end

#add_allObject



39
# File 'lib/gitti/project.rb', line 39

def add_all()                 Git.add_all; end

#branchObject

branch management



53
# File 'lib/gitti/project.rb', line 53

def branch()                  Git.branch; end

#changesObject



25
# File 'lib/gitti/project.rb', line 25

def changes()                 Git.changes; end

#changes?Boolean Also known as: dirty?

Returns:

  • (Boolean)


27
# File 'lib/gitti/project.rb', line 27

def changes?()                Git.changes?; end

#clean?Boolean

Returns:

  • (Boolean)


26
# File 'lib/gitti/project.rb', line 26

def clean?()                  Git.clean?; end

#commit(message) ⇒ Object



40
# File 'lib/gitti/project.rb', line 40

def commit( message )         Git.commit( message ); end

#fast_forwardObject Also known as: ff



33
# File 'lib/gitti/project.rb', line 33

def fast_forward()            Git.fast_forward; end

#fetchObject



31
# File 'lib/gitti/project.rb', line 31

def fetch()                   Git.fetch; end

#filesObject



42
# File 'lib/gitti/project.rb', line 42

def files()                   Git.files; end

#main?Boolean

Returns:

  • (Boolean)


55
# File 'lib/gitti/project.rb', line 55

def main?()                   Git.main?; end

#master?Boolean

Returns:

  • (Boolean)


54
# File 'lib/gitti/project.rb', line 54

def master?()                 Git.master?; end

#open(&blk) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/gitti/project.rb', line 15

def open( &blk )
  ## puts "Dir.getwd: #{Dir.getwd}"
  Dir.chdir( @path ) do
    blk.call( self )
  end
  ## puts "Dir.getwd: #{Dir.getwd}"
end

#originObject



47
# File 'lib/gitti/project.rb', line 47

def origin()                  Git.origin; end

#origin?Boolean

Returns:

  • (Boolean)


49
# File 'lib/gitti/project.rb', line 49

def origin?()                 Git.origin?; end

#pullObject



32
# File 'lib/gitti/project.rb', line 32

def pull()                    Git.pull; end

#pushObject



36
# File 'lib/gitti/project.rb', line 36

def push()                    Git.push; end

#remoteObject

remote show origin|upstream|etc.



46
# File 'lib/gitti/project.rb', line 46

def remote()                  Git.remote; end

#run(cmd) ⇒ Object



58
# File 'lib/gitti/project.rb', line 58

def run( cmd )                Git::Shell.run( cmd ); end

#status(short: false) ⇒ Object



24
# File 'lib/gitti/project.rb', line 24

def status( short: false )    Git.status( short: short ); end

#upstreamObject



48
# File 'lib/gitti/project.rb', line 48

def upstream()                Git.upstream; end

#upstream?Boolean

Returns:

  • (Boolean)


50
# File 'lib/gitti/project.rb', line 50

def upstream?()               Git.upstream?; end