fastlane-plugin-sunny_project 0.1.19 → 0.1.20

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: a3855025f2d9e15b82cca4539824c3e2c8c850bc2eb47e01edefe47fff6762a4
4
- data.tar.gz: 46feb62db9a5f63bb4a6116112a60792b8ed35f970257790149bd8e29d8b41df
3
+ metadata.gz: 077567b8b1975f13a73613b05e48677b0bb271b71ce4e4f1ee671e020044f17e
4
+ data.tar.gz: 17b9e8f103cbf1da04603e9b57427336fe725528a3179ea48e856fd7495f2a16
5
5
  SHA512:
6
- metadata.gz: 7ac0254a3298c5e8d639a1f46e145a77bc3d4b07ac8995a4925be29b6954dab75e4a60276974c77f6a86e994ab3115a7f18d4666b6b96a293f8f3d298135ece1
7
- data.tar.gz: 9f5fc48f02f75eb80219b86e05f486a72059c5a99da250aa68cd5d6a78dea0b71a17dd56fe612c949a78bcfde8407a105d065ae97bb79f4bacfc62a2a0341e15
6
+ metadata.gz: fa8b1b12128bcfca58685c644240b7b71e92566f4d155db0298e62832e031bec83dc8726d34c0e271b8ac814d0e94730e1ae02120c4a04cb21a1b1c7308d13bc
7
+ data.tar.gz: 9b960dc6106b6ac4736f61b10e15d0c5da1c4b530a8105c93e3f638dcb1a758e15ce884f705d3e1328f08bd6c2b4a7be63cefd8cf861ce6994e23433dc6cc254
@@ -9,7 +9,7 @@ def resort_keys(input)
9
9
  keys = []
10
10
  input.each_key do |key|
11
11
  puts("Key #{key} #{key.class}")
12
- keys.push("#{key}")
12
+ keys.push(key.to_s)
13
13
  end
14
14
 
15
15
  keys = keys.sort
@@ -30,26 +30,35 @@ module Fastlane
30
30
  end
31
31
 
32
32
  sunny_file = Sunny.config(SunnyProject::Options.available_options, {})
33
- sunny_file.load_configuration_file("Sunnyfile")
33
+ sunny_file.load_configuration_file("Sunnyfile", skip_printing_values = true)
34
34
 
35
35
  app_file = CredentialsManager::AppfileConfig
36
- firebase_app_id=sunny_file[:firebase_app_id]
36
+ firebase_app_id = sunny_file[:firebase_app_id]
37
37
  unless firebase_app_id
38
38
  UI.user_error!("Missing firebase_app_id. Set this in Sunnyfile")
39
39
  end
40
40
 
41
41
  old_version = Sunny.current_semver
42
- build_number = ''
42
+ old_version_no_build = "#{old_version.major}.#{old_version.minor}.#{old_version.patch}"
43
+
44
+ new_version = ''
45
+
43
46
  ## If we're not going to build, we don't need to update
44
47
  # version numbers.
45
- if options[:build] and not options[:no_bump]
46
- if options[:release]
47
- build_number = Sunny.do_increase_version(type: "build", patch: true)
48
+
49
+ if (not options[:skip_build]) && (not options[:no_bump])
50
+ if options[:patch]
51
+ new_version = Sunny.do_increase_version(type: "patch")
52
+ elsif options[:minor]
53
+ new_version = Sunny.do_increase_version(type: "minor")
54
+ elsif options[:build]
55
+ new_version = Sunny.do_increase_version(type: "build")
48
56
  else
49
- build_number = Sunny.do_increase_version(type: "build")
57
+ UI.user_error!("You must provide the type of version change. options are minor, patch, build.
58
+ You can also provide no_bump:true to keep the same build number")
50
59
  end
51
60
 
52
- unless build_number
61
+ unless new_version
53
62
  UI.user_error!("Version incrementing failed")
54
63
  return
55
64
  end
@@ -57,21 +66,34 @@ module Fastlane
57
66
 
58
67
  # Whatever happened with the incrementing, this is the build number we're
59
68
  # going with
60
- version = Sunny.current_semver
61
- UI.command_output("Build Version: #{version}")
69
+ version = new_version
70
+ version_no_build = "#{version.major}.#{version.minor}.#{version.patch}"
71
+ is_version_changed = old_version_no_build.eql?(version_no_build) != true
72
+ build_number = version.build
62
73
  changes = Sunny.release_notes(options)
63
- UI.important('--------------- CHANGELOG ------------------')
64
- UI.important(changes)
65
- UI.important('--------------------------------------------')
66
-
74
+ app_name = options[:app_name]
75
+ release_target = options[:release_target]
76
+
77
+ puts("")
78
+ build_summary = [
79
+ ["App name", (app_file.try_fetch_value(:app_identifier)).to_s],
80
+ ["Target", app_name],
81
+ ["Major version", is_version_changed ? "#{old_version_no_build} -> #{version_no_build}" : "#{version_no_build} (no change)"],
82
+ ["Build number", "#{old_version.build} -> #{build_number}"],
83
+ ["Releasing to", release_target,],
84
+ %W[Changelog #{changes}],
85
+ ]
86
+ UI.important("\n\n#{Terminal::Table.new(rows: FastlaneCore::PrintTable.transform_output(build_summary),
87
+ title: 'Build Summary')}")
88
+ puts("")
67
89
  # TRY to execute a build. if it fails, revert the version number changes
68
90
  begin
69
- if options[:build]
91
+ unless options[:skip_build]
70
92
  if options[:skip_flutter_build]
71
- UI.important "Skipping Flutter Build"
93
+ UI.important("Skipping Flutter Build")
72
94
  else
73
- UI.header "Run Flutter Build"
74
- Sunny.build_ios(build_number)
95
+ UI.header("Run Flutter Build")
96
+ Sunny.build_ios(version_no_build, build_number)
75
97
  end
76
98
  require 'match'
77
99
  build_opts = options[:build_options]
@@ -83,16 +105,16 @@ module Fastlane
83
105
 
84
106
  match_opts.load_configuration_file("Matchfile")
85
107
 
86
- UI.header "Read Appfile info"
108
+ UI.header("Read Appfile info")
87
109
  # Read the app identifier from Appfile
88
110
  app_identifier = app_file.try_fetch_value(:app_identifier)
89
- UI.command_output "App: #{app_identifier}"
111
+ UI.command_output("App: #{app_identifier}")
90
112
  unless app_identifier
91
113
  UI.user_error!("No app_identifier could be found")
92
114
  end
93
115
 
94
116
  MatchAction.run(match_opts)
95
- UI.header "Run Xcode Build"
117
+ UI.header("Run Xcode Build")
96
118
  Sunny.run_action(BuildAppAction, workspace: "ios/Runner.xcworkspace",
97
119
  scheme: "Runner",
98
120
  export_method: build_opts[1],
@@ -101,7 +123,7 @@ module Fastlane
101
123
  clean: options[:clean],
102
124
  export_options: {
103
125
  provisioningProfiles: {
104
- "#{app_identifier}" => "match #{build_opts[2]} #{app_identifier}",
126
+ app_identifier.to_s => "match #{build_opts[2]} #{app_identifier}",
105
127
  }
106
128
  },
107
129
  output_directory: "build/ios")
@@ -115,28 +137,27 @@ module Fastlane
115
137
  return
116
138
  end
117
139
 
118
- app_name = options[:app_name]
119
140
  # Commits the version number, deletes changelog file
120
- if options[:build] or options[:post_build]
141
+ if (not options[:skip_build]) || options[:post_build]
121
142
  unless options[:skip_symbols]
122
- UI.header "Upload Symbols to Crashlytics"
143
+ UI.header("Upload Symbols to Crashlytics")
123
144
  Sunny.run_action(UploadSymbolsToCrashlyticsAction, dsym_path: "./build/ios/#{app_name}.app.dSYM.zip",
124
145
  binary_path: "./ios/Pods/FirebaseCrashlytics/upload-symbols")
125
146
  end
126
147
 
127
- UI.header "Commit pubspec.yaml, Info.plist for version updates"
148
+ UI.header("Commit pubspec.yaml, Info.plist for version updates")
128
149
  # If we got this far, let's commit the build number and update the git tags. If the rest of the pro
129
150
  # process fails, we should revert this because it will mess up our commit logs
130
151
  Sunny.run_action(GitCommitAction,
131
152
  allow_nothing_to_commit: true,
132
- path: %w[./pubspec.yaml ./pubspec.lock ./Gemfile.lock ./ios/Runner/Info.plist],
133
- message: "\"Version bump to: #{version.major}.#{version.minor}.#{version.patch}#800#{version.build}\"")
134
- UI.header "Tagging repo v#{version.build}"
153
+ path: %w[./pubspec.yaml ./pubspec.lock ./ios/Podfile.lock ./Gemfile.lock ./ios/Runner/Info.plist],
154
+ message: "\"Version bump to: #{version_no_build}##{build_number}\"")
155
+ UI.header("Tagging repo v#{version.build}")
135
156
  Sunny.run_action(AddGitTagAction,
136
157
  grouping: "sunny-builds",
137
158
  prefix: "v",
138
159
  force: true,
139
- build_number: version.build
160
+ build_number: build_number
140
161
  )
141
162
  Sunny.run_action(PushGitTagsAction, force: false)
142
163
  end
@@ -144,10 +165,9 @@ module Fastlane
144
165
  unless options[:no_upload]
145
166
 
146
167
  # platform :ios do
147
- release_target = options[:release_target]
168
+
148
169
  if release_target == "firebase"
149
- UI.header "Firebase: uploading build/ios/#{app_name}.ipa"
150
- #require 'fastlane-plugin-firebase_app_distribution'
170
+ UI.header("Firebase: uploading build/ios/#{app_name}.ipa")
151
171
 
152
172
  Sunny.run_action(FirebaseAppDistributionAction,
153
173
  app: firebase_app_id,
@@ -156,7 +176,7 @@ module Fastlane
156
176
  debug: true
157
177
  )
158
178
  elsif release_target == "testflight"
159
- UI.header "Testflight: uploading build/ios/#{app_name}.ipa"
179
+ UI.header("Testflight: uploading build/ios/#{app_name}.ipa")
160
180
  Sunny.run_action(UploadToTestflightAction,
161
181
  ipa: "build/ios/#{app_name}.ipa",
162
182
  localized_build_info: {
@@ -177,7 +197,7 @@ module Fastlane
177
197
  end
178
198
 
179
199
  def self.description
180
- "Modify pubspec for local or git development"
200
+ "Perform ios or firebase release"
181
201
  end
182
202
 
183
203
  def self.authors
@@ -199,25 +219,34 @@ module Fastlane
199
219
  env_name: "SUNNY_NO_BUMP",
200
220
  description: "Whether to skip a bump",
201
221
  optional: true, type: Object),
202
- FastlaneCore::ConfigItem.new(key: :build,
203
- env_name: "SUNNY_BUILD",
204
- description: "Whether to perform a complete build",
222
+ FastlaneCore::ConfigItem.new(key: :skip_build,
223
+ env_name: "SUNNY_SKIP_BUILD",
224
+ description: "Whether to skip the building of the project",
205
225
  optional: true, type: Object),
206
226
  FastlaneCore::ConfigItem.new(key: :post_build,
207
227
  env_name: "SUNNY_POST_BUILD",
208
- description: "Whether to execute actions after building",
228
+ description: "Whether to execute actions after building. Can be used in conjunction with skip_build to avoid building the entire project, but still applying tags",
209
229
  optional: true, type: Object),
210
230
  FastlaneCore::ConfigItem.new(key: :skip_dirty_check,
211
231
  env_name: "SUNNY_SKIP_DIRTY_CHECK",
212
232
  description: "Whether to skip dirty repo check",
213
233
  optional: true, type: Object),
234
+
214
235
  FastlaneCore::ConfigItem.new(key: :clean,
215
236
  env_name: "SUNNY_CLEAN",
216
237
  description: "Whether to do a clean build",
217
238
  optional: true, type: Object),
218
- FastlaneCore::ConfigItem.new(key: :release,
219
- env_name: "SUNNY_RELEASE",
220
- description: "Whether to make a release vs patch build",
239
+ FastlaneCore::ConfigItem.new(key: :minor,
240
+ env_name: "SUNNY_MINOR",
241
+ description: "Whether to make a minor release",
242
+ optional: true, type: Object),
243
+ FastlaneCore::ConfigItem.new(key: :patch,
244
+ env_name: "SUNNY_PATCH",
245
+ description: "Whether to make a patch release",
246
+ optional: true, type: Object),
247
+ FastlaneCore::ConfigItem.new(key: :build,
248
+ env_name: "SUNNY_BUILD",
249
+ description: "Whether to increment only the build number for the release",
221
250
  optional: true, type: Object),
222
251
  FastlaneCore::ConfigItem.new(key: :changelog,
223
252
  env_name: "SUNNY_CHANGELOG",
@@ -236,7 +265,7 @@ module Fastlane
236
265
 
237
266
  FastlaneCore::ConfigItem.new(key: :release_target,
238
267
  env_name: "SUNNY_RELEASE_TARGET",
239
- description: "Where we're releasing to",
268
+ description: "Where we're releasing to, must be either fastlane or testflight",
240
269
  optional: false,
241
270
  type: String),
242
271
 
@@ -286,7 +315,7 @@ module Fastlane
286
315
 
287
316
  def visit_Psych_Nodes_Scalar(o)
288
317
  if o.value.is_a?(String)
289
- str = "#{o.value}"
318
+ str = (o.value).to_s
290
319
  if str.start_with?('^') || str.start_with?('..')
291
320
  @handler.scalar(o.value, o.anchor, o.tag, o.plain, o.quoted, 1)
292
321
  elsif str.start_with?('https://') || str.start_with?('git@')
@@ -47,34 +47,39 @@ module Fastlane
47
47
  bump_type = options[:type]
48
48
  bump_type = "build" unless bump_type
49
49
  command = "pubver bump #{bump_type}"
50
- if bump_type == 'patch'
51
- command += "-b"
50
+ unless bump_type.eql?('build')
51
+ command += " -b"
52
52
  end
53
- self.exec_cmd("bump patch", command)
53
+ self.exec_cmd(command.to_s, command)
54
+
55
+ unless bump_type.eql?('build')
56
+ self.exec_cmd("also bump build", "pubver bump build")
57
+ end
58
+
54
59
  self.current_semver
55
60
  end
56
61
 
57
62
  def self.exec_cmd(name, *command, **args)
58
63
  if (command.count > 1)
59
- command = command.map { |item| Shellwords.escape item }
64
+ command = command.map { |item| Shellwords.escape(item) }
60
65
  end
61
66
  joined = command.join(" ")
62
67
  if args[:verbose]
63
68
  begin
64
69
  return sh(command)
65
70
  rescue StandardError => e
66
- UI.user_error! ">> #{name} failed << \n #{e}"
71
+ UI.user_error!(">> #{name} failed << \n #{e}")
67
72
  end
68
73
  else
69
74
  if args[:cmd_out]
70
- UI.command_output name
75
+ UI.command_output(name)
71
76
  elsif args[:quiet]
72
77
  else
73
78
  UI.command name
74
79
  end
75
80
 
76
81
  stdout, err, status = Open3.capture3(joined)
77
- UI.user_error! ">> #{name} failed << \n command: #{joined}\n error: #{err}" unless status == 0
82
+ UI.user_error!(">> #{name} failed << \n command: #{joined}\n error: #{err}") unless status == 0
78
83
  stdout
79
84
  end
80
85
  end
@@ -85,7 +90,7 @@ module Fastlane
85
90
 
86
91
  ### Reads the latest version from pubspec.yaml
87
92
  def self.current_semver
88
- Semantic::Version.new current_version_string
93
+ Semantic::Version.new(current_version_string)
89
94
  end
90
95
 
91
96
  def self.release_notes(options)
@@ -129,7 +134,7 @@ module Fastlane
129
134
  lines = ["## [#{v}]\n", " * #{changes}\n", "\n"] + lines
130
135
 
131
136
  output = File.new("CHANGELOG.md", "w")
132
- lines.each { |line| output.write line }
137
+ lines.each { |line| output.write(line) }
133
138
  output.close
134
139
  end
135
140
  changes
@@ -142,7 +147,7 @@ module Fastlane
142
147
  def self.override_version(**options)
143
148
  semver = options[:version]
144
149
  unless semver
145
- UI.user_error! "No version parameter found"
150
+ UI.user_error!("No version parameter found")
146
151
  return
147
152
  end
148
153
  self.exec_cmd("set_version", "pubver set #{semver}", quiet: true)
@@ -156,14 +161,15 @@ module Fastlane
156
161
  xcodeproj: "ios/Runner.xcodeproj"
157
162
  )
158
163
  else
159
- UI.user_error! "No version found"
164
+ UI.user_error!("No version found")
160
165
  end
161
166
 
162
167
  end
163
168
 
164
- def self.build_ios(build_num, **options)
169
+ def self.build_ios(build_ver, build_num, **options)
165
170
  flutter = get_flutter(options[:flutter])
166
- self.exec_cmd("build flutter ios release #{build_num}", "#{flutter} build ios --release --no-tree-shake-icons --no-codesign --build-number=#{build_num}")
171
+
172
+ self.exec_cmd("build flutter ios release #{build_ver} #{build_num}", "#{flutter} build ios --release --no-tree-shake-icons --no-codesign")
167
173
  end
168
174
 
169
175
  ### Reads the latest version from pubspec.yaml
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SunnyProject
3
- VERSION = "0.1.19"
3
+ VERSION = "0.1.20"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-sunny_project
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - ericmartineau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-07 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry