fastlane-craft 1.4.0 → 1.5.3

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: 6b8499c0d0064edadabc667cce7b5ed6be67e96d9d08567b0be91daf95917ac3
4
- data.tar.gz: fdc52b0ac3cc687875fca4d19498cf075a920114b6ac5096732a05aa51914ee5
3
+ metadata.gz: af83c5009022f0ea6d71c461147f7237b7e508ffc356a6fd73a79ba1c52106fa
4
+ data.tar.gz: 37e443e5275e9004b5413f0a4f38f6d13dbcdf1a91b09486d4792e250241bd41
5
5
  SHA512:
6
- metadata.gz: 67f72ff63a3a609d43b4614c9642e80eee843a7221afa2f091c2eb2b6860ca19dd71f64c440767a8a7d4eca83da55573e8627a7d16532dc84336b0172348ce25
7
- data.tar.gz: a681ce300e49fb8350255e96115f99de2a868d16af584de19be3c22fa9acb0e80b3b42c148b33f2a8c5977d8cebdbf96adc86bf2a78427d466647639abf36521
6
+ metadata.gz: b63744dc924a13ba5deac43665c5d2d68d51c9e824fe2f79d70a6033db27e808249f2a0cf1fcf3c8dfeb211d5f1bdcb2782d701eba9ce7ac9dc8929b3270fbce
7
+ data.tar.gz: bdebb841815f94db7ff7006991e531653505c15d45b7a223fd926e79cd8975f5827c1ae4a03e685355ce2ce3cbd09654f51c744beefc469eaa1e22361aea4f40
@@ -5,9 +5,8 @@ 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],
13
12
  params[:target_suffix]
@@ -29,28 +28,21 @@ module Fastlane
29
28
  def self.available_options
30
29
  [
31
30
  FastlaneCore::ConfigItem.new(
32
- key: :scheme,
33
- description: 'project scheme',
34
- verify_block: proc do |value|
35
- UI.user_error!('empty scheme') if value.empty?
36
- end
37
- ),
38
- FastlaneCore::ConfigItem.new(
39
- key: :info_plist,
40
- description: 'target info plist path',
31
+ key: :schemes,
32
+ description: 'schemes',
33
+ type: Array,
41
34
  verify_block: proc do |value|
42
- msg = 'info plist path not found'
43
- UI.user_error!(msg) unless File.file?(value)
35
+ msg = 'invalid or empty schemes'
36
+ UI.user_error!(msg) if value.empty?
44
37
  end
45
38
  ),
46
39
  FastlaneCore::ConfigItem.new(
47
- key: :extra_info_plists,
48
- description: 'extra info plists paths',
49
- type: Array,
50
- default_value: [],
40
+ key: :project,
41
+ description: 'path to xcodeproj',
42
+ default_value: Dir.glob('*.xcodeproj').first,
51
43
  verify_block: proc do |value|
52
- msg = 'invalid info plists paths'
53
- UI.user_error!(msg) unless value.all? { |p| File.file?(p) }
44
+ msg = 'xcodeproj not found'
45
+ UI.user_error!(msg) unless File.directory?(value)
54
46
  end
55
47
  ),
56
48
  FastlaneCore::ConfigItem.new(
@@ -77,13 +69,11 @@ module Fastlane
77
69
  def self.example_code
78
70
  [
79
71
  'app_release(
80
- scheme: "AppScheme",
81
- info_plist: "/path/to/info/plist"
72
+ schemes: ["AppScheme", "AppExtension"]
82
73
  )',
83
74
  'app_release(
84
- scheme: "Application",
85
- info_plist: "/path/to/info/plist",
86
- extra_info_plists: ["plist1", "plist2"],
75
+ schemes: ["AppScheme", "AppExtension"],
76
+ project: "/path/to/xcodeproj",
87
77
  branch: "master",
88
78
  version: "2.3.0",
89
79
  target_suffix: "_sfx"
@@ -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,16 +12,15 @@ 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
@@ -29,7 +28,8 @@ module FastlaneCraft
29
28
  archive
30
29
  upload_to_tf
31
30
  update_env
32
- @plist_controller.bump_build_version_patch
31
+
32
+ build_version.nil? @project_controller.bump_build_version_patch : @project_controller.set_build_version(build_version)
33
33
  push_version_bump
34
34
 
35
35
  remove_existing_git_tag
@@ -38,22 +38,24 @@ module FastlaneCraft
38
38
 
39
39
  def bump_version
40
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
41
+ UI.user_error! msg if @version < @project_controller.version
42
+ return unless @version > @project_controller.version
43
43
 
44
- @plist_controller.set_version(@version)
45
- @plist_controller.set_build_version(Version.new(@version.to_s + '.0'))
44
+ @project_controller.set_version(@version)
45
+ @project_controller.set_build_version(Version.new(@version.to_s + '.0'))
46
46
  UI.success "Version was successfully bumped to #{version_dump}"
47
47
  end
48
48
 
49
49
  def upload_to_tf
50
+ # see more at https://github.com/fastlane/fastlane/issues/15390
51
+ ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = "-t DAV"
50
52
  cmd = 'fastlane pilot upload --skip_submission --skip_waiting_for_build_processing'
51
53
  raise "TF uploading Failed! Command execution error: '#{cmd}'" unless system(cmd)
52
54
  end
53
55
 
54
56
  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] = @project_controller.version.to_s
58
+ ENV[SharedValues::APP_RELEASE_BUILD_NUMBER] = @project_controller.build_version.to_s
57
59
  ENV[SharedValues::APP_RELEASE_VERSION_TAG] = version_dump
58
60
  end
59
61
 
@@ -110,7 +112,7 @@ module FastlaneCraft
110
112
  end
111
113
 
112
114
  def version_dump
113
- "#{@plist_controller.version}/#{@plist_controller.build_version}"
115
+ "#{@project_controller.version}/#{@project_controller.build_version}"
114
116
  end
115
117
  end
116
118
  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
@@ -137,8 +137,8 @@ module Fastlane
137
137
  end
138
138
 
139
139
  def self.is_supported?(platform)
140
- platform == :android || platform == :ios
140
+ %i[ios android].include?(platform)
141
141
  end
142
142
  end
143
143
  end
144
- end
144
+ end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCraft
2
- VERSION = '1.4.0'.freeze
2
+ VERSION = '1.5.3'.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.0
4
+ version: 1.5.3
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: 2018-12-19 00:00:00.000000000 Z
12
+ date: 2020-07-31 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.3
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