disco_app 0.14.0 → 0.15.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 970c527220c6ea8c650c51f80c6b1e68eee859d86d5652330eb9577d4a4ce2ad
4
- data.tar.gz: ac39e32ed7ec03b2244b8efdcfb9e32f9ee8c0fdcfbeb60d186e80785e390cce
3
+ metadata.gz: ffe2c53f6a63376cf9484d15fbfb9030d7e4b5c07e0c38cccbc3f2ef095ac00f
4
+ data.tar.gz: 91019e6d795d0bd4b930badc400d8add493da10965312747db9b67ed58a8addc
5
5
  SHA512:
6
- metadata.gz: 1ca38662339da5af03b15600f934cafd63c9335a07394af5f813fb17cec8005e30f20d2c204754573bdbd44705175e5e04c1164b89fa9b3eacab47d4f567aee2
7
- data.tar.gz: 3804a7bd20cbf1eec6012af974b4dc91fac66b1cd219a86cc005b799f3d88b2d611ea208c9c39c118fcf88aab846895aab6fe408bb560668246d2ee5b715776d
6
+ metadata.gz: dba9193914aa136db5dd59dd9c25b49e70396967f0aa2f0cbe05682408864c93d6e57f6afb771ad5c19b3e00074efb4b1d9f6e76f3805aed7473a390993a2183
7
+ data.tar.gz: 3b171fa44ccab7a8af5470c50106ff1023370a29c95da68e9f2909287d551d5858ac840063daf9c091ed2184157eb25184278b4ac05916ffe887b1fe6df1b09d
File without changes
@@ -0,0 +1,48 @@
1
+ module DiscoApp::Concerns::WebhooksController
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ before_action :verify_webhook
6
+ protect_from_forgery with: :null_session
7
+ end
8
+
9
+ def process_webhook
10
+ # Get the topic and domain for this webhook.
11
+ topic = request.headers['HTTP_X_SHOPIFY_TOPIC']
12
+ shopify_domain = request.headers['HTTP_X_SHOPIFY_SHOP_DOMAIN']
13
+
14
+ # Ensure a domain was provided in the headers.
15
+ unless shopify_domain
16
+ head :bad_request
17
+ end
18
+
19
+ # Try to find a matching background job task for the given topic using class name.
20
+ job_class = DiscoApp::WebhookService.find_job_class(topic)
21
+
22
+ # Return bad request if we couldn't match a job class.
23
+ unless job_class.present?
24
+ head :bad_request
25
+ end
26
+
27
+ # Decode the body data and enqueue the appropriate job.
28
+ data = ActiveSupport::JSON::decode(request.body.read).with_indifferent_access
29
+ job_class.perform_later(shopify_domain, data)
30
+
31
+ render body: nil
32
+ end
33
+
34
+ private
35
+
36
+ def verify_webhook
37
+ unless webhook_is_valid?
38
+ head :unauthorized
39
+ end
40
+ request.body.rewind
41
+ end
42
+
43
+ def webhook_is_valid?
44
+ return true if Rails.env.development? and DiscoApp.configuration.skip_webhook_verification?
45
+ DiscoApp::WebhookService.is_valid_hmac?(request.body.read.to_s, ShopifyApp.configuration.secret, request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'])
46
+ end
47
+
48
+ end
@@ -1,46 +1,3 @@
1
- module DiscoApp
2
- class WebhooksController < ActionController::Base
3
-
4
- before_action :verify_webhook
5
-
6
- def process_webhook
7
- # Get the topic and domain for this webhook.
8
- topic = request.headers['HTTP_X_SHOPIFY_TOPIC']
9
- shopify_domain = request.headers['HTTP_X_SHOPIFY_SHOP_DOMAIN']
10
-
11
- # Ensure a domain was provided in the headers.
12
- unless shopify_domain
13
- head :bad_request
14
- end
15
-
16
- # Try to find a matching background job task for the given topic using class name.
17
- job_class = DiscoApp::WebhookService.find_job_class(topic)
18
-
19
- # Return bad request if we couldn't match a job class.
20
- unless job_class.present?
21
- head :bad_request
22
- end
23
-
24
- # Decode the body data and enqueue the appropriate job.
25
- data = ActiveSupport::JSON::decode(request.body.read).with_indifferent_access
26
- job_class.perform_later(shopify_domain, data)
27
-
28
- render body: nil
29
- end
30
-
31
- private
32
-
33
- def verify_webhook
34
- unless webhook_is_valid?
35
- head :unauthorized
36
- end
37
- request.body.rewind
38
- end
39
-
40
- def webhook_is_valid?
41
- return true if Rails.env.development? and DiscoApp.configuration.skip_webhook_verification?
42
- DiscoApp::WebhookService.is_valid_hmac?(request.body.read.to_s, ShopifyApp.configuration.secret, request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'])
43
- end
44
-
45
- end
1
+ class DiscoApp::WebhooksController < ActionController::Base
2
+ include DiscoApp::Concerns::WebhooksController
46
3
  end
@@ -14,7 +14,7 @@ module DiscoApp::Concerns::Taggable
14
14
  end
15
15
 
16
16
  def has_tag?(tag_to_check)
17
- tags.any? { |tag| tag.casecmp(tag_to_check) }
17
+ tags.any? { |tag| tag.casecmp?(tag_to_check) }
18
18
  end
19
19
 
20
20
  end
@@ -5,7 +5,7 @@ class DiscoApp::ProxyService
5
5
  def self.proxy_signature_is_valid?(query_string, secret)
6
6
  query_hash = Rack::Utils.parse_query(query_string)
7
7
  signature = query_hash.delete('signature').to_s
8
- ActiveSupport::SecurityUtils.variable_size_secure_compare(self.calculated_signature(query_hash, secret), signature)
8
+ ActiveSupport::SecurityUtils.secure_compare(self.calculated_signature(query_hash, secret), signature)
9
9
  end
10
10
 
11
11
  # Return the calculated signature for the given query hash and secret.
@@ -3,7 +3,7 @@ class DiscoApp::RequestValidationService
3
3
  def self.hmac_valid?(query_string, secret)
4
4
  query_hash = Rack::Utils.parse_query(query_string)
5
5
  hmac = query_hash.delete('hmac').to_s
6
- ActiveSupport::SecurityUtils.variable_size_secure_compare(self.calculated_hmac(query_hash, secret), hmac)
6
+ ActiveSupport::SecurityUtils.secure_compare(self.calculated_hmac(query_hash, secret), hmac)
7
7
  end
8
8
 
9
9
  # Return the calculated hmac for the given query hash and secret.
@@ -1,3 +1,3 @@
1
1
  module DiscoApp
2
- VERSION = '0.14.0'
2
+ VERSION = '0.15.2'
3
3
  end
@@ -8,12 +8,13 @@ class DiscoAppGenerator < Rails::Generators::Base
8
8
  # - Slightly customised version of the default Rails .gitignore;
9
9
  # - Default simple Procfile for Heroku;
10
10
  # - .editorconfig to help enforce 2-space tabs, newlines and truncated whitespace for editors that support it.
11
- # - README template
11
+ # - README/PULL REQUEST template
12
12
  #
13
13
  def copy_root_files
14
14
  %w(.editorconfig .env .env.local .gitignore .rubocop.yml .codeclimate.yml Procfile CHECKS README.md).each do |file|
15
15
  copy_file "root/#{file}", file
16
16
  end
17
+ directory 'root/.github'
17
18
  end
18
19
 
19
20
  # Remove a number of root files.
@@ -0,0 +1,7 @@
1
+ engines:
2
+ rubocop:
3
+ enabled: true
4
+
5
+ ratings:
6
+ paths:
7
+ - "**.rb"
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
@@ -0,0 +1,20 @@
1
+ DEFAULT_HOST=
2
+
3
+ SHOPIFY_APP_NAME=
4
+ SHOPIFY_APP_API_KEY=00000000000000000000000000000000
5
+ SHOPIFY_APP_SECRET=00000000000000000000000000000000
6
+ SHOPIFY_APP_SCOPE=
7
+ SHOPIFY_APP_PROXY_PREFIX=
8
+
9
+ ADMIN_APP_USERNAME=
10
+ ADMIN_APP_PASSWORD=
11
+
12
+ SHOPIFY_CHARGES_REAL=
13
+
14
+ SECRET_KEY_BASE=
15
+
16
+ REDIS_PROVIDER=
17
+
18
+ DISCO_API_URL=
19
+
20
+ WHITELISTED_DOMAINS=
@@ -0,0 +1,25 @@
1
+ DEFAULT_HOST=
2
+
3
+ SHOPIFY_APP_NAME=
4
+ SHOPIFY_APP_API_KEY=
5
+ SHOPIFY_APP_SECRET=
6
+ SHOPIFY_APP_SCOPE=
7
+ SHOPIFY_APP_PROXY_PREFIX=
8
+
9
+ ADMIN_APP_USERNAME=
10
+ ADMIN_APP_PASSWORD=
11
+
12
+ SHOPIFY_REAL_CHARGES=
13
+
14
+ SKIP_PROXY_VERIFICATION=
15
+ SKIP_WEBHOOK_VERIFICATION=
16
+ SKIP_CARRIER_REQUEST_VERIFICATION=
17
+ SKIP_OAUTH=
18
+
19
+ SECRET_KEY_BASE=
20
+
21
+ REDIS_PROVIDER=
22
+
23
+ DISCO_API_URL=
24
+
25
+ WHITELISTED_DOMAINS=
@@ -0,0 +1,18 @@
1
+ Jira: [XXX-1](https://discodev.atlassian.net/browse/XXX-1)
2
+
3
+ ### Description
4
+ A brief overview of the work done. Be sure to provide some context to the issue/feature, so that the reviewer can jump right on in and review your sweet, sweet code.
5
+
6
+ Highlight any interesting design decisions that you may have taken.
7
+
8
+ ### Notes
9
+ * A bulleted list of any secondary information that you feel would be useful to the reviewer.
10
+ * Gotchas, new dependencies, unusual data migrations, etc., would all live here.
11
+
12
+ ### Checklist
13
+
14
+ - [ ] Updated README and any other relevant documentation.
15
+ - [ ] Tested changes locally.
16
+ - [ ] Updated test suite and made sure that it all passes.
17
+ - [ ] Ensured that Rubocop and friends are happy.
18
+ - [ ] Checked that this PR is referencing the correct base.
@@ -0,0 +1,43 @@
1
+ *.rbc
2
+ *.pgdump
3
+ capybara-*.html
4
+ .rspec
5
+ /log
6
+ /tmp
7
+ /db/*.sqlite3
8
+ /db/*.sqlite3-journal
9
+ /public/system
10
+ /coverage/
11
+ /spec/tmp
12
+ **.orig
13
+ rerun.txt
14
+ pickle-email-*.html
15
+ .byebug_history
16
+ .DS_Store
17
+ .disco_app
18
+
19
+ ## Environment normalisation:
20
+ /.bundle
21
+ /vendor/bundle
22
+ /vendor/ruby
23
+ /.env.local
24
+ .envrc
25
+
26
+ # these should all be checked in to normalise the environment:
27
+ # Gemfile.lock, .ruby-version, .ruby-gemset
28
+
29
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
30
+ .rvmrc
31
+
32
+ # if using bower-rails ignore default bower_components path bower.json files
33
+ /vendor/assets/bower_components
34
+ *.bowerrc
35
+ bower.json
36
+
37
+ # Ignore pow environment settings
38
+ .powenv
39
+
40
+ # Editors
41
+ .idea
42
+ .vscode
43
+ TAGS
@@ -0,0 +1,660 @@
1
+ AllCops:
2
+ Exclude:
3
+ - db/schema.rb
4
+
5
+ Style/AccessorMethodName:
6
+ Description: Check the naming of accessor methods for get_/set_.
7
+ Enabled: false
8
+
9
+ Style/Alias:
10
+ Description: 'Use alias_method instead of alias.'
11
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
12
+ Enabled: true
13
+
14
+ Style/ArrayJoin:
15
+ Description: 'Use Array#join instead of Array#*.'
16
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
17
+ Enabled: true
18
+
19
+ Style/AsciiComments:
20
+ Description: 'Use only ascii symbols in comments.'
21
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
22
+ Enabled: true
23
+
24
+ Style/AsciiIdentifiers:
25
+ Description: 'Use only ascii symbols in identifiers.'
26
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
27
+ Enabled: true
28
+
29
+ Style/Attr:
30
+ Description: 'Checks for uses of Module#attr.'
31
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
32
+ Enabled: true
33
+
34
+ Metrics/BlockNesting:
35
+ Description: 'Avoid excessive block nesting'
36
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
37
+ Enabled: true
38
+
39
+ Style/CaseEquality:
40
+ Description: 'Avoid explicit use of the case equality operator(===).'
41
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
42
+ Enabled: false
43
+
44
+ Style/CharacterLiteral:
45
+ Description: 'Checks for uses of character literals.'
46
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
47
+ Enabled: true
48
+
49
+ Style/ClassAndModuleChildren:
50
+ Description: 'Checks style of children classes and modules.'
51
+ Enabled: true
52
+ EnforcedStyle: nested
53
+
54
+ Metrics/ClassLength:
55
+ Description: 'Avoid classes longer than 100 lines of code.'
56
+ Enabled: false
57
+
58
+ Metrics/ModuleLength:
59
+ Description: 'Avoid modules longer than 100 lines of code.'
60
+ Enabled: false
61
+
62
+ Style/ClassVars:
63
+ Description: 'Avoid the use of class variables.'
64
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
65
+ Enabled: true
66
+
67
+ Style/CollectionMethods:
68
+ Enabled: true
69
+ PreferredMethods:
70
+ find: find
71
+ inject: reduce
72
+ collect: map
73
+ find_all: select
74
+
75
+ Style/ColonMethodCall:
76
+ Description: 'Do not use :: for method call.'
77
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
78
+ Enabled: true
79
+
80
+ Style/MutableConstant:
81
+ Description: 'Avoids assignment of mutable literals to constants..'
82
+ StyleGuide: 'http://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Style/MutableConstant'
83
+ Enabled: false
84
+
85
+ Style/CommentAnnotation:
86
+ Description: >-
87
+ Checks formatting of special comments
88
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
89
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
90
+ Enabled: false
91
+
92
+ Metrics/AbcSize:
93
+ Description: >-
94
+ A calculated magnitude based on number of assignments,
95
+ branches, and conditions.
96
+ Enabled: false
97
+
98
+ Metrics/CyclomaticComplexity:
99
+ Description: >-
100
+ A complexity metric that is strongly correlated to the number
101
+ of test cases needed to validate a method.
102
+ Enabled: false
103
+
104
+ Rails/Delegate:
105
+ Description: 'Prefer delegate method for delegations.'
106
+ Enabled: false
107
+
108
+ Style/PreferredHashMethods:
109
+ Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
110
+ StyleGuide: '#hash-key'
111
+ Enabled: true
112
+
113
+ Style/Documentation:
114
+ Description: 'Document classes and non-namespace modules.'
115
+ Enabled: false
116
+
117
+ Style/DoubleNegation:
118
+ Description: 'Checks for uses of double negation (!!).'
119
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
120
+ Enabled: true
121
+
122
+ Style/EachWithObject:
123
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
124
+ Enabled: false
125
+
126
+ Style/EmptyLiteral:
127
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
128
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
129
+ Enabled: true
130
+
131
+ # Checks whether the source file has a utf-8 encoding comment or not
132
+ # AutoCorrectEncodingComment must match the regex
133
+ # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
134
+ Style/Encoding:
135
+ Enabled: false
136
+
137
+ Style/EvenOdd:
138
+ Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
139
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
140
+ Enabled: true
141
+
142
+ Style/FileName:
143
+ Description: 'Use snake_case for source file names.'
144
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
145
+ Enabled: true
146
+
147
+ Style/FrozenStringLiteralComment:
148
+ Description: >-
149
+ Add the frozen_string_literal comment to the top of files
150
+ to help transition from Ruby 2.3.0 to Ruby 3.0.
151
+ Enabled: false
152
+
153
+ Style/FlipFlop:
154
+ Description: 'Checks for flip flops'
155
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
156
+ Enabled: true
157
+
158
+ Style/FormatString:
159
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
160
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
161
+ Enabled: true
162
+
163
+ Style/GlobalVars:
164
+ Description: 'Do not introduce global variables.'
165
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
166
+ Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
167
+ Enabled: false
168
+
169
+ Style/GuardClause:
170
+ Description: 'Check for conditionals that can be replaced with guard clauses'
171
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
172
+ Enabled: true
173
+
174
+ Style/IfUnlessModifier:
175
+ Description: >-
176
+ Favor modifier if/unless usage when you have a
177
+ single-line body.
178
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
179
+ Enabled: true
180
+
181
+ Style/IfWithSemicolon:
182
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
183
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
184
+ Enabled: true
185
+
186
+ Style/InlineComment:
187
+ Description: 'Avoid inline comments.'
188
+ Enabled: true
189
+
190
+ Style/Lambda:
191
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
192
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
193
+ Enabled: true
194
+
195
+ Style/LambdaCall:
196
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
197
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
198
+ Enabled: true
199
+
200
+ Style/LineEndConcatenation:
201
+ Description: >-
202
+ Use \ instead of + or << to concatenate two string literals at
203
+ line end.
204
+ Enabled: true
205
+
206
+ Metrics/LineLength:
207
+ Description: 'Limit lines to 80 characters.'
208
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
209
+ Max: 80
210
+ Enabled: false
211
+
212
+ Metrics/MethodLength:
213
+ Description: 'Avoid methods longer than 10 lines of code.'
214
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
215
+ Enabled: false
216
+
217
+ Style/ModuleFunction:
218
+ Description: 'Checks for usage of `extend self` in modules.'
219
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
220
+ Enabled: false
221
+
222
+ Style/MultilineBlockChain:
223
+ Description: 'Avoid multi-line chains of blocks.'
224
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
225
+ Enabled: false
226
+
227
+ Style/NegatedIf:
228
+ Description: >-
229
+ Favor unless over if for negative conditions
230
+ (or control flow or).
231
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
232
+ Enabled: true
233
+
234
+ Style/NegatedWhile:
235
+ Description: 'Favor until over while for negative conditions.'
236
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
237
+ Enabled: true
238
+
239
+ Style/Next:
240
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
241
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
242
+ Enabled: true
243
+
244
+ Style/NilComparison:
245
+ Description: 'Prefer x.nil? to x == nil.'
246
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
247
+ Enabled: true
248
+
249
+ Style/Not:
250
+ Description: 'Use ! instead of not.'
251
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
252
+ Enabled: true
253
+
254
+ Style/NumericLiterals:
255
+ Description: >-
256
+ Add underscores to large numeric literals to improve their
257
+ readability.
258
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
259
+ Enabled: true
260
+
261
+ Style/OneLineConditional:
262
+ Description: >-
263
+ Favor the ternary operator(?:) over
264
+ if/then/else/end constructs.
265
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
266
+ Enabled: true
267
+
268
+ Style/OpMethod:
269
+ Description: 'When defining binary operators, name the argument other.'
270
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
271
+ Enabled: false
272
+
273
+ Metrics/ParameterLists:
274
+ Description: 'Avoid parameter lists longer than three or four parameters.'
275
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
276
+ Enabled: true
277
+
278
+ Style/PercentLiteralDelimiters:
279
+ Description: 'Use `%`-literal delimiters consistently'
280
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
281
+ Enabled: true
282
+
283
+ Style/PerlBackrefs:
284
+ Description: 'Avoid Perl-style regex back references.'
285
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
286
+ Enabled: true
287
+
288
+ Style/PredicateName:
289
+ Description: 'Check the names of predicate methods.'
290
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
291
+ NamePrefixBlacklist:
292
+ - is_
293
+ Exclude:
294
+ - spec/**/*
295
+
296
+ Style/Proc:
297
+ Description: 'Use proc instead of Proc.new.'
298
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
299
+ Enabled: true
300
+
301
+ Style/RaiseArgs:
302
+ Description: 'Checks the arguments passed to raise/fail.'
303
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
304
+ Enabled: true
305
+
306
+ Style/RegexpLiteral:
307
+ Description: 'Use / or %r around regular expressions.'
308
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
309
+ Enabled: true
310
+
311
+ Style/SelfAssignment:
312
+ Description: >-
313
+ Checks for places where self-assignment shorthand should have
314
+ been used.
315
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
316
+ Enabled: true
317
+
318
+ Style/SingleLineBlockParams:
319
+ Description: 'Enforces the names of some block params.'
320
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
321
+ Enabled: false
322
+
323
+ Style/SingleLineMethods:
324
+ Description: 'Avoid single-line methods.'
325
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
326
+ Enabled: true
327
+
328
+ Style/SignalException:
329
+ Description: 'Checks for proper usage of fail and raise.'
330
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
331
+ Enabled: true
332
+
333
+ Style/SpecialGlobalVars:
334
+ Description: 'Avoid Perl-style global variables.'
335
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
336
+ Enabled: true
337
+
338
+ Style/StringLiterals:
339
+ Description: 'Checks if uses of quotes match the configured preference.'
340
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
341
+ EnforcedStyle: single_quotes
342
+ Enabled: true
343
+
344
+ Style/TrailingCommaInArguments:
345
+ Description: 'Checks for trailing comma in argument lists.'
346
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
347
+ EnforcedStyleForMultiline: comma
348
+ Enabled: true
349
+
350
+ Style/TrailingCommaInLiteral:
351
+ Description: 'Checks for trailing comma in array and hash literals.'
352
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
353
+ EnforcedStyleForMultiline: comma
354
+ Enabled: false
355
+
356
+ Style/TrivialAccessors:
357
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
358
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
359
+ Enabled: true
360
+
361
+ Style/VariableInterpolation:
362
+ Description: >-
363
+ Don't interpolate global, instance and class variables
364
+ directly in strings.
365
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
366
+ Enabled: true
367
+
368
+ Style/WhenThen:
369
+ Description: 'Use when x then ... for one-line cases.'
370
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
371
+ Enabled: true
372
+
373
+ Style/WhileUntilModifier:
374
+ Description: >-
375
+ Favor modifier while/until usage when you have a
376
+ single-line body.
377
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
378
+ Enabled: true
379
+
380
+ Style/WordArray:
381
+ Description: 'Use %w or %W for arrays of words.'
382
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
383
+ Enabled: true
384
+
385
+ Style/SymbolArray:
386
+ MinSize: 3
387
+
388
+ # Lint
389
+
390
+ Lint/AmbiguousOperator:
391
+ Description: >-
392
+ Checks for ambiguous operators in the first argument of a
393
+ method invocation without parentheses.
394
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
395
+ Enabled: true
396
+
397
+ Lint/AmbiguousRegexpLiteral:
398
+ Description: >-
399
+ Checks for ambiguous regexp literals in the first argument of
400
+ a method invocation without parenthesis.
401
+ Enabled: false
402
+
403
+ Lint/AssignmentInCondition:
404
+ Description: "Don't use assignment in conditions."
405
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
406
+ Enabled: true
407
+
408
+ Lint/CircularArgumentReference:
409
+ Description: "Don't refer to the keyword argument in the default value."
410
+ Enabled: false
411
+
412
+ Lint/ConditionPosition:
413
+ Description: >-
414
+ Checks for condition placed in a confusing position relative to
415
+ the keyword.
416
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
417
+ Enabled: true
418
+
419
+ Lint/DeprecatedClassMethods:
420
+ Description: 'Check for deprecated class method calls.'
421
+ Enabled: true
422
+
423
+ Lint/DuplicatedKey:
424
+ Description: 'Check for duplicate keys in hash literals.'
425
+ Enabled: true
426
+
427
+ Lint/EachWithObjectArgument:
428
+ Description: 'Check for immutable argument given to each_with_object.'
429
+ Enabled: false
430
+
431
+ Lint/ElseLayout:
432
+ Description: 'Check for odd code arrangement in an else block.'
433
+ Enabled: true
434
+
435
+ Lint/FormatParameterMismatch:
436
+ Description: 'The number of parameters to format/sprint must match the fields.'
437
+ Enabled: true
438
+
439
+ Lint/HandleExceptions:
440
+ Description: "Don't suppress exception."
441
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
442
+ Enabled: true
443
+
444
+ Lint/InvalidCharacterLiteral:
445
+ Description: >-
446
+ Checks for invalid character literals with a non-escaped
447
+ whitespace character.
448
+ Enabled: false
449
+
450
+ Lint/LiteralInCondition:
451
+ Description: 'Checks of literals used in conditions.'
452
+ Enabled: false
453
+
454
+ Lint/LiteralInInterpolation:
455
+ Description: 'Checks for literals used in interpolation.'
456
+ Enabled: false
457
+
458
+ Lint/Loop:
459
+ Description: >-
460
+ Use Kernel#loop with break rather than begin/end/until or
461
+ begin/end/while for post-loop tests.
462
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
463
+ Enabled: false
464
+
465
+ Lint/NestedMethodDefinition:
466
+ Description: 'Do not use nested method definitions.'
467
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
468
+ Enabled: true
469
+
470
+ Lint/NonLocalExitFromIterator:
471
+ Description: 'Do not use return in iterator to cause non-local exit.'
472
+ Enabled: true
473
+
474
+ Lint/ParenthesesAsGroupedExpression:
475
+ Description: >-
476
+ Checks for method calls with a space before the opening
477
+ parenthesis.
478
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
479
+ Enabled: true
480
+
481
+ Lint/RequireParentheses:
482
+ Description: >-
483
+ Use parentheses in the method call to avoid confusion
484
+ about precedence.
485
+ Enabled: true
486
+
487
+ Lint/UnderscorePrefixedVariableName:
488
+ Description: 'Do not use prefix `_` for a variable that is used.'
489
+ Enabled: false
490
+
491
+ Lint/UnneededDisable:
492
+ Description: >-
493
+ Checks for rubocop:disable comments that can be removed.
494
+ Note: this cop is not disabled when disabling all cops.
495
+ It must be explicitly disabled.
496
+ Enabled: false
497
+
498
+ Lint/Void:
499
+ Description: 'Possible use of operator/literal/variable in void context.'
500
+ Enabled: false
501
+
502
+ # Performance
503
+
504
+ Performance/CaseWhenSplat:
505
+ Description: >-
506
+ Place `when` conditions that use splat at the end
507
+ of the list of `when` branches.
508
+ Enabled: false
509
+
510
+ Performance/Count:
511
+ Description: >-
512
+ Use `count` instead of `select...size`, `reject...size`,
513
+ `select...count`, `reject...count`, `select...length`,
514
+ and `reject...length`.
515
+ Enabled: true
516
+
517
+ Performance/Detect:
518
+ Description: >-
519
+ Use `detect` instead of `select.first`, `find_all.first`,
520
+ `select.last`, and `find_all.last`.
521
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
522
+ Enabled: false
523
+
524
+ Performance/FlatMap:
525
+ Description: >-
526
+ Use `Enumerable#flat_map`
527
+ instead of `Enumerable#map...Array#flatten(1)`
528
+ or `Enumberable#collect..Array#flatten(1)`
529
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
530
+ Enabled: true
531
+
532
+ Performance/ReverseEach:
533
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
534
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
535
+ Enabled: true
536
+
537
+ Performance/Sample:
538
+ Description: >-
539
+ Use `sample` instead of `shuffle.first`,
540
+ `shuffle.last`, and `shuffle[Fixnum]`.
541
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
542
+ Enabled: true
543
+
544
+ Performance/Size:
545
+ Description: >-
546
+ Use `size` instead of `count` for counting
547
+ the number of elements in `Array` and `Hash`.
548
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
549
+ Enabled: true
550
+
551
+ Performance/StringReplacement:
552
+ Description: >-
553
+ Use `tr` instead of `gsub` when you are replacing the same
554
+ number of characters. Use `delete` instead of `gsub` when
555
+ you are deleting characters.
556
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
557
+ Enabled: true
558
+
559
+ # Rails
560
+
561
+ Rails/ActionFilter:
562
+ Description: 'Enforces consistent use of action filter methods.'
563
+ Enabled: true
564
+
565
+ Rails/Date:
566
+ Description: >-
567
+ Checks the correct usage of date aware methods,
568
+ such as Date.today, Date.current etc.
569
+ Enabled: true
570
+
571
+ Rails/FindBy:
572
+ Description: 'Prefer find_by over where.first.'
573
+ Enabled: true
574
+
575
+ Rails/FindEach:
576
+ Description: 'Prefer all.find_each over all.find.'
577
+ Enabled: true
578
+
579
+ Rails/HasAndBelongsToMany:
580
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
581
+ Enabled: true
582
+
583
+ Rails/Output:
584
+ Description: 'Checks for calls to puts, print, etc.'
585
+ Enabled: true
586
+
587
+ Rails/ReadWriteAttribute:
588
+ Description: >-
589
+ Checks for read_attribute(:attr) and
590
+ write_attribute(:attr, val).
591
+ Enabled: false
592
+
593
+ Rails/ScopeArgs:
594
+ Description: 'Checks the arguments of ActiveRecord scopes.'
595
+ Enabled: true
596
+
597
+ Rails/TimeZone:
598
+ Description: 'Checks the correct usage of time zone aware methods.'
599
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
600
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
601
+ Enabled: true
602
+
603
+ Rails/Validation:
604
+ Description: 'Use validates :attribute, hash of validations.'
605
+ Enabled: false
606
+
607
+ # Layout
608
+
609
+ Layout/EmptyLinesAroundClassBody:
610
+ Enabled: true
611
+ EnforcedStyle: empty_lines
612
+
613
+ Layout/AlignParameters:
614
+ Description: 'Here we check if the parameters on a multi-line method call or definition are aligned.'
615
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
616
+ Enabled: true
617
+
618
+ Layout/DotPosition:
619
+ Description: 'Checks the position of the dot in multi-line method calls.'
620
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
621
+ EnforcedStyle: leading
622
+
623
+ Layout/ExtraSpacing:
624
+ Description: 'Do not use unnecessary spacing.'
625
+ Enabled: true
626
+
627
+ Layout/MultilineOperationIndentation:
628
+ Description: >-
629
+ Checks indentation of binary operations that span more than
630
+ one line.
631
+ Enabled: true
632
+ EnforcedStyle: indented
633
+
634
+ Layout/MultilineMethodCallIndentation:
635
+ Description: >-
636
+ Checks indentation of method calls with the dot operator
637
+ that span more than one line.
638
+ Enabled: true
639
+ EnforcedStyle: indented
640
+
641
+ Layout/InitialIndentation:
642
+ Description: >-
643
+ Checks the indentation of the first non-blank non-comment line in a file.
644
+ Enabled: false
645
+
646
+ Layout/IndentHash:
647
+ Enabled: true
648
+ EnforcedStyle: consistent
649
+
650
+ Layout/AccessModifierIndentation:
651
+ Enabled: true
652
+
653
+ Layout/IndentationConsistency:
654
+ EnforcedStyle: rails
655
+ Enabled: true
656
+
657
+ # Bundler
658
+
659
+ Bundler/OrderedGems:
660
+ Enabled: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disco_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Ballard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-14 00:00:00.000000000 Z
11
+ date: 2021-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: 5.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.1'
26
+ version: 5.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sass-rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -512,6 +512,7 @@ files:
512
512
  - app/assets/components/shopify/ui-stack/_ui-stack.scss
513
513
  - app/assets/components/shopify/ui-stack/ui-stack-item.es6.jsx
514
514
  - app/assets/components/shopify/ui-stack/ui-stack.es6.jsx
515
+ - app/assets/images/disco_app/.keep
515
516
  - app/assets/images/disco_app/icon.svg
516
517
  - app/assets/images/disco_app/icons.svg
517
518
  - app/assets/images/disco_app/logo.png
@@ -583,6 +584,7 @@ files:
583
584
  - app/controllers/disco_app/concerns/authenticated_controller.rb
584
585
  - app/controllers/disco_app/concerns/carrier_request_controller.rb
585
586
  - app/controllers/disco_app/concerns/user_authenticated_controller.rb
587
+ - app/controllers/disco_app/concerns/webhooks_controller.rb
586
588
  - app/controllers/disco_app/frame_controller.rb
587
589
  - app/controllers/disco_app/install_controller.rb
588
590
  - app/controllers/disco_app/subscriptions_controller.rb
@@ -701,6 +703,14 @@ files:
701
703
  - lib/generators/disco_app/templates/initializers/session_store.rb
702
704
  - lib/generators/disco_app/templates/initializers/shopify_app.rb
703
705
  - lib/generators/disco_app/templates/initializers/shopify_session_repository.rb
706
+ - lib/generators/disco_app/templates/root/.codeclimate.yml
707
+ - lib/generators/disco_app/templates/root/.editorconfig
708
+ - lib/generators/disco_app/templates/root/.env
709
+ - lib/generators/disco_app/templates/root/.env.local
710
+ - lib/generators/disco_app/templates/root/.github/PULL_REQUEST_TEMPLATE.md
711
+ - lib/generators/disco_app/templates/root/.gitignore
712
+ - lib/generators/disco_app/templates/root/.rubocop.yml
713
+ - lib/generators/disco_app/templates/root/.ruby-version
704
714
  - lib/generators/disco_app/templates/root/CHECKS
705
715
  - lib/generators/disco_app/templates/root/Procfile
706
716
  - lib/generators/disco_app/templates/root/README.md