Class: FastlaneCraft::AppReleaseManager
- Inherits:
-
Object
- Object
- FastlaneCraft::AppReleaseManager
- Includes:
- FastlaneCore, Gem
- Defined in:
- lib/fastlane-craft/app_release_manager.rb
Instance Method Summary collapse
- #archive ⇒ Object
- #bump_version ⇒ Object
- #curr_git_tag ⇒ Object
- #existing_git_tag ⇒ Object
- #git_tags ⇒ Object
-
#initialize(scheme, info_plist, extra_info_plists, branch, version = nil, target_suffix = nil) ⇒ AppReleaseManager
constructor
A new instance of AppReleaseManager.
- #push_git_tag ⇒ Object
- #push_version_bump ⇒ Object
- #release ⇒ Object
- #remove_existing_git_tag ⇒ Object
- #update_env ⇒ Object
- #upload_to_tf ⇒ Object
- #version_dump ⇒ Object
- #version_valid?(version) ⇒ Boolean
Constructor Details
#initialize(scheme, info_plist, extra_info_plists, branch, version = nil, target_suffix = nil) ⇒ AppReleaseManager
Returns a new instance of AppReleaseManager.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 15 def initialize(scheme, info_plist, extra_info_plists, branch, version = nil, target_suffix = nil) raise 'Invalid Branch' if branch.empty? raise 'Invalid Scheme' if scheme.empty? raise 'Invalid Version' if version && !version_valid?(version) @scheme = scheme @branch = branch @target_suffix = target_suffix @plist_controller = InfoPlistController.new(info_plist, extra_info_plists) @version = version.nil? ? @plist_controller.version : Version.new(version) end |
Instance Method Details
#archive ⇒ Object
71 72 73 74 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 71 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
39 40 41 42 43 44 45 46 47 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 39 def bump_version msg = 'Given version is less than the actual app version' UI.user_error! msg if @version < @plist_controller.version return unless @version > @plist_controller.version @plist_controller.set_version(@version) @plist_controller.set_build_version(Version.new(@version.to_s + '.0')) UI.success "Version was successfully bumped to #{version_dump}" end |
#curr_git_tag ⇒ Object
91 92 93 94 95 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 91 def curr_git_tag return @version.to_s unless @target_suffix "#{@version}_#{@target_suffix}" end |
#existing_git_tag ⇒ Object
97 98 99 100 101 102 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 97 def existing_git_tag .detect do |t| tag_v = t.match(/[0-9.]+/)[0] version_valid?(tag_v) && Version.new(tag_v) == @version end end |
#git_tags ⇒ Object
104 105 106 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 104 def `git tag`.split("\n") end |
#push_git_tag ⇒ Object
76 77 78 79 80 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 76 def push_git_tag UI. "going to push tag: #{curr_git_tag}" cmd = "git tag #{curr_git_tag} && git push --tags" raise "Tag push failed! Command execution error: '#{cmd}'" unless system(cmd) end |
#push_version_bump ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 60 def push_version_bump cmd = "git pull origin HEAD:#{@branch}" raise "Git Pull Failed! Command execution error: '#{cmd}'" unless system(cmd) 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 35 36 37 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 27 def release bump_version archive upload_to_tf update_env @plist_controller.bump_build_version_patch push_version_bump remove_existing_git_tag push_git_tag end |
#remove_existing_git_tag ⇒ Object
82 83 84 85 86 87 88 89 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 82 def remove_existing_git_tag tag = existing_git_tag return if tag.nil? UI. "going to remove tag: #{tag}" cmd = "git tag -d #{tag} && git push origin :refs/tags/#{tag}" raise "Git tag deletion failed! Command execution error: '#{cmd}'" unless system(cmd) end |
#update_env ⇒ Object
54 55 56 57 58 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 54 def update_env ENV[SharedValues::APP_RELEASE_VERSION] = @plist_controller.version.to_s ENV[SharedValues::APP_RELEASE_BUILD_NUMBER] = @plist_controller.build_version.to_s ENV[SharedValues::APP_RELEASE_VERSION_TAG] = version_dump end |
#upload_to_tf ⇒ Object
49 50 51 52 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 49 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
112 113 114 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 112 def version_dump "#{@plist_controller.version}/#{@plist_controller.build_version}" end |
#version_valid?(version) ⇒ Boolean
108 109 110 |
# File 'lib/fastlane-craft/app_release_manager.rb', line 108 def version_valid?(version) version.to_s.match?(/^\d\.\d\.\d{1,3}$/) end |