Class: Fastlane::Actions::XcresulttoolMetadataAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



35
36
37
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_metadata_action.rb', line 35

def self.authors
  ["crazymanish"]
end

.available_optionsObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_metadata_action.rb', line 47

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :result_bundle_path,
      description: "Path to the .xcresult bundle",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :format,
      description: "Output format (json, flat, human-readable)",
      optional: true,
      default_value: "json",
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :output_path,
      description: "Path to save output",
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :verbose,
      description: "Enable verbose output",
      optional: true,
      default_value: false,
      is_string: false
    )
  ]
end

.categoryObject



95
96
97
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_metadata_action.rb', line 95

def self.category
  :testing
end

.descriptionObject



31
32
33
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_metadata_action.rb', line 31

def self.description
  "Get Result Bundle metadata using xcresulttool"
end

.detailsObject



43
44
45
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_metadata_action.rb', line 43

def self.details
  "This action extracts metadata from an Xcode result bundle (.xcresult) using Apple's xcresulttool metadata subcommand"
end

.example_codeObject



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_metadata_action.rb', line 82

def self.example_code
  [
    'xcresulttool_metadata(
      result_bundle_path: "path/to/Test.xcresult"
    )',
    'xcresulttool_metadata(
      result_bundle_path: "path/to/Test.xcresult",
      format: "human-readable",
      output_path: "metadata.txt"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_metadata_action.rb', line 78

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

.return_valueObject



39
40
41
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_metadata_action.rb', line 39

def self.return_value
  "The output of the xcresulttool metadata command as a string, or nil if output_path is specified"
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_metadata_action.rb', line 7

def self.run(params)
  args = ["metadata"]
  
  # Validate result bundle path
  Helper::XcresulttoolHelper.validate_result_bundle_path(params[:result_bundle_path])
  
  # Add required arguments
  args << "--path" << params[:result_bundle_path]
  
  # Add optional arguments
  args << "--format" << params[:format] if params[:format]
  args << "--output-path" << params[:output_path] if params[:output_path]
  args << "--verbose" if params[:verbose]
  
  # Execute the command
  result = Helper::XcresulttoolHelper.execute_command(args)
  
  if params[:output_path]
    UI.success("Metadata saved to #{params[:output_path]}")
  else
    return result
  end
end