Class: Fastlane::Actions::BumpVersionAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::BumpVersionAction
- Defined in:
- lib/fastlane/plugin/version_manager/actions/bump_version_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
51 52 53 |
# File 'lib/fastlane/plugin/version_manager/actions/bump_version_action.rb', line 51 def self. ["Ibrahim AshShohail"] end |
.available_options ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/fastlane/plugin/version_manager/actions/bump_version_action.rb', line 65 def self. [ FastlaneCore::ConfigItem.new( key: :pubspec, env_name: 'PUBSPEC', description: 'The path of pubspec.yml file', optional: true, type: String, default_value: './pubspec.yaml' ), FastlaneCore::ConfigItem.new( key: :part, env_name: 'PART', description: 'The version part to bump', optional: true, type: String, default_value: 'build' ), ] end |
.description ⇒ Object
47 48 49 |
# File 'lib/fastlane/plugin/version_manager/actions/bump_version_action.rb', line 47 def self.description "Version manager" end |
.details ⇒ Object
61 62 63 |
# File 'lib/fastlane/plugin/version_manager/actions/bump_version_action.rb', line 61 def self.details "Version manager" end |
.is_supported?(platform) ⇒ Boolean
86 87 88 |
# File 'lib/fastlane/plugin/version_manager/actions/bump_version_action.rb', line 86 def self.is_supported?(platform) true end |
.return_value ⇒ Object
55 56 57 58 59 |
# File 'lib/fastlane/plugin/version_manager/actions/bump_version_action.rb', line 55 def self.return_value [ ['VERSION', 'The version number'] ] end |
.run(params) ⇒ Object
7 8 9 10 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 45 |
# File 'lib/fastlane/plugin/version_manager/actions/bump_version_action.rb', line 7 def self.run(params) pubspec_file = params[:pubspec] begin pubspec = YAML.load_file(pubspec_file) # rubocop:disable Style/RescueStandardError rescue raise 'Failed to read pubspec.yaml' end oldV = SemVersion.new(pubspec['version']) newV = SemVersion.new(pubspec['version']) case params[:part] when "major" newV.major = newV.major + 1 newV.minor = 0 newV.patch = 0 newV. = (newV..to_i + 1).to_s when "minor" newV.minor = newV.minor + 1 newV.patch = 0 newV. = (newV..to_i + 1).to_s when "patch" newV.patch = newV.patch + 1 newV. = (newV..to_i + 1).to_s when "build" newV. = (newV..to_i + 1).to_s else raise 'Invalid part' end Helper::VersionManagerHelper.write_file( pubspec_file, IO.readlines(pubspec_file).map { |s| s.gsub(oldV.to_s, newV.to_s) }, ) UI.(newV) end |