Class: Fastlane::Actions::ParseJsonAction

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

Class Method Summary collapse

Class Method Details

.authorsObject


14
15
16
# File 'lib/fastlane/plugin/parse_json/actions/parse_json_action.rb', line 14

def self.authors
  ["KrauseFx"]
end

.available_optionsObject


22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fastlane/plugin/parse_json/actions/parse_json_action.rb', line 22

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                            env_name: "PARSE_JSON_PATH",
                         description: "Path to the JSON file",
                            optional: false,
                            verify_block: proc do |value|
                              UI.user_error!("Couldn't find given file") unless File.exist?(value)
                            end,
                                type: String)
  ]
end

.descriptionObject


10
11
12
# File 'lib/fastlane/plugin/parse_json/actions/parse_json_action.rb', line 10

def self.description
  "Parse a JSON file"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)

35
36
37
# File 'lib/fastlane/plugin/parse_json/actions/parse_json_action.rb', line 35

def self.is_supported?(platform)
  true
end

.return_valueObject


18
19
20
# File 'lib/fastlane/plugin/parse_json/actions/parse_json_action.rb', line 18

def self.return_value
  "The content of the JSON file"
end

.run(params) ⇒ Object


4
5
6
7
8
# File 'lib/fastlane/plugin/parse_json/actions/parse_json_action.rb', line 4

def self.run(params)
  file_path = params[:path]
  file_content = File.read(file_path)
  return JSON.parse(file_content)
end