fastlane-plugin-sunny_project 0.1.15 → 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: 6aea270fd928ab346d0584a3e4f38da827b8b3419a708c22ccec6998afcfe367
4
- data.tar.gz: 30898a2a549a849d9d2c9b9cb62dbb6be17da9a9c6324c09ff70780bb38a18d1
3
+ metadata.gz: 077567b8b1975f13a73613b05e48677b0bb271b71ce4e4f1ee671e020044f17e
4
+ data.tar.gz: 17b9e8f103cbf1da04603e9b57427336fe725528a3179ea48e856fd7495f2a16
5
5
  SHA512:
6
- metadata.gz: e917e23d4bff8cc4cf7faf4512a1230bd86664a55334e10976e9f14469b291d50ea5432098c5e7ed7135f8814a2a100b65205ed13b11d4c923757f9e4450023a
7
- data.tar.gz: 46dcab55ca6f875ef076ccf3c7d757633a63f5a1f528a991379b55fb1a20039c31af4a91b19748a66b893eee71097c761464a87c7410f1af8b5b1403d62415cd
6
+ metadata.gz: fa8b1b12128bcfca58685c644240b7b71e92566f4d155db0298e62832e031bec83dc8726d34c0e271b8ac814d0e94730e1ae02120c4a04cb21a1b1c7308d13bc
7
+ data.tar.gz: 9b960dc6106b6ac4736f61b10e15d0c5da1c4b530a8105c93e3f638dcb1a758e15ce884f705d3e1328f08bd6c2b4a7be63cefd8cf861ce6994e23433dc6cc254
@@ -8,15 +8,15 @@ module Fastlane
8
8
  version = Sunny.current_semver
9
9
  # If we got this far, let's commit the build number and update the git tags. If the rest of the pro
10
10
  # process fails, we should revert this because it will mess up our commit logs
