maintenance_tasks 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a050fbc2d9dbc3eab88b027ee68163f09cae1472df9e236a7151f5fa1f4464b
4
- data.tar.gz: c6cf0f55b868b7810c7361669d4383d0fd159dc337b270396e3123a795e75d24
3
+ metadata.gz: cd4ace45bec0d57e14080ddf832419d1daa1a06fc8cb7d7e79af2c14b2e9c26c
4
+ data.tar.gz: 698945e60d17b43eeab9da5a3f43aa68fb0d9841f2aad1f66fc0c1f2994a4bc5
5
5
  SHA512:
6
- metadata.gz: 903da6a69576ffcf022a09248fd7945ec816150505d36c65d96f70cfeec969cb3315e820317c5bff8c882d4e0c09ad33758f9221b2d4d2cf08292a0415219c3a
7
- data.tar.gz: 811d79fa5d58252649faea6ed0bc82b6f8fa471d77ae02535cf73fb873a9e663deb893fc81d2528863f68194123db7f7dc55c1a9dc299143da9586fccb4570a6
6
+ metadata.gz: 5a4c862c0eddbf87fd0196b390eb6cc01b7dbe56d08772c4afb23e7cbaf351a6a9328e4c8bdf66057b4e871c099983649b6acddb6371fc7f216bb226b9ba372c
7
+ data.tar.gz: f7da9ab1b727fc9be10900da568a59c8c7a6a9620e7619f879942a5489b56ab673c8efcfbfc0551d54f018df0baef1638220854a2f88c7c0824bcfb6ccbaf222
data/README.md CHANGED
@@ -8,9 +8,9 @@ A Rails engine for queuing and managing maintenance tasks.
8
8
 
9
9
  To install the gem and run the install generator, execute:
10
10
 
11
- ```bash
12
- $ bundle add maintenance_tasks
13
- $ bin/rails generate maintenance_tasks:install
11
+ ```sh-session
12
+ bundle add maintenance_tasks
13
+ bin/rails generate maintenance_tasks:install
14
14
  ```
15
15
 
16
16
  The generator creates and runs a migration to add the necessary table to your
@@ -39,8 +39,8 @@ take a look at the [Active Job documentation][active-job-docs].
39
39
 
40
40
  A generator is provided to create tasks. Generate a new task by running:
41
41
 
42
- ```bash
43
- $ bin/rails generate maintenance_tasks:task update_posts
42
+ ```sh-session
43
+ bin/rails generate maintenance_tasks:task update_posts
44
44
  ```
45
45
 
46
46
  This creates the task file `app/tasks/maintenance/update_posts_task.rb`.
@@ -86,8 +86,8 @@ instuctions][setup].
86
86
 
87
87
  Generate a CSV Task by running:
88
88
 
89
- ```bash
90
- $ bin/rails generate maintenance_tasks:task import_posts --csv
89
+ ```sh-session
90
+ bin/rails generate maintenance_tasks:task import_posts --csv
91
91
  ```
92
92
 
93
93
  The generated task is a subclass of `MaintenanceTasks::Task` that implements:
@@ -195,8 +195,8 @@ collection-less tasks.
195
195
 
196
196
  Generate a collection-less Task by running:
197
197
 
198
- ```bash
199
- $ bin/rails generate maintenance_tasks:task no_collection_task --no-collection
198
+ ```sh-session
199
+ bin/rails generate maintenance_tasks:task no_collection_task --no-collection
200
200
  ```
201
201
 
202
202
  The generated task is a subclass of `MaintenanceTasks::Task` that implements:
@@ -483,21 +483,21 @@ You can run your new Task by accessing the Web UI and clicking on "Run".
483
483
 
484
484
  Alternatively, you can run your Task in the command line:
485
485
 
486
- ```bash
487
- $ bundle exec maintenance_tasks perform Maintenance::UpdatePostsTask
486
+ ```sh-session
487
+ bundle exec maintenance_tasks perform Maintenance::UpdatePostsTask
488
488
  ```
489
489
 
490
490
  To run a Task that processes CSVs from the command line, use the --csv option:
491
491
 
492
- ```bash
493
- $ bundle exec maintenance_tasks perform Maintenance::ImportPostsTask --csv "path/to/my_csv.csv"
492
+ ```sh-session
493
+ bundle exec maintenance_tasks perform Maintenance::ImportPostsTask --csv "path/to/my_csv.csv"
494
494
  ```
495
495
 
496
496
  To run a Task that takes arguments from the command line, use the --arguments
497
497
  option, passing arguments as a set of \<key>:\<value> pairs:
498
498
 
499
- ```bash
500
- $ bundle exec maintenance_tasks perform Maintenance::ParamsTask \
499
+ ```sh-session
500
+ bundle exec maintenance_tasks perform Maintenance::ParamsTask \
501
501
  --arguments post_ids:1,2,3 content:"Hello, World!"
502
502
  ```
503
503
 
@@ -745,8 +745,8 @@ clean backtraces.
745
745
  Use bundler to check for and upgrade to newer versions. After installing a new
746
746
  version, re-run the install command:
747
747
 
748
- ```bash
749
- $ bin/rails generate maintenance_tasks:install
748
+ ```sh-session
749
+ bin/rails generate maintenance_tasks:install
750
750
  ```
