class OhlohScm::GitSvn::Scm
Public Class Methods
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 6 def initialize(core:, url:, branch_name:, username:, password:) super @branch_name = branch_name || :master end
Calls superclass method
OhlohScm::Scm::new
Public Instance Methods
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 16 def accept_ssl_certificate_cmd File.expand_path('../../../.bin/accept_svn_ssl_certificate', __dir__) end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 24 def checkout_files(names) filenames = names.map { |name| "*#{name}" }.join(' ') run "cd #{url} && git checkout $(git ls-files #{filenames})" end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 11 def pull(source_scm, callback) @source_scm = source_scm convert_to_git(callback) end
Private Instance Methods
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 57 def accept_certificate_if_prompted # git svn does not support non iteractive and serv-certificate options # Permanently accept svn certificate when it prompts opts = username_and_password_opts run "#{accept_ssl_certificate_cmd} svn info #{opts} '#{@source_scm.url}'" end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 88 def clean_up_disk return unless File.exist?(url) run "cd #{url} && "\ "find . -maxdepth 1 -not -name .git -not -name '*.nfs*' -not -name . -print0"\ ' | xargs -0 rm -rf --' end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 48 def clone prepare_dest_dir accept_certificate_if_prompted cmd = "#{password_prompt} git svn clone --quiet #{username_opts}"\ " '#{@source_scm.url}' '#{url}'" run(cmd) end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 31 def convert_to_git(callback) callback.update(0, 1) if FileTest.exist?(git_path) accept_certificate_if_prompted fetch else clone end clean_up_disk callback.update(1, 1) end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 83 def fetch cmd = "cd #{url} && git svn fetch" run(cmd) end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 44 def git_path File.join(url, '/.git') end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 70 def password_prompt password.to_s.empty? ? '' : "echo #{password} |" end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 78 def prepare_dest_dir FileUtils.mkdir_p(url) FileUtils.rm_rf(url) end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 64 def username_and_password_opts username = username.to_s.empty? ? '' : "--username #{@source_scm.username}" password = password.to_s.empty? ? '' : "--password='#{@source_scm.password}'" "#{username} #{password}" end
Source
# File lib/ohloh_scm/git_svn/scm.rb, line 74 def username_opts username.to_s.empty? ? '' : "--username #{username}" end