Class: Fastlane::Actions::SetPropertiesValueAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



18
19
20
# File 'lib/fastlane/plugin/properties/actions/set_properties_value.rb', line 18

def self.authors
  ["Pavlo Pakholka"]
end

.available_optionsObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fastlane/plugin/properties/actions/set_properties_value.rb', line 31

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :key,
      env_name: "PROPERIES_GET_VALUE_PARAM_KEY",
      description: "Key of properie in .properties file",
      optional: false,
      type: String),
    FastlaneCore::ConfigItem.new(key: :value,
      env_name: "PROPERIES_SET_VALUE_PARAM_VALUE",
      description: "Value to set",
      skip_type_validation: true, # skipping type validation as fastlane converts YES/NO/true/false strings into booleans
      type: String,
      optional: false),
    FastlaneCore::ConfigItem.new(key: :path,
      env_name: "PROPERIES_GET_VALUE_PARAM_PATH",
      description: "Path to .properies file you want to update",
      type: String,
      optional: false,
      verify_block: proc do |value|
        UI.user_error!("Couldn't find .properties file at path '#{value}'") unless File.exist?(File.expand_path(value))
      end)
  ]
end

.descriptionObject



14
15
16
# File 'lib/fastlane/plugin/properties/actions/set_properties_value.rb', line 14

def self.description
  "Sets a value of a setting in .properties file."
end

.detailsObject



26
27
28
29
# File 'lib/fastlane/plugin/properties/actions/set_properties_value.rb', line 26

def self.details
  # Optional:
  ""
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
58
59
60
61
# File 'lib/fastlane/plugin/properties/actions/set_properties_value.rb', line 55

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.return_valueObject



22
23
24
# File 'lib/fastlane/plugin/properties/actions/set_properties_value.rb', line 22

def self.return_value
  nil
end

.run(params) ⇒ Object



8
9
10
11
12
# File 'lib/fastlane/plugin/properties/actions/set_properties_value.rb', line 8

def self.run(params)
  content = JavaProperties.load(params[:path])
  content[params[:key].to_sym] = params[:value]
  JavaProperties.write(content, params[:path])
end