Class: Capistrano::Deploy::SCM::Git

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

Instance Method Summary collapse

Instance Method Details

#checkout(revision, destination) ⇒ Object



3
4
5
# File 'lib/locarails/git.rb', line 3

def checkout(revision, destination)
  sub_wrapper(:checkout_old, revision, destination)
end

#checkout_oldObject



2
# File 'lib/locarails/git.rb', line 2

alias :checkout_old :checkout

#remote_repositoryObject

force the remote git commands to fetch from the local filesystem instead making a round-trip to itself through ssh



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/locarails/git.rb', line 26

def remote_repository
  url = "#{configuration[:user]}@#{configuration[:domain]}:"
  @remote_repository ||= if configuration[:repository].include?(url)
    tmp = configuration[:repository].sub(url, "file://")
    if tmp.include?("~")
      tmp.sub!("~", "/home/#{configuration[:user]}")
    end
    tmp
  else
    configuration[:repository]
  end
  @remote_repository
end

#sub_wrapper(method, revision, destination) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/locarails/git.rb', line 12

def sub_wrapper(method, revision, destination)
  execute = send(method, revision, destination) # execute original method
  # filter the git URL to force it to a local file:// URL
  execute.collect do |line|
    if line.include?(configuration[:repository])
      line.sub(configuration[:repository], remote_repository)
    else
      line
    end
  end
end

#sync(revision, destination) ⇒ Object



8
9
10
# File 'lib/locarails/git.rb', line 8

def sync(revision, destination)
  sub_wrapper(:sync_old, revision, destination)
end

#sync_oldObject



7
# File 'lib/locarails/git.rb', line 7

alias :sync_old :sync