fastlane-craft 1.4.5 → 1.5.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: f930e9181d9774d65eddd3045daabbff884f1998bcafd80349960b86a23988c1
4
- data.tar.gz: 87ead6c3f4c68b39cbe27f2f4b939bd87554ce9f292487e0637bd6c9e357d984
3
+ metadata.gz: f7ffbc1651b3397ebe0d68371744c450f8671df8a6f25910bff50cec6abf8803
4
+ data.tar.gz: 1c4c017f4b7b5e351749aa12bf0804fb11b64aa36fc47ddb43d1fcec9a0eb5e9
5
5
  SHA512:
6
- metadata.gz: 872c29132bc2ed12c3ce30aabea953d54ba5d95425202cb0a5fadfd16fe37fecb9b920747bc3387edab32f73f7f482e4e6f969057fee2baa2db51495ab05d55a
7
- data.tar.gz: a51efc1a6575e36fbee1e0045b6706dd54783ded1a15c792e7ea7c1d000e7bdb9b943f45277053102bbd3939031dff1e27228dedbf8a480fc0332628b004e27b
6
+ metadata.gz: 8d29aaf8b19147285e350a52ee13e2aa443c2893f17e21cb364cd39b1f29e9b50fb7eee70342525f4e9eb0c0ed30492dfa6076bf0013f8813ccf6c6c13a341cc
7
+ data.tar.gz: a180bf4f92989ebbbac494c39b8531228ee1254d41034163a0ccbd2402f999efdf127409d6588fdbab2c29c36d6fa783e3ed764a63dcf6ca3a95b5375f128869
@@ -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,13 @@ 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, target_suffix = nil)
18
16
  raise 'Invalid Version' if version && !version_valid?(version)
19
17
 
20
- @scheme = scheme
21
18
  @branch = branch
22
19
  @target_suffix = target_suffix
23
- @plist_controller = InfoPlistController.new(info_plist, extra_info_plists)
24
- @version = version.nil? ? @plist_controller.version : Version.new(version)
20
+ @project_controller = ProjectController.new(project, schemes)
21
+ @version = version.nil? ? @project_controller.version : Version.new(version)
25
22
  end
26
23
 
27
24
  def release
@@ -29,7 +26,7 @@ module FastlaneCraft
29
26
  archive
30
27
  upload_to_tf
31
28
  update_env
32
- @plist_controller.bump_build_version_patch
29
+ @project_controller.bump_build_version_patch
33
30
  push_version_bump
34
31
 
35
32
  remove_existing_git_tag
@@ -38,11 +35,11 @@ module FastlaneCraft
38
35
 
39
36
  def bump_version
40
37
  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
38
+ UI.user_error! msg if @version < @project_controller.version
39
+ return unless @version > @project_controller.version
43
40
 
44
- @plist_controller.set_version(@version)
45
- @plist_controller.set_build_version(Version.new(@version.to_s + '.0'))
41
+ @project_controller.set_version(@version)
42
+ @project_controller.set_build_version(Version.new(@version.to_s + '.0'))
46
43
  UI.success "Version was successfully bumped to #{version_dump}"
47
44
  end
48
45
 
@@ -54,8 +51,8 @@ module FastlaneCraft
54
51
  end
55
52
 
56
53
  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
54
+ ENV[SharedValues::APP_RELEASE_VERSION] = @project_controller.version.to_s
55
+ ENV[SharedValues::APP_RELEASE_BUILD_NUMBER] = @project_controller.build_version.to_s
59
56
  ENV[SharedValues::APP_RELEASE_VERSION_TAG] = version_dump
60
57
  end
61
58
 
@@ -112,7 +109,7 @@ module FastlaneCraft
112
109
  end
113
110
 
114
111
  def version_dump
115
- "#{@plist_controller.version}/#{@plist_controller.build_version}"
112
+ "#{@project_controller.version}/#{@project_controller.build_version}"
116
113
  end
117
114
  end
118
115
  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.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.4.5
4
+ version: 1.5.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: 2019-09-30 00:00:00.000000000 Z
12
+ date: 2019-12-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
@@ -157,8 +171,7 @@ 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
174
+ rubygems_version: 3.0.6
162
175
  signing_key:
163
176
  specification_version: 4
164
177
  summary: fastlane craft summary
@@ -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