fastlane-plugin-sunny_project 0.1.18 → 0.1.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/sunny_project/actions/local_packages_action.rb +155 -0
- data/lib/fastlane/plugin/sunny_project/actions/sunny_release_action.rb +2 -3
- data/lib/fastlane/plugin/sunny_project/helper/plugin_options.rb +28 -32
- data/lib/fastlane/plugin/sunny_project/helper/sunny_project_helper.rb +18 -2
- data/lib/fastlane/plugin/sunny_project/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3855025f2d9e15b82cca4539824c3e2c8c850bc2eb47e01edefe47fff6762a4
|
4
|
+
data.tar.gz: 46feb62db9a5f63bb4a6116112a60792b8ed35f970257790149bd8e29d8b41df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ac0254a3298c5e8d639a1f46e145a77bc3d4b07ac8995a4925be29b6954dab75e4a60276974c77f6a86e994ab3115a7f18d4666b6b96a293f8f3d298135ece1
|
7
|
+
data.tar.gz: 9f5fc48f02f75eb80219b86e05f486a72059c5a99da250aa68cd5d6a78dea0b71a17dd56fe612c949a78bcfde8407a105d065ae97bb79f4bacfc62a2a0341e15
|
@@ -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
|
+
|
@@ -29,7 +29,6 @@ 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
33
|
sunny_file.load_configuration_file("Sunnyfile")
|
35
34
|
|
@@ -45,9 +44,9 @@ module Fastlane
|
|
45
44
|
# version numbers.
|
46
45
|
if options[:build] and not options[:no_bump]
|
47
46
|
if options[:release]
|
48
|
-
build_number = Sunny.do_increase_version(
|
47
|
+
build_number = Sunny.do_increase_version(type: "build", patch: true)
|
49
48
|
else
|
50
|
-
build_number = Sunny.do_increase_version(
|
49
|
+
build_number = Sunny.do_increase_version(type: "build")
|
51
50
|
end
|
52
51
|
|
53
52
|
unless build_number
|
@@ -12,38 +12,34 @@ module Fastlane
|
|
12
12
|
|
13
13
|
def self.available_options
|
14
14
|
[
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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,8 +44,10 @@ module Fastlane
|
|
30
44
|
end
|
31
45
|
|
32
46
|
def self.do_increase_version(options)
|
33
|
-
|
34
|
-
|
47
|
+
bump_type = options[:type]
|
48
|
+
bump_type = "build" unless bump_type
|
49
|
+
command = "pubver bump #{bump_type}"
|
50
|
+
if bump_type == 'patch'
|
35
51
|
command += "-b"
|
36
52
|
end
|
37
53
|
self.exec_cmd("bump patch", command)
|
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.
|
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-
|
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
|