docker/pool/builder/lib/builder/git.rb
# Initialize application Git repository to clone from remote
# If the repository exists, it fetches the latest
Initialize application Git repository to clone from remote
If the repository exists, it fetches the latest
Initialize application Git repository to clone from remote If the repository exists it fetches the latest
def init_repo(url, path, logger, opts = {})
      logger.info "repository url: #{url}"
      if opts[:workspace_dir]
        workspace_path = File.join(File.dirname(path), WORKSPACE_BASE_DIR, opts[:workspace_dir])
      else
        workspace_path = path
      end
      if FileTest.exist?(workspace_path)
        logger.info "repository workspace_path exists: #{workspace_path}"
        rgit = ::Git.open(workspace_path, :log => logger)
        logger.info rgit.fetch unless opts[:no_fetch]
      else
        logger.info "repository workspace_path doesn't exist: #{workspace_path}"
        app_repository_name = workspace_path.split('/').last
        logger.info "cloning: #{[url, app_repository_name, File.basename(workspace_path)].join(",")}"
        rgit = ::Git.clone(url,
                           app_repository_name,
                           :path => File.dirname(workspace_path),
                           :log  => logger)
      end
      return rgit
    end
def init_repo ( url , path , logger , opts = { } ) logger . info "repository url: #{url}" if opts [ :workspace_dir ] workspace_path = File . join ( File . dirname ( path ) , WORKSPACE_BASE_DIR , opts [ :workspace_dir ] ) else workspace_path = path end if FileTest . exist? ( workspace_path ) logger . info "repository workspace_path exists: #{workspace_path}" rgit = :: Git . open ( workspace_path , :log => logger ) logger . info rgit . fetch unless opts [ :no_fetch ] else logger . info "repository workspace_path doesn't exist: #{workspace_path}" app_repository_name = workspace_path . split ( '/' ) . last logger . info "cloning: #{[url, app_repository_name, File.basename(workspace_path)].join(",")}" rgit = :: Git . clone ( url , app_repository_name , :path => File . dirname ( workspace_path ) , :log => logger ) end return rgit end
Initialize application Git repository to clone from remote
If the repository exists, it fetches the latest
Initialize application Git repository to clone from remote If the repository exists it fetches the latest
url
path
logger
opts