fastlane-plugin-flutter_version 0.1.4 → 1.0.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: ce3aa6cd147116a2aa4849864bfcdb12443d211211349baa52bd1a71f2ed3084
4
- data.tar.gz: d7c0f4ce4f0b14d44d63261cd49d8acf91974bb1091ebc70029ff264cd5255ec
3
+ metadata.gz: 72062642dce0b537558b2a480a19a1c31c4cfd3c119a0278e12e2d25eae3c7d6
4
+ data.tar.gz: d5574a0cfe29e50524f3dc94c88aa3692bda2ea6988fe40d17f7306e52901666
5
5
  SHA512:
6
- metadata.gz: 642d42d5398dfcc79650db78968853c658f27bde1849bba6c1a3c319c3a0691d972535889ae8a4182f247fada6f2385bfad6c5c99d11bb2f3d757fa0280aee20
7
- data.tar.gz: 11cde6e8201ff1b1c25826cfb6a2c2292767fd2677b15185dcc543d8168837c983845b0cd39a129c62625d724e793dab17958ea99c7276a54de9d615d0e8c6e4
6
+ metadata.gz: a6947376adb60e834f72e92bd171c30de595eb5628844183b6a15968c0b4e1594477fc97ff8e2480a73a2e0f3b527326018ca2382c03cb72d947d1cece319294
7
+ data.tar.gz: f78067f666324d7022f3dc3adb7c844395571f9020b5ded531a4c50002616edcd6bafa824f61c043344b8b732a9ad9fac6fb872eaa48d45cf0685803fa7efe46
data/README.md CHANGED
@@ -1,50 +1,133 @@
1
- # flutter_version plugin
1
+ # flutter_version (Fastlane plugin)
2
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3
+ [![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
4
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
2
5
 
3
6
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-flutter_version)
4
7
  [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/tianhaoz95/fastlane-plugin-flutter_version)
8
+ [![codecov](https://codecov.io/gh/tianhaoz95/fastlane-plugin-flutter_version/branch/master/graph/badge.svg)](https://codecov.io/gh/tianhaoz95/fastlane-plugin-flutter_version)
5
9
 
6
- ## Getting Started
10
+ flutter_version is a Fastlane plugin to retrieve version code from Flutter projects which can be used to release changlogs and other metadata to marketplaces.
11
+
12
+ ## Installation
7
13
 
8
14
  This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-flutter_version`, add it to your project by adding the following lines in `Gemfile`:
9
15
 
10
- ```Gemfile
11
- gem "fastlane-plugin-flutter_version", git: "https://github.com/tianhaoz95/fastlane-plugin-flutter-version"
16
+ ### From GitHub registry (recommended)
17
+
18
+ Install from the command line:
19
+
20
+ ```bash
21
+ gem install fastlane-plugin-flutter_version --version "1.0.0" --source "https://rubygems.pkg.github.com/tianhaoz95"
12
22
  ```
13
23
 
14
- ## About flutter_version
24
+ Install via Gemfile:
15
25
 
16
- A plugin to retrieve versioning information for Flutter projects.
26
+ ```bash
27
+ source "https://rubygems.pkg.github.com/tianhaoz95" do
28
+ gem "fastlane-plugin-flutter_version", "1.0.0"
29
+ end
30
+ ```
17
31
 
18
- ## Example
32
+ Check out the instructions in [GitHub Registry](https://github.com/tianhaoz95/fastlane-plugin-flutter_version/packages/143774).
19
33
 
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 test`.
34
+ ### From gem registry
21
35
 
22
- ## Run tests for this plugin
36
+ Check out the instructions [here](https://rubygems.org/gems/fastlane-plugin-flutter_version).
23
37
 
24
- To run both the tests, and code style validation, run
38
+ ### Directly from Github
25
39
 
40
+ ```Gemfile
41
+ gem "fastlane-plugin-flutter_version", git: "https://github.com/tianhaoz95/fastlane-plugin-flutter-version"
26
42
  ```
27
- rake
28
- ```
29
43
 
30
- To automatically fix many of the styling issues, use
44
+ ## Usage
45
+
46
+ ### Android example
31
47
 
48
+ The following example releases a Android app to Google Play Store without needing to manually specify the app version:
49
+
50
+ ```ruby
51
+ desc "submit to internal track in Google Play Store"
52
+ lane :internal do
53
+ gradle(task: 'bundle', build_type: 'Release')
54
+ upload_to_play_store(
55
+ track: 'internal',
56
+ version_code: flutter_version()["version_code"],
57
+ aab: '../build/app/outputs/bundle/release/app-release.aab',
58
+ skip_upload_screenshots: true,
59
+ skip_upload_images: true
60
+ )
61
+ end
32
62
  ```
33
- rubocop -a
63
+
64
+ The line `flutter_version()` fetches the version information from the `pubspec.yaml` file from the Flutter project and parses the version information from the file. This is convenient for continuous integration because it saves the effort for developers to keep track of version information in multiple places.
65
+
66
+ For more details, check out the [example project configuration](https://github.com/tianhaoz95/photochat/blob/master/photochatapp/android/fastlane/Fastfile).
67
+
68
+ ### iOS example
69
+
70
+ The following example releases an iOS app to TestFlight without needing to manually specify the app version or build number:
71
+
72
+ ```ruby
73
+ desc "submit to TestFlight"
74
+ lane :internal do
75
+ # https://docs.fastlane.tools/actions/increment_version_number/
76
+ increment_version_number(
77
+ xcodeproj: "Runner.xcodeproj",
78
+ version_number: flutter_version()["version_name"] # Set a specific version number
79
+ )
80
+ # https://docs.fastlane.tools/actions/increment_build_number/
81
+ increment_build_number(
82
+ xcodeproj: "Runner.xcodeproj",
83
+ build_number: flutter_version()["version_code"] # Set a specific build number
84
+ )
85
+ build_app(workspace: "Runner.xcworkspace", export_method: "app-store")
86
+ upload_to_testflight
87
+ end
34
88
  ```
35
89
 
36
- ## Issues and Feedback
90
+ ### Available options
91
+
92
+ | Name | Description | Optional | Type | Default |
93
+ |:---:|:---:|:---:|:---:|:---:|
94
+ | `pubspec_location` | The location of the `pubspec.yaml` file. | :white_check_mark: | `String` | `../pubspec.yaml` |
95
+ | `should_omit_version_code` | If the version code should be omitted for projects that do not use a version code. | :white_check_mark: | `Boolean` | `false` |
37
96
 
38
- For any other issues and feedback about this plugin, please submit it to this repository.
97
+ ## Issues and feedback
98
+
99
+ For any other issues and feedback about this plugin, please submit it to [this repository](https://github.com/tianhaoz95/fastlane-plugin-flutter_version).
39
100
 
40
101
  ## Troubleshooting
41
102
 
42
103
  If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
43
104
 
44
- ## Using _fastlane_ Plugins
105
+ ## Using Fastlane plugins
45
106
 
46
107
  For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
47
108
 
48
- ## About _fastlane_
109
+ ## About Fastlane
110
+
111
+ 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).
112
+
113
+ ## Contributors ✨
114
+
115
+ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
116
+
117
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
118
+ <!-- prettier-ignore-start -->
119
+ <!-- markdownlint-disable -->
120
+ <table>
121
+ <tr>
122
+ <td align="center"><a href="https://www.shunkakinoki.com/"><img src="https://avatars0.githubusercontent.com/u/39187513?v=4" width="100px;" alt=""/><br /><sub><b>Shun Kakinoki</b></sub></a><br /><a href="https://github.com/tianhaoz95/fastlane-plugin-flutter_version/commits?author=shunkakinoki" title="Code">💻</a></td>
123
+ <td align="center"><a href="http://tianhaoz.com"><img src="https://avatars3.githubusercontent.com/u/16887772?v=4" width="100px;" alt=""/><br /><sub><b>Tianhao Zhou</b></sub></a><br /><a href="https://github.com/tianhaoz95/fastlane-plugin-flutter_version/commits?author=tianhaoz95" title="Code">💻</a></td>
124
+ <td align="center"><a href="https://github.com/davidbrenner"><img src="https://avatars3.githubusercontent.com/u/236870?v=4" width="100px;" alt=""/><br /><sub><b>davidbrenner</b></sub></a><br /><a href="#ideas-davidbrenner" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/tianhaoz95/fastlane-plugin-flutter_version/commits?author=davidbrenner" title="Documentation">📖</a></td>
125
+ <td align="center"><a href="http://lahaus.com"><img src="https://avatars2.githubusercontent.com/u/76348?v=4" width="100px;" alt=""/><br /><sub><b>Daniel Gomez</b></sub></a><br /><a href="#ideas-danielgomezrico" title="Ideas, Planning, & Feedback">🤔</a></td>
126
+ </tr>
127
+ </table>
128
+
129
+ <!-- markdownlint-enable -->
130
+ <!-- prettier-ignore-end -->
131
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
49
132
 
50
- _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).
133
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
@@ -1,6 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fastlane/plugin/flutter_version/version'
2
4
 
3
5
  module Fastlane
6
+ # The plugin wrapper
4
7
  module FlutterVersion
5
8
  # Return all .rb files inside the "actions" and "helper" directory
6
9
  def self.all_classes
@@ -1,61 +1,96 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fastlane/action'
2
4
  require 'yaml'
3
5
  require_relative '../helper/flutter_version_helper'
4
6
 
5
7
  module Fastlane
6
8
  module Actions
9
+ # The top-level plugin interface
7
10
  class FlutterVersionAction < Action
8
11
  def self.run(params)
9
- UI.message("The flutter_version plugin is working!")
10
12
  pubspec_location = params[:pubspec_location]
11
- pubspec = YAML.load_file(pubspec_location)
12
- version = pubspec["version"]
13
- UI.message("The full version is: ".concat(version))
14
- if not version.include? "+"
15
- raise "Verson code indicator (+) not foud in pubspec.yml"
13
+ should_omit_version_code = params[:should_omit_version_code]
14
+ begin
15
+ pubspec = YAML.load_file(pubspec_location)
16
+ # rubocop:disable Style/RescueStandardError
17
+ rescue
18
+ raise 'Read pubspec.yaml failed'
19
+ end
20
+ # rubocop:enable Style/RescueStandardError
21
+ version = pubspec['version']
22
+ UI.message('The full version is: '.dup.concat(version))
23
+ has_version_code_pattern = version.include?('+')
24
+ if should_omit_version_code && has_version_code_pattern
25
+ raise 'Version code omitted but verson code indicator (+) found in pubspec.yml'
26
+ end
27
+ if !should_omit_version_code && !has_version_code_pattern
28
+ raise 'Verson code indicator (+) not found in pubspec.yml'
16
29
  end
17
- version_sections = version.split("+")
30
+
31
+ version_sections = if should_omit_version_code
32
+ [version, 'NOT_FOUND']
33
+ else
34
+ version.split('+')
35
+ end
18
36
  version_name = version_sections[0]
19
37
  version_code = version_sections[1]
20
- UI.message("The version name: ".concat(version_name))
21
- UI.message("The version code: ".concat(version_code))
22
- return version_code
38
+ UI.message('The version name: '.dup.concat(version_name))
39
+ UI.message('The version code: '.dup.concat(version_code))
40
+ {
41
+ 'version_code' => version_code,
42
+ 'version_name' => version_name
43
+ }
23
44
  end
24
45
 
25
46
  def self.description
26
- "A plugin to retrieve versioning information for Flutter projects."
47
+ 'A plugin to retrieve versioning information for Flutter projects.'
27
48
  end
28
49
 
29
50
  def self.authors
30
- ["tianhaoz95"]
51
+ ['tianhaoz95']
31
52
  end
32
53
 
33
54
  def self.return_value
34
55
  [
35
- ['VERSION_CODE', 'The version code']
56
+ ['VERSION_CODE', 'The version code'],
57
+ ['VERSION_NAME', 'The verison name']
36
58
  ]
37
59
  end
38
60
 
39
61
  def self.details
40
- "The plugin reads and parses pubspec.yml of a Flutter project and composes the versioning information into structured data to be consumed by various releasing automations."
62
+ "The plugin reads and parses pubspec.yml of a Flutter
63
+ project and composes the versioning information into
64
+ structured data to be consumed by various releasing
65
+ automations."
41
66
  end
42
67
 
43
68
  def self.available_options
44
69
  [
45
70
  FastlaneCore::ConfigItem.new(
46
71
  key: :pubspec_location,
47
- env_name: "PUBSPEC_LOCATION",
48
- description: "The location of pubspec.yml",
72
+ env_name: 'PUBSPEC_LOCATION',
73
+ description: 'The location of pubspec.yml',
49
74
  optional: true,
50
75
  type: String,
51
- default_value:"../pubspec.yaml"
76
+ default_value: '../pubspec.yaml'
52
77
  ),
78
+ FastlaneCore::ConfigItem.new(
79
+ key: :should_omit_version_code,
80
+ env_name: 'SHOULD_OMIT_VERSION_CODE',
81
+ description: 'If the version code should be omitted for projects that do not use a version code',
82
+ optional: true,
83
+ type: Boolean,
84
+ default_value: false
85
+ )
53
86
  ]
54
87
  end
55
88
 
56
- def self.is_supported?(platform)
89
+ # rubocop:disable Naming/PredicateName
90
+ def self.is_supported?(_platform)
57
91
  true
58
92
  end
93
+ # rubocop:enable Naming/PredicateName
59
94
  end
60
95
  end
61
96
  end
@@ -1,15 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fastlane_core/ui/ui'
2
4
 
5
+ # Fastlane namespace
3
6
  module Fastlane
4
- UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
7
+ UI = FastlaneCore::UI unless Fastlane.const_defined?('UI')
5
8
 
6
9
  module Helper
10
+ # Generated helper function for the plugin
7
11
  class FlutterVersionHelper
8
12
  # class methods that you define here become available in your action
9
13
  # as `Helper::FlutterVersionHelper.your_method`
10
- #
11
14
  def self.show_message
12
- UI.message("Hello from the flutter_version plugin helper!")
15
+ UI.message('Hello from the flutter_version plugin helper!')
13
16
  end
14
17
  end
15
18
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fastlane
2
4
  module FlutterVersion
3
- VERSION = "0.1.4"
5
+ VERSION = '1.0.1'
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-flutter_version
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - tianhaoz95
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-04 00:00:00.000000000 Z
11
+ date: 2020-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: pry
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,21 +25,21 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: fastlane
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 2.142.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 2.142.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec_junit_formatter
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,21 +81,21 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rubocop
84
+ name: rspec_junit_formatter
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.49.1
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.49.1
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubocop-require_tools
98
+ name: rubocop
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: simplecov
112
+ name: rubocop-require_tools
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,19 +123,19 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: fastlane
126
+ name: simplecov
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: 2.142.0
131
+ version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: 2.142.0
138
+ version: '0'
139
139
  description:
140
140
  email: tianhaoz@umich.edu
141
141
  executables: []
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - ">="
162
162
  - !ruby/object:Gem::Version
163
- version: '0'
163
+ version: '2.6'
164
164
  required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - ">="