Module: Cuken::Api::Git
- Includes:
- Aruba::Api, Clone, Common, Repository
- Defined in:
- lib/cuken/api/git.rb,
lib/cuken/api/git/clone.rb,
lib/cuken/api/git/common.rb,
lib/cuken/api/git/repository.rb
Defined Under Namespace
Modules: Clone, Common, Repository
Constant Summary
Constants included from Aruba::Api
Aruba::Api::DEFAULT_IO_WAIT_SECONDS, Aruba::Api::DEFAULT_TIMEOUT_SECONDS
Instance Attribute Summary
Attributes included from Common
#git_uri, #local_git_repo, #remote_git_repo
Instance Method Summary collapse
-
#git_clone_repo(repo_path, repo = git.remote_git_repo, type = {'branch' => 'master'}, deep_clone = true) ⇒ Object
TODO: Refactor with chef_clone_repo method.
Methods included from Aruba::Api
#_create_file, #_ensure_newline, #_mkdir, #_write_interactive, #all_output, #all_stderr, #all_stdout, #announce_or_puts, #append_to_file, #assert_exact_output, #assert_exit_status_and_output, #assert_exit_status_and_partial_output, #assert_exiting_with, #assert_failing_with, #assert_partial_output, #assert_passing_with, #cd, #check_directory_presence, #check_exact_file_content, #check_file_content, #check_file_presence, #create_dir, #current_dir, #current_ruby, #detect_ruby, #dirs, #exit_timeout, #get_process, #in_dir, #io_wait, #only_processes, #original_env, #output_from, #overwrite_file, #prep_for_fs_check, #processes, #regexp, #register_process, #remove_file, #restore_env, #run, #run_interactive, #run_simple, #set_env, #stderr_from, #stdout_from, #stop_processes!, #type, #unescape, #unset_bundler_env_vars, #use_clean_gemset, #write_file
Methods included from Repository
#check_repository_presence, #check_repository_table_presence, #parse_to_repository_path
Methods included from Common
Instance Method Details
#git_clone_repo(repo_path, repo = git.remote_git_repo, type = {'branch' => 'master'}, deep_clone = true) ⇒ Object
TODO: Refactor with chef_clone_repo method
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cuken/api/git.rb', line 34 def git_clone_repo(repo_path, repo = git.remote_git_repo, type = {'branch' => 'master'} , deep_clone = true) in_dir do pth = Pathname(repo_path). gritty = ::Grit::Git.new((pth + '.git').to_s) announce_or_puts gritty.inspect clone_opts = {:quiet => false, :verbose => true, :progress => true} clone_opts[:depth] = 1 unless deep_clone type['branch'] = type['branch'].nil? ? '' : type['branch'] type['tag'] = type['tag'].nil? ? '' : type['tag'] type['ref'] = type['ref'].nil? ? '' : type['ref'] if pth.directory? announce_or_puts "Pulling: #{repo} into #{pth}" FileUtils.cd(pth.to_s) do res = gritty.pull(clone_opts, repo) end clone_opts[:branch] = type['branch'].empty? ? 'master' : type['branch'] else clone_opts[:branch] = type['branch'].empty? ? 'master' : type['branch'] announce_or_puts "Cloning: #{repo} into #{pth}" res = gritty.clone(clone_opts, repo, pth.to_s) end clone_pull_error_check(res) if res grotty = ::Grit::Git.new((pth + '.git').to_s) grotty.checkout( { :B => clone_opts[:branch]||'master' } ) if !type['tag'].empty? || !type['ref'].empty? grotty.checkout( { :B => true }, 'cuken', type['tag']||type['ref'] ) else grotty.checkout( { :B => true }, 'cuken' ) end pth end end |