fastlane-craft 1.2.7 → 1.2.8

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: 935d4bc6b8077891fa5cd90feea42cc66f45c65e1128b0a8112f3fa5680c4bf6
4
- data.tar.gz: 00bb41ce3de0aef7c0e0258aa4eaacbba3432a87cd9e9a207680390646a2ebf7
3
+ metadata.gz: ed453af9060430952658fc7c3626694130a3fa41ef48c429580072ec6408d0db
4
+ data.tar.gz: 5a617fdd68fffa5c5da35bbb9eca75038b31ecf75aa6c5ae747fae5c6143d5c4
5
5
  SHA512:
6
- metadata.gz: daead6929612ace6ef3c9f399cebab0af35bc68391f4d1b487cbd37fb64ed2510a60170e6c362b6f782291afe8c78c63b093b8abb252957d8b04e96e1d947f9a
7
- data.tar.gz: 1d91977f5e487c1958891bbf11fc25052c1869f2bbd3fff47f0713e2145079077193834e7cd0f5374f1ae078c1957f94b878113984b71654ab0c949a5419974c
6
+ metadata.gz: 426de8520f37bce11b75348448ba6ead10355585cbc5f40abeba393cc9da85163da52bdade1e36f7c823e55a44b71ade01bdb6aa47d51e9a2bc03bbaabfc7777
7
+ data.tar.gz: c00e7387f47338730e748e7cd755fadfb380e00cb0be21c4b804266ddfe02fc3fceeca6c89b9fb1d41a58eab13f65ab186f5db6e6d7b47bfcb1752c18217294f
@@ -1,5 +1,3 @@
1
- require_relative 'fastlane_craft/tag_release_manager'
2
- require_relative 'fastlane_craft/telegram_notifier'
3
1
  require_relative 'fastlane_craft/version'
4
2
 
5
3
  module FastlaneCraft
@@ -1,4 +1,5 @@
1
1
  require_relative 'tag_release_manager'
2
+ require 'fastlane'
2
3
 
3
4
  module Fastlane
4
5
  module Actions
@@ -7,7 +8,11 @@ module Fastlane
7
8
 
8
9
  def self.run(params)
9
10
  TagReleaseManager.new(
10
- params[:info_plist_path],
11
+ params[:scheme],
12
+ params[:info_plist],
13
+ params[:extra_info_plists],
14
+ params[:branch],
15
+ params[:tag] || Actions.last_git_tag_name,
11
16
  params[:target_suffix]
12
17
  ).release
13
18
  end
@@ -27,24 +32,65 @@ module Fastlane
27
32
  def self.available_options
28
33
  [
29
34
  FastlaneCore::ConfigItem.new(
30
- key: :target_suffix,
31
- description: 'Specific target suffix',
32
- optional: true
35
+ key: :scheme,
36
+ description: 'project scheme',
37
+ verify_block: proc do |value|
38
+ UI.user_error!('empty scheme') if value.empty?
39
+ end
33
40
  ),
34
41
  FastlaneCore::ConfigItem.new(
35
- key: :info_plist_path,
42
+ key: :info_plist,
36
43
  description: 'target info plist path',
37
44
  verify_block: proc do |value|
38
- msg = 'empty info plist path'
39
- UI.user_error!(msg) unless value && !value.empty?
45
+ msg = 'info plist path not found'
46
+ UI.user_error!(msg) unless File.file?(value)
40
47
  end
48
+ ),
49
+ FastlaneCore::ConfigItem.new(
50
+ key: :extra_info_plists,
51
+ description: 'extra info plists paths',
52
+ type: Array,
53
+ default_value: [],
54
+ verify_block: proc do |value|
55
+ msg = 'invalid info plists paths'
56
+ UI.user_error!(msg) unless value.all? { |p| File.file?(p) }
57
+ end
58
+ ),
59
+ FastlaneCore::ConfigItem.new(
60
+ key: :branch,
61
+ description: 'branch',
62
+ default_value: 'master',
63
+ verify_block: proc do |value|
64
+ UI.user_error!('invalid branch') if value.empty?
65
+ end
66
+ ),
67
+ FastlaneCore::ConfigItem.new(
68
+ key: :tag,
69
+ description: 'git tag',
70
+ optional: true
71
+ ),
72
+ FastlaneCore::ConfigItem.new(
73
+ key: :target_suffix,
74
+ description: 'Specific target suffix',
75
+ optional: true
41
76
  )
42
77
  ]
43
78
  end
44
79
 
45
80
  def self.example_code
46
81
  [
47
- 'tag_release(info_plist_path: "/path/to/info/plist")'
82
+ 'tag_release(
83
+ scheme: "AppScheme",
84
+ info_plist: "/path/to/info/plist"
85
+ )',
86
+ 'tag_release(
87
+ scheme: "Application",
88
+ info_plist: "/path/to/info/plist",
89
+ extra_info_plists: ["plist1", "plist2"],
90
+ branch: "master",
91
+ tag: "2.3.0",
92
+ target_suffix: "_sfx"
93
+ )'
48
94
  ]
49
95
  end
50
96
 
@@ -1,60 +1,74 @@
1
1
  require_relative 'info_plist_controller'
2
+ require 'fastlane_core'
3
+ require 'fastlane'
2
4
 
3
5
  module FastlaneCraft
4
6
  class TagReleaseManager
5
- def initialize(info_plist, extra_info_plists, target_suffix = nil)
7
+ include FastlaneCore
8
+ include Gem
9
+
10
+ def initialize(scheme, info_plist, extra_info_plists, branch, tag, target_suffix = nil)
11
+ raise 'Invalid Branch' if branch.empty?
12
+ raise 'Invalid Scheme' if scheme.empty?
13
+ raise 'Invalid Tag' if tag.nil? || tag.empty?
14
+
15
+ @scheme = scheme
16
+ @branch = branch
17
+ @tag = tag
6
18
  @target_suffix = target_suffix
7
19
  @plist_controller = InfoPlistController.new(info_plist, extra_info_plists)
8
20
  end
9
21
 
10
22
  def release
11
- puts 'releasing :)'
23
+ bump_version
24
+ archive
25
+ upload_to_tf
26
+ @plist_controller.bump_build_version_patch
27
+ push_version_bump
28
+ end
29
+
30
+ def bump_version
31
+ msg = 'The version of the tag is less than the actual app version'
32
+ UI.user_error! msg if tag_version < @plist_controller.version
33
+ UI.user_error! "Tag '#{@tag}' has no suffix: '#{@target_suffix}'" unless tag_valid?
34
+ return unless tag_version > @plist_controller.version
35
+
36
+ @plist_controller.set_version(tag_version)
37
+ @plist_controller.set_build_version(Version.new(tag_version.to_s + '.0'))
38
+ UI.success "Version was successfully bumped to #{version_dump}"
39
+ end
40
+
41
+ def upload_to_tf
42
+ cmd = 'fastlane upload_to_testflight --skip_submission true'
43
+ raise "TF uploading Failed! Command execution error: '#{cmd}'" unless system(cmd)
44
+ end
45
+
46
+ def push_version_bump
47
+ cmd = "fastlane commit_version_bump -message #{version_dump} --force true"
48
+ raise "Git Commit Failed! Command execution error: '#{cmd}'" unless system(cmd)
49
+
50
+ cmd = "git push origin HEAD:#{@branch}"
51
+ raise "Git Push Failed! Command execution error: '#{cmd}'" unless system(cmd)
52
+ end
53
+
54
+ def tag_version
55
+ version_format = /[0-9.]+/
56
+ tag = @tag.match(version_format)[0]
57
+ Version.new(tag)
58
+ end
59
+
60
+ def tag_valid?
61
+ return true if @target_suffix.nil? || @target_suffix.empty?
62
+ @tag.end_with? @target_suffix
63
+ end
64
+
65
+ def archive
66
+ cmd = "fastlane gym --scheme #{@scheme} --export_method app-store"
67
+ raise "Archiving failed! Command execution error: '#{cmd}'" unless system(cmd)
68
+ end
69
+
70
+ def version_dump
71
+ "#{@plist_controller.version}/#{@plist_controller.build_version}"
12
72
  end
13
73
  end
14
74
  end
15
-
16
- # lane :bump_version do |options|
17
- # if tag_version < app_version
18
- # UI.user_error! 'The version of the tag is less than the actual app version'
19
- # end
20
- #
21
- # if tag_version > app_version
22
- # version = tag_version.to_s
23
- # build_version = Gem::Version.new(version.to_s + '.0')
24
- # elsif tag_version == app_version && options[:bump_patch]
25
- # version = app_version.to_s
26
- # build_version = bumped_version(app_build_version)
27
- # end
28
- #
29
- # set_app_version(version)
30
- # set_app_build_version(build_version)
31
- # UI.success "Version was successfully bumped to #{version}/#{build_version}"
32
- # end
33
- #
34
- # lane :push_version_bump do
35
- # commit_version_bump(
36
- # message: "Bump version to #{app_version}/#{app_build_version}",
37
- # force: true
38
- # )
39
- #
40
- # push_to_git_remote(
41
- # local_branch: 'master',
42
- # remote_branch: 'master'
43
- # )
44
- # end
45
- #
46
- # lane :release do
47
- # bump_version
48
- # certificates
49
- # archive_appstore
50
- # upload_to_testflight(skip_submission: true)
51
- # bump_version(bump_patch: true)
52
- # push_version_bump
53
- # broadcast_release
54
- # end
55
- #
56
- # def tag_version
57
- # version_format = /[0-9.]+/
58
- # tag = last_git_tag.match(version_format)[0]
59
- # Gem::Version.new(tag)
60
- # end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCraft
2
- VERSION = '1.2.7'.freeze
2
+ VERSION = '1.2.8'.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.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - sroik