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: d1064b20657a45a14d78e09e6abd1d56b4e48289460e210839cfaf8f54c8bb3e
4
- data.tar.gz: 5b81f2e53b86780f6728c0e382cc06ba3abafbaf5ad82cfd435f41f9f73965aa
3
+ metadata.gz: 3d48625bc06b18d4b615207477e6cfd062429fb892d6036ce0d877a96e4fbba4
4
+ data.tar.gz: f93a143ffa8884875564aacf7f5227a821cc28035b71182f7a8fe29850cbd31e
5
5
  SHA512:
6
- metadata.gz: 1c32d9fe80c2dc1307fe54679545cdb43adbf93b7b6a9c95326727b337d0806dbcb9909299bcd218561c5e7186174d7f60f53a70c7cbf7b750cfd203fbbbae10
7
- data.tar.gz: dfa5b03b41bdceeaebd373f44b1d75ead37a81a06f84c7c9fba97b0041fd945c03d3e422eb2ebefcea0258630358202aa551deb710c38145c29832d38d0f18e9
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
  [![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
+ [![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)
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` any part of version you want by use instead of `patch` (`major`,`minor` or `patch`)
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 congigure_major
52
- return @is_major ? @current_version_in_hash['major'] + 1 : @current_version_in_hash['major']
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 @is_minor
57
- @current_version_in_hash['minor'] + 1
58
- else
59
- @is_major ? 0 : @current_version_in_hash['minor']
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 @is_patch
65
- @current_version_in_hash['patch'] + 1
66
- else
67
- @is_major || @is_minor ? 0 : @current_version_in_hash['patch']
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(part)
76
- @is_major = part == "major"
77
- @is_minor = part == "minor"
78
- @is_patch = part == "patch"
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
- @current_version_in_hash['major'] = congigure_major
86
- @current_version_in_hash['minor'] = configure_minor
87
- @current_version_in_hash['patch'] = configure_patch
88
- @current_version_in_hash['build'] = configure_build
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
- part = params[:part] || "build"
115
+ parts = params[:parts] || "build"
116
+ split_parts = parts.split(",")
108
117
  bump_version = FlutterBumpVersion.new(pubspec_path)
109
- bump_version.bump_version(part)
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: :part,
146
+ key: :parts,
138
147
  description: "part you want upgrade (major,minor or patch)",
139
148
  optional: true,
140
149
  type: String
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module FlutterBumpVersion
3
- VERSION = "0.1.3"
3
+ VERSION = "0.2.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.1.3
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-24 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler