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
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 = " git clone https://github.com/splaplapla/procon_bypass_man.git \#{pathname.src_pbm_path}\n SHELL\n else\n # TODO cache for testing\n shell = <<~SHELL\n curl -L https://github.com/splaplapla/procon_bypass_man/archive/refs/tags/v\#{version}.tar.gz | tar xvz -C /tmp > /dev/null 2>&1\n SHELL\n end\n\n if Helper.system_and_puts(shell)\n unless File.exist?(pathname.src_pbm_project_template_path)\n raise Pbmenv::CreateVersionService::NotSupportVersionError, \"This version is not support by pbmenv\"\n end\n else\n raise DownloadError\n end\nend\n" |