Class: Fastlane::Actions::PropertyFileWriteAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



31
32
33
# File 'lib/fastlane/plugin/property_file_write/actions/property_file_write_action.rb', line 31

def self.authors
  ["Jan Meier"]
end

.available_optionsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/fastlane/plugin/property_file_write/actions/property_file_write_action.rb', line 44

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :file,
          env_name: "PROPERTY_FILE_WRITE_FILE",
       description: "Property file to write",
          optional: false,
              type: String),
    FastlaneCore::ConfigItem.new(key: :key,
          env_name: "PROPERTY_FILE_WRITE_KEY",
       description: "Property key of file to alter",
          optional: false,
              type: String),
    FastlaneCore::ConfigItem.new(key: :value,
          env_name: "PROPERTY_FILE_WRITE_VALUE",
       description: "Value of property to set",
          optional: false,
              type: String)
  ]
end

.descriptionObject



27
28
29
# File 'lib/fastlane/plugin/property_file_write/actions/property_file_write_action.rb', line 27

def self.description
  "Writes value into properties file"
end

.detailsObject



39
40
41
42
# File 'lib/fastlane/plugin/property_file_write/actions/property_file_write_action.rb', line 39

def self.details
  # Optional:
  "Writes into property files. Used mostly in Android development as configuration files for gradle builds."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
67
68
69
70
# File 'lib/fastlane/plugin/property_file_write/actions/property_file_write_action.rb', line 64

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.return_valueObject



35
36
37
# File 'lib/fastlane/plugin/property_file_write/actions/property_file_write_action.rb', line 35

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



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

def self.run(params)

  property_file = params[:file]

  property_key = params[:key]
  property_value = params[:value]

  # read in content of file
  content = JavaProperties.load(property_file)

  # alter content
  content[property_key.to_sym] = property_value

  # save back to file
  JavaProperties.write(content, property_file)
  true
end