fastlane-plugin-flutter_bump_version 0.1.3 → 0.2.0
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: 3d48625bc06b18d4b615207477e6cfd062429fb892d6036ce0d877a96e4fbba4
|
4
|
+
data.tar.gz: f93a143ffa8884875564aacf7f5227a821cc28035b71182f7a8fe29850cbd31e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f773201143302b33f2ae5332da847baa810e954d20f119b899d870f3aa0ec41c3d833a17105423502fb20b51a1742584b6558464616c3b23c0f536aa3c0b3fb
|
7
|
+
data.tar.gz: 90c55a664663a078f2c6e52316f4645cbc321f23ea19a5a9a11c86023d5eff3de28da35582bf535117d2ba3b0e989b7045d1e5391785822588ee566dc38d8039
|
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,9 +19,20 @@ 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
|
+
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
|
+
|
22
33
|
build (version code) auto-increase based on current version code
|
23
|
-
if you not pass any option with command will bump build as default
|
34
|
+
if you not pass any option or wrong option with command will bump build as default
|
35
|
+
|
24
36
|
And the `push` if `true` plugin will push bump version to git remote if `false` will not push it
|
25
37
|
|
26
38
|
## Issues and Feedback
|
@@ -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)
|
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)
|
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,10 @@ 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
|
+
split_parts = parts.split(",")
|
108
117
|
bump_version = FlutterBumpVersion.new(pubspec_path)
|
109
|
-
bump_version.bump_version(
|
118
|
+
bump_version.bump_version(split_parts)
|
110
119
|
end
|
111
120
|
|
112
121
|
def self.description
|
@@ -134,7 +143,7 @@ module Fastlane
|
|
134
143
|
type: String
|
135
144
|
),
|
136
145
|
FastlaneCore::ConfigItem.new(
|
137
|
-
key: :
|
146
|
+
key: :parts,
|
138
147
|
description: "part you want upgrade (major,minor or patch)",
|
139
148
|
optional: true,
|
140
149
|
type: String
|
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.
|
4
|
+
version: 0.2.0
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|