Class: Fastlane::Actions::BumpInfoPlistAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::BumpInfoPlistAction
- Defined in:
- lib/fastlane/plugin/version_bump/actions/bump_info_plist.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .plist_set(plist, key, value) ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
60 61 62 |
# File 'lib/fastlane/plugin/version_bump/actions/bump_info_plist.rb', line 60 def self. ["Drawing Board Apps LLC"] end |
.available_options ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fastlane/plugin/version_bump/actions/bump_info_plist.rb', line 44 def self. [ FastlaneCore::ConfigItem.new( key: :plist, description: "Path to the Info.plist", optional: false, ), FastlaneCore::ConfigItem.new( key: :semver, description: "SemVer version string (e.g. 0.1.1). Omit to leave " \ "CFBundleShortVersionString unchanged", optional: true, ), ] end |
.category ⇒ Object
75 76 77 |
# File 'lib/fastlane/plugin/version_bump/actions/bump_info_plist.rb', line 75 def self.category :project end |
.description ⇒ Object
34 35 36 |
# File 'lib/fastlane/plugin/version_bump/actions/bump_info_plist.rb', line 34 def self.description "Set CFBundleShortVersionString + CFBundleVersion in an Info.plist" end |
.details ⇒ Object
38 39 40 41 42 |
# File 'lib/fastlane/plugin/version_bump/actions/bump_info_plist.rb', line 38 def self.details "CFBundleVersion is always set from `git rev-list --count HEAD` (monotonic; " \ "App Store rejects duplicates). CFBundleShortVersionString is set from " \ ":semver when provided; omitted ⇒ left untouched." end |
.example_code ⇒ Object
68 69 70 71 72 73 |
# File 'lib/fastlane/plugin/version_bump/actions/bump_info_plist.rb', line 68 def self.example_code [ 'bump_info_plist(plist: "iosApp/Info.plist", semver: "0.1.1")', 'bump_info_plist(plist: "iosApp/Info.plist") # build-number-only', ] end |
.is_supported?(platform) ⇒ Boolean
64 65 66 |
# File 'lib/fastlane/plugin/version_bump/actions/bump_info_plist.rb', line 64 def self.is_supported?(platform) platform == :ios end |
.plist_set(plist, key, value) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/fastlane/plugin/version_bump/actions/bump_info_plist.rb', line 24 def self.plist_set(plist, key, value) # :Add fails if the key exists; :Set fails if it doesn't. Try both, # fail only if the second also fails. system("/usr/libexec/PlistBuddy", "-c", "Add :#{key} string #{value}", plist, out: File::NULL, err: File::NULL) unless system("/usr/libexec/PlistBuddy", "-c", "Set :#{key} #{value}", plist) UI.user_error!("PlistBuddy failed to set #{key} in #{plist}") end end |
.run(params) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fastlane/plugin/version_bump/actions/bump_info_plist.rb', line 6 def self.run(params) plist = params[:plist] semver = params[:semver] UI.user_error!("plist not found: #{plist}") unless File.exist?(plist) build_num = `git rev-list --count HEAD`.strip UI.user_error!("git rev-list failed") if build_num.empty? plist_set(plist, "CFBundleVersion", build_num) if semver plist_set(plist, "CFBundleShortVersionString", semver) UI.success("[version-bump] #{plist}: #{semver} (#{build_num})") else UI.success("[version-bump] #{plist}: build=#{build_num} (semver unchanged)") end end |