fastlane-plugin-sunny_project 0.1.0 → 0.1.6
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 +4 -4
- data/lib/fastlane/plugin/sunny_project.rb +1 -1
- data/lib/fastlane/plugin/sunny_project/actions/curr_semver_action.rb +44 -0
- data/lib/fastlane/plugin/sunny_project/actions/dart_package_status_action.rb +102 -0
- data/lib/fastlane/plugin/sunny_project/actions/finalize_version_action.rb +64 -0
- data/lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb +77 -0
- data/lib/fastlane/plugin/sunny_project/actions/increase_version_action.rb +12 -53
- data/lib/fastlane/plugin/sunny_project/actions/{sunny_project_action.rb → pub_publish_action.rb} +7 -11
- data/lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb +155 -0
- data/lib/fastlane/plugin/sunny_project/actions/release_notes_action.rb +96 -0
- data/lib/fastlane/plugin/sunny_project/actions/rename_assets_action.rb +44 -0
- data/lib/fastlane/plugin/sunny_project/helper/plugin_options.rb +42 -0
- data/lib/fastlane/plugin/sunny_project/helper/sunny_project_helper.rb +109 -7
- data/lib/fastlane/plugin/sunny_project/version.rb +1 -1
- metadata +31 -10
- data/lib/fastlane/plugin/sunny_project/actions/sunny_release_action.rb +0 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d87ddec1dc5c7c4f0a49ba91e1c3b64de6f98826f60feea653348736883f1c4
|
4
|
+
data.tar.gz: e06c57be9eccd39f2459b6aa73c18a0eecc15be69b7b2155f2d4c2046b11de57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec2ef481634f91d84ce14186ae583ca4625c71c80d76955ff803e01e9a4dc232f6484c2bcf6a58b39ed454636b8daf9b54bc79404d6fab2f040989a4d4e97c94
|
7
|
+
data.tar.gz: 67d750a01f3d233eae1e7f45acefef1d83a12cedb73210449e8ee1b50fffa2384e76a15c2943d90ca2b5daf8d654bf61917d063a349bd6070ae46c59ed4c2931
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/sunny_project_helper'
|
3
|
+
require 'semantic'
|
4
|
+
|
5
|
+
module Fastlane
|
6
|
+
module Actions
|
7
|
+
class CurrSemverAction < Action
|
8
|
+
def self.run(options)
|
9
|
+
Sunny.current_semver
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"Gets the current version from the project's pubspec.yaml file"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.authors
|
17
|
+
["ericmartineau"]
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.return_value
|
21
|
+
# If your method provides a return value, you can describe here what it does
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.details
|
25
|
+
# Optional:
|
26
|
+
""
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.available_options
|
30
|
+
[
|
31
|
+
|
32
|
+
]
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.is_supported?(platform)
|
36
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
37
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
38
|
+
#
|
39
|
+
# [:ios, :mac, :android].include?(platform)
|
40
|
+
true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
# require 'ci'
|
3
|
+
require_relative '../helper/sunny_project_helper'
|
4
|
+
require 'semantic'
|
5
|
+
require_relative '../helper/plugin_options'
|
6
|
+
|
7
|
+
# def with_captured_stdout
|
8
|
+
# original_stdout = FastlaneCore::UI.ui_object
|
9
|
+
# str = ''
|
10
|
+
# ci_output = FastlaneCI::FastlaneCIOutput.new(
|
11
|
+
# each_line_block: proc do |raw_row|
|
12
|
+
# str = str + raw_row
|
13
|
+
# end
|
14
|
+
# )
|
15
|
+
#
|
16
|
+
# FastlaneCore::UI.ui_object = ci_output
|
17
|
+
# yield
|
18
|
+
# str
|
19
|
+
# ensure
|
20
|
+
# FastlaneCore::UI.ui_object = original_stdout
|
21
|
+
# end
|
22
|
+
|
23
|
+
module Fastlane
|
24
|
+
module Actions
|
25
|
+
class DartPackageStatusAction < Action
|
26
|
+
def self.run(options)
|
27
|
+
params = FastlaneCore::Configuration.create(Fastlane::SunnyProject::Options.available_options, {})
|
28
|
+
params.load_configuration_file("Sunnyfile")
|
29
|
+
options.all_keys.each do |key|
|
30
|
+
params.set(key, options[key])
|
31
|
+
end
|
32
|
+
plugins = params[:sunny_plugins]
|
33
|
+
branches = params[:sunny_plugins]
|
34
|
+
Dir.chdir(params[:sunny_plugin_folder]) do
|
35
|
+
plugins.keys.each do |key|
|
36
|
+
folder = plugins[key]
|
37
|
+
folder_str = ''
|
38
|
+
unless key.to_s.eql? folder.to_s
|
39
|
+
folder_str = " (folder=#{folder})"
|
40
|
+
end
|
41
|
+
UI.command_output "############### #{key} #{folder_str}"
|
42
|
+
if !File.exists? "./#{folder_str}"
|
43
|
+
UI.important " > folder is missing"
|
44
|
+
else
|
45
|
+
Dir.chdir("./#{folder}") do
|
46
|
+
res = ''
|
47
|
+
begin
|
48
|
+
Fastlane::Actions::EnsureGitStatusCleanAction.run({})
|
49
|
+
rescue StandardError => e
|
50
|
+
UI.important " >> failed to check git status << #{e.message}"
|
51
|
+
unless res == ''
|
52
|
+
UI.important " >> #{res}"
|
53
|
+
end
|
54
|
+
if params[:sunny_verbose]
|
55
|
+
UI.user_error! "#{e.backtrace}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
def self.convert_options(options)
|
67
|
+
o = options.__hash__.dup
|
68
|
+
o.delete(:verbose)
|
69
|
+
o
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.description
|
73
|
+
"Get or retrieve release notes from git"
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.authors
|
77
|
+
["ericmartineau"]
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.return_value
|
81
|
+
# If your method provides a return value, you can describe here what it does
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.details
|
85
|
+
# Optional:
|
86
|
+
""
|
87
|
+
end
|
88
|
+
|
89
|
+
def self.available_options
|
90
|
+
Fastlane::SunnyProject::Options.available_options
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.is_supported?(platform)
|
94
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
95
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
96
|
+
#
|
97
|
+
# [:ios, :mac, :android].include?(platform)
|
98
|
+
true
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/sunny_project_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class FinalizeVersionAction < Action
|
7
|
+
def self.run(options)
|
8
|
+
version = Sunny.current_semver
|
9
|
+
# If we got this far, let's commit the build number and update the git tags. If the rest of the pro
|
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,
|
18
|
+
)
|
19
|
+
Fastlane::Actions::PushGitTagsAction.run(log: true)
|
20
|
+
if File.exist?(Sunny.release_notes_file)
|
21
|
+
File.delete(Sunny.release_notes_file)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.description
|
26
|
+
"Commit version tags"
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.authors
|
30
|
+
["ericmartineau"]
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.return_value
|
34
|
+
# If your method provides a return value, you can describe here what it does
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.details
|
38
|
+
# Optional:
|
39
|
+
""
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.available_options
|
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
|
+
|
51
|
+
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.is_supported?(platform)
|
56
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
57
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
58
|
+
#
|
59
|
+
# [:ios, :mac, :android].include?(platform)
|
60
|
+
true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/sunny_project_helper'
|
3
|
+
require 'semantic'
|
4
|
+
|
5
|
+
module Fastlane
|
6
|
+
module Actions
|
7
|
+
class GenerateIconsAction < Action
|
8
|
+
def self.run(options)
|
9
|
+
Dir.chdir("..") {
|
10
|
+
self.download_icons
|
11
|
+
self.build_icon_fonts(options)
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.build_icon_fonts(options)
|
16
|
+
snake_name = options[:icon_set_name]
|
17
|
+
camel_value = snake_name.split('_').downcase.collect(&:capitalize).join
|
18
|
+
helper.exec_cmd("Generate flutter icons", "icon_font_generator",
|
19
|
+
"--from=#{options[:icon_source_folder]}", "--class-name=#{camel_value}",
|
20
|
+
"--out-font=lib/fonts/#{camel_value}.ttf", "--out-flutter=lib/#{snake_name}_font.dart",
|
21
|
+
"--normalize")
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.download_icons
|
26
|
+
Dir.chdir("..") {
|
27
|
+
cmd("Download icons", "dart", "tools/iconsource/downloader.dart")
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.description
|
32
|
+
"Generates a flutter icon set as a font"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.authors
|
36
|
+
["ericmartineau"]
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.return_value
|
40
|
+
# If your method provides a return value, you can describe here what it does
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.details
|
44
|
+
# Optional:
|
45
|
+
""
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.available_options
|
49
|
+
[
|
50
|
+
FastlaneCore::ConfigItem.new(key: :icon_source_folder,
|
51
|
+
env_name: "SUNNY_PROJECT_ICON_SOURCE_FOLDER",
|
52
|
+
description: "The folder to look in for svg icons",
|
53
|
+
optional: false,
|
54
|
+
type: String,
|
55
|
+
default_value: "iconsource/svg"),
|
56
|
+
FastlaneCore::ConfigItem.new(key: :icon_set_name,
|
57
|
+
env_name: "SUNNY_PROJECT_ICON_SET_NAME",
|
58
|
+
description: "The snake-case name of the icon set",
|
59
|
+
optional: false,
|
60
|
+
verify_block: proc do |value|
|
61
|
+
UI.error!("This value cannot be blank") unless value
|
62
|
+
UI.error!("This value must be snake case") unless Sunny.underscore(value) == value
|
63
|
+
end,
|
64
|
+
type: String),
|
65
|
+
]
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.is_supported?(platform)
|
69
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
70
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
71
|
+
#
|
72
|
+
# [:ios, :mac, :android].include?(platform)
|
73
|
+
true
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -5,56 +5,12 @@ require 'semantic'
|
|
5
5
|
module Fastlane
|
6
6
|
module Actions
|
7
7
|
class IncreaseVersionAction < Action
|
8
|
-
### Reads the latest version from pubspec.yaml
|
9
|
-
def self.current_semver
|
10
|
-
Semantic::Version.new current_version
|
11
|
-
end
|
12
|
-
|
13
|
-
### Reads the latest version from pubspec.yaml (doesn't have to be in .. to run)
|
14
|
-
def self.current_semver_path
|
15
|
-
version = nil
|
16
|
-
Dir.chdir("..") {
|
17
|
-
version=current_semver
|
18
|
-
}
|
19
|
-
version
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.build_number
|
23
|
-
current_semver.build
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.release_notes_file
|
27
|
-
".release-notes"
|
28
|
-
end
|
29
|
-
|
30
8
|
def self.run(options)
|
31
|
-
|
32
|
-
|
33
|
-
version=nil
|
34
|
-
Dir.chdir("..") {
|
35
|
-
if options[:patch]
|
36
|
-
cmd("bump patch", "pubver bump patch -b")
|
37
|
-
version=current_semver
|
38
|
-
end
|
39
|
-
if options[:build]
|
40
|
-
cmd("bump build", "pubver bump build")
|
41
|
-
version=current_semver
|
42
|
-
end
|
43
|
-
if version
|
44
|
-
puts(version)
|
45
|
-
else
|
46
|
-
puts("No version changes occurred")
|
47
|
-
next
|
48
|
-
end
|
49
|
-
}
|
50
|
-
|
51
|
-
version
|
52
|
-
|
53
|
-
|
9
|
+
Sunny.do_increase_version options
|
54
10
|
end
|
55
11
|
|
56
12
|
def self.description
|
57
|
-
"
|
13
|
+
"Increment version number in pubspec.yaml file"
|
58
14
|
end
|
59
15
|
|
60
16
|
def self.authors
|
@@ -71,12 +27,17 @@ module Fastlane
|
|
71
27
|
end
|
72
28
|
|
73
29
|
def self.available_options
|
30
|
+
verify_type = lambda do |value|
|
31
|
+
UI.error "Invalid option: #{value} Must be 'build' or 'patch'" unless value == "build" or value == "patch"
|
32
|
+
end
|
74
33
|
[
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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)
|
80
41
|
]
|
81
42
|
end
|
82
43
|
|
@@ -88,7 +49,5 @@ module Fastlane
|
|
88
49
|
true
|
89
50
|
end
|
90
51
|
end
|
91
|
-
|
92
|
-
|
93
52
|
end
|
94
53
|
end
|
data/lib/fastlane/plugin/sunny_project/actions/{sunny_project_action.rb → pub_publish_action.rb}
RENAMED
@@ -1,15 +1,16 @@
|
|
1
1
|
require 'fastlane/action'
|
2
2
|
require_relative '../helper/sunny_project_helper'
|
3
|
+
require 'semantic'
|
3
4
|
|
4
5
|
module Fastlane
|
5
6
|
module Actions
|
6
|
-
class
|
7
|
-
def self.run(
|
8
|
-
|
7
|
+
class PubPublishAction < Action
|
8
|
+
def self.run(options)
|
9
|
+
Sunny.exec_cmd("pub publish", "pub publish -f")
|
9
10
|
end
|
10
11
|
|
11
12
|
def self.description
|
12
|
-
"
|
13
|
+
"Executes pub publish command"
|
13
14
|
end
|
14
15
|
|
15
16
|
def self.authors
|
@@ -26,12 +27,9 @@ module Fastlane
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def self.available_options
|
30
|
+
|
29
31
|
[
|
30
|
-
|
31
|
-
# env_name: "SUNNY_PROJECT_YOUR_OPTION",
|
32
|
-
# description: "A description of your option",
|
33
|
-
# optional: false,
|
34
|
-
# type: String)
|
32
|
+
|
35
33
|
]
|
36
34
|
end
|
37
35
|
|
@@ -43,7 +41,5 @@ module Fastlane
|
|
43
41
|
true
|
44
42
|
end
|
45
43
|
end
|
46
|
-
|
47
|
-
|
48
44
|
end
|
49
45
|
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
|
3
|
+
# require 'ci'
|
4
|
+
require_relative '../helper/sunny_project_helper'
|
5
|
+
require 'semantic'
|
6
|
+
require 'yaml'
|
7
|
+
require 'yaml_normalizer'
|
8
|
+
require_relative '../helper/plugin_options'
|
9
|
+
|
10
|
+
def resort_keys(input)
|
11
|
+
resort={}
|
12
|
+
keys=[]
|
13
|
+
input.each_key do |key|
|
14
|
+
puts("Key #{key} #{key.class}")
|
15
|
+
keys.push("#{key}")
|
16
|
+
end
|
17
|
+
|
18
|
+
keys=keys.sort
|
19
|
+
puts("Sorted keys: #{keys}")
|
20
|
+
keys.each do |k|
|
21
|
+
resort[k] = input[k]
|
22
|
+
end
|
23
|
+
resort
|
24
|
+
end
|
25
|
+
|
26
|
+
module Fastlane
|
27
|
+
module Actions
|
28
|
+
class PubspecDoctorAction < Action
|
29
|
+
def self.run(options)
|
30
|
+
|
31
|
+
params = FastlaneCore::Configuration.create(Fastlane::SunnyProject::Options.available_options, {})
|
32
|
+
params.load_configuration_file("Sunnyfile")
|
33
|
+
options.all_keys.each do |key|
|
34
|
+
puts("override #{key} => #{options[key]}")
|
35
|
+
params.set(key, options[key])
|
36
|
+
end
|
37
|
+
params.all_keys.each do |k|
|
38
|
+
puts("#{k} => #{params[k]}")
|
39
|
+
end
|
40
|
+
|
41
|
+
plugins = params[:sunny_plugins]
|
42
|
+
branches = params[:sunny_plugins_branches]
|
43
|
+
plugin_folder = params[:sunny_plugin_folder]
|
44
|
+
pubspec = YAML.load_file("pubspec.yaml")
|
45
|
+
local_mode = params[:sunny_local_mode]
|
46
|
+
is_local = "local".eql?(local_mode)
|
47
|
+
puts("Local #{local_mode} creates #{is_local}")
|
48
|
+
dependency_overrides = pubspec["dependency_overrides"]
|
49
|
+
|
50
|
+
plugins.keys.each do |key|
|
51
|
+
info = plugins[key]
|
52
|
+
folder = key
|
53
|
+
branch = nil
|
54
|
+
path = nil
|
55
|
+
repo = key
|
56
|
+
if info.is_a? String
|
57
|
+
repo = info
|
58
|
+
else
|
59
|
+
path = info[:path]
|
60
|
+
branch = info[:branch] if info[:branch]
|
61
|
+
repo = info[:repo] if info[:repo]
|
62
|
+
folder = repo
|
63
|
+
end
|
64
|
+
|
65
|
+
if is_local
|
66
|
+
dependency_overrides[key.to_s] = {
|
67
|
+
'path' => "#{plugin_folder}/#{folder}#{path ? "/#{path}" : ''}"
|
68
|
+
}
|
69
|
+
else
|
70
|
+
settings = {
|
71
|
+
'git' => {
|
72
|
+
'url' => "git@github.com:SunnyApp/#{repo}.git",
|
73
|
+
}
|
74
|
+
}
|
75
|
+
if branch
|
76
|
+
settings['git']['ref'] = branch
|
77
|
+
end
|
78
|
+
if path
|
79
|
+
settings['git']['path'] = "#{path}"
|
80
|
+
end
|
81
|
+
dependency_overrides[key.to_s] = settings
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
pubspec["dependencies"] = resort_keys pubspec["dependencies"]
|
86
|
+
pubspec["dev_dependencies"] = resort_keys pubspec["dev_dependencies"]
|
87
|
+
pubspec["dependency_overrides"] = resort_keys pubspec["dependency_overrides"]
|
88
|
+
|
89
|
+
pyaml = Psych::Visitors::YAMLTree.create
|
90
|
+
pyaml << pubspec
|
91
|
+
n=StringIO.new
|
92
|
+
emitter = CustomVisitor.new(n)
|
93
|
+
emitter.accept(pyaml.tree)
|
94
|
+
final_pubspec=n.string.gsub("---", "")
|
95
|
+
File.write('pubspec.yaml', final_pubspec)
|
96
|
+
# normalize = YamlNormalizer::Services::Normalize.new('pubspec.yaml')
|
97
|
+
# normalize.call
|
98
|
+
print(final_pubspec)
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.description
|
102
|
+
"Modify pubspec for local or git development"
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.authors
|
106
|
+
["ericmartineau"]
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.return_value
|
110
|
+
# If your method provides a return value, you can describe here what it does
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.details
|
114
|
+
# Optional:
|
115
|
+
""
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.available_options
|
119
|
+
Fastlane::SunnyProject::Options.available_options
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.is_supported?(platform)
|
123
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
124
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
125
|
+
#
|
126
|
+
# [:ios, :mac, :android].include?(platform)
|
127
|
+
true
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
class CustomVisitor < Psych::Visitors::Emitter
|
132
|
+
def initialize(io)
|
133
|
+
super(io)
|
134
|
+
end
|
135
|
+
|
136
|
+
def visit_Psych_Nodes_Scalar(o)
|
137
|
+
if o.value.is_a? String
|
138
|
+
str="#{o.value}"
|
139
|
+
if str.start_with?('^') || str.start_with?('..')
|
140
|
+
@handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, 1
|
141
|
+
elsif str.start_with?('https://') || str.start_with?('git@')
|
142
|
+
@handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, 3
|
143
|
+
else
|
144
|
+
@handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, o.style
|
145
|
+
end
|
146
|
+
return
|
147
|
+
end
|
148
|
+
@handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, o.style
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/sunny_project_helper'
|
3
|
+
require 'semantic'
|
4
|
+
|
5
|
+
|
6
|
+
module Fastlane
|
7
|
+
module Actions
|
8
|
+
|
9
|
+
class ReleaseNotesAction < Action
|
10
|
+
def self.run(options)
|
11
|
+
changes = Sunny.string(options[:changes])
|
12
|
+
if Sunny.blank(changes)
|
13
|
+
if File.file?(Sunny.release_notes_file)
|
14
|
+
changes = Sunny.string(File.read(Sunny.release_notes_file))
|
15
|
+
|
16
|
+
UI.message "Found release notes: \n#####################################################\n\n#{changes}\n\n#####################################################\n"
|
17
|
+
sleep(5)
|
18
|
+
return changes
|
19
|
+
end
|
20
|
+
unless File.file?(Sunny.release_notes_file)
|
21
|
+
changes = Sunny.string(Fastlane::Actions::ChangelogFromGitCommitsAction.run(
|
22
|
+
path: "./",
|
23
|
+
pretty: "%B",
|
24
|
+
ancestry_path: false,
|
25
|
+
match_lightweight_tag: true,
|
26
|
+
quiet: false,
|
27
|
+
merge_commit_filtering: ":exclude_merges"
|
28
|
+
))
|
29
|
+
|
30
|
+
if Sunny.blank(changes)
|
31
|
+
changes = Sunny.string(Fastlane::Actions::PromptAction.run(
|
32
|
+
text: "Please Enter a description of what changed.\nWhen you are finished, type END\n Changelog: ",
|
33
|
+
multi_line_end_keyword: 'END'))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
unless Sunny.blank(changes)
|
37
|
+
File.open(Sunny.release_notes_file, 'w') { |file|
|
38
|
+
file.write(changes)
|
39
|
+
}
|
40
|
+
end
|
41
|
+
if File.file?(Sunny.release_notes_file)
|
42
|
+
changes = Sunny.string(File.read(Sunny.release_notes_file))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
if File.file?("CHANGELOG.md")
|
47
|
+
f = File.open("CHANGELOG.md", "r+")
|
48
|
+
lines = f.readlines
|
49
|
+
f.close
|
50
|
+
v = Sunny.current_semver
|
51
|
+
lines = ["## [#{v}]\n", " * #{changes}\n", "\n"] + lines
|
52
|
+
|
53
|
+
output = File.new("CHANGELOG.md", "w")
|
54
|
+
lines.each { |line| output.write line }
|
55
|
+
output.close
|
56
|
+
end
|
57
|
+
changes
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.description
|
61
|
+
"Get or retrieve release notes from git"
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.authors
|
65
|
+
["ericmartineau"]
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.return_value
|
69
|
+
# If your method provides a return value, you can describe here what it does
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.details
|
73
|
+
# Optional:
|
74
|
+
""
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.available_options
|
78
|
+
[
|
79
|
+
FastlaneCore::ConfigItem.new(key: :changes,
|
80
|
+
env_name: "SUNNY_PROJECT_CHANGES",
|
81
|
+
description: "Change log text",
|
82
|
+
optional: true,
|
83
|
+
type: String)
|
84
|
+
]
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.is_supported?(platform)
|
88
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
89
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
90
|
+
#
|
91
|
+
# [:ios, :mac, :android].include?(platform)
|
92
|
+
true
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/sunny_project_helper'
|
3
|
+
require 'semantic'
|
4
|
+
|
5
|
+
module Fastlane
|
6
|
+
module Actions
|
7
|
+
class RenameAssetsAction < Action
|
8
|
+
def self.run(options)
|
9
|
+
Sunny.exec_cmd("dart asset_renamer.dart", "dart tools/asset_renamer.dart")
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"Renames assets, generates an assets.dart file to reference them."
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.authors
|
17
|
+
["ericmartineau"]
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.return_value
|
21
|
+
# If your method provides a return value, you can describe here what it does
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.details
|
25
|
+
# Optional:
|
26
|
+
""
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.available_options
|
30
|
+
[
|
31
|
+
|
32
|
+
]
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.is_supported?(platform)
|
36
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
37
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
38
|
+
#
|
39
|
+
# [:ios, :mac, :android].include?(platform)
|
40
|
+
true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'fastlane_core/configuration/config_item'
|
2
|
+
require 'fastlane/helper/lane_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module SunnyProject
|
6
|
+
class Options
|
7
|
+
# This is match specific, as users can append storage specific options
|
8
|
+
def self.append_option(option)
|
9
|
+
self.available_options # to ensure we created the initial `@available_options` array
|
10
|
+
self.available_options.merge(option)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.available_options
|
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: :sunny_plugin_folder,
|
21
|
+
env_name: "SUNNY_PLUGIN_FOLDER",
|
22
|
+
description: "Folder that contains the packages",
|
23
|
+
type: String,
|
24
|
+
optional: false,
|
25
|
+
default_value: '../plugin'),
|
26
|
+
FastlaneCore::ConfigItem.new(key: :sunny_plugins_branches,
|
27
|
+
env_name: "SUNNY_PLUGINS_BRANCHES",
|
28
|
+
description: "Specific branches to use",
|
29
|
+
type: Hash,
|
30
|
+
optional: true,),
|
31
|
+
FastlaneCore::ConfigItem.new(key: :sunny_local_mode,
|
32
|
+
env_name: "SUNNY_LOCAL_MODE",
|
33
|
+
description: "Whether the project uses local checked out packages",
|
34
|
+
type: String,
|
35
|
+
optional: true,
|
36
|
+
default_value: "git"),
|
37
|
+
|
38
|
+
]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,16 +1,118 @@
|
|
1
1
|
require 'fastlane_core/ui/ui'
|
2
|
+
require "fastlane"
|
2
3
|
|
3
4
|
module Fastlane
|
4
5
|
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
6
|
|
6
|
-
module
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
UI.message("Hello from the sunny_project plugin helper!")
|
7
|
+
module Sunny
|
8
|
+
def self.string(str)
|
9
|
+
if str
|
10
|
+
str.strip
|
11
|
+
else
|
12
|
+
nil
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
def self.blank(str)
|
17
|
+
if str
|
18
|
+
str.strip.empty?
|
19
|
+
else
|
20
|
+
true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def self.do_increase_version(options)
|
26
|
+
command = "pubver bump #{options[:type]} "
|
27
|
+
if options[:type] == 'patch'
|
28
|
+
command += "-b"
|
29
|
+
end
|
30
|
+
self.exec_cmd("bump patch", command)
|
31
|
+
self.current_semver
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.exec_cmd(name, *command, **args)
|
35
|
+
if (command.count > 1)
|
36
|
+
command = command.map { |item| Shellwords.escape item }
|
37
|
+
end
|
38
|
+
joined = command.join(" ")
|
39
|
+
if args[:verbose]
|
40
|
+
begin
|
41
|
+
return sh(command)
|
42
|
+
rescue StandardError => e
|
43
|
+
UI.user_error! ">> #{name} failed << \n #{e}"
|
44
|
+
end
|
45
|
+
else
|
46
|
+
if args[:cmd_out]
|
47
|
+
UI.command_output name
|
48
|
+
else
|
49
|
+
UI.command name
|
50
|
+
end
|
51
|
+
|
52
|
+
stdout, err, status = Open3.capture3(joined)
|
53
|
+
UI.user_error! ">> #{name} failed << \n command: #{joined}\n error: #{err}" unless status == 0
|
54
|
+
stdout
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.release_notes_file
|
59
|
+
".release-notes"
|
60
|
+
end
|
61
|
+
|
62
|
+
### Reads the latest version from pubspec.yaml
|
63
|
+
def self.current_semver
|
64
|
+
Semantic::Version.new current_version_string
|
65
|
+
end
|
66
|
+
|
67
|
+
### Reads the latest version from pubspec.yaml
|
68
|
+
def self.current_semver_path
|
69
|
+
version = nil
|
70
|
+
Dir.chdir("..") do
|
71
|
+
version = self.current_semver
|
72
|
+
end
|
73
|
+
version
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.build_number
|
77
|
+
self.current_semver.build
|
78
|
+
end
|
79
|
+
|
80
|
+
## Retrieves the current semver based on git tags
|
81
|
+
def self.current_version_string
|
82
|
+
self.exec_cmd("get version", "pubver get")
|
83
|
+
end
|
84
|
+
|
85
|
+
# lane :ximg do |options|
|
86
|
+
# Dir.chdir("..") {
|
87
|
+
# cmd("dart asset_renamer.dart", "dart tools/asset_renamer.dart")
|
88
|
+
# }
|
89
|
+
# end
|
90
|
+
#
|
91
|
+
# lane :icons do
|
92
|
+
# download_icons
|
93
|
+
# build_icon_fonts
|
94
|
+
# end
|
95
|
+
#
|
96
|
+
# lane :build_icon_fonts do
|
97
|
+
# Dir.chdir("..") {
|
98
|
+
# cmd("Generate flutter icons", "icon_font_generator", "--from=iconsource/svg", "--class-name=AuthIcons",
|
99
|
+
# "--out-font=lib/fonts/AuthIcons.ttf", "--out-flutter=lib/auth_icon_font.dart", "--normalize")
|
100
|
+
# }
|
101
|
+
# end
|
102
|
+
#
|
103
|
+
# lane :download_icons do
|
104
|
+
# Dir.chdir("..") {
|
105
|
+
# cmd("Download icons", "dart", "tools/iconsource/downloader.dart")
|
106
|
+
# }
|
107
|
+
# end
|
108
|
+
|
109
|
+
def self.underscore(str)
|
110
|
+
str.gsub(/::/, '/').
|
111
|
+
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
|
112
|
+
gsub(/([a-z\d])([A-Z])/, '\1_\2').
|
113
|
+
tr("-", "_").
|
114
|
+
downcase
|
115
|
+
end
|
15
116
|
end
|
16
117
|
end
|
118
|
+
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ericmartineau
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ci
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: pry
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,15 +142,15 @@ dependencies:
|
|
128
142
|
requirements:
|
129
143
|
- - ">="
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: 2.
|
145
|
+
version: 2.168.0
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: 2.
|
139
|
-
description:
|
152
|
+
version: 2.168.0
|
153
|
+
description:
|
140
154
|
email: smartytime@gmail.com
|
141
155
|
executables: []
|
142
156
|
extensions: []
|
@@ -145,16 +159,23 @@ files:
|
|
145
159
|
- LICENSE
|
146
160
|
- README.md
|
147
161
|
- lib/fastlane/plugin/sunny_project.rb
|
162
|
+
- lib/fastlane/plugin/sunny_project/actions/curr_semver_action.rb
|
163
|
+
- lib/fastlane/plugin/sunny_project/actions/dart_package_status_action.rb
|
164
|
+
- lib/fastlane/plugin/sunny_project/actions/finalize_version_action.rb
|
165
|
+
- lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb
|
148
166
|
- lib/fastlane/plugin/sunny_project/actions/increase_version_action.rb
|
149
|
-
- lib/fastlane/plugin/sunny_project/actions/
|
150
|
-
- lib/fastlane/plugin/sunny_project/actions/
|
167
|
+
- lib/fastlane/plugin/sunny_project/actions/pub_publish_action.rb
|
168
|
+
- lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb
|
169
|
+
- lib/fastlane/plugin/sunny_project/actions/release_notes_action.rb
|
170
|
+
- lib/fastlane/plugin/sunny_project/actions/rename_assets_action.rb
|
171
|
+
- lib/fastlane/plugin/sunny_project/helper/plugin_options.rb
|
151
172
|
- lib/fastlane/plugin/sunny_project/helper/sunny_project_helper.rb
|
152
173
|
- lib/fastlane/plugin/sunny_project/version.rb
|
153
174
|
homepage: https://github.com/SunnyApp/fastlane-plugin-sunny_project
|
154
175
|
licenses:
|
155
176
|
- MIT
|
156
177
|
metadata: {}
|
157
|
-
post_install_message:
|
178
|
+
post_install_message:
|
158
179
|
rdoc_options: []
|
159
180
|
require_paths:
|
160
181
|
- lib
|
@@ -170,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
191
|
version: '0'
|
171
192
|
requirements: []
|
172
193
|
rubygems_version: 3.0.3
|
173
|
-
signing_key:
|
194
|
+
signing_key:
|
174
195
|
specification_version: 4
|
175
196
|
summary: Sunny flutter projects
|
176
197
|
test_files: []
|
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'fastlane/action'
|
2
|
-
require_relative '../helper/sunny_project_helper'
|
3
|
-
|
4
|
-
module Fastlane
|
5
|
-
module Actions
|
6
|
-
class SunnyReleaseAction < Action
|
7
|
-
def self.run(params)
|
8
|
-
UI.message("The sunny_release plugin is working!")
|
9
|
-
lane :increase_version do |options|
|
10
|
-
version=nil
|
11
|
-
|
12
|
-
Dir.chdir("..") {
|
13
|
-
if options[:patch]
|
14
|
-
cmd("bump patch", "pubver bump patch -b")
|
15
|
-
version=current_semver
|
16
|
-
end
|
17
|
-
if options[:build]
|
18
|
-
cmd("bump build", "pubver bump build")
|
19
|
-
version=current_semver
|
20
|
-
end
|
21
|
-
if version
|
22
|
-
puts(version)
|
23
|
-
else
|
24
|
-
puts("No version changes occurred")
|
25
|
-
next
|
26
|
-
end
|
27
|
-
}
|
28
|
-
|
29
|
-
version
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.description
|
35
|
-
"Sunny release plugin"
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.authors
|
39
|
-
["ericmartineau"]
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.return_value
|
43
|
-
# If your method provides a return value, you can describe here what it does
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.details
|
47
|
-
# Optional:
|
48
|
-
""
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.available_options
|
52
|
-
[
|
53
|
-
# FastlaneCore::ConfigItem.new(key: :your_option,
|
54
|
-
# env_name: "SUNNY_PROJECT_YOUR_OPTION",
|
55
|
-
# description: "A description of your option",
|
56
|
-
# optional: false,
|
57
|
-
# type: String)
|
58
|
-
]
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.is_supported?(platform)
|
62
|
-
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
63
|
-
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
64
|
-
#
|
65
|
-
# [:ios, :mac, :android].include?(platform)
|
66
|
-
true
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
|
71
|
-
end
|
72
|
-
end
|