Class: Fastlane::Actions::XcresulttoolExportAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



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

def self.authors
  ["crazymanish"]
end

.available_optionsObject



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
91
92
93
94
95
96
97
98
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_export_action.rb', line 57

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 file",
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :output_dir,
      description: "Directory to save output files",
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :export_items,
      description: "Array of items to export",
      optional: true,
      type: Array
    ),
    FastlaneCore::ConfigItem.new(
      key: :verbose,
      description: "Enable verbose output",
      optional: true,
      default_value: false,
      is_string: false
    )
  ]
end

.categoryObject



118
119
120
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_export_action.rb', line 118

def self.category
  :testing
end

.descriptionObject



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

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

.detailsObject



53
54
55
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_export_action.rb', line 53

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

.example_codeObject



104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_export_action.rb', line 104

def self.example_code
  [
    'xcresulttool_export(
      result_bundle_path: "path/to/Test.xcresult",
      output_path: "output.json"
    )',
    'xcresulttool_export(
      result_bundle_path: "path/to/Test.xcresult",
      output_dir: "export_directory",
      export_items: ["logs", "diagnostics"]
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean



100
101
102
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_export_action.rb', line 100

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

.return_valueObject



49
50
51
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_export_action.rb', line 49

def self.return_value
  "The output of the xcresulttool export command as a string, or nil if output_path or output_dir 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
32
33
34
35
36
37
38
39
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_export_action.rb', line 7

def self.run(params)
  args = ["export"]
  
  # 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 << "--output-dir" << params[:output_dir] if params[:output_dir]
  
  # Handle export items
  if params[:export_items]
    params[:export_items].each do |item|
      args << "--export-item" << item
    end
  end
  
  args << "--verbose" if params[:verbose]
  
  # Execute the command
  result = Helper::XcresulttoolHelper.execute_command(args)
  
  output_location = params[:output_path] || params[:output_dir]
  if output_location
    UI.success("Results exported to #{output_location}")
  else
    return result
  end
end