Class: Headdesk::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/headdesk/report.rb

Overview

Descriptions for APK methods

Direct Known Subclasses

APKReport, IPAReport

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReport

Returns a new instance of Report.



13
14
15
# File 'lib/headdesk/report.rb', line 13

def initialize
  @checks = []
end

Instance Attribute Details

#android_sdkObject (readonly)

Returns the value of attribute android_sdk.



11
12
13
# File 'lib/headdesk/report.rb', line 11

def android_sdk
  @android_sdk
end

#apkObject (readonly)

Returns the value of attribute apk.



11
12
13
# File 'lib/headdesk/report.rb', line 11

def apk
  @apk
end

#bundle_idObject (readonly)

Returns the value of attribute bundle_id.



11
12
13
# File 'lib/headdesk/report.rb', line 11

def bundle_id
  @bundle_id
end

#checksObject (readonly)

Returns the value of attribute checks.



11
12
13
# File 'lib/headdesk/report.rb', line 11

def checks
  @checks
end

#file_nameObject (readonly)

Returns the value of attribute file_name.



11
12
13
# File 'lib/headdesk/report.rb', line 11

def file_name
  @file_name
end

#ipaObject (readonly)

Returns the value of attribute ipa.



11
12
13
# File 'lib/headdesk/report.rb', line 11

def ipa
  @ipa
end

Instance Method Details

#<<(value) ⇒ Object



17
18
19
# File 'lib/headdesk/report.rb', line 17

def <<(value)
  @checks << value
end

#color_for_statusObject



29
30
31
32
33
34
35
# File 'lib/headdesk/report.rb', line 29

def color_for_status
  {
    success: "\e[32m%s\e[0m",
    fail: "\e[31m%s\e[0m",
    skip: "\e[36m%s\e[0m"
  }
end

#describeObject



67
# File 'lib/headdesk/report.rb', line 67

def describe; end

#icon_for_statusObject



21
22
23
24
25
26
27
# File 'lib/headdesk/report.rb', line 21

def icon_for_status
  {
    success: '',
    fail: '',
    skip: ''
  }
end


37
38
39
# File 'lib/headdesk/report.rb', line 37

def link
  "\e[37;4m%s\e[0m"
end

#to_hObject



55
56
57
58
59
60
61
# File 'lib/headdesk/report.rb', line 55

def to_h
  {
    bundle_id: bundle_id,
    file_name: file_name,
    checks: checks
  }
end

#to_json(opts = {}) ⇒ Object



63
64
65
# File 'lib/headdesk/report.rb', line 63

def to_json(opts = {})
  to_h.to_json(opts)
end

#to_sObject



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/headdesk/report.rb', line 41

def to_s
  ERB.new(<<~DESCRIPTION, nil, '>').result(binding)
    Bundle Id: <%= bundle_id %>\n
    <%= describe %>\n
    <% for @check in checks %>
      <%= color_for_status[@check[:status]] % icon_for_status[@check[:status]] %> <%= color_for_status[@check[:status]] % @check[:description] %> (<%= link % @check[:doc] %>)\n
      <% for @step in @check[:steps] %>
        ↳ <%= color_for_status[@step[:status]] % icon_for_status[@step[:status]] %> <%= color_for_status[@step[:status]] % @step[:description] %>\n
      <% end %>
      <% unless @check[:export].empty? %><%= "  💾 " + @check[:export].to_json + "\n" %><% end %>\n
    <% end %>
  DESCRIPTION
end