Class: Fastlane::Actions::XcresulttoolGetAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



37
38
39
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_get_action.rb', line 37

def self.authors
  ["crazymanish"]
end

.available_optionsObject



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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_get_action.rb', line 49

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: :id,
      description: "ID for the get subcommand",
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :type,
      description: "Content type for the get subcommand (e.g., 'action-testSummary', 'test-report')",
      optional: true,
      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



114
115
116
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_get_action.rb', line 114

def self.category
  :testing
end

.descriptionObject



33
34
35
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_get_action.rb', line 33

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

.detailsObject



45
46
47
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_get_action.rb', line 45

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

.example_codeObject



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_get_action.rb', line 96

def self.example_code
  [
    'xcresulttool_get(
      result_bundle_path: "path/to/Test.xcresult",
      format: "json"
    )',
    'xcresulttool_get(
      result_bundle_path: "path/to/Test.xcresult",
      type: "action-testSummary",
      output_path: "test_summary.json"
    )',
    'xcresulttool_get(
      result_bundle_path: "path/to/Test.xcresult",
      type: "test-report"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_get_action.rb', line 92

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

.return_valueObject



41
42
43
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_get_action.rb', line 41

def self.return_value
  "The output of the xcresulttool get 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
30
31
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_get_action.rb', line 7

def self.run(params)
  args = ["get"]
  
  # 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 << "--id" << params[:id] if params[:id]
  args << "--output-path" << params[:output_path] if params[:output_path]
  args << "--type" << params[:type] if params[:type]
  args << "--verbose" if params[:verbose]
  
  # Execute the command
  result = Helper::XcresulttoolHelper.execute_command(args)
  
  if params[:output_path]
    UI.success("Results saved to #{params[:output_path]}")
  else
    return result
  end
end