Class: FastlaneCraft::TagReleaseManager
- Inherits:
-
Object
- Object
- FastlaneCraft::TagReleaseManager
- Includes:
- FastlaneCore, Gem
- Defined in:
- lib/fastlane-craft/tag_release_manager.rb
Instance Method Summary collapse
- #archive ⇒ Object
- #bump_version ⇒ Object
-
#initialize(scheme, info_plist, extra_info_plists, branch, tag, target_suffix = nil) ⇒ TagReleaseManager
constructor
A new instance of TagReleaseManager.
- #push_version_bump ⇒ Object
- #release ⇒ Object
- #tag_valid? ⇒ Boolean
- #tag_version ⇒ Object
- #update_env ⇒ Object
- #upload_to_tf ⇒ Object
- #version_dump ⇒ Object
Constructor Details
#initialize(scheme, info_plist, extra_info_plists, branch, tag, target_suffix = nil) ⇒ TagReleaseManager
Returns a new instance of TagReleaseManager.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fastlane-craft/tag_release_manager.rb', line 15 def initialize(scheme, info_plist, extra_info_plists, branch, tag, target_suffix = nil) raise 'Invalid Branch' if branch.empty? raise 'Invalid Scheme' if scheme.empty? raise 'Invalid Tag' if tag.nil? || tag.empty? @scheme = scheme @branch = branch @tag = tag @target_suffix = target_suffix @plist_controller = InfoPlistController.new(info_plist, extra_info_plists) end |
Instance Method Details
#archive ⇒ Object
77 78 79 80 |
# File 'lib/fastlane-craft/tag_release_manager.rb', line 77 def archive cmd = "fastlane gym --configuration Release --scheme #{@scheme} --export_method app-store" raise "Archiving failed! Command execution error: '#{cmd}'" unless system(cmd) end |
#bump_version ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fastlane-craft/tag_release_manager.rb', line 36 def bump_version msg = 'The version of the tag is less than the actual app version' UI.user_error! msg if tag_version < @plist_controller.version UI.user_error! "Tag '#{@tag}' has no suffix: '#{@target_suffix}'" unless tag_valid? return unless tag_version > @plist_controller.version @plist_controller.set_version(tag_version) @plist_controller.set_build_version(Version.new(tag_version.to_s + '.0')) UI.success "Version was successfully bumped to #{version_dump}" end |
#push_version_bump ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/fastlane-craft/tag_release_manager.rb', line 58 def push_version_bump cmd = "git add . && git commit -m 'Bump version to #{version_dump}'" raise "Git Commit Failed! Command execution error: '#{cmd}'" unless system(cmd) cmd = "git push origin HEAD:#{@branch}" raise "Git Push Failed! Command execution error: '#{cmd}'" unless system(cmd) end |
#release ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/fastlane-craft/tag_release_manager.rb', line 27 def release bump_version archive upload_to_tf update_env @plist_controller.bump_build_version_patch push_version_bump end |
#tag_valid? ⇒ Boolean
72 73 74 75 |
# File 'lib/fastlane-craft/tag_release_manager.rb', line 72 def tag_valid? return true if @target_suffix.nil? || @target_suffix.empty? @tag.end_with? @target_suffix end |
#tag_version ⇒ Object
66 67 68 69 70 |
# File 'lib/fastlane-craft/tag_release_manager.rb', line 66 def tag_version version_format = /[0-9.]+/ tag = @tag.match(version_format)[0] Version.new(tag) end |
#update_env ⇒ Object
52 53 54 55 56 |
# File 'lib/fastlane-craft/tag_release_manager.rb', line 52 def update_env ENV[SharedValues::TG_RELEASE_VERSION] = @plist_controller.version.to_s ENV[SharedValues::TG_RELEASE_BUILD_NUMBER] = @plist_controller.build_version.to_s ENV[SharedValues::TG_RELEASE_VERSION_TAG] = version_dump end |
#upload_to_tf ⇒ Object
47 48 49 50 |
# File 'lib/fastlane-craft/tag_release_manager.rb', line 47 def upload_to_tf cmd = 'fastlane pilot upload --skip_submission --skip_waiting_for_build_processing' raise "TF uploading Failed! Command execution error: '#{cmd}'" unless system(cmd) end |
#version_dump ⇒ Object
82 83 84 |
# File 'lib/fastlane-craft/tag_release_manager.rb', line 82 def version_dump "#{@plist_controller.version}/#{@plist_controller.build_version}" end |