flutter_version_tool 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/flutter_version_tool.rb +35 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbad9eef2f7d73d4b77b3e7fa7ae33285be8b677c9e81dde913fe69eceaf041a
4
- data.tar.gz: 64df2ffc684d9115e6672181d2d18fd4b0ce2ccf3790593782b7b5fb8c6cacde
3
+ metadata.gz: 30fc4b7e6fbcc9b8a500e93142f9146171b8dc1281db7ad28cdadb93a6348027
4
+ data.tar.gz: d11c1654e3a8cc86f07c33e7ab19c7df00f988d285466f0b383dbb995705c9d9
5
5
  SHA512:
6
- metadata.gz: c94f632a80b9787e6cc4596961c68ba48d906a9493f9ae41d59e629a26af2f9febf8490d633bc98e2a6e47acff7d32e43c114145f84ecc889a82e7b08a96cd28
7
- data.tar.gz: dfdb53d32f0c66ac0da153c02379149d5fdad6cf606e3063ac79696bc282a774bbd1181ab44ecaef7556c33e7cd49b12a52e4c3400a0a3368802e797cd5ba013
6
+ metadata.gz: 4e9201c10144571a5a59b74b83c2ec203a0a19f018a763cbfe78da1f270872ee3375623b06f4b8ddfd5ad52c85474d0ccffc72c7195b51a8fe23c1824cf9936b
7
+ data.tar.gz: bc11db9bc1f6a7f988cb0cdee1378f7621f41c7881a7cf22944d3e8a0f5b9a6d46632558bb04c552689c350c99cde098c60a5427f7130ab6fbb0d9d943fdc5a4
@@ -1,3 +1,5 @@
1
+ require 'yaml'
2
+
1
3
  class FlutterVersionTool
2
4
  attr_reader :pubspecPath, :vName, :vCode, :vMajor, :vMinor, :vPatch
3
5
 
@@ -5,11 +7,19 @@ class FlutterVersionTool
5
7
  return "#{@vMajor.to_s}.#{@vMinor.to_s}.#{@vPatch.to_s}+#{@vCode.to_s}"
6
8
  end
7
9
 
8
- def initialize(path)
10
+ def initialize(path = "pubspec.yaml")
11
+ # Load version from pubspec file
12
+ #
13
+ # Example:
14
+ # >> fvt = FlutterVersionTool.new("some_project/path/pubspec.yaml")
15
+ #
16
+ # Arguments:
17
+ # pubspecPath: (String)
18
+
9
19
  @pubspecPath = path
10
20
 
11
21
  begin
12
- pubspec = YAML.load_file(@pubspecPath)
22
+ pubspec = YAML::load_file(@pubspecPath)
13
23
  rescue
14
24
  raise 'Read pubspec.yaml failed'
15
25
  end
@@ -56,16 +66,38 @@ class FlutterVersionTool
56
66
  end
57
67
 
58
68
  def changeVersionCode(p_code)
69
+ # Change version build number directly to any number
70
+ #
71
+ # Example:
72
+ # >> fvt.changeVersionCode(140)
73
+ # Arguments:
74
+ # p_code: (Integer)
75
+
59
76
  @vCode=p_code.to_i
60
77
  commitChanges
61
78
  end
62
79
 
63
80
  def bumpVersionCode(increment = 1)
81
+ # Increment version build number (default by +1)
82
+ #
83
+ # Example:
84
+ # >> fvt.bumpVersionCode(1)
85
+ # Arguments:
86
+ # increment: (Integer)
87
+
64
88
  @vCode= @vCode+increment
65
89
  commitChanges
66
90
  end
67
91
 
68
- def bumpVersionName(level = "major", increment)
92
+ def bumpVersionName(level = "major", increment = 1)
93
+ # Increment version name semantically (default major version by +1)
94
+ #
95
+ # Example:
96
+ # >> fvt.bumpVersionName("patch")
97
+ # Arguments:
98
+ # level: ("major","minor","patch")
99
+ # increment: (Integer)
100
+
69
101
  case level
70
102
  when "major"
71
103
  @vMajor=@vMajor+increment
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flutter_version_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rim Ganiev
@@ -29,7 +29,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: 2.5.1
33
33
  required_rubygems_version: !ruby/object:Gem::Requirement
34
34
  requirements:
35
35
  - - ">="