fastlane-craft 1.2.20 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 338e990c3986c5756d2f66657cad0092d54ff21207149071f2a2ac1a49f20d2a
4
- data.tar.gz: 0d3d43b1c10dce96cf8b77d4952858a44c5902c105331c76f900a11e09bf855a
3
+ metadata.gz: 3d0d618deaa5a2cff0c480fabe7d4eb532d71169ab7aa652ddb58b2163f5607b
4
+ data.tar.gz: ee70728a5f9842eb4bd5afcf11da80affc887ed4be11e36cf39203ef51f720a0
5
5
  SHA512:
6
- metadata.gz: 0ef872795d18f4cdbbc3b2f404f61d86ac4092e2ee784338aa4bd492b6bfc9469f4969945ac9460e019ef10efea9c583db0e76c5210b523e984826fc35579b6f
7
- data.tar.gz: 854a4d27a061532bc75bdac1801c9cc1cfdc4137a5edf409e1c1d33570c448b61f0f664871af3bca438de35e054ac8a596e4a510c8afead0404695c341c33a54
6
+ metadata.gz: 51b34e57ec9f993e6ea5da4c385742ea2b59be4afcce69b500d930bd0a348d98962304950665d87081af43c36498dc730a35074a5254fb342fded32e5ac94565
7
+ data.tar.gz: bb572c901ee9dec55f96fb69eb6e09a5d4b8568a2017a5bf242b9ab478af22f04c758486803ea6b32bef602e0f581a6f542dd2a996be050d0bbae285bc9cc864
@@ -1,6 +1,6 @@
1
1
  require_relative 'fastlane-craft/version'
2
2
  require_relative 'fastlane-craft/telegram'
3
- require_relative 'fastlane-craft/tag_release'
3
+ require_relative 'fastlane-craft/app_release'
4
4
 
5
5
  module FastlaneCraft
6
6
  end
@@ -1,15 +1,15 @@
1
- require_relative 'tag_release_manager'
1
+ require_relative 'app_release_manager'
2
2
 
3
3
  module Fastlane
4
4
  module Actions
5
- class TagReleaseAction < Action
5
+ class AppReleaseAction < Action
6
6
  def self.run(params)
7
- FastlaneCraft::TagReleaseManager.new(
7
+ FastlaneCraft::AppReleaseManager.new(
8
8
  params[:scheme],
9
9
  params[:info_plist],
10
10
  params[:extra_info_plists],
11
11
  params[:branch],
12
- params[:tag] || Actions.last_git_tag_name,
12
+ params[:version],
13
13
  params[:target_suffix]
14
14
  ).release
15
15
  end
@@ -19,11 +19,11 @@ module Fastlane
19
19
  #####################################################
20
20
 
21
21
  def self.description
22
- 'Release app according to the latest tag'
22
+ 'Release app according to the version'
23
23
  end
24
24
 
25
25
  def self.details
26
- 'Release app according to the latest tag'
26
+ 'Release app according to the version'
27
27
  end
28
28
 
29
29
  def self.available_options
@@ -62,8 +62,8 @@ module Fastlane
62
62
  end
63
63
  ),
64
64
  FastlaneCore::ConfigItem.new(
65
- key: :tag,
66
- description: 'git tag',
65
+ key: :version,
66
+ description: 'app version (like 1.1.0)',
67
67
  optional: true
68
68
  ),
69
69
  FastlaneCore::ConfigItem.new(
@@ -76,16 +76,16 @@ module Fastlane
76
76
 
77
77
  def self.example_code
78
78
  [
79
- 'tag_release(
79
+ 'app_release(
80
80
  scheme: "AppScheme",
81
81
  info_plist: "/path/to/info/plist"
82
82
  )',
83
- 'tag_release(
83
+ 'app_release(
84
84
  scheme: "Application",
85
85
  info_plist: "/path/to/info/plist",
86
86
  extra_info_plists: ["plist1", "plist2"],
87
87
  branch: "master",
88
- tag: "2.3.0",
88
+ version: "2.3.0",
89
89
  target_suffix: "_sfx"
90
90
  )'
91
91
  ]
