Class: Fastlane::Actions::LoadJsonAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



15
16
17
# File 'lib/fastlane/plugin/load_json/actions/load_json_action.rb', line 15

def self.authors
  ["KrauseFx"]
end

.available_optionsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fastlane/plugin/load_json/actions/load_json_action.rb', line 23

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :json_path,
                            env_name: "LOAD_JSON_JSON_PATH",
                         description: "The relative path to the JSON file",
                            optional: false,
                                type: String,
                        verify_block: proc do |value|
                                        value = File.expand_path(value)
                                        UI.user_error!("Couldn't find JSON at path '#{value}'") unless File.exist?(value)
                                      end)
  ]
end

.descriptionObject



11
12
13
# File 'lib/fastlane/plugin/load_json/actions/load_json_action.rb', line 11

def self.description
  "Loads a local JSON file and parses it"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/fastlane/plugin/load_json/actions/load_json_action.rb', line 37

def self.is_supported?(platform)
  true
end

.return_valueObject



19
20
21
# File 'lib/fastlane/plugin/load_json/actions/load_json_action.rb', line 19

def self.return_value
  "Content of the JSON file to load"
end

.run(params) ⇒ Object



4
5
6
7
8
9
# File 'lib/fastlane/plugin/load_json/actions/load_json_action.rb', line 4

def self.run(params)
  require 'json'

  data = File.read(params[:json_path])
  return JSON.parse(data)
end