fastlane-plugin-flutter_bump_version 0.2.2 → 0.3.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: b57a4e3fce387ecc52be8f96d19da7db9f802b506723317153b4b7fd954246c1
4
- data.tar.gz: 00ac5a33ba1a908e3363af3fe0b62518c001dd66e7aa56179662db8ae37e35bb
3
+ metadata.gz: 695afce38924df171631388691a1851420581102c3d9f102ca8c77eaece1230c
4
+ data.tar.gz: cf317a9aac07f1e88c8a69bb56e01fa6f029fc9c3de0641fa944d84dbc0c9b71
5
5
  SHA512:
6
- metadata.gz: 95cd97e7fdb269ca48c533cedc4cf5f4c4adb3325637f61a4c6643e68452a9de922048f78a7a1fcf7e0974838ca5fb4d433aa038c532ff22646a2d5a433b8c5f
7
- data.tar.gz: 5c0c8c007469daf8ec5931e878d1c4e1ce7ca4fbb75cb601139794cb131875a4124cf4df08cee9ca240141435c5025c8086d7c11f641a93ef84258f6eb4a6fb3
6
+ metadata.gz: 01a571866a7046ae79647e85cc0ee5f966a1b0ce238d3aece28d7682ae22dfacd48734d821ef64c5706853824a83f78a50198577a633b4684bfc26c1a42ae1d8
7
+ data.tar.gz: 3820d32e073a2c780d7f771bd9fb8594cf1563ed2471500d434ba4f75db20f3e54360e842c4fa0965721cbb17629be08afd527708c1a73e824a82528ebdf5f81
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-flutter_bump_version)
4
4
  [![Plugin Version](https://badge.fury.io/rb/fastlane-plugin-flutter_bump_version.svg)](https://badge.fury.io/rb/fastlane-plugin-flutter_bump_version)
5
5
  [![Test](https://github.com/M97Chahboun/fastlane-plugin-flutter_bump_version/actions/workflows/test.yml/badge.svg)](https://github.com/M97Chahboun/fastlane-plugin-flutter_bump_version/actions/workflows/test.yml)
6
+
6
7
  ## Getting Started
7
8
 
8
9
  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:
@@ -21,19 +22,23 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
21
22
 
22
23
  You can `bump` multi parts of version you want by use instead of `patch` (`major`,`minor` or `patch`) split it by (,)
23
24
 
24
- As Example :
25
+ Example :
25
26
 
26
- old version : 1.0.0
27
+ old version : `1.0.0`
27
28
 
28
29
  ```sh
29
30
  [bundle exec] fastlane bump_version bump:major,minor,minor,patch
30
31
  ```
31
- new version : 2.2.1
32
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
33
+ new version : `2.2.1`
34
+
35
+ ## Available options
35
36
 
36
- And the `push` if `true` plugin will bump version & create tag from it then push to git remote if `false` not do anything
37
+ - `bump_build`: build (version code) auto-increases based on current version code. You can disable it by passing `false` to this parameter. If you don't pass any options, the command will bump the `build` by default.
38
+ - `push`: You can automatically create a tag and push it to git remote if you pass the `push: true` parameter.
39
+ - `version`: provide a version using the SemVer format (`x.x.x`) to be applied to the `pubspec.yaml` file. The build part is managed by the `bump_build` parameter.
40
+
41
+ See [available options](./lib/fastlane/plugin/flutter_bump_version/actions/flutter_bump_version_action.rb#L159) in the source file for more on available options.
37
42
 
38
43
  ## Issues and Feedback
39
44
 
@@ -50,4 +55,3 @@ For more information about how the `fastlane` plugin system works, check out the
50
55
  ## About _fastlane_
51
56
 
52
57
  _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
53
-
@@ -107,6 +107,22 @@ module Fastlane
107
107
  UI.message("Previous app version: #{current_version}")
108
108
  UI.message("New app version: #{new_version}")
109
109
  end
110
+
111
+ def update_provided_version(provided_version, bump_build)
112
+ UI.user_error!("Invalid version format. Please provide version in format x.x.x") unless provided_version.match?(/\d+\.\d+\.\d+/)
113
+
114
+ current_version = @pubspec_yaml_reader.field('version')
115
+
116
+ build_exist = current_version.count("+") != 0
117
+ build = build_exist || @bump_build ? current_version.split("+")[1] : "0"
118
+
119
+ @current_version_in_hash = Hash("build" => build.to_i)
120
+ @current_version_in_hash['build'] = configure_build(bump_build)
121
+
122
+ new_version = "#{provided_version}+#{@current_version_in_hash['build']}"
123
+ update_pubspec(new_version, current_version)
124
+ return Hash(new: new_version, previous: current_version)
125
+ end
110
126
  end
111
127
 
112
128
  class FlutterBumpVersionAction < Action
@@ -115,8 +131,13 @@ module Fastlane
115
131
  parts = params[:parts] || "build"
116
132
  bump_build = params[:bump_build].to_s.empty? ? true : params[:bump_build]
117
133
  split_parts = parts.split(",")
134
+ provided_version = params[:version].to_s.empty? ? false : params[:version]
118
135
  bump_version = FlutterBumpVersion.new(pubspec_path)
119
- bump_version.bump_version(split_parts, bump_build)
136
+ if provided_version
137
+ bump_version.update_provided_version(provided_version, bump_build)
138
+ else
139
+ bump_version.bump_version(split_parts, bump_build)
140
+ end
120
141
  end
121
142
 
122
143
  def self.description
@@ -154,6 +175,12 @@ module Fastlane
154
175
  description: "handle bump build as default true",
155
176
  optional: true,
156
177
  type: Boolean
178
+ ),
179
+ FastlaneCore::ConfigItem.new(
180
+ key: :version,
181
+ description: "Provide a new version to apply and automatically update build number",
182
+ optional: true,
183
+ type: String
157
184
  )
158
185
  ]
159
186
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module FlutterBumpVersion
3
- VERSION = "0.2.2"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  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.2.2
4
+ version: 0.3.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-10-20 00:00:00.000000000 Z
11
+ date: 2025-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler