fastlane-craft 1.4.5 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f930e9181d9774d65eddd3045daabbff884f1998bcafd80349960b86a23988c1
4
- data.tar.gz: 87ead6c3f4c68b39cbe27f2f4b939bd87554ce9f292487e0637bd6c9e357d984
3
+ metadata.gz: 007f46fd08119285ba01878a4c74aa164ba05f77ce58df54e6e5f150f12315a6
4
+ data.tar.gz: a97e7d4dbbb538d21986b510250f18f7adcfe56bdf79da62f5a33995ccd93013
5
5
  SHA512:
6
- metadata.gz: 872c29132bc2ed12c3ce30aabea953d54ba5d95425202cb0a5fadfd16fe37fecb9b920747bc3387edab32f73f7f482e4e6f969057fee2baa2db51495ab05d55a
7
- data.tar.gz: a51efc1a6575e36fbee1e0045b6706dd54783ded1a15c792e7ea7c1d000e7bdb9b943f45277053102bbd3939031dff1e27228dedbf8a480fc0332628b004e27b
6
+ metadata.gz: cb7faa55995678b15fe4e93f275a50008e0dc228b4472417731296b13c57cc5f080a6fafa0e3f549fab38930f9d2636b255f4cb45303a8a1f41d53907e55504a
7
+ data.tar.gz: 67924fa3ffaf58a0d3758e630f9f0e436ce25fccd48f7f216ac085ec135bbcf88f3c7dd18c35c3f2d812d0d151ee870d174fd3ea185e28de0d11097c822b6627
@@ -5,11 +5,11 @@ module Fastlane
5
5
  class AppReleaseAction < Action
6
6
  def self.run(params)
7
7
  FastlaneCraft::AppReleaseManager.new(
8
- params[:scheme],
9
- params[:info_plist],
10
- params[:extra_info_plists],
8
+ params[:schemes],
9
+ params[:project],
11
10
  params[:branch],
12
11
  params[:version],
12
+ params[:build_version]
13
13
  params[:target_suffix]
14
14
  ).release
15
15
  end
@@ -29,28 +29,21 @@ module Fastlane
29
29
  def self.available_options
30
30
  [
31
31
  FastlaneCore::ConfigItem.new(
32
- key: :scheme,
33
- description: 'project scheme',
32
+ key: :schemes,
33
+ description: 'schemes',
34
+ type: Array,
34
35
  verify_block: proc do |value|
35
- UI.user_error!('empty scheme') if value.empty?
36
+ msg = 'invalid or empty schemes'
37
+ UI.user_error!(msg) if value.empty?
36
38
  end
37
39
  ),
38
40
  FastlaneCore::ConfigItem.new(
39
- key: :info_plist,
40
- description: 'target info plist path',
41
+ key: :project,
42
+ description: 'path to xcodeproj',
43
+ default_value: Dir.glob('*.xcodeproj').first,
41
44
  verify_block: proc do |value|
42
- msg = 'info plist path not found'
43
- UI.user_error!(msg) unless File.file?(value)
44
- end
45
- ),
46
- FastlaneCore::ConfigItem.new(
47
- key: :extra_info_plists,
48
- description: 'extra info plists paths',
49
- type: Array,
50
- default_value: [],
51
- verify_block: proc do |value|
52
- msg = 'invalid info plists paths'
53
- UI.user_error!(msg) unless value.all? { |p| File.file?(p) }
45
+ msg = 'xcodeproj not found'
46
+ UI.user_error!(msg) unless File.directory?(value)
54
47
  end
55
48
  ),
56
49
  FastlaneCore::ConfigItem.new(
@@ -66,6 +59,11 @@ module Fastlane
66
59
  description: 'app version (like 1.1.0)',
67
60
  optional: true
68
61
  ),
62
+ FastlaneCore::ConfigItem.new(
63
+ key: :build_version,
64
+ description: 'build version (like 23)',
65
+ optional: true
66
+ ),
69
67
  FastlaneCore::ConfigItem.new(
70
68
  key: :target_suffix,
71
69
  description: 'Specific target suffix',
@@ -77,15 +75,14 @@ module Fastlane
77
75
  def self.example_code
78
76
  [
79
77
  'app_release(
80
- scheme: "AppScheme",
81
- info_plist: "/path/to/info/plist"
78
+ schemes: ["AppScheme", "AppExtension"]
82
79
  )',
83
80
  'app_release(
84
- scheme: "Application",
85
- info_plist: "/path/to/info/plist",
86
- extra_info_plists: ["plist1", "plist2"],
81
+ schemes: ["AppScheme", "AppExtension"],
82
+ project: "/path/to/xcodeproj",
87
83
  branch: "master",
88
84
  version: "2.3.0",
85
+ build_version: "23",
89
86
  target_suffix: "_sfx"
90
87
  )'
91
88
  ]
@@ -1,4 +1,4 @@
1
- require_relative 'info_plist_controller'
1
+ require_relative 'project_controller'
2
2
  require 'fastlane_core/ui/ui'
3
3
 
4
4
  module FastlaneCraft
@@ -12,24 +12,23 @@ module FastlaneCraft
12
12
  include FastlaneCore
13
13
  include Gem
14
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?
15
+ def initialize(schemes, project, branch, version = nil, build_version = nil, target_suffix = nil)
18
16
  raise 'Invalid Version' if version && !version_valid?(version)
19
17
 
20
- @scheme = scheme
18
+ @scheme = schemes.first
21
19
  @branch = branch
22
20
  @target_suffix = target_suffix
23
- @plist_controller = InfoPlistController.new(info_plist, extra_info_plists)
24
- @version = version.nil? ? @plist_controller.version : Version.new(version)
21
+ @project_controller = ProjectController.new(project, schemes)
22
+ @version = version.nil? ? @project_controller.version : Version.new(version)
23
+ @build_version = build_version
25
24
  end
26
25
 
27
26
  def release
28
27
  bump_version
29
28
  archive
30
29
  upload_to_tf
30
+ build_version.nil? ? @project_controller.bump_build_version_patch : @project_controller.set_build_version(build_version)
31
31
  update_env
32
- @plist_controller.bump_build_version_patch
33
32
  push_version_bump
34
33
 
35
34
  remove_existing_git_tag
@@ -38,11 +37,11 @@ module FastlaneCraft
38
37
 
39
38
  def bump_version
40
39
  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
40
+ UI.user_error! msg if @version < @project_controller.version
41
+ return unless @version > @project_controller.version
43
42
 
44
- @plist_controller.set_version(@version)
45
- @plist_controller.set_build_version(Version.new(@version.to_s + '.0'))
43
+ @project_controller.set_version(@version)
44
+ @project_controller.set_build_version(Version.new(@version.to_s + '.0'))
46
45
  UI.success "Version was successfully bumped to #{version_dump}"
47
46
  end
48
47
 
@@ -54,8 +53,8 @@ module FastlaneCraft
54
53
  end
55
54
 
56
55
  def update_env
57
- ENV[SharedValues::APP_RELEASE_VERSION] = @plist_controller.version.to_s
58
- ENV[SharedValues::APP_RELEASE_BUILD_NUMBER] = @plist_controller.build_version.to_s
56
+ ENV[SharedValues::APP_RELEASE_VERSION] = @project_controller.version.to_s
57
+ ENV[SharedValues::APP_RELEASE_BUILD_NUMBER] = @project_controller.build_version.to_s
59
58
  ENV[SharedValues::APP_RELEASE_VERSION_TAG] = version_dump
60
59
  end
61
60
 
@@ -112,7 +111,7 @@ module FastlaneCraft
112
111
  end
113
112
 
114
113
  def version_dump
115
- "#{@plist_controller.version}/#{@plist_controller.build_version}"
114
+ "#{@project_controller.version}/#{@project_controller.build_version}"
116
115
  end
117
116
  end
118
117
  end
