xc_metrics_aggregator 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.rspec +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +36 -0
- data/LICENSE +22 -0
- data/README.md +244 -0
- data/Rakefile +2 -0
- data/assets/XCMetricsAggregator.png +0 -0
- data/bin/bundle +114 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/xcmagg +5 -0
- data/lib/xc_metrics_aggregator/crawler.rb +19 -0
- data/lib/xc_metrics_aggregator/formatter/formatter.rb +105 -0
- data/lib/xc_metrics_aggregator/formatter/output_format.rb +10 -0
- data/lib/xc_metrics_aggregator/product.rb +113 -0
- data/lib/xc_metrics_aggregator/service/categories_service.rb +146 -0
- data/lib/xc_metrics_aggregator/service/devices_service.rb +85 -0
- data/lib/xc_metrics_aggregator/service/latest_service.rb +91 -0
- data/lib/xc_metrics_aggregator/service/metrics_service.rb +51 -0
- data/lib/xc_metrics_aggregator/service/percentiles_service.rb +52 -0
- data/lib/xc_metrics_aggregator/structure/structure.rb +17 -0
- data/lib/xc_metrics_aggregator/version.rb +3 -0
- data/lib/xc_metrics_aggregator.rb +125 -0
- data/lib/xcode_metrics_automation.applescript +210 -0
- data/run.sh +5 -0
- data/xc_metrics_aggregator.gemspec +32 -0
- metadata +171 -0
@@ -0,0 +1,210 @@
|
|
1
|
+
use AppleScript version "2.4"
|
2
|
+
use scripting additions
|
3
|
+
use framework "Foundation"
|
4
|
+
use framework "ApplicationServices"
|
5
|
+
use framework "Quartz"
|
6
|
+
|
7
|
+
|
8
|
+
tell application "Xcode"
|
9
|
+
activate
|
10
|
+
tell application "System Events"
|
11
|
+
tell process "Xcode"
|
12
|
+
my displayOrganizer()
|
13
|
+
delay 1
|
14
|
+
|
15
|
+
my arrangePositionOfWindow()
|
16
|
+
my clickRadioButtonOfMetricsViewer()
|
17
|
+
|
18
|
+
set total_row_list to my getAllAppsFromTable()
|
19
|
+
set visible_row_list to my getVisibleAppsFromTable()
|
20
|
+
|
21
|
+
set total_row_count to count of total_row_list
|
22
|
+
set visible_row_count to count of visible_row_list
|
23
|
+
|
24
|
+
tell my NumberOfScrolling to calculate(total_row_count, visible_row_count)
|
25
|
+
set start_pos to 1
|
26
|
+
|
27
|
+
repeat result of NumberOfScrolling times
|
28
|
+
my scrollDownForScrollingToTop()
|
29
|
+
end repeat
|
30
|
+
|
31
|
+
repeat result of NumberOfScrolling times
|
32
|
+
tell my TableRowsClicker to calculateVisibleRows()
|
33
|
+
tell my TableRowsClicker to clickStepByStep(start_pos)
|
34
|
+
|
35
|
+
my scrollUp()
|
36
|
+
delay 1
|
37
|
+
|
38
|
+
set start_pos to start_pos + (row_count_in_scroll of TableRowsClicker)
|
39
|
+
end repeat
|
40
|
+
end tell
|
41
|
+
end tell
|
42
|
+
end tell
|
43
|
+
|
44
|
+
-- Script Object
|
45
|
+
|
46
|
+
script TableRowsClicker
|
47
|
+
property row_list_in_scroll : []
|
48
|
+
property row_count_in_scroll : 0
|
49
|
+
|
50
|
+
on calculateVisibleRows()
|
51
|
+
tell application "System Events"
|
52
|
+
tell process "Xcode"
|
53
|
+
set my row_list_in_scroll to value of attribute "AXVisibleRows" of table 1 of scroll area 1 of splitter group 1 of window 1
|
54
|
+
set my row_count_in_scroll to (count of row_list_in_scroll) - 1
|
55
|
+
end tell
|
56
|
+
end tell
|
57
|
+
end calculateVisibleRows
|
58
|
+
|
59
|
+
on clickStepByStep(start_pos)
|
60
|
+
tell application "System Events"
|
61
|
+
tell process "Xcode"
|
62
|
+
|
63
|
+
set end_pos to start_pos + (my row_count_in_scroll)
|
64
|
+
|
65
|
+
repeat with elem_pos from start_pos to end_pos by 1
|
66
|
+
if elem_pos > my total_row_count then
|
67
|
+
exit repeat
|
68
|
+
end if
|
69
|
+
|
70
|
+
set row_elem to my getRowElement(elem_pos)
|
71
|
+
set pos to position of row_elem
|
72
|
+
my clickAt(item 1 of pos, item 2 of pos)
|
73
|
+
|
74
|
+
--my waitForDownloading()
|
75
|
+
end repeat
|
76
|
+
|
77
|
+
end tell
|
78
|
+
end tell
|
79
|
+
end clickStepByStep
|
80
|
+
|
81
|
+
on getRowElement(pos)
|
82
|
+
tell application "System Events"
|
83
|
+
tell process "Xcode"
|
84
|
+
return row pos of table 1 of scroll area 1 of splitter group 1 of window 1
|
85
|
+
end tell
|
86
|
+
end tell
|
87
|
+
end getRowElement
|
88
|
+
|
89
|
+
on waitForDownloading()
|
90
|
+
tell application "System Events"
|
91
|
+
tell process "Xcode"
|
92
|
+
repeat 100 times
|
93
|
+
delay 1
|
94
|
+
if exists static text 1 of splitter group 0 of splitter group 0 of window 1 then
|
95
|
+
set label to value of static text 1 of splitter group 0 of splitter group 0 of window 1
|
96
|
+
else
|
97
|
+
exit repeat
|
98
|
+
end if
|
99
|
+
|
100
|
+
log label
|
101
|
+
if my checkIfDownloadedState(label) then
|
102
|
+
exit repeat
|
103
|
+
end if
|
104
|
+
end repeat
|
105
|
+
|
106
|
+
end tell
|
107
|
+
end tell
|
108
|
+
end waitForDownloading
|
109
|
+
|
110
|
+
on checkIfDownloadedState(label)
|
111
|
+
return label = "No Metrics" or label = "Last Updated Today" or label = "Unable to Read Metrics" or label begins with "An error occurred"
|
112
|
+
end checkIfDownloadedState
|
113
|
+
end script
|
114
|
+
|
115
|
+
script NumberOfScrolling
|
116
|
+
property result : 0
|
117
|
+
|
118
|
+
on calculate(total_row_count, visible_row_count)
|
119
|
+
tell application "System Events"
|
120
|
+
tell process "Xcode"
|
121
|
+
set scroll_div to total_row_count div visible_row_count
|
122
|
+
set scroll_mod to total_row_count mod visible_row_count
|
123
|
+
|
124
|
+
|
125
|
+
if 0 < scroll_mod then
|
126
|
+
set my result to scroll_div + 1
|
127
|
+
else
|
128
|
+
set my result to scroll_div
|
129
|
+
end if
|
130
|
+
end tell
|
131
|
+
end tell
|
132
|
+
end calculate
|
133
|
+
end script
|
134
|
+
|
135
|
+
-- Functions
|
136
|
+
|
137
|
+
on scrollDownForScrollingToTop()
|
138
|
+
tell application "System Events"
|
139
|
+
tell process "Xcode"
|
140
|
+
perform action "AXScrollDownByPage" of scroll area 1 of splitter group 1 of window 1
|
141
|
+
end tell
|
142
|
+
end tell
|
143
|
+
end scrollDownForScrollingToTop
|
144
|
+
|
145
|
+
on scrollUp()
|
146
|
+
tell application "System Events"
|
147
|
+
tell process "Xcode"
|
148
|
+
perform action "AXScrollUpByPage" of scroll area 1 of splitter group 1 of window 1
|
149
|
+
end tell
|
150
|
+
end tell
|
151
|
+
end scrollUp
|
152
|
+
|
153
|
+
on displayOrganizer()
|
154
|
+
tell application "System Events"
|
155
|
+
tell process "Xcode"
|
156
|
+
click menu item "Organizer" of menu 1 of menu bar item "Window" of menu bar 1
|
157
|
+
end tell
|
158
|
+
end tell
|
159
|
+
end displayOrganizer
|
160
|
+
|
161
|
+
on arrangePositionOfWindow()
|
162
|
+
tell application "Finder"
|
163
|
+
set screen_height to (do shell script "system_profiler SPDisplaysDataType | awk '/Resolution/{print $4}'")
|
164
|
+
end tell
|
165
|
+
|
166
|
+
tell application "System Events"
|
167
|
+
tell process "Xcode"
|
168
|
+
set position of window 1 to {0, 0}
|
169
|
+
set size of window 1 to {300, screen_height}
|
170
|
+
end tell
|
171
|
+
end tell
|
172
|
+
end arrangePositionOfWindow
|
173
|
+
|
174
|
+
on clickRadioButtonOfMetricsViewer()
|
175
|
+
tell application "System Events"
|
176
|
+
tell process "Xcode"
|
177
|
+
click radio button 4 of radio group 1 of group 1 of toolbar 1 of window 1
|
178
|
+
end tell
|
179
|
+
end tell
|
180
|
+
end clickRadioButtonOfMetricsViewer
|
181
|
+
|
182
|
+
on getAllAppsFromTable()
|
183
|
+
tell application "System Events"
|
184
|
+
tell process "Xcode"
|
185
|
+
set total_row_list to row of table 1 of scroll area 1 of splitter group 1 of window 1
|
186
|
+
end tell
|
187
|
+
end tell
|
188
|
+
return total_row_list
|
189
|
+
end getAllAppsFromTable
|
190
|
+
|
191
|
+
on getVisibleAppsFromTable()
|
192
|
+
tell application "System Events"
|
193
|
+
tell process "Xcode"
|
194
|
+
set visible_row_list to value of attribute "AXVisibleRows" of table 1 of scroll area 1 of splitter group 1 of window 1
|
195
|
+
end tell
|
196
|
+
end tell
|
197
|
+
return visible_row_list
|
198
|
+
end getVisibleAppsFromTable
|
199
|
+
|
200
|
+
|
201
|
+
on clickAt(newX, newY)
|
202
|
+
|
203
|
+
set pt to current application's CGPointZero
|
204
|
+
set x of pt to newX
|
205
|
+
set y of pt to newY
|
206
|
+
|
207
|
+
current application's CGPostMouseEvent(pt, 1, 1, 1)
|
208
|
+
current application's CGPostMouseEvent(pt, 1, 1, 0)
|
209
|
+
|
210
|
+
end clickAt
|
data/run.sh
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "xc_metrics_aggregator/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "xc_metrics_aggregator"
|
8
|
+
spec.version = XcMetricsAggregator::VERSION
|
9
|
+
spec.authors = ["Yahoo Japan Corporation"]
|
10
|
+
spec.email = ["kahayash@yahoo-copr.jp"]
|
11
|
+
|
12
|
+
spec.summary = %q{AppleScript for Xcode Metrics Organizer}
|
13
|
+
spec.description = %q{XCMetricsAggregator aggregates metrics across all apps from Xcode Metrics Organizer by automating Xcode with AppleScript.}
|
14
|
+
spec.homepage = "https://github.com/yahoojapan/XCMetricsAggregator"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = "bin"
|
21
|
+
spec.executables = ["xcmagg"]
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "thor"
|
25
|
+
spec.add_dependency "etc"
|
26
|
+
spec.add_dependency "terminal-table"
|
27
|
+
spec.add_dependency "ascii_charts"
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "spec"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xc_metrics_aggregator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yahoo Japan Corporation
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: etc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: terminal-table
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ascii_charts
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: spec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: XCMetricsAggregator aggregates metrics across all apps from Xcode Metrics
|
112
|
+
Organizer by automating Xcode with AppleScript.
|
113
|
+
email:
|
114
|
+
- kahayash@yahoo-copr.jp
|
115
|
+
executables:
|
116
|
+
- xcmagg
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files: []
|
119
|
+
files:
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- CODE_OF_CONDUCT.md
|
123
|
+
- Gemfile
|
124
|
+
- Gemfile.lock
|
125
|
+
- LICENSE
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- assets/XCMetricsAggregator.png
|
129
|
+
- bin/bundle
|
130
|
+
- bin/console
|
131
|
+
- bin/setup
|
132
|
+
- bin/xcmagg
|
133
|
+
- lib/xc_metrics_aggregator.rb
|
134
|
+
- lib/xc_metrics_aggregator/crawler.rb
|
135
|
+
- lib/xc_metrics_aggregator/formatter/formatter.rb
|
136
|
+
- lib/xc_metrics_aggregator/formatter/output_format.rb
|
137
|
+
- lib/xc_metrics_aggregator/product.rb
|
138
|
+
- lib/xc_metrics_aggregator/service/categories_service.rb
|
139
|
+
- lib/xc_metrics_aggregator/service/devices_service.rb
|
140
|
+
- lib/xc_metrics_aggregator/service/latest_service.rb
|
141
|
+
- lib/xc_metrics_aggregator/service/metrics_service.rb
|
142
|
+
- lib/xc_metrics_aggregator/service/percentiles_service.rb
|
143
|
+
- lib/xc_metrics_aggregator/structure/structure.rb
|
144
|
+
- lib/xc_metrics_aggregator/version.rb
|
145
|
+
- lib/xcode_metrics_automation.applescript
|
146
|
+
- run.sh
|
147
|
+
- xc_metrics_aggregator.gemspec
|
148
|
+
homepage: https://github.com/yahoojapan/XCMetricsAggregator
|
149
|
+
licenses:
|
150
|
+
- MIT
|
151
|
+
metadata: {}
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
requirements: []
|
167
|
+
rubygems_version: 3.1.2
|
168
|
+
signing_key:
|
169
|
+
specification_version: 4
|
170
|
+
summary: AppleScript for Xcode Metrics Organizer
|
171
|
+
test_files: []
|