751
751
 
752
752
  This ensures that new migrations are installed and run as well.
@@ -8,7 +8,15 @@ module MaintenanceTasks
8
8
  BULMA_CDN = "https://cdn.jsdelivr.net"
9
9
 
10
10
  content_security_policy do |policy|
11
- policy.style_src(BULMA_CDN)
11
+ policy.style_src(
12
+ BULMA_CDN,
13
+ # ruby syntax highlighting
14
+ "'sha256-y9V0na/WU44EUNI/HDP7kZ7mfEci4PAOIjYOOan6JMA='",
15
+ )
16
+ policy.script_src(
17
+ # page refresh script
18
+ "'sha256-2RPaBS4XCMLp0JJ/sW407W9l4qjC+WQAHmTOFJTGfqo='",
19
+ )
12
20
  policy.frame_ancestors(:self)
13
21
  end
14
22
 
@@ -44,7 +44,7 @@ module MaintenanceTasks
44
44
  private
45
45
 
46
46
  def set_refresh
47
- @refresh = 3
47
+ @refresh = true
48
48
  end
49
49
  end
50
50
  end
@@ -15,13 +15,13 @@
15
15
  <%= csrf_meta_tags %>
16
16
 
17
17
  <%=
18
- stylesheet_link_tag URI.join(controller.class::BULMA_CDN, 'npm/bulma@0.9.1/css/bulma.css'),
18
+ stylesheet_link_tag(URI.join(controller.class::BULMA_CDN, 'npm/bulma@0.9.3/css/bulma.css'),
19
19
  media: :all,
20
- integrity: 'sha256-67AR2JVjhMZCLVxapLuBSMap5RrXbksv4vlllenHBSE=',
21
- crossorigin: 'anonymous'
20
+ integrity: 'sha384-Zkr9rpl37lclZu6AwYQZZm0CxiMqLZFiibodW+UXLnAWPBr6qgIzPpcmHkpwnyWD',
21
+ crossorigin: 'anonymous') unless request.xhr?
22
22
  %>
23
23
 
24
- <style nonce="<%= content_security_policy_nonce %>">
24
+ <style>
25
25
  .ruby-comment { color: #6a737d;}
26
26
  .ruby-const { color: #e36209; }
27
27
  .ruby-embexpr-beg, .ruby-embexpr-end, .ruby-period { color: #24292e; }
@@ -31,12 +31,30 @@
31
31
  .ruby-label, .ruby-tstring-beg, .ruby-tstring-content, .ruby-tstring-end { color: #032f62; }
32
32
  </style>
33
33
 
34
- <% if defined?(@refresh) %>
35
- <meta http-equiv="refresh" content="<%= @refresh %>">
36
- <% end %>
34
+ <script>
35
+ function refresh() {
36
+ if (!("refresh" in document.body.dataset)) return
37
+ window.setTimeout(() => {
38
+ document.body.style.cursor = "wait"
39
+ fetch(document.location, { headers: { "X-Requested-With": "XMLHttpRequest" } }).then(
40
+ async response => {
41
+ const text = await response.text()
42
+ const newDocument = new DOMParser().parseFromString(text, "text/html")
43
+ document.body.replaceWith(newDocument.body)
44
+ <%# force a redraw for Safari %>
45
+ window.scrollTo({ top: document.documentElement.scrollTop + 1 })
46
+ window.scrollTo({ top: document.documentElement.scrollTop - 1 })
47
+ refresh()
48
+ },
49
+ error => location.reload()
50
+ )
51
+ }, 3000)
52
+ }
53
+ document.addEventListener('DOMContentLoaded', refresh)
54
+ </script>
37
55
  </head>
38
56
 
39
- <body>
57
+ <body <%= "data-refresh" if defined?(@refresh) && @refresh %>>
40
58
  <%= render 'layouts/maintenance_tasks/navbar' %>
41
59
 
42
60
  <section class="section">
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'test_helper'
2
+ require "test_helper"
3
3
 
4
4
  module <%= tasks_module %>
5
5
  <% module_namespacing do -%>
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
- require 'rails_helper'
2
+ require "rails_helper"
3
3
 
4
4
  module <%= tasks_module %>
5
5
  <% module_namespacing do -%>
6
6
  RSpec.describe <%= class_name %>Task do
7
7
  describe "#process" do
8
8
  subject(:process) { described_class.process(element) }
9
- let(:element) {
9
+ let(:element) {
10
10
  # Object to be processed in a single iteration of this task
11
11
  }
12
12
  pending "add some examples to (or delete) #{__FILE__}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'test_helper'
2
+ require "test_helper"
3
3
 
4
4
  module <%= tasks_module %>
5
5
  <% module_namespacing do -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maintenance_tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-05 00:00:00.000000000 Z
11
+ date: 2022-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -151,7 +151,7 @@ homepage: https://github.com/Shopify/maintenance_tasks
151
151
  licenses:
152
152
  - MIT
153
153
  metadata:
154
- source_code_uri: https://github.com/Shopify/maintenance_tasks/tree/v1.9.0
154
+ source_code_uri: https://github.com/Shopify/maintenance_tasks/tree/v1.10.0
155
155
  allowed_push_host: https://rubygems.org
156
156
  post_install_message:
157
157
  rdoc_options: []