Class: GitTest::Proj

Inherits:
Git::Base
  • Object
show all
Defined in:
lib/git_test/proj.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, notify = Notify.new) ⇒ Proj

Returns a new instance of Proj.



4
5
6
7
8
# File 'lib/git_test/proj.rb', line 4

def initialize(options = {}, notify = Notify.new)
  self.notify = notify
  path =  options[:path]||"."
  super :working_directory => path
end

Instance Attribute Details

#notifyObject

Returns the value of attribute notify.



3
4
5
# File 'lib/git_test/proj.rb', line 3

def notify
  @notify
end

Instance Method Details

#check_repo_status!Object



28
29
30
# File 'lib/git_test/proj.rb', line 28

def check_repo_status!
  repo_status_checked = true
end

#clone_to(path) ⇒ Object Also known as: clone_to_test



44
45
46
# File 'lib/git_test/proj.rb', line 44

def clone_to(path)
  Git.clone(self.repo, path)
end

#pathObject



32
33
34
# File 'lib/git_test/proj.rb', line 32

def path
  dir.to_s
end

#real_pull(remote = 'origin', branch = 'master') ⇒ Object



23
24
25
26
# File 'lib/git_test/proj.rb', line 23

def real_pull(remote = 'origin', branch = 'master')
  check_repo_status!
  self.lib.send :command, 'pull', [remote, branch]
end

#repo_nameObject

def test_directory

File.join(path, '..', ".tmp-git-test-dir-for-#{repo_name}")

end



40
41
42
# File 'lib/git_test/proj.rb', line 40

def repo_name
  path.split('/').last
end

#show(branch, file) ⇒ Object



18
19
20
# File 'lib/git_test/proj.rb', line 18

def show(branch, file)
  self.lib.send :command, "show", "#{branch}:#{file}"
end

#usernameObject



10
11
12
# File 'lib/git_test/proj.rb', line 10

def username
  config["user.name"]
end