Class: Git

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

Overview

TODO: Move to another repository (e.g.: ‘SimpleGit`)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(working_directory) ⇒ Git

Returns a new instance of Git.



25
26
27
# File 'lib/git.rb', line 25

def initialize(working_directory)
  @working_directory ||= File.absolute_path(working_directory)
end

Instance Attribute Details

#working_directoryObject (readonly)

Returns the value of attribute working_directory.



23
24
25
# File 'lib/git.rb', line 23

def working_directory
  @working_directory
end

Class Method Details

.git(method_name, cmd = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/git.rb', line 5

def self.git(method_name, cmd = nil)
  define_method(method_name) do |args|
    if cmd
      git("#{cmd} #{args}")
    else
      git("#{method_name} #{args}")
    end
  end
end

.verbose!(is_verbose = true) ⇒ Object



15
16
17
# File 'lib/git.rb', line 15

def self.verbose!(is_verbose = true)
  @verbose = is_verbose
end

.verbose?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/git.rb', line 19

def self.verbose?
  !!@verbose
end