fastlane-plugin-sunny_project 0.1.14 → 0.1.19

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: 1b40e0053f637e07d053a17c343cd7f9534b5fea432599585162068c8064be68
4
- data.tar.gz: 0f0c50ae8c57178a6d7d81423916f7a92184e35e2712653805f59ee1605ee7f1
3
+ metadata.gz: a3855025f2d9e15b82cca4539824c3e2c8c850bc2eb47e01edefe47fff6762a4
4
+ data.tar.gz: 46feb62db9a5f63bb4a6116112a60792b8ed35f970257790149bd8e29d8b41df
5
5
  SHA512:
6
- metadata.gz: f8ba33b0495a4c50a9193c53782382eb744c9f03a643221cdb175e9f9bfccea8b0abb67159b21eb89b70a12c14bb73a74393142b275a2c1a247544446106aaf6
7
- data.tar.gz: 31ad9d4d7bdc85c57174942010c6c7d6fc9c68ff19e269c1b57de276f9ef89c7cc18a18f13c355399f39799fb7fa596c3481980f01a479bcac33a9ee94598a05
6
+ metadata.gz: 7ac0254a3298c5e8d639a1f46e145a77bc3d4b07ac8995a4925be29b6954dab75e4a60276974c77f6a86e994ab3115a7f18d4666b6b96a293f8f3d298135ece1
7
+ data.tar.gz: 9f5fc48f02f75eb80219b86e05f486a72059c5a99da250aa68cd5d6a78dea0b71a17dd56fe612c949a78bcfde8407a105d065ae97bb79f4bacfc62a2a0341e15
@@ -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
+
@@ -44,9 +44,9 @@ module Fastlane
44
44
  # version numbers.
45
45
  if options[:build] and not options[:no_bump]
46
46
  if options[:release]
47
- build_number = Sunny.do_increase_version(build: true, patch: true)
47
+ build_number = Sunny.do_increase_version(type: "build", patch: true)
48
48
  else
49
- build_number = Sunny.do_increase_version(build: true)
49
+ build_number = Sunny.do_increase_version(type: "build")
50
50
  end
51
51
 
52
52
  unless build_number
@@ -71,7 +71,7 @@ module Fastlane
71
71
  UI.important "Skipping Flutter Build"
72
72
  else
73
73
  UI.header "Run Flutter Build"
74
- Sunny.build_ios(build_number, options)
74
+ Sunny.build_ios(build_number)
75
75
  end
76
76
  require 'match'
77
77
  build_opts = options[:build_options]
@@ -108,10 +108,10 @@ module Fastlane
108
108
 
109
109
  end
110
110
  rescue StandardError => e
111
- UI.user_error!(">> build ios failed << \n #{e}", {})
112
111
  # Put the version back like it was
113
112
  UI.important("Restoring old version: #{old_version}")
114
113
  Sunny.override_version(version: old_version)
114
+ UI.user_error!(">> build ios failed #{e} << \n #{e.backtrace.join("\n")}")
115
115
  return
116
116
  end
117
117
 
@@ -127,8 +127,10 @@ module Fastlane
127
127
  UI.header "Commit pubspec.yaml, Info.plist for version updates"
128
128
  # If we got this far, let's commit the build number and update the git tags. If the rest of the pro
129
129
  # process fails, we should revert this because it will mess up our commit logs
130
- Sunny.run_action(GitCommitAction, path: %w[./pubspec.yaml ./pubspec.lock ./Gemfile.lock ./ios/Runner/Info.plist],
131
- message: "Version bump to: #{version.major}.#{version.minor}.#{version.patch}#800#{version.build}")
130
+ Sunny.run_action(GitCommitAction,
131
+ 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}\"")
132
134
  UI.header "Tagging repo v#{version.build}"
133
135
  Sunny.run_action(AddGitTagAction,
134
136
  grouping: "sunny-builds",
@@ -240,8 +242,8 @@ module Fastlane
240
242
 
241
243
  FastlaneCore::ConfigItem.new(key: :skip_flutter_build,
242
244
  env_name: "SKIP FLUTTER BUILD",
243
- description: "Where we're releasing to",
244
- optional: false,
245
+ description: "Skip the initial flutter build",
246
+ optional: true,
245
247
  type: Object),
246
248
  FastlaneCore::ConfigItem.new(key: :verbose,
247
249
  env_name: "SUNNY_VERBOSE",
@@ -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
@@ -29,10 +43,11 @@ module Fastlane
29
43
  action.run(self.config(action.available_options, options))
30
44
  end
31
45
 
32
-
33
46
  def self.do_increase_version(options)
34
- command = "pubver #{options[:type]} "
35
- if options[:type] == 'patch'
47
+ bump_type = options[:type]
48
+ bump_type = "build" unless bump_type
49
+ command = "pubver bump #{bump_type}"
50
+ if bump_type == 'patch'
36
51
  command += "-b"
37
52
  end
38
53
  self.exec_cmd("bump patch", command)
@@ -81,7 +96,7 @@ module Fastlane
81
96
  return changes
82
97
  end
83
98
  unless File.file?(Sunny.release_notes_file)
84
- changes = Sunny.string(Fastlane::Actions::ChangelogFromGitCommitsAction.run(
99
+ changes = Sunny.string(Fastlane::Actions::ChangelogFromGitCommitsAction.run(
85
100
  path: "./",
86
101
  pretty: "%B",
87
102
  ancestry_path: false,
@@ -130,22 +145,20 @@ module Fastlane
130
145
  UI.user_error! "No version parameter found"
131
146
  return
132
147
  end
133
- cmd("set_version", "pubver set #{semver}")
134
- sync_version_number(semver)
148
+ self.exec_cmd("set_version", "pubver set #{semver}", quiet: true)
149
+ self.sync_version_number(semver)
135
150
  end
136
151
 
137
152
  def self.sync_version_number(version)
138
- Dir.chdir("../ios") {
139
- if version
140
- ## This will update the xcode version number
141
- Fastlane::Actions::IncrementVersionNumberAction(
142
- version_number: "#{version.major}.#{version.minor}.#{version.patch}",
143
- xcodeproj: "ios/Runner.xcodeproj"
144
- )
145
- else
146
- UI.user_error! "No version found"
147
- end
148
- }
153
+ if version
154
+ self.run_action(Fastlane::Actions::IncrementVersionNumberAction,
155
+ version_number: "#{version.major}.#{version.minor}.#{version.patch}",
156
+ xcodeproj: "ios/Runner.xcodeproj"
157
+ )
158
+ else
159
+ UI.user_error! "No version found"
160
+ end
161
+
149
162
  end
150
163
 
151
164
  def self.build_ios(build_num, **options)
@@ -168,7 +181,7 @@ module Fastlane
168
181
 
169
182
  ## Retrieves the current semver based on git tags
170
183
  def self.current_version_string
171
- self.exec_cmd("get version", "pubver get", quiet:true)
184
+ self.exec_cmd("get version", "pubver get", quiet: true)
172
185
  end
173
186
 
174
187
  # lane :ximg do |options|
@@ -197,10 +210,10 @@ module Fastlane
197
210
 
198
211
  def self.underscore(str)
199
212
  str.gsub(/::/, '/').
200
- gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
201
- gsub(/([a-z\d])([A-Z])/, '\1_\2').
202
- tr("-", "_").
203
- downcase
213
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
214
+ gsub(/([a-z\d])([A-Z])/, '\1_\2').
215
+ tr("-", "_").
216
+ downcase
204
217
  end
205
218
  end
206
219
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SunnyProject
3
- VERSION = "0.1.14"
3
+ VERSION = "0.1.19"
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.14
4
+ version: 0.1.19
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-07 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