Class: Fastlane::Actions::FlutterVersionAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FlutterVersionAction
- Defined in:
- lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb
Overview
The top-level plugin interface
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
-
.is_supported?(_platform) ⇒ Boolean
rubocop:disable Naming/PredicateName.
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
50 51 52 |
# File 'lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb', line 50 def self. ['tianhaoz95'] end |
.available_options ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb', line 68 def self. [ FastlaneCore::ConfigItem.new( key: :pubspec_location, env_name: 'PUBSPEC_LOCATION', description: 'The location of pubspec.yml', optional: true, type: String, default_value: '../pubspec.yaml' ), FastlaneCore::ConfigItem.new( key: :should_omit_version_code, env_name: 'SHOULD_OMIT_VERSION_CODE', description: 'If the version code should be omitted for projects that do not use a version code', optional: true, type: Boolean, default_value: false ) ] end |
.description ⇒ Object
46 47 48 |
# File 'lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb', line 46 def self.description 'A plugin to retrieve versioning information for Flutter projects.' end |
.details ⇒ Object
61 62 63 64 65 66 |
# File 'lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb', line 61 def self.details "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." end |
.is_supported?(_platform) ⇒ Boolean
rubocop:disable Naming/PredicateName
90 91 92 |
# File 'lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb', line 90 def self.is_supported?(_platform) true end |
.return_value ⇒ Object
54 55 56 57 58 59 |
# File 'lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb', line 54 def self.return_value [ ['VERSION_CODE', 'The version code'], ['VERSION_NAME', 'The verison name'] ] end |
.run(params) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb', line 11 def self.run(params) pubspec_location = params[:pubspec_location] should_omit_version_code = params[:should_omit_version_code] begin pubspec = YAML.load_file(pubspec_location) # rubocop:disable Style/RescueStandardError rescue raise 'Read pubspec.yaml failed' end # rubocop:enable Style/RescueStandardError version = pubspec['version'] UI.('The full version is: '.dup.concat(version)) has_version_code_pattern = version.include?('+') if should_omit_version_code && has_version_code_pattern raise 'Version code omitted but verson code indicator (+) found in pubspec.yml' end if !should_omit_version_code && !has_version_code_pattern raise 'Verson code indicator (+) not found in pubspec.yml' end version_sections = if should_omit_version_code [version, 'NOT_FOUND'] else version.split('+') end version_name = version_sections[0] version_code = version_sections[1] UI.('The version name: '.dup.concat(version_name)) UI.('The version code: '.dup.concat(version_code)) { 'version_code' => version_code, 'version_name' => version_name } end |