Class: LgPodPlugin::GitDownloader
- Inherits:
-
Object
- Object
- LgPodPlugin::GitDownloader
- Defined in:
- lib/lg_pod_plugin/git/git_download.rb
Instance Attribute Summary collapse
-
#checkout_options ⇒ Object
Returns the value of attribute checkout_options.
-
#config ⇒ Object
Returns the value of attribute config.
-
#git ⇒ Object
Returns the value of attribute git.
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(checkout_options = {}) ⇒ GitDownloader
constructor
A new instance of GitDownloader.
- #is_use_gitlab_archive_file(git) ⇒ Object
Constructor Details
#initialize(checkout_options = {}) ⇒ GitDownloader
Returns a new instance of GitDownloader.
13 14 15 16 17 |
# File 'lib/lg_pod_plugin/git/git_download.rb', line 13 def initialize( = {}) self.git = [:git] self.config = [:config] self. = end |
Instance Attribute Details
#checkout_options ⇒ Object
Returns the value of attribute checkout_options.
12 13 14 |
# File 'lib/lg_pod_plugin/git/git_download.rb', line 12 def @checkout_options end |
#config ⇒ Object
Returns the value of attribute config.
11 12 13 |
# File 'lib/lg_pod_plugin/git/git_download.rb', line 11 def config @config end |
#git ⇒ Object
Returns the value of attribute git.
10 11 12 |
# File 'lib/lg_pod_plugin/git/git_download.rb', line 10 def git @git end |
Instance Method Details
#download ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/lg_pod_plugin/git/git_download.rb', line 21 def download begin if self.is_use_gitlab_archive_file(self.git) git_archive = GitLabArchive.new(self.) return git_archive.download elsif self.git.include?("https://github.com") github_archive = GitHubArchive.new(self.) return github_archive.download else git_clone = GitRepository.new() return git_clone.download end rescue LgPodPlugin.log_red "异常信息: #{$!}" LgPodPlugin.log_yellow " 异常位置: #{$@}" git_clone = GitRepository.new() return git_clone.download end end |
#is_use_gitlab_archive_file(git) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/lg_pod_plugin/git/git_download.rb', line 43 def is_use_gitlab_archive_file(git) return false unless self.config&.access_token return true if self.config.project project_name = LUtils.get_git_project_name(git) self.config.project = GitLabAPI.request_project_info(config.host, project_name, config.access_token, git) (self.config.project != nil) end |