Class: Pbmenv::CreateVersionService
- Inherits:
-
Object
- Object
- Pbmenv::CreateVersionService
- Defined in:
- lib/pbmenv/services/create_version_service.rb
Defined Under Namespace
Classes: AlreadyCreatedError, NotSupportVersionError
Instance Attribute Summary collapse
-
#enable_pbm_cloud ⇒ Object
Returns the value of attribute enable_pbm_cloud.
-
#use_option ⇒ Object
Returns the value of attribute use_option.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(version:, use_option:, enable_pbm_cloud:) ⇒ CreateVersionService
constructor
A new instance of CreateVersionService.
Constructor Details
#initialize(version:, use_option:, enable_pbm_cloud:) ⇒ CreateVersionService
Returns a new instance of CreateVersionService.
10 11 12 13 14 |
# File 'lib/pbmenv/services/create_version_service.rb', line 10 def initialize(version: , use_option: , enable_pbm_cloud: ) self.version = version self.use_option = use_option self.enable_pbm_cloud = enable_pbm_cloud end |
Instance Attribute Details
#enable_pbm_cloud ⇒ Object
Returns the value of attribute enable_pbm_cloud.
8 9 10 |
# File 'lib/pbmenv/services/create_version_service.rb', line 8 def enable_pbm_cloud @enable_pbm_cloud end |
#use_option ⇒ Object
Returns the value of attribute use_option.
8 9 10 |
# File 'lib/pbmenv/services/create_version_service.rb', line 8 def use_option @use_option end |
#version ⇒ Object
Returns the value of attribute version.
8 9 10 |
# File 'lib/pbmenv/services/create_version_service.rb', line 8 def version @version end |
Instance Method Details
#execute! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pbmenv/services/create_version_service.rb', line 16 def execute! pathname = VersionPathname.new(version) if File.exist?(pathname.version_path) raise AlreadyCreatedError end begin download_src(version) build_app_file create_if_miss_shared_dir create_if_miss_device_id_file link_device_id_file(version: version) create_if_miss_current_dir(version: version) rescue DownloadSrcService::DownloadError puts "Download failed. Check the version name." raise NotSupportVersionError rescue => e Helper.system_and_puts "rm -rf #{pathname.version_path}" raise ensure if Dir.exist?(pathname.src_pbm_path) Helper.system_and_puts "rm -rf #{pathname.src_pbm_path}" end end return true end |