Module: GitHelper

Includes:
Paths
Included in:
MasterStarter, SlaveDeinitializer, SlaveInitializer, SlaveStarter
Defined in:
lib/nixenvironment/jenkins/Modules/git_helper.rb

Instance Method Summary collapse

Methods included from Paths

#path_to_backup, #path_to_environment, #path_to_provisioning_updater, #root_jenkins_path

Instance Method Details

#clone_environmentObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/nixenvironment/jenkins/Modules/git_helper.rb', line 13

def clone_environment
    FileUtils.mkdir_p(path_to_environment)
    
    Dir.chdir(path_to_environment) do
        unless system('git clone [email protected]:NIX_iPhone_Internal/IJE.git .')
          if system('git clone [email protected]:NIX_iPhone_Internal/IJE.git .')
            `git remote set-url origin [email protected]:NIX_iPhone_Internal/IJE.git`
          end
        end
    end
end

#clone_provisioning_updaterObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/nixenvironment/jenkins/Modules/git_helper.rb', line 25

def clone_provisioning_updater
    FileUtils.mkdir_p(path_to_provisioning_updater)

    Dir.chdir(path_to_provisioning_updater) do
      unless system('git clone [email protected]:NIX_iPhone_Internal/NPU.git .')
        if system('git clone [email protected]:NIX_iPhone_Internal/NPU.git .')
          `git remote set-url origin [email protected]:NIX_iPhone_Internal/NPU.git`
        end
      end
    end
end

#remove_local_environmentObject



52
53
54
# File 'lib/nixenvironment/jenkins/Modules/git_helper.rb', line 52

def remove_local_environment
    FileUtils.rm_rf(path_to_environment)
end

#remove_local_provisioning_updaterObject



56
57
58
# File 'lib/nixenvironment/jenkins/Modules/git_helper.rb', line 56

def remove_local_provisioning_updater
    FileUtils.rm_rf(path_to_provisioning_updater)
end

#set_git_hookObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/nixenvironment/jenkins/Modules/git_helper.rb', line 37

def set_git_hook
    Thread.new do
        Dir.chdir(path_to_environment) do
            loop do
                if repos_changed
                    `git pull`
                    yield
                end
                
                sleep(15)
            end
        end  
    end
end