Class: Fastlane::Actions::SetVersionAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/version/actions/set_version_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



31
32
33
# File 'lib/fastlane/plugin/version/actions/set_version_action.rb', line 31

def self.authors
  ["Jason Nam"]
end

.available_optionsObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fastlane/plugin/version/actions/set_version_action.rb', line 35

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :plist,
                        short_option: "-p",
                         description: "Path for the plist to update",
                                type: String),
    FastlaneCore::ConfigItem.new(key: :version,
                        short_option: "-v",
                         description: "Short version (CFBundleShortVersionString)",
                            optional: true,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :build_version,
                        short_option: "-b",
                         description: "Build version (CFBundleVersion)",
                            optional: true,
                                type: String)
  ]
end

.descriptionObject



27
28
29
# File 'lib/fastlane/plugin/version/actions/set_version_action.rb', line 27

def self.description
  "Set version"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/fastlane/plugin/version/actions/set_version_action.rb', line 54

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.run(params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fastlane/plugin/version/actions/set_version_action.rb', line 6

def self.run(params)
  plist = params[:plist]
  version = params[:version]
  build_version = params[:build_version]

  if version
    Actions::SetInfoPlistValueAction.run(
      path: plist,
      key: "CFBundleShortVersionString",
      value: version
    )
  end
  if build_version
    Actions::SetInfoPlistValueAction.run(
      path: plist,
      key: "CFBundleVersion",
      value: build_version
    )
  end
end