@@ -0,0 +1,81 @@
1
+ require 'xcodeproj'
2
+
3
+ module FastlaneCraft
4
+ class ProjectController
5
+ include Gem
6
+
7
+ def initialize(path, schemes)
8
+ raise 'Invalid Path' unless File.directory?(path)
9
+
10
+ @project = Xcodeproj::Project.open(path)
11
+ @schemes = schemes
12
+ end
13
+
14
+ def bump_build_version_patch
15
+ value = build_version.to_s
16
+ value[-1] = (value[-1].to_i + 1).to_s
17
+ set_build_version(Version.new(value))
18
+ end
19
+
20
+ def set_version(version)
21
+ @schemes.each do |s|
22
+ set_scheme_value_for_key(s, version.to_s, version_key)
23
+ end
24
+ end
25
+
26
+ def set_build_version(version)
27
+ @schemes.each do |s|
28
+ set_scheme_value_for_key(s, version.to_s, build_version_key)
29
+ end
30
+ end
31
+
32
+ def version
33
+ value = scheme_value_for_key(@schemes.first, version_key)
34
+ Version.new(value)
35
+ end
36
+
37
+ def build_version
38
+ value = scheme_value_for_key(@schemes.first, build_version_key)
39
+ Version.new(value)
40
+ end
41
+
42
+ private
43
+
44
+ def set_scheme_value_for_key(scheme, value, key, configuration = nil)
45
+ target = project_target(scheme)
46
+ target.build_configurations.each do |config|
47
+ if configuration.nil? || config.name == configuration
48
+ config.build_settings[key] = value
49
+ end
50
+ end
51
+
52
+ @project.save()
53
+ end
54
+
55
+ def scheme_value_for_key(scheme, key, configuration = nil)
56
+ target = project_target(scheme)
57
+ target.build_configurations.each do |config|
58
+ if configuration.nil? || config.name == configuration
59
+ value = config.build_settings[key]
60
+ return value if value
61
+ end
62
+ end
63
+
64
+ return nil
65
+ end
66
+
67
+ def project_target(scheme)
68
+ target = @project.targets.find { |t| t.name == scheme }
69
+ raise "Target not found for scheme: #{scheme}" unless target
70
+ return target
71
+ end
72
+
73
+ def version_key
74
+ 'MARKETING_VERSION'
75
+ end
76
+
77
+ def build_version_key
78
+ 'CURRENT_PROJECT_VERSION'
79
+ end
80
+ end
81
+ end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCraft
2
- VERSION = '1.4.5'.freeze
2
+ VERSION = '1.5.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-craft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - sroik
8
8
  - elfenlaid
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-09-30 00:00:00.000000000 Z
12
+ date: 2020-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-s3
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - ">"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: xcodeproj
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">"
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">"
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: bundler
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -132,7 +146,7 @@ files:
132
146
  - lib/fastlane-craft.rb
133
147
  - lib/fastlane-craft/app_release.rb
134
148
  - lib/fastlane-craft/app_release_manager.rb
135
- - lib/fastlane-craft/info_plist_controller.rb
149
+ - lib/fastlane-craft/project_controller.rb
136
150
  - lib/fastlane-craft/telegram.rb
137
151
  - lib/fastlane-craft/telegram_notifier.rb
138
152
  - lib/fastlane-craft/upload_dsym.rb
@@ -142,7 +156,7 @@ homepage: https://github.com/app-craft/fastlane-craft.git
142
156
  licenses:
143
157
  - MIT
144
158
  metadata: {}
145
- post_install_message:
159
+ post_install_message:
146
160
  rdoc_options: []
147
161
  require_paths:
148
162
  - lib
@@ -157,9 +171,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
171
  - !ruby/object:Gem::Version
158
172
  version: '0'
159
173
  requirements: []
160
- rubyforge_project:
161
- rubygems_version: 2.7.7
162
- signing_key:
174
+ rubygems_version: 3.0.6
175
+ signing_key:
163
176
  specification_version: 4
164
177
  summary: fastlane craft summary
165
178
  test_files: []
@@ -1,67 +0,0 @@
1
- require 'plist'
2
-
3
- module FastlaneCraft
4
- class InfoPlistController
5
- include Gem
6
-
7
- def initialize(info_plist, extra_info_plists = [])
8
- raise 'Invalid Info Plist Path' unless File.file?(info_plist)
9
- raise 'Invalid Extra Info Plists Paths' unless extra_info_plists.all? { |p| File.file?(p) }
10
-
11
- @info_plist = info_plist
12
- @extra_info_plists = extra_info_plists
13
- end
14
-
15
- def bump_build_version_patch
16
- value = build_version.to_s
17
- value[-1] = (value[-1].to_i + 1).to_s
18
- set_build_version(Version.new(value))
19
- end
20
-
21
- def set_version(version)
22
- info_plists.each do |path|
23
- set_plist_value_for(path, version.to_s, version_key)
24
- end
25
- end
26
-
27
- def set_build_version(version)
28
- info_plists.each do |path|
29
- set_plist_value_for(path, version.to_s, build_version_key)
30
- end
31
- end
32
-
33
- def version
34
- value = plist_value_for(@info_plist, version_key)
35
- Version.new(value)
36
- end
37
-
38
- def build_version
39
- value = plist_value_for(@info_plist, build_version_key)
40
- Version.new(value)
41
- end
42
-
43
- private
44
-
45
- def set_plist_value_for(plist_path, value, key)
46
- plist = Plist.parse_xml(plist_path)
47
- plist[key] = value
48
- File.write(plist_path, Plist::Emit.dump(plist))
49
- end
50
-
51
- def plist_value_for(plist_path, key)
52
- Plist.parse_xml(plist_path)[key]
53
- end
54
-
55
- def info_plists
56
- [@info_plist] + @extra_info_plists
57
- end
58
-
59
- def version_key
60
- 'CFBundleShortVersionString'
61
- end
62
-
63
- def build_version_key
64
- 'CFBundleVersion'
65
- end
66
- end
67
- end