10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/sidekiq/cypress_viewport_updater/update_cypress_viewports_job.rb', line 10
def perform
analytics = CypressViewportUpdater::GoogleAnalyticsReports
.new
.request_reports
viewports = CypressViewportUpdater::Viewports
.new(user_report: analytics.user_report)
.create(viewport_report: analytics.viewport_report)
github = CypressViewportUpdater::GithubService.new
cypress_config_js_file = CypressViewportUpdater::CypressConfigJsFile.new
viewport_preset_js_file = CypressViewportUpdater::ViewportPresetJsFile.new
github.get_content(file: cypress_config_js_file)
github.get_content(file: viewport_preset_js_file)
github.create_branch
[cypress_config_js_file, viewport_preset_js_file].each do |file|
file.update(viewports:)
github.update_content(file:)
end
github.submit_pr
self
end
|