@@ -0,0 +1,110 @@
1
+ require_relative 'info_plist_controller'
2
+ require 'fastlane_core/ui/ui'
3
+
4
+ module FastlaneCraft
5
+ module SharedValues
6
+ APP_RELEASE_VERSION = 'APP_RELEASE_VERSION'.freeze
7
+ APP_RELEASE_BUILD_NUMBER = 'APP_RELEASE_BUILD_NUMBER'.freeze
8
+ APP_RELEASE_VERSION_TAG = 'APP_RELEASE_VERSION_TAG'.freeze
9
+ end
10
+
11
+ class AppReleaseManager
12
+ include FastlaneCore
13
+ include Gem
14
+
15
+ def initialize(scheme, info_plist, extra_info_plists, branch, version = nil, target_suffix = nil)
16
+ raise 'Invalid Branch' if branch.empty?
17
+ raise 'Invalid Scheme' if scheme.empty?
18
+ raise 'Invalid Version' if version && !version_valid?(version)
19
+
20
+ @scheme = scheme
21
+ @branch = branch
22
+ @target_suffix = target_suffix
23
+ @plist_controller = InfoPlistController.new(info_plist, extra_info_plists)
24
+ @version = Version.new(version) || @plist_controller.version
25
+ end
26
+
27
+ def release
28
+ bump_version
29
+ archive
30
+ upload_to_tf
31
+ update_env
32
+ @plist_controller.bump_build_version_patch
33
+ push_version_bump
34
+
35
+ remove_last_git_tag_if_needed
36
+ push_git_tag
37
+ end
38
+
39
+ def bump_version
40
+ msg = 'Given version is less than the actual app version'
41
+ UI.user_error! msg if @version < @plist_controller.version
42
+ return unless @version > @plist_controller.version
43
+
44
+ @plist_controller.set_version(@version)
45
+ @plist_controller.set_build_version(Version.new(@version.to_s + '.0'))
46
+ UI.success "Version was successfully bumped to #{version_dump}"
47
+ end
48
+
49
+ def upload_to_tf
50
+ cmd = 'fastlane pilot upload --skip_submission --skip_waiting_for_build_processing'
51
+ raise "TF uploading Failed! Command execution error: '#{cmd}'" unless system(cmd)
52
+ end
53
+
54
+ def update_env
55
+ ENV[SharedValues::APP_RELEASE_VERSION] = @plist_controller.version.to_s
56
+ ENV[SharedValues::APP_RELEASE_BUILD_NUMBER] = @plist_controller.build_version.to_s
57
+ ENV[SharedValues::APP_RELEASE_VERSION_TAG] = version_dump
58
+ end
59
+
60
+ def push_version_bump
61
+ cmd = "git add . && git commit -m 'Bump version to #{version_dump}'"
62
+ raise "Git Commit Failed! Command execution error: '#{cmd}'" unless system(cmd)
63
+
64
+ cmd = "git push origin HEAD:#{@branch}"
65
+ raise "Git Push Failed! Command execution error: '#{cmd}'" unless system(cmd)
66
+ end
67
+
68
+ def archive
69
+ cmd = "fastlane gym --configuration Release --scheme #{@scheme} --export_method app-store"
70
+ raise "Archiving failed! Command execution error: '#{cmd}'" unless system(cmd)
71
+ end
72
+
73
+ def push_git_tag
74
+ cmd = "git tag #{git_tag} && git push --tags"
75
+ raise "Tag push failed! Command execution error: '#{cmd}'" unless system(cmd)
76
+ end
77
+
78
+ def remove_last_git_tag
79
+ tag = last_git_tag
80
+ cmd = "git tag -d #{tag} && git push origin :refs/tags/#{tag}"
81
+ raise "Git tag deletion failed! Command execution error: '#{cmd}'" unless system(cmd)
82
+ end
83
+
84
+ def remove_last_git_tag_if_needed
85
+ remove_last_git_tag if last_git_tag_version == @version
86
+ end
87
+
88
+ def git_tag
89
+ return @version.to_s unless @target_suffix
90
+ "#{@version}_#{@target_suffix}"
91
+ end
92
+
93
+ def last_git_tag_version
94
+ tag = last_git_tag.match(/[0-9.]+/)[0]
95
+ version_valid?(tag) ? Version.new(tag) : nil
96
+ end
97
+
98
+ def last_git_tag
99
+ Actions.last_git_tag_name
100
+ end
101
+
102
+ def version_valid?(v)
103
+ v.to_s.match?(/^\d\.\d\.\d{1,3}$/)
104
+ end
105
+
106
+ def version_dump
107
+ "#{@plist_controller.version}/#{@plist_controller.build_version}"
108
+ end
109
+ end
110
+ end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCraft
2
- VERSION = '1.2.20'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-craft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.20
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sroik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-04 00:00:00.000000000 Z
12
+ date: 2018-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fastlane
@@ -116,9 +116,9 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - lib/fastlane-craft.rb
119
+ - lib/fastlane-craft/app_release.rb
120
+ - lib/fastlane-craft/app_release_manager.rb
119
121
  - lib/fastlane-craft/info_plist_controller.rb
120
- - lib/fastlane-craft/tag_release.rb
121
- - lib/fastlane-craft/tag_release_manager.rb
122
122
  - lib/fastlane-craft/telegram.rb
123
123
  - lib/fastlane-craft/telegram_notifier.rb
124
124
  - lib/fastlane-craft/version.rb
@@ -1,86 +0,0 @@
1
- require_relative 'info_plist_controller'
2
- require 'fastlane_core/ui/ui'
3
-
4
- module FastlaneCraft
5
- module SharedValues
6
- TG_RELEASE_VERSION = 'TG_RELEASE_VERSION'.freeze
7
- TG_RELEASE_BUILD_NUMBER = 'TG_RELEASE_BUILD_NUMBER'.freeze
8
- TG_RELEASE_VERSION_TAG = 'TG_RELEASE_VERSION_TAG'.freeze
9
- end
10
-
11
- class TagReleaseManager
12
- include FastlaneCore
13
- include Gem
14
-
15
- def initialize(scheme, info_plist, extra_info_plists, branch, tag, target_suffix = nil)
16
- raise 'Invalid Branch' if branch.empty?
17
- raise 'Invalid Scheme' if scheme.empty?
18
- raise 'Invalid Tag' if tag.nil? || tag.empty?
19
-
20
- @scheme = scheme
21
- @branch = branch
22
- @tag = tag
23
- @target_suffix = target_suffix
24
- @plist_controller = InfoPlistController.new(info_plist, extra_info_plists)
25
- end
26
-
27
- def release
28
- bump_version
29
- archive
30
- upload_to_tf
31
- update_env
32
- @plist_controller.bump_build_version_patch
33
- push_version_bump
34
- end
35
-
36
- def bump_version
37
- msg = 'The version of the tag is less than the actual app version'
38
- UI.user_error! msg if tag_version < @plist_controller.version
39
- UI.user_error! "Tag '#{@tag}' has no suffix: '#{@target_suffix}'" unless tag_valid?
40
- return unless tag_version > @plist_controller.version
41
-
42
- @plist_controller.set_version(tag_version)
43
- @plist_controller.set_build_version(Version.new(tag_version.to_s + '.0'))
44
- UI.success "Version was successfully bumped to #{version_dump}"
45
- end
46
-
47
- def upload_to_tf
48
- cmd = 'fastlane pilot upload --skip_submission --skip_waiting_for_build_processing'
49
- raise "TF uploading Failed! Command execution error: '#{cmd}'" unless system(cmd)
50
- end
51
-
52
- def update_env
53
- ENV[SharedValues::TG_RELEASE_VERSION] = @plist_controller.version.to_s
54
- ENV[SharedValues::TG_RELEASE_BUILD_NUMBER] = @plist_controller.build_version.to_s
55
- ENV[SharedValues::TG_RELEASE_VERSION_TAG] = version_dump
56
- end
57
-
58
- def push_version_bump
59
- cmd = "git add . && git commit -m 'Bump version to #{version_dump}'"
60
- raise "Git Commit Failed! Command execution error: '#{cmd}'" unless system(cmd)
61
-
62
- cmd = "git push origin HEAD:#{@branch}"
63
- raise "Git Push Failed! Command execution error: '#{cmd}'" unless system(cmd)
64
- end
65
-
66
- def tag_version
67
- version_format = /[0-9.]+/
68
- tag = @tag.match(version_format)[0]
69
- Version.new(tag)
70
- end
71
-
72
- def tag_valid?
73
- return true if @target_suffix.nil? || @target_suffix.empty?
74
- @tag.end_with? @target_suffix
75
- end
76
-
77
- def archive
78
- cmd = "fastlane gym --configuration Release --scheme #{@scheme} --export_method app-store"
79
- raise "Archiving failed! Command execution error: '#{cmd}'" unless system(cmd)
80
- end
81
-
82
- def version_dump
83
- "#{@plist_controller.version}/#{@plist_controller.build_version}"
84
- end
85
- end
86
- end