11
- Fastlane::Actions::GitCommitAction.run(path: %w[./pubspec.yaml ./pubspec.lock ./CHANGELOG.md],
12
- allow_nothing_to_commit: true,
13
- message: "Version bump to: #{version.major}.#{version.minor}.#{version.patch}#800#{version.build}")
14
- Fastlane::Actions::AddGitTagAction.run(
15
- tag: "sunny/builds/v#{version.build}",
16
- force: true,
17
- sign: false,
11
+ Sunny.run_action(GitCommitAction, path: %w[./pubspec.yaml ./pubspec.lock ./CHANGELOG.md],
12
+ allow_nothing_to_commit: true,
13
+ message: "Version bump to: #{version.major}.#{version.minor}.#{version.patch}#800#{version.build}")
14
+ Sunny.run_action(AddGitTagAction,
15
+ tag: "sunny/builds/v#{version.build}",
16
+ force: true,
17
+ sign: false,
18
18
  )
19
- Fastlane::Actions::PushGitTagsAction.run(log: true)
19
+ Sunny.run_action(PushGitTagsAction, force: true)
20
20
  if File.exist?(Sunny.release_notes_file)
21
21
  File.delete(Sunny.release_notes_file)
22
22
  end
@@ -41,13 +41,12 @@ module Fastlane
41
41
 
42
42
  def self.available_options
43
43
  [
44
- FastlaneCore::ConfigItem.new(key: :tag_group,
45
- env_name: "SUNNY_PROJECT_TAG_GROUP",
46
- description: "The name of the tag group",
47
- optional: false,
48
- type: String,
49
- default_value: "sunny/builds"),
50
-
44
+ FastlaneCore::ConfigItem.new(key: :tag_group,
45
+ env_name: "SUNNY_PROJECT_TAG_GROUP",
46
+ description: "The name of the tag group",
47
+ optional: false,
48
+ type: String,
49
+ default_value: "sunny/builds"),
51
50
 
52
51
  ]
53
52
  end
@@ -31,13 +31,13 @@ module Fastlane
31
31
  UI.error "Invalid option: #{value} Must be 'build' or 'patch'" unless value == "build" or value == "patch"
32
32
  end
33
33
  [
34
- FastlaneCore::ConfigItem.new(key: :type,
35
- env_name: "SUNNY_PROJECT_TYPE",
36
- description: "Whether to make a patch or build version change",
37
- optional: true,
38
- verify_block: verify_type,
39
- default_value: 'build',
40
- type: String)
34
+ FastlaneCore::ConfigItem.new(key: :type,
35
+ env_name: "SUNNY_PROJECT_TYPE",
36
+ description: "Whether to make a patch or build version change",
37
+ optional: true,
38
+ verify_block: verify_type,
39
+ default_value: 'build',
40
+ type: String)
41
41
  ]
42
42
  end
43
43
 
@@ -0,0 +1,155 @@
1
+ require 'fastlane/action'
2
+
3
+ # require 'ci'
4
+ require_relative '../helper/sunny_project_helper'
5
+ require 'yaml'
6
+
7
+ require_relative '../helper/plugin_options'
8
+
9
+ module Fastlane
10
+ module Actions
11
+ class LocalPackagesAction < Action
12
+ def self.run(options)
13
+ puts("Incoming: #{options.class}")
14
+
15
+ unless options
16
+ options = FastlaneCore::Configuration.create(self.available_options, {})
17
+ end
18
+ options.load_configuration_file("Sunnyfile")
19
+ options.load_configuration_file(".Sunnyfile")
20
+
21
+ params = options
22
+ params.all_keys.each do |k|
23
+ puts("#{k} => #{params[k]}")
24
+ end
25
+
26
+ plugins = params[:sunny_plugins]
27
+ plugin_folder = params[:sunny_plugin_folder]
28
+ # pubspec = YAML.load_file("pubspec.yaml")
29
+ local_mode = params[:sunny_local_mode]
30
+ is_local = "local".eql?(local_mode)
31
+ UI.command_output("Local #{local_mode} creates #{is_local}")
32
+
33
+ unless is_local
34
+ UI.user_error!("Not set to local development. Not checking out")
35
+ return
36
+ end
37
+
38
+ roots = []
39
+ Dir.chdir(plugin_folder) do
40
+ plugins.keys.each do |key|
41
+ info = plugins[key] ? plugins[key] : "#{key}"
42
+ folder = key
43
+ root_folder = nil
44
+ branch = nil
45
+ path = nil
46
+ repo = key
47
+ if info.is_a?(String)
48
+ repo = info
49
+ root_folder = key
50
+ else
51
+ path = info[:path]
52
+ branch = info[:branch] if info[:branch]
53
+ repo = info[:repo] if info[:repo]
54
+ folder = repo
55
+ root_folder = if path
56
+ repo
57
+ else
58
+ key
59
+ end
60
+ end
61
+ UI.header("#{folder}")
62
+ if roots.include?(root_folder)
63
+ UI.message "Skipping root #{root_folder} - already processed"
64
+ else
65
+ git_repo = "git@github.com:SunnyApp/#{repo}.git"
66
+
67
+ plugin_exists = Dir.exist?("./#{root_folder}")
68
+ if !plugin_exists || options[:force]
69
+ UI.important("Checking out plugin #{repo} to #{root_folder}")
70
+ Sunny.exec_cmd("clone #{key}", "git clone #{git_repo} #{root_folder}", quiet: true)
71
+ else
72
+ UI.message("Plugin already cloned: #{root_folder}")
73
+ end
74
+
75
+ roots.push(root_folder)
76
+
77
+ Dir.chdir("./#{folder}") do
78
+ if branch
79
+ UI.important("Verifying branch #{branch}")
80
+ unless Sunny.is_branch(branch)
81
+ if Sunny.is_clean
82
+ Sunny.exec_cmd("checkout branch #{branch}", "git checkout #{branch}")
83
+ else
84
+ UI.user_error!("Needs to be on branch #{branch}, but repo is not clean. You will need to manually fix this")
85
+ end
86
+ end
87
+ end
88
+
89
+ if params[:update]
90
+ begin
91
+ Sunny.run_action(GitPullAction, rebase: true)
92
+ rescue StandardError => e
93
+ UI.error("---------- Failed to update ---------------")
94
+ UI.error("There are changes to the working tree. Check ")
95
+ UI.error("the status of each repo below and make any fixes.")
96
+ UI.error("------------------------------------------------")
97
+
98
+ UI.command_output(cmd("myrepos status", "git status --porcelain", args = options))
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
105
+
106
+ end
107
+
108
+ def self.description
109
+ "Checks out local dart packages"
110
+ end
111
+
112
+ def self.authors
113
+ ["ericmartineau"]
114
+ end
115
+
116
+ def self.return_value
117
+ # If your method provides a return value, you can describe here what it does
118
+ end
119
+
120
+ def self.details
121
+ # Optional:
122
+ ""
123
+ end
124
+
125
+ def self.available_options
126
+ opts = [
127
+ FastlaneCore::ConfigItem.new(key: :update,
128
+ env_name: "SUNNY_UPDATE",
129
+ description: "Whether to update each plugin",
130
+ type: Object,
131
+ optional: true),
132
+ FastlaneCore::ConfigItem.new(key: :force,
133
+ env_name: "SUNNY_FORCE",
134
+ description: "Whether to update each plugin",
135
+ type: Object,
136
+ optional: true),
137
+ ]
138
+
139
+ Fastlane::SunnyProject::Options.available_options.each do |option|
140
+ opts.push(option)
141
+ end
142
+ opts
143
+ end
144
+
145
+ def self.is_supported?(platform)
146
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
147
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
148
+ #
149
+ # [:ios, :mac, :android].include?(platform)
150
+ true
151
+ end
152
+ end
153
+ end
154
+ end
155
+
@@ -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
@@ -29,28 +29,36 @@ module Fastlane
29
29
  Sunny.run_action(EnsureGitStatusCleanAction)
30
30
  end
31
31
 
32
-
33
32
  sunny_file = Sunny.config(SunnyProject::Options.available_options, {})
34
- sunny_file.load_configuration_file("Sunnyfile")
33
+ sunny_file.load_configuration_file("Sunnyfile", skip_printing_values = true)
35
34
 
36
35
  app_file = CredentialsManager::AppfileConfig
37
- firebase_app_id=sunny_file[:firebase_app_id]
36
+ firebase_app_id = sunny_file[:firebase_app_id]
38
37
  unless firebase_app_id
39
38
  UI.user_error!("Missing firebase_app_id. Set this in Sunnyfile")
40
39
  end
41
40
 
42
41
  old_version = Sunny.current_semver
43
- build_number = ''
42
+ old_version_no_build = "#{old_version.major}.#{old_version.minor}.#{old_version.patch}"
43
+
44
+ new_version = ''
45
+
44
46
  ## If we're not going to build, we don't need to update
45
47
  # version numbers.
46
- if options[:build] and not options[:no_bump]
47
- if options[:release]
48
- build_number = Sunny.do_increase_version(build: true, 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")
49
56
  else
50
- build_number = Sunny.do_increase_version(build: true)
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")
51
59
  end
52
60
 
53
- unless build_number
61
+ unless new_version
54
62
  UI.user_error!("Version incrementing failed")
55
63
  return
56
64
  end
@@ -58,21 +66,34 @@ module Fastlane
58
66
 
59
67
  # Whatever happened with the incrementing, this is the build number we're
60
68
  # going with
61
- version = Sunny.current_semver
62
- 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
63
73
  changes = Sunny.release_notes(options)
64
- UI.important('--------------- CHANGELOG ------------------')
65
- UI.important(changes)
66
- UI.important('--------------------------------------------')
67
-
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("")
68
89
  # TRY to execute a build. if it fails, revert the version number changes
69
90
  begin
70
- if options[:build]
91
+ unless options[:skip_build]
71
92
  if options[:skip_flutter_build]
72
- UI.important "Skipping Flutter Build"
93
+ UI.important("Skipping Flutter Build")
73
94
  else
74
- UI.header "Run Flutter Build"
75
- Sunny.build_ios(build_number)
95
+ UI.header("Run Flutter Build")
96
+ Sunny.build_ios(version_no_build, build_number)
76
97
  end
77
98
  require 'match'
78
99
  build_opts = options[:build_options]
@@ -84,16 +105,16 @@ module Fastlane
84
105
 
85
106
  match_opts.load_configuration_file("Matchfile")
86
107
 
87
- UI.header "Read Appfile info"
108
+ UI.header("Read Appfile info")
88
109
  # Read the app identifier from Appfile
89
110
  app_identifier = app_file.try_fetch_value(:app_identifier)
90
- UI.command_output "App: #{app_identifier}"
111
+ UI.command_output("App: #{app_identifier}")
91
112
  unless app_identifier
92
113
  UI.user_error!("No app_identifier could be found")
93
114
  end
94
115
 
95
116
  MatchAction.run(match_opts)
96
- UI.header "Run Xcode Build"
117
+ UI.header("Run Xcode Build")
97
118
  Sunny.run_action(BuildAppAction, workspace: "ios/Runner.xcworkspace",
98
119
  scheme: "Runner",
99
120
  export_method: build_opts[1],
@@ -102,7 +123,7 @@ module Fastlane
102
123
  clean: options[:clean],
103
124
  export_options: {
104
125
  provisioningProfiles: {
105
- "#{app_identifier}" => "match #{build_opts[2]} #{app_identifier}",
126
+ app_identifier.to_s => "match #{build_opts[2]} #{app_identifier}",
106
127
  }
107
128
  },
108
129
  output_directory: "build/ios")
@@ -116,26 +137,27 @@ module Fastlane
116
137
  return
117
138
  end
118
139
 
119
- app_name = options[:app_name]
120
140
  # Commits the version number, deletes changelog file
121
- if options[:build] or options[:post_build]
141
+ if (not options[:skip_build]) || options[:post_build]
122
142
  unless options[:skip_symbols]
123
- UI.header "Upload Symbols to Crashlytics"
143
+ UI.header("Upload Symbols to Crashlytics")
124
144
  Sunny.run_action(UploadSymbolsToCrashlyticsAction, dsym_path: "./build/ios/#{app_name}.app.dSYM.zip",
125
145
  binary_path: "./ios/Pods/FirebaseCrashlytics/upload-symbols")
126
146
  end
127
147
 
128
- UI.header "Commit pubspec.yaml, Info.plist for version updates"
148
+ UI.header("Commit pubspec.yaml, Info.plist for version updates")
129
149
  # If we got this far, let's commit the build number and update the git tags. If the rest of the pro
130
150
  # process fails, we should revert this because it will mess up our commit logs
131
- Sunny.run_action(GitCommitAction, path: %w[./pubspec.yaml ./pubspec.lock ./Gemfile.lock ./ios/Runner/Info.plist],
132
- message: "Version bump to: #{version.major}.#{version.minor}.#{version.patch}#800#{version.build}")
133
- UI.header "Tagging repo v#{version.build}"
151
+ Sunny.run_action(GitCommitAction,
152
+ allow_nothing_to_commit: true,
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}")
134
156
  Sunny.run_action(AddGitTagAction,
135
157
  grouping: "sunny-builds",
136
158
  prefix: "v",
137
159
  force: true,
138
- build_number: version.build
160
+ build_number: build_number
139
161
  )
140
162
  Sunny.run_action(PushGitTagsAction, force: false)
141
163
  end
@@ -143,10 +165,9 @@ module Fastlane
143
165
  unless options[:no_upload]
144
166
 
145
167
  # platform :ios do
146
- release_target = options[:release_target]
168
+
147
169
  if release_target == "firebase"
148
- UI.header "Firebase: uploading build/ios/#{app_name}.ipa"
149
- #require 'fastlane-plugin-firebase_app_distribution'
170
+ UI.header("Firebase: uploading build/ios/#{app_name}.ipa")
150
171
 
151
172
  Sunny.run_action(FirebaseAppDistributionAction,
152
173
  app: firebase_app_id,
@@ -155,7 +176,7 @@ module Fastlane
155
176
  debug: true
156
177
  )
157
178
  elsif release_target == "testflight"
158
- UI.header "Testflight: uploading build/ios/#{app_name}.ipa"
179
+ UI.header("Testflight: uploading build/ios/#{app_name}.ipa")
159
180
  Sunny.run_action(UploadToTestflightAction,
160
181
  ipa: "build/ios/#{app_name}.ipa",
161
182
  localized_build_info: {
@@ -176,7 +197,7 @@ module Fastlane
176
197
  end
177
198
 
178
199
  def self.description
179
- "Modify pubspec for local or git development"
200
+ "Perform ios or firebase release"
180
201
  end
181
202
 
182
203
  def self.authors
@@ -198,25 +219,34 @@ module Fastlane
198
219
  env_name: "SUNNY_NO_BUMP",
199
220
  description: "Whether to skip a bump",
200
221
  optional: true, type: Object),
201
- FastlaneCore::ConfigItem.new(key: :build,
202
- env_name: "SUNNY_BUILD",
203
- 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",
204
225
  optional: true, type: Object),
205
226
  FastlaneCore::ConfigItem.new(key: :post_build,
206
227
  env_name: "SUNNY_POST_BUILD",
207
- 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",
208
229
  optional: true, type: Object),
209
230
  FastlaneCore::ConfigItem.new(key: :skip_dirty_check,
210
231
  env_name: "SUNNY_SKIP_DIRTY_CHECK",
211
232
  description: "Whether to skip dirty repo check",
212
233
  optional: true, type: Object),
234
+
213
235
  FastlaneCore::ConfigItem.new(key: :clean,
214
236
  env_name: "SUNNY_CLEAN",
215
237
  description: "Whether to do a clean build",
216
238
  optional: true, type: Object),
217
- FastlaneCore::ConfigItem.new(key: :release,
218
- env_name: "SUNNY_RELEASE",
219
- 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",
220
250
  optional: true, type: Object),
221
251
  FastlaneCore::ConfigItem.new(key: :changelog,
222
252
  env_name: "SUNNY_CHANGELOG",
@@ -235,7 +265,7 @@ module Fastlane
235
265
 
236
266
  FastlaneCore::ConfigItem.new(key: :release_target,
237
267
  env_name: "SUNNY_RELEASE_TARGET",
238
- description: "Where we're releasing to",
268
+ description: "Where we're releasing to, must be either fastlane or testflight",
239
269
  optional: false,
240
270
  type: String),
241
271
 
@@ -285,7 +315,7 @@ module Fastlane
285
315
 
286
316
  def visit_Psych_Nodes_Scalar(o)
287
317
  if o.value.is_a?(String)
288
- str = "#{o.value}"
318
+ str = (o.value).to_s
289
319
  if str.start_with?('^') || str.start_with?('..')
290
320
  @handler.scalar(o.value, o.anchor, o.tag, o.plain, o.quoted, 1)
291
321
  elsif str.start_with?('https://') || str.start_with?('git@')
@@ -12,38 +12,34 @@ module Fastlane
12
12
 
13
13
  def self.available_options
14
14
  [
15
- FastlaneCore::ConfigItem.new(key: :sunny_plugins,
16
- env_name: "SUNNY_PLUGINS",
17
- description: "The plugins",
18
- type: Hash,
19
- optional: true,),
20
- FastlaneCore::ConfigItem.new(key: :firebase_app_id,
21
- env_name: "SUNNY_FIREBASE_APP_ID",
22
- description: "Firebase app id",
23
- type: String,
24
- optional: true,),
25
- FastlaneCore::ConfigItem.new(key: :firebase_cli_path,
26
- env_name: "SUNNY_FIREBASE_CLI_PATH",
27
- description: "Firebase cli path",
28
- type: String,
29
- optional: true,),
30
- FastlaneCore::ConfigItem.new(key: :sunny_plugin_folder,
31
- env_name: "SUNNY_PLUGIN_FOLDER",
32
- description: "Folder that contains the packages",
33
- type: String,
34
- optional: false,
35
- default_value: '../plugin'),
36
- FastlaneCore::ConfigItem.new(key: :sunny_plugins_branches,
37
- env_name: "SUNNY_PLUGINS_BRANCHES",
38
- description: "Specific branches to use",
39
- type: Hash,
40
- optional: true,),
41
- FastlaneCore::ConfigItem.new(key: :sunny_local_mode,
42
- env_name: "SUNNY_LOCAL_MODE",
43
- description: "Whether the project uses local checked out packages",
44
- type: String,
45
- optional: true,
46
- default_value: "git"),
15
+ FastlaneCore::ConfigItem.new(key: :sunny_plugins,
16
+ env_name: "SUNNY_PLUGINS",
17
+ description: "The plugins",
18
+ type: Hash,
19
+ optional: true,),
20
+ FastlaneCore::ConfigItem.new(key: :firebase_app_id,
21
+ env_name: "SUNNY_FIREBASE_APP_ID",
22
+ description: "Firebase app id",
23
+ type: String,
24
+ optional: true,),
25
+ FastlaneCore::ConfigItem.new(key: :firebase_cli_path,
26
+ env_name: "SUNNY_FIREBASE_CLI_PATH",
27
+ description: "Firebase cli path",
28
+ type: String,
29
+ optional: true,),
30
+ FastlaneCore::ConfigItem.new(key: :sunny_plugin_folder,
31
+ env_name: "SUNNY_PLUGIN_FOLDER",
32
+ description: "Folder that contains the packages",
33
+ type: String,
34
+ optional: false,
35
+ default_value: '../plugin'),
36
+ # value should be 'git' or 'local'
37
+ FastlaneCore::ConfigItem.new(key: :sunny_local_mode,
38
+ env_name: "SUNNY_LOCAL_MODE",
39
+ description: "Whether the project uses local checked out packages",
40
+ type: String,
41
+ optional: true,
42
+ default_value: "git"),
47
43
 
48
44
  ]
49
45
  end
@@ -21,6 +21,20 @@ module Fastlane
21
21
  end
22
22
  end
23
23
 
24
+ def self.is_clean
25
+ self.run_action(Fastlane::Actions::EnsureGitStatusCleanAction)
26
+ true
27
+ rescue
28
+ false
29
+ end
30
+
31
+ def self.is_branch(branch_name)
32
+ self.run_action(Fastlane::Actions::EnsureGitBranchAction, branch: branch_name)
33
+ true
34
+ rescue
35
+ false
36
+ end
37
+
24
38
  def self.config(available_options, options)
25
39
  FastlaneCore::Configuration.create(available_options, options)
26
40
  end
@@ -30,35 +44,42 @@ module Fastlane
30
44
  end
31
45
 
32
46
  def self.do_increase_version(options)
33
- command = "pubver #{options[:type]} "
34
- if options[:type] == 'patch'
35
- command += "-b"
47
+ bump_type = options[:type]
48
+ bump_type = "build" unless bump_type
49
+ command = "pubver bump #{bump_type}"
50
+ unless bump_type.eql?('build')
51
+ command += " -b"
36
52
  end
37
- 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
+
38
59
  self.current_semver
39
60
  end
40
61
 
41
62
  def self.exec_cmd(name, *command, **args)
42
63
  if (command.count > 1)
43
- command = command.map { |item| Shellwords.escape item }
64
+ command = command.map { |item| Shellwords.escape(item) }
44
65
  end
45
66
  joined = command.join(" ")
46
67
  if args[:verbose]
47
68
  begin
48
69
  return sh(command)
49
70
  rescue StandardError => e
50
- UI.user_error! ">> #{name} failed << \n #{e}"
71
+ UI.user_error!(">> #{name} failed << \n #{e}")
51
72
  end
52
73
  else
53
74
  if args[:cmd_out]
54
- UI.command_output name
75
+ UI.command_output(name)
55
76
  elsif args[:quiet]
56
77
  else
57
78
  UI.command name
58
79
  end
59
80
 
60
81
  stdout, err, status = Open3.capture3(joined)
61
- 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
62
83
  stdout
63
84
  end
64
85
  end
@@ -69,7 +90,7 @@ module Fastlane
69
90
 
70
91
  ### Reads the latest version from pubspec.yaml
71
92
  def self.current_semver
72
- Semantic::Version.new current_version_string
93
+ Semantic::Version.new(current_version_string)
73
94
  end
74
95
 
75
96
  def self.release_notes(options)
@@ -113,7 +134,7 @@ module Fastlane
113
134
  lines = ["## [#{v}]\n", " * #{changes}\n", "\n"] + lines
114
135
 
115
136
  output = File.new("CHANGELOG.md", "w")
116
- lines.each { |line| output.write line }
137
+ lines.each { |line| output.write(line) }
117
138
  output.close
118
139
  end
119
140
  changes
@@ -126,7 +147,7 @@ module Fastlane
126
147
  def self.override_version(**options)
127
148
  semver = options[:version]
128
149
  unless semver
129
- UI.user_error! "No version parameter found"
150
+ UI.user_error!("No version parameter found")
130
151
  return
131
152
  end
132
153
  self.exec_cmd("set_version", "pubver set #{semver}", quiet: true)
@@ -140,14 +161,15 @@ module Fastlane
140
161
  xcodeproj: "ios/Runner.xcodeproj"
141
162
  )
142
163
  else
143
- UI.user_error! "No version found"
164
+ UI.user_error!("No version found")
144
165
  end
145
166
 
146
167
  end
147
168
 
148
- def self.build_ios(build_num, **options)
169
+ def self.build_ios(build_ver, build_num, **options)
149
170
  flutter = get_flutter(options[:flutter])
150
- 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")
151
173
  end
152
174
 
153
175
  ### Reads the latest version from pubspec.yaml
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SunnyProject
3
- VERSION = "0.1.15"
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.15
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-03 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
@@ -150,6 +150,7 @@ files:
150
150
  - lib/fastlane/plugin/sunny_project/actions/finalize_version_action.rb
151
151
  - lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb
152
152
  - lib/fastlane/plugin/sunny_project/actions/increase_version_action.rb
153
+ - lib/fastlane/plugin/sunny_project/actions/local_packages_action.rb
153
154
  - lib/fastlane/plugin/sunny_project/actions/pub_publish_action.rb
154
155
  - lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb
155
156
  - lib/fastlane/plugin/sunny_project/actions/release_notes_action.rb