class Dpl::Providers::Pages::Git
Public Instance Methods
Source
# File lib/dpl/providers/pages/git.rb, line 98 def deploy git_clone? ? git_clone : git_init copy_files return info :stop if git_clone? && !git_dirty? git_config git_commit git_push git_status if verbose? end
Source
# File lib/dpl/providers/pages/git.rb, line 81 def login token? ? login_token : setup_deploy_key end
Source
# File lib/dpl/providers/pages/git.rb, line 91 def prepare info :deploy info :keep_history if keep_history? debug :work_dir Dir.chdir(work_dir) end
Source
# File lib/dpl/providers/pages/git.rb, line 85 def setup info :setup_dir, src_dir info :committer_from_gh if committer_from_gh? info :git_config end
Private Instance Methods
Source
# File lib/dpl/providers/pages/git.rb, line 244 def api @api ||= Octokit::Client.new(access_token: token, api_endpoint:) end
Source
# File lib/dpl/providers/pages/git.rb, line 248 def api_endpoint opts[:url] == 'github.com' ? 'https://api.github.com/' : "https://#{opts[:url]}/api/v3/" end
Source
# File lib/dpl/providers/pages/git.rb, line 141 def copy_files shell :copy_files end
Source
# File lib/dpl/providers/pages/git.rb, line 256 def debug(*args) info(*args) if verbose? end
Source
# File lib/dpl/providers/pages/git.rb, line 194 def email str = super if email? str ||= user.email if committer_from_gh? str || git_author_email end
Calls superclass method
Source
# File lib/dpl/providers/pages/git.rb, line 168 def git_branch_exists? git_ls_remote?(remote_url, target_branch) end
Source
# File lib/dpl/providers/pages/git.rb, line 132 def git_clone shell :git_clone, echo: false end
Source
# File lib/dpl/providers/pages/git.rb, line 128 def git_clone? keep_history? && git_branch_exists? end
Source
# File lib/dpl/providers/pages/git.rb, line 150 def git_commit info :prepare shell :git_commit_hook, path: asset(:git, :detect_private_key).path, echo: false if deploy_key? shell :deployment_file if deployment_file? shell :cname if fqdn? shell :git_add shell :git_commit shell :git_show end
Source
# File lib/dpl/providers/pages/git.rb, line 176 def git_commit_msg_opts msg = interpolate(commit_message, vars:) msg.split("\n").reject(&:empty?).map { |message| %(-m #{quote(message)}) } end
Source
# File lib/dpl/providers/pages/git.rb, line 172 def git_commit_opts ' --allow-empty' if allow_empty_commit? end
Source
# File lib/dpl/providers/pages/git.rb, line 145 def git_config shell :git_config_name, echo: false shell :git_config_email, echo: false end
Source
# File lib/dpl/providers/pages/git.rb, line 136 def git_init shell :git_init shell :git_checkout end
Source
# File lib/dpl/providers/pages/git.rb, line 160 def git_push shell :git_push, echo: false end
Source
# File lib/dpl/providers/pages/git.rb, line 181 def git_push_opts ' --force' unless keep_history? end
Source
# File lib/dpl/providers/pages/git.rb, line 164 def git_status shell 'git status' end
Source
# File lib/dpl/providers/pages/git.rb, line 217 def git_url "git@#{opts[:url]}:#{slug}.git" end
Source
# File lib/dpl/providers/pages/git.rb, line 213 def https_url_with_token "https://#{token}@#{url}" end
Source
# File lib/dpl/providers/pages/git.rb, line 111 def login_token user.login info :login, user.login error :insufficient_scopes unless sufficient_scopes? rescue Octokit::Unauthorized => e error :invalid_token, e.message end
Source
# File lib/dpl/providers/pages/git.rb, line 185 def name str = super if name? str ||= user.name if committer_from_gh? str ||= git_author_name str = "#{str} (via Travis CI)" if ENV['TRAVIS'] && !name? str end
Calls superclass method
Source
# File lib/dpl/providers/pages/git.rb, line 201 def project_name super || fqdn || repo_slug end
Calls superclass method
Source
# File lib/dpl/providers/pages/git.rb, line 209 def remote_url token? ? https_url_with_token : git_url end
Source
# File lib/dpl/providers/pages/git.rb, line 119 def setup_deploy_key path = '~/.dpl/deploy_key' info(:setup_deploy_key, path:) mv deploy_key, path chmod 0o600, path setup_git_ssh path shell :check_deploy_key, key: path, url: opts[:url] end
Source
# File lib/dpl/providers/pages/git.rb, line 236 def src_dir @src_dir ||= expand(local_dir) end
Source
# File lib/dpl/providers/pages/git.rb, line 205 def sufficient_scopes? api.scopes.include?('public_repo') || api.scopes.include?('repo') end
Source
# File lib/dpl/providers/pages/git.rb, line 221 def url "#{opts[:url]}/#{slug}.git" end
Source
# File lib/dpl/providers/pages/git.rb, line 229 def user @user ||= api.user rescue StandardError => e puts "ERR: #{e.inspect}" puts e.backtrace end
Source
# File lib/dpl/providers/pages/git.rb, line 240 def work_dir @work_dir ||= tmp_dir end