class Object

Public Instance Methods

connected?(url) click to toggle source
# File lib/retrospec/plugins/v1/plugin/templates/clone-hook, line 37
def connected?(url)
  unless ENV['CLONE_RETROSPEC_TEMPLATES'].nil?
    # if the user wants internet but doesn't want cloning, allow them to set this variable
    return false
  end
  true
end
create_repo(template_dir, git_url, branch) click to toggle source
# File lib/retrospec/plugins/v1/plugin/templates/clone-hook, line 14
def create_repo(template_dir, git_url, branch)
  # check if repo already exists
  unless git_exists?(template_dir)
    puts `git clone -b #{branch} #{git_url} #{template_dir}`
  end
end
git_exists?(template_dir) click to toggle source
# File lib/retrospec/plugins/v1/plugin/templates/clone-hook, line 21
def git_exists?(template_dir)
  File.exist? File.join(template_dir, '.git', 'config')
end
origin_exists?(template_dir) click to toggle source
# File lib/retrospec/plugins/v1/plugin/templates/clone-hook, line 25
def origin_exists?(template_dir)
  `git --git-dir #{template_dir}/.git --work-tree #{template_dir} remote show origin`
  $CHILD_STATUS.success?
end
update_templates(git_url, dest, branch = 'master') click to toggle source
# File lib/retrospec/plugins/v1/plugin/templates/clone-hook, line 30
def update_templates(git_url, dest, branch = 'master')
  create_repo(dest, git_url, branch)
  puts "Attempting to connect to #{@template_repo}"
  puts `git --git-dir #{dest}/.git --work-tree #{dest} pull`
  dest
end