fastlane-plugin-flutter_bump_version 0.1.3 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1064b20657a45a14d78e09e6abd1d56b4e48289460e210839cfaf8f54c8bb3e
4
- data.tar.gz: 5b81f2e53b86780f6728c0e382cc06ba3abafbaf5ad82cfd435f41f9f73965aa
3
+ metadata.gz: 6e86cbce7c6cc864127abfd40d7136977dc76ce58bbe6c282b241f0806446b7d
4
+ data.tar.gz: 41ae26b545bb5dd5577fa96534ce030b48447aa742ae2ea6bf8510d0007ef35d
5
5
  SHA512:
6
- metadata.gz: 1c32d9fe80c2dc1307fe54679545cdb43adbf93b7b6a9c95326727b337d0806dbcb9909299bcd218561c5e7186174d7f60f53a70c7cbf7b750cfd203fbbbae10
7
- data.tar.gz: dfa5b03b41bdceeaebd373f44b1d75ead37a81a06f84c7c9fba97b0041fd945c03d3e422eb2ebefcea0258630358202aa551deb710c38145c29832d38d0f18e9
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
  [![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,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` any part of version you want by use instead of `patch` (`major`,`minor` or `patch`)
22
- build (version code) auto-increase based on current version code
23
- if you not pass any option with command will bump build as default
24
- And the `push` if `true` plugin will push bump version to git remote if `false` will not push it
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 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, 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
- @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 && 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
- part = params[:part] || "build"
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(part)
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: :part,
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
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module FlutterBumpVersion
3
- VERSION = "0.1.3"
3
+ VERSION = "0.2.1"
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.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-24 00:00:00.000000000 Z
11
+ date: 2022-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler