fastlane-plugin-flutter_bump_version 0.1.3 → 0.2.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e86cbce7c6cc864127abfd40d7136977dc76ce58bbe6c282b241f0806446b7d
|
4
|
+
data.tar.gz: 41ae26b545bb5dd5577fa96534ce030b48447aa742ae2ea6bf8510d0007ef35d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10b60d98fda44c62bc7f11566098da36b4e40bb11dc0bcfdbe7b8d9839fb906620c60ae904e43ad3306cc9a820252e709f44ad32e75d0398379b93fe07703809
|
7
|
+
data.tar.gz: 824a19edff652048ab7ab2c4be9610ee49876cac1e11c346fae28e0b14a79ef0c017ffd2a2ea56c3376d967a5c9efbc428f928cd9b5ef6813ba46283fd84a34a
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# flutter_bump_version plugin
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/fastlane-plugin-flutter_bump_version)
|
4
|
-
|
4
|
+
[](https://badge.fury.io/rb/fastlane-plugin-flutter_bump_version)
|
5
|
+
[](https://github.com/M97Chahboun/fastlane-plugin-flutter_bump_version/actions/workflows/test.yml)
|
5
6
|
## Getting Started
|
6
7
|
|
7
8
|
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-flutter_bump_version`, add it to your project by running:
|
@@ -18,10 +19,21 @@ Manages Flutter project version
|
|
18
19
|
|
19
20
|
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane bump_version bump:patch push:false`.
|
20
21
|
|
21
|
-
You can `bump`
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
You can `bump` multi parts of version you want by use instead of `patch` (`major`,`minor` or `patch`) split it by (,)
|
23
|
+
|
24
|
+
As Example :
|
25
|
+
|
26
|
+
old version : 1.0.0
|
27
|
+
|
28
|
+
```sh
|
29
|
+
[bundle exec] fastlane bump_version bump:major,minor,minor,patch
|
30
|
+
```
|
31
|
+
new version : 2.2.1
|
32
|
+
|
33
|
+
build (version code) auto-increase based on current version code & you can disable it by pass `false` with bump_build parameter
|
34
|
+
if you not pass any option or wrong option with command will bump build as default
|
35
|
+
|
36
|
+
And the `push` if `true` plugin will bump version & create tag from it then push to git remote if `false` not do anything
|
25
37
|
|
26
38
|
## Issues and Feedback
|
27
39
|
|
@@ -48,44 +48,52 @@ module Fastlane
|
|
48
48
|
@pubspec_file_writter = FileWritter.new(pubspec_path)
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
52
|
-
|
51
|
+
def configure_major(part)
|
52
|
+
if part == "major"
|
53
|
+
@current_version_in_hash['major'] += @increase_major
|
54
|
+
end
|
53
55
|
end
|
54
56
|
|
55
|
-
def configure_minor
|
56
|
-
if
|
57
|
-
@
|
58
|
-
|
59
|
-
|
57
|
+
def configure_minor(part)
|
58
|
+
if part == "minor" || part == "major"
|
59
|
+
if @increase_major == 0
|
60
|
+
@current_version_in_hash['minor'] += @increase_minor
|
61
|
+
else
|
62
|
+
@current_version_in_hash['minor'] = @increase_minor
|
63
|
+
end
|
60
64
|
end
|
61
65
|
end
|
62
66
|
|
63
|
-
def configure_patch
|
64
|
-
if
|
65
|
-
@
|
66
|
-
|
67
|
-
|
67
|
+
def configure_patch(part)
|
68
|
+
if part == "patch" || part == "minor" || part == "major"
|
69
|
+
if @increase_major != 0 || @increase_minor != 0
|
70
|
+
@current_version_in_hash['patch'] = @increase_patch
|
71
|
+
else
|
72
|
+
@current_version_in_hash['patch'] += @increase_patch
|
73
|
+
end
|
68
74
|
end
|
69
75
|
end
|
70
76
|
|
71
|
-
def configure_build
|
72
|
-
@current_version_in_hash['build'] + 1
|
77
|
+
def configure_build(bump_build)
|
78
|
+
bump_build ? @current_version_in_hash['build'] + 1 : @current_version_in_hash['build']
|
73
79
|
end
|
74
80
|
|
75
|
-
def bump_version(
|
76
|
-
@
|
77
|
-
@
|
78
|
-
@
|
81
|
+
def bump_version(parts, bump_build)
|
82
|
+
@increase_major = parts.count("major")
|
83
|
+
@increase_minor = parts.count("minor")
|
84
|
+
@increase_patch = parts.count("patch")
|
79
85
|
current_version = @pubspec_yaml_reader.field('version')
|
80
86
|
split_current_version = current_version.split(".")
|
81
87
|
build_exist = current_version.count("+") != 0
|
82
88
|
patch = build_exist ? split_current_version.last.split("+")[0] : split_current_version[2]
|
83
|
-
build = build_exist ? split_current_version.last.split("+")[1] : "0"
|
89
|
+
build = build_exist || @bump_build ? split_current_version.last.split("+")[1] : "0"
|
84
90
|
@current_version_in_hash = Hash("major" => split_current_version[0].to_i, "minor" => split_current_version[1].to_i, "patch" => patch.to_i, "build" => build.to_i)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
91
|
+
parts.uniq.sort.reverse_each do |part|
|
92
|
+
configure_major(part)
|
93
|
+
configure_minor(part)
|
94
|
+
configure_patch(part)
|
95
|
+
@current_version_in_hash['build'] = configure_build(parts.uniq.max == part && bump_build)
|
96
|
+
end
|
89
97
|
new_version = "#{@current_version_in_hash['major']}.#{@current_version_in_hash['minor']}.#{@current_version_in_hash['patch']}"
|
90
98
|
new_version += "+#{@current_version_in_hash['build']}"
|
91
99
|
update_pubspec(new_version, current_version)
|
@@ -104,9 +112,11 @@ module Fastlane
|
|
104
112
|
class FlutterBumpVersionAction < Action
|
105
113
|
def self.run(params)
|
106
114
|
pubspec_path = params[:pubspec] || '../'
|
107
|
-
|
115
|
+
parts = params[:parts] || "build"
|
116
|
+
bump_build = params[:bump_build].to_s.empty? ? true : params[:bump_build]
|
117
|
+
split_parts = parts.split(",")
|
108
118
|
bump_version = FlutterBumpVersion.new(pubspec_path)
|
109
|
-
bump_version.bump_version(
|
119
|
+
bump_version.bump_version(split_parts, bump_build)
|
110
120
|
end
|
111
121
|
|
112
122
|
def self.description
|
@@ -134,10 +144,16 @@ module Fastlane
|
|
134
144
|
type: String
|
135
145
|
),
|
136
146
|
FastlaneCore::ConfigItem.new(
|
137
|
-
key: :
|
147
|
+
key: :parts,
|
138
148
|
description: "part you want upgrade (major,minor or patch)",
|
139
149
|
optional: true,
|
140
150
|
type: String
|
151
|
+
),
|
152
|
+
FastlaneCore::ConfigItem.new(
|
153
|
+
key: :bump_build,
|
154
|
+
description: "handle bump build as default true",
|
155
|
+
optional: true,
|
156
|
+
type: Boolean
|
141
157
|
)
|
142
158
|
]
|
143
159
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-flutter_bump_version
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mohammed chahboun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|