Class: Pbmenv::DownloadSrcService
- Inherits:
-
Object
- Object
- Pbmenv::DownloadSrcService
- Defined in:
- lib/pbmenv/services/download_src_service.rb
Defined Under Namespace
Classes: DownloadError
Instance Attribute Summary collapse
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(version) ⇒ DownloadSrcService
constructor
A new instance of DownloadSrcService.
Constructor Details
#initialize(version) ⇒ DownloadSrcService
Returns a new instance of DownloadSrcService.
7 8 9 |
# File 'lib/pbmenv/services/download_src_service.rb', line 7 def initialize(version) self.version = version end |
Instance Attribute Details
#version ⇒ Object
Returns the value of attribute version.
5 6 7 |
# File 'lib/pbmenv/services/download_src_service.rb', line 5 def version @version end |
Instance Method Details
#execute! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pbmenv/services/download_src_service.rb', line 11 def execute! pathname = VersionPathname.new(version) pathname.src_pbm_path if ENV["DEBUG_INSTALL"] shell = <<~SHELL git clone https://github.com/splaplapla/procon_bypass_man.git #{pathname.src_pbm_path} SHELL else # TODO cache for testing shell = <<~SHELL curl -L https://github.com/splaplapla/procon_bypass_man/archive/refs/tags/v#{version}.tar.gz | tar xvz -C /tmp > /dev/null 2>&1 SHELL end if Helper.system_and_puts(shell) unless File.exist?(pathname.src_pbm_project_template_path) raise Pbmenv::CreateVersionService::NotSupportVersionError, "This version is not support by pbmenv" end else raise DownloadError end end |