Class: Gitti::GitProject
- Inherits:
-
Object
- Object
- Gitti::GitProject
- Defined in:
- lib/gitti/project.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add(*pathspecs) ⇒ Object
- #add_all ⇒ Object
-
#branch ⇒ Object
branch management.
- #changes ⇒ Object
- #changes? ⇒ Boolean (also: #dirty?)
- #clean? ⇒ Boolean
- #commit(message) ⇒ Object
- #fast_forward ⇒ Object (also: #ff)
- #fetch ⇒ Object
- #files ⇒ Object
-
#initialize(path) ⇒ GitProject
constructor
A new instance of GitProject.
- #main? ⇒ Boolean
- #master? ⇒ Boolean
- #open(&blk) ⇒ Object
- #origin ⇒ Object
- #origin? ⇒ Boolean
- #pull ⇒ Object
- #push ⇒ Object
-
#remote ⇒ Object
remote show origin|upstream|etc.
- #run(cmd) ⇒ Object
- #status(short: false) ⇒ Object
- #upstream ⇒ Object
- #upstream? ⇒ Boolean
Constructor Details
#initialize(path) ⇒ GitProject
Returns a new instance of GitProject.
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 |
#branch ⇒ Object
branch management
53 |
# File 'lib/gitti/project.rb', line 53 def branch() Git.branch; end |
#changes? ⇒ Boolean Also known as: dirty?
27 |
# File 'lib/gitti/project.rb', line 27 def changes?() Git.changes?; end |
#commit(message) ⇒ Object
40 |
# File 'lib/gitti/project.rb', line 40 def commit( ) Git.commit( ); end |
#fast_forward ⇒ Object Also known as: ff
33 |
# File 'lib/gitti/project.rb', line 33 def fast_forward() Git.fast_forward; 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 |
#remote ⇒ Object
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 |