pushyd 0.3.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: deac6c7be88fd0fe05c8afa55880aa29e6c4212d
4
- data.tar.gz: 4f6a4226355bbee4a76bb489867f0b000d3455ed
3
+ metadata.gz: e5aec80f8d9fb5ae6dea9ded765c0c182cb4df3f
4
+ data.tar.gz: edd2a2cfebcfe4909f423dbd9df2047cc0022e00
5
5
  SHA512:
6
- metadata.gz: 646e19080f09c51c448189dbe5743a17a5be869670220ce740dd16d1f11ea49f060e8627ffe7ff8c83f61f21cc8d086ee3795bcdf0fce8594c2b639bc5006ffb
7
- data.tar.gz: b707e637e0bd0e27acfd71f32c2b5db5caf146429fc1f3b9802facfe415242f0bc0222d6fb6d6a0f63ded5c9ba86b37736e9944fb2e63eb73df93a09a9c14b8f
6
+ metadata.gz: 833db2c5b2b39dc40e238d7156b89b8953771014bd1443cc88bfd2a683b1f669d9bfbe29816248e7aeb14b9a8a745f2c526c1709558fea1905f92edaed04d878
7
+ data.tar.gz: 15ab75984969df568efe8abb3fc6bfa5e65c2ff23a96d47d9453390d3329c7cc4aac21942ec1dc20226d125ce18dfad08fa6343745dd8c9843875aa1e40920cf
data/.rubocop.yml ADDED
@@ -0,0 +1,794 @@
1
+ # This is the default configuration file. Enabling and disabling is configured
2
+ # in separate files. This file adds all other parameters apart from Enabled.
3
+
4
+ inherit_from:
5
+
6
+
7
+ # Common configuration.
8
+ AllCops:
9
+ # Include common Ruby source files.
10
+ Include:
11
+ - '**/*.gemspec'
12
+ - '**/*.podspec'
13
+ - '**/*.jbuilder'
14
+ - '**/*.rake'
15
+ - '**/*.opal'
16
+ - '**/config.ru'
17
+ - '**/Gemfile'
18
+ - '**/Rakefile'
19
+ - '**/Capfile'
20
+ - '**/Guardfile'
21
+ - '**/Podfile'
22
+ - '**/Thorfile'
23
+ - '**/Vagrantfile'
24
+ - '**/Berksfile'
25
+ - '**/Cheffile'
26
+ - '**/Vagabondfile'
27
+ Exclude:
28
+ - 'vendor/**/*'
29
+ - 'DOC/**/*'
30
+ - '**/actors/*'
31
+ # Cop names are not displayed in offense messages by default. Change behavior
32
+ # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
33
+ # option.
34
+ DisplayCopNames: false
35
+ # Style guide URLs are not displayed in offense messages by default. Change
36
+ # behavior by overriding DisplayStyleGuide, or by giving the
37
+ # -S/--display-style-guide option.
38
+ DisplayStyleGuide: false
39
+ # Additional cops that do not reference a style guide rule may be enabled by
40
+ # default. Change behavior by overriding StyleGuideCopsOnly, or by giving
41
+ # the --only-guide-cops option.
42
+ StyleGuideCopsOnly: false
43
+
44
+ # Indent private/protected/public as deep as method definitions
45
+ Style/AccessModifierIndentation:
46
+ EnforcedStyle: indent
47
+ SupportedStyles:
48
+ - outdent
49
+ - indent
50
+
51
+ # Align the elements of a hash literal if they span more than one line.
52
+ Style/AlignHash:
53
+ # Alignment of entries using hash rocket as separator. Valid values are:
54
+ #
55
+ # key - left alignment of keys
56
+ # 'a' => 2
57
+ # 'bb' => 3
58
+ # separator - alignment of hash rockets, keys are right aligned
59
+ # 'a' => 2
60
+ # 'bb' => 3
61
+ # table - left alignment of keys, hash rockets, and values
62
+ # 'a' => 2
63
+ # 'bb' => 3
64
+ EnforcedHashRocketStyle: key
65
+ # Alignment of entries using colon as separator. Valid values are:
66
+ #
67
+ # key - left alignment of keys
68
+ # a: 0
69
+ # bb: 1
70
+ # separator - alignment of colons, keys are right aligned
71
+ # a: 0
72
+ # bb: 1
73
+ # table - left alignment of keys and values
74
+ # a: 0
75
+ # bb: 1
76
+ EnforcedColonStyle: key
77
+ # Select whether hashes that are the last argument in a method call should be
78
+ # inspected? Valid values are:
79
+ #
80
+ # always_inspect - Inspect both implicit and explicit hashes.
81
+ # Registers an offense for:
82
+ # function(a: 1,
83
+ # b: 2)
84
+ # Registers an offense for:
85
+ # function({a: 1,
86
+ # b: 2})
87
+ # always_ignore - Ignore both implicit and explicit hashes.
88
+ # Accepts:
89
+ # function(a: 1,
90
+ # b: 2)
91
+ # Accepts:
92
+ # function({a: 1,
93
+ # b: 2})
94
+ # ignore_implicit - Ignore only implicit hashes.
95
+ # Accepts:
96
+ # function(a: 1,
97
+ # b: 2)
98
+ # Registers an offense for:
99
+ # function({a: 1,
100
+ # b: 2})
101
+ # ignore_explicit - Ignore only explicit hashes.
102
+ # Accepts:
103
+ # function({a: 1,
104
+ # b: 2})
105
+ # Registers an offense for:
106
+ # function(a: 1,
107
+ # b: 2)
108
+ EnforcedLastArgumentHashStyle: always_inspect
109
+ SupportedLastArgumentHashStyles:
110
+ - always_inspect
111
+ - always_ignore
112
+ - ignore_implicit
113
+ - ignore_explicit
114
+
115
+ Style/AlignParameters:
116
+ # Alignment of parameters in multi-line method calls.
117
+ #
118
+ # The `with_first_parameter` style aligns the following lines along the same
119
+ # column as the first parameter.
120
+ #
121
+ # method_call(a,
122
+ # b)
123
+ #
124
+ # The `with_fixed_indentation` style aligns the following lines with one
125
+ # level of indentation relative to the start of the line with the method call.
126
+ #
127
+ # method_call(a,
128
+ # b)
129
+ EnforcedStyle: with_first_parameter
130
+ SupportedStyles:
131
+ - with_first_parameter
132
+ - with_fixed_indentation
133
+
134
+ Style/AndOr:
135
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
136
+ # or completely (always).
137
+ EnforcedStyle: always
138
+ SupportedStyles:
139
+ - always
140
+ - conditionals
141
+
142
+
143
+ # Checks if usage of %() or %Q() matches configuration.
144
+ Style/BarePercentLiterals:
145
+ EnforcedStyle: bare_percent
146
+ SupportedStyles:
147
+ - percent_q
148
+ - bare_percent
149
+
150
+ Style/BlockDelimiters:
151
+ EnforcedStyle: line_count_based
152
+ SupportedStyles:
153
+ # The `line_count_based` style enforces braces around single line blocks and
154
+ # do..end around multi-line blocks.
155
+ - line_count_based
156
+ # The `semantic` style enforces braces around functional blocks, where the
157
+ # primary purpose of the block is to return a value and do..end for
158
+ # procedural blocks, where the primary purpose of the block is its
159
+ # side-effects.
160
+ #
161
+ # This looks at the usage of a block's method to determine its type (e.g. is
162
+ # the result of a `map` assigned to a variable or passed to another
163
+ # method) but exceptions are permitted in the `ProceduralMethods`,
164
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
165
+ - semantic
166
+ ProceduralMethods:
167
+ # Methods that are known to be procedural in nature but look functional from
168
+ # their usage, e.g.
169
+ #
170
+ # time = Benchmark.realtime do
171
+ # foo.bar
172
+ # end
173
+ #
174
+ # Here, the return value of the block is discarded but the return value of
175
+ # `Benchmark.realtime` is used.
176
+ - benchmark
177
+ - bm
178
+ - bmbm
179
+ - create
180
+ - each_with_object
181
+ - measure
182
+ - new
183
+ - realtime
184
+ - tap
185
+ - with_object
186
+ FunctionalMethods:
187
+ # Methods that are known to be functional in nature but look procedural from
188
+ # their usage, e.g.
189
+ #
190
+ # let(:foo) { Foo.new }
191
+ #
192
+ # Here, the return value of `Foo.new` is used to define a `foo` helper but
193
+ # doesn't appear to be used from the return value of `let`.
194
+ - let
195
+ - let!
196
+ - subject
197
+ - watch
198
+ IgnoredMethods:
199
+ # Methods that can be either procedural or functional and cannot be
200
+ # categorised from their usage alone, e.g.
201
+ #
202
+ # foo = lambda do |x|
203
+ # puts "Hello, #{x}"
204
+ # end
205
+ #
206
+ # foo = lambda do |x|
207
+ # x * 100
208
+ # end
209
+ #
210
+ # Here, it is impossible to tell from the return value of `lambda` whether
211
+ # the inner block's return value is significant.
212
+ - lambda
213
+ - proc
214
+ - it
215
+
216
+ Style/BracesAroundHashParameters:
217
+ EnforcedStyle: no_braces
218
+ SupportedStyles:
219
+ # The `braces` style enforces braces around all method parameters that are
220
+ # hashes.
221
+ - braces
222
+ # The `no_braces` style checks that the last parameter doesn't have braces
223
+ # around it.
224
+ - no_braces
225
+ # The `context_dependent` style checks that the last parameter doesn't have
226
+ # braces around it, but requires braces if the second to last parameter is
227
+ # also a hash literal.
228
+ - context_dependent
229
+
230
+ # Indentation of `when`.
231
+ Style/CaseIndentation:
232
+ IndentWhenRelativeTo: case
233
+ SupportedStyles:
234
+ - case
235
+ - end
236
+ IndentOneStep: false
237
+
238
+ Style/ClassAndModuleChildren:
239
+ # Checks the style of children definitions at classes and modules.
240
+ #
241
+ # Basically there are two different styles:
242
+ #
243
+ # `nested` - have each child on a separate line
244
+ # class Foo
245
+ # class Bar
246
+ # end
247
+ # end
248
+ #
249
+ # `compact` - combine definitions as much as possible
250
+ # class Foo::Bar
251
+ # end
252
+ #
253
+ # The compact style is only forced, for classes / modules with one child.
254
+ EnforcedStyle: nested
255
+ SupportedStyles:
256
+ - nested
257
+ - compact
258
+
259
+ Style/ClassCheck:
260
+ EnforcedStyle: is_a?
261
+ SupportedStyles:
262
+ - is_a?
263
+ - kind_of?
264
+
265
+ # Align with the style guide.
266
+ Style/CollectionMethods:
267
+ # Mapping from undesired method to desired_method
268
+ # e.g. to use `detect` over `find`:
269
+ #
270
+ # CollectionMethods:
271
+ # PreferredMethods:
272
+ # find: detect
273
+ PreferredMethods:
274
+ collect: 'map'
275
+ collect!: 'map!'
276
+ inject: 'reduce'
277
+ detect: 'find'
278
+ find_all: 'select'
279
+
280
+ # Use ` or %x around command literals.
281
+ Style/CommandLiteral:
282
+ EnforcedStyle: backticks
283
+ # backticks: Always use backticks.
284
+ # percent_x: Always use %x.
285
+ # mixed: Use backticks on single-line commands, and %x on multi-line commands.
286
+ SupportedStyles:
287
+ - backticks
288
+ - percent_x
289
+ - mixed
290
+ # If false, the cop will always recommend using %x if one or more backticks
291
+ # are found in the command string.
292
+ AllowInnerBackticks: false
293
+
294
+ # Checks formatting of special comments
295
+ Style/CommentAnnotation:
296
+ Keywords:
297
+ - TODO
298
+ - FIXME
299
+ - OPTIMIZE
300
+ - HACK
301
+ - REVIEW
302
+
303
+ # Checks that you have put a copyright in a comment before any code.
304
+ #
305
+ # You can override the default Notice in your .rubocop.yml file.
306
+ #
307
+ # In order to use autocorrect, you must supply a value for the
308
+ # AutocorrectNotice key that matches the regexp Notice. A blank
309
+ # AutocorrectNotice will cause an error during autocorrect.
310
+ #
311
+ # Autocorrect will add a copyright notice in a comment at the top
312
+ # of the file immediately after any shebang or encoding comments.
313
+ #
314
+ # Example rubocop.yml:
315
+ #
316
+ # Style/Copyright:
317
+ # Enabled: true
318
+ # Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
319
+ # AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
320
+ #
321
+ Style/Copyright:
322
+ Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
323
+ AutocorrectNotice: ''
324
+
325
+ # Multi-line method chaining should be done with leading dots.
326
+ Style/DotPosition:
327
+ EnforcedStyle: leading
328
+ SupportedStyles:
329
+ - leading
330
+ - trailing
331
+
332
+ # Warn on empty else statements
333
+ # empty - warn only on empty else
334
+ # nil - warn on else with nil in it
335
+ # both - warn on empty else and else with nil in it
336
+ Style/EmptyElse:
337
+ EnforcedStyle: both
338
+ SupportedStyles:
339
+ - empty
340
+ - nil
341
+ - both
342
+
343
+ # Use empty lines between defs.
344
+ Style/EmptyLineBetweenDefs:
345
+ # If true, this parameter means that single line method definitions don't
346
+ # need an empty line between them.
347
+ AllowAdjacentOneLineDefs: false
348
+
349
+ Style/EmptyLinesAroundBlockBody:
350
+ EnforcedStyle: no_empty_lines
351
+ SupportedStyles:
352
+ - empty_lines
353
+ - no_empty_lines
354
+
355
+ Style/EmptyLinesAroundClassBody:
356
+ EnforcedStyle: no_empty_lines
357
+ SupportedStyles:
358
+ - empty_lines
359
+ - no_empty_lines
360
+
361
+ Style/EmptyLinesAroundModuleBody:
362
+ EnforcedStyle: no_empty_lines
363
+ SupportedStyles:
364
+ - empty_lines
365
+ - no_empty_lines
366
+
367
+ # Checks whether the source file has a utf-8 encoding comment or not
368
+ # AutoCorrectEncodingComment must match the regex
369
+ # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
370
+ Style/Encoding:
371
+ EnforcedStyle: always
372
+ SupportedStyles:
373
+ - when_needed
374
+ - always
375
+ AutoCorrectEncodingComment: '# encoding: utf-8'
376
+
377
+ Style/FileName:
378
+ # File names listed in AllCops:Include are excluded by default. Add extra
379
+ # excludes here.
380
+ Exclude: []
381
+ Enabled: false
382
+
383
+ Style/FirstParameterIndentation:
384
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
385
+ SupportedStyles:
386
+ # The first parameter should always be indented one step more than the
387
+ # preceding line.
388
+ - consistent
389
+ # The first parameter should normally be indented one step more than the
390
+ # preceding line, but if it's a parameter for a method call that is itself
391
+ # a parameter in a method call, then the inner parameter should be indented
392
+ # relative to the inner method.
393
+ - special_for_inner_method_call
394
+ # Same as special_for_inner_method_call except that the special rule only
395
+ # applies if the outer method call encloses its arguments in parentheses.
396
+ - special_for_inner_method_call_in_parentheses
397
+
398
+ # Checks use of for or each in multiline loops.
399
+ Style/For:
400
+ EnforcedStyle: each
401
+ SupportedStyles:
402
+ - for
403
+ - each
404
+
405
+ # Enforce the method used for string formatting.
406
+ Style/FormatString:
407
+ EnforcedStyle: format
408
+ SupportedStyles:
409
+ - format
410
+ - sprintf
411
+ - percent
412
+
413
+ # Built-in global variables are allowed by default.
414
+ Style/GlobalVars:
415
+ AllowedVariables: ["$queue", "$pool"]
416
+
417
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
418
+ # needs to have to trigger this cop
419
+ Style/GuardClause:
420
+ MinBodyLength: 1
421
+
422
+ Style/HashSyntax:
423
+ EnforcedStyle: ruby19
424
+ SupportedStyles:
425
+ - ruby19
426
+ - ruby19_no_mixed_keys
427
+ - hash_rockets
428
+ # Force hashes that have a symbol value to use hash rockets
429
+ UseHashRocketsWithSymbolValues: false
430
+
431
+ Style/IfUnlessModifier:
432
+ MaxLineLength: 160
433
+
434
+ Style/IndentationConsistency:
435
+ # The difference between `rails` and `normal` is that the `rails` style
436
+ # prescribes that in classes and modules the `protected` and `private`
437
+ # modifier keywords shall be indented the same as public methods and that
438
+ # protected and private members shall be indented one step more than the
439
+ # modifiers. Other than that, both styles mean that entities on the same
440
+ # logical depth shall have the same indentation.
441
+ EnforcedStyle: normal
442
+ SupportedStyles:
443
+ - normal
444
+ - rails
445
+
446
+ Style/IndentationWidth:
447
+ # Number of spaces for each indentation level.
448
+ Width: 2
449
+
450
+ # Checks the indentation of the first key in a hash literal.
451
+ Style/IndentHash:
452
+ # The value `special_inside_parentheses` means that hash literals with braces
453
+ # that have their opening brace on the same line as a surrounding opening
454
+ # round parenthesis, shall have their first key indented relative to the
455
+ # first position inside the parenthesis.
456
+ # The value `consistent` means that the indentation of the first key shall
457
+ # always be relative to the first position of the line where the opening
458
+ # brace is.
459
+ EnforcedStyle: special_inside_parentheses
460
+ SupportedStyles:
461
+ - special_inside_parentheses
462
+ - consistent
463
+
464
+ Style/LambdaCall:
465
+ EnforcedStyle: call
466
+ SupportedStyles:
467
+ - call
468
+ - braces
469
+
470
+ Style/Next:
471
+ # With `always` all conditions at the end of an iteration needs to be
472
+ # replaced by next - with `skip_modifier_ifs` the modifier if like this one
473
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
474
+ EnforcedStyle: skip_modifier_ifs
475
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
476
+ # needs to have to trigger this cop
477
+ MinBodyLength: 3
478
+ SupportedStyles:
479
+ - skip_modifier_ifs
480
+ - always
481
+
482
+ Style/NonNilCheck:
483
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
484
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
485
+ # **usually** OK, but might change behavior.
486
+ #
487
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
488
+ # offenses for `!x.nil?` and does no changes that might change behavior.
489
+ IncludeSemanticChanges: false
490
+
491
+ Style/MethodDefParentheses:
492
+ EnforcedStyle: require_no_parentheses
493
+ SupportedStyles:
494
+ - require_parentheses
495
+ - require_no_parentheses
496
+
497
+ Style/MethodName:
498
+ EnforcedStyle: snake_case
499
+ SupportedStyles:
500
+ - snake_case
501
+ - camelCase
502
+
503
+ Style/MultilineOperationIndentation:
504
+ EnforcedStyle: aligned
505
+ SupportedStyles:
506
+ - aligned
507
+ - indented
508
+
509
+ Style/NumericLiterals:
510
+ MinDigits: 5
511
+
512
+ # Allow safe assignment in conditions.
513
+ Style/ParenthesesAroundCondition:
514
+ AllowSafeAssignment: true
515
+
516
+ Style/PercentLiteralDelimiters:
517
+ PreferredDelimiters:
518
+ '%': ()
519
+ '%i': ()
520
+ '%q': ()
521
+ '%Q': ()
522
+ '%r': '{}'
523
+ '%s': ()
524
+ '%w': ()
525
+ '%W': ()
526
+ '%x': ()
527
+
528
+ Style/PercentQLiterals:
529
+ EnforcedStyle: lower_case_q
530
+ SupportedStyles:
531
+ - lower_case_q # Use %q when possible, %Q when necessary
532
+ - upper_case_q # Always use %Q
533
+
534
+ Style/PredicateName:
535
+ # Predicate name prefices.
536
+ NamePrefix:
537
+ - is_
538
+ - has_
539
+ - have_
540
+ # Predicate name prefices that should be removed.
541
+ NamePrefixBlacklist:
542
+ - is_
543
+ - has_
544
+ - have_
545
+
546
+ Style/RaiseArgs:
547
+ EnforcedStyle: exploded
548
+ SupportedStyles:
549
+ - compact # raise Exception.new(msg)
550
+ - exploded # raise Exception, msg
551
+
552
+ Style/RedundantReturn:
553
+ # When true allows code like `return x, y`.
554
+ AllowMultipleReturnValues: false
555
+
556
+ # Use / or %r around regular expressions.
557
+ Style/RegexpLiteral:
558
+ EnforcedStyle: slashes
559
+ # slashes: Always use slashes.
560
+ # percent_r: Always use %r.
561
+ # mixed: Use slashes on single-line regexes, and %r on multi-line regexes.
562
+ SupportedStyles:
563
+ - slashes
564
+ - percent_r
565
+ - mixed
566
+ # If false, the cop will always recommend using %r if one or more slashes
567
+ # are found in the regexp string.
568
+ AllowInnerSlashes: false
569
+
570
+ Style/Semicolon:
571
+ # Allow ; to separate several expressions on the same line.
572
+ AllowAsExpressionSeparator: false
573
+
574
+ Style/SignalException:
575
+ EnforcedStyle: semantic
576
+ SupportedStyles:
577
+ - only_raise
578
+ - only_fail
579
+ - semantic
580
+
581
+ Style/SingleLineBlockParams:
582
+ Methods:
583
+ - reduce:
584
+ - a
585
+ - e
586
+ - inject:
587
+ - a
588
+ - e
589
+
590
+ Style/SingleLineMethods:
591
+ AllowIfMethodIsEmpty: true
592
+
593
+ Style/StringLiterals:
594
+ EnforcedStyle: double_quotes
595
+ SupportedStyles:
596
+ - single_quotes
597
+ - double_quotes
598
+
599
+ Style/StringLiteralsInInterpolation:
600
+ EnforcedStyle: double_quotes
601
+ SupportedStyles:
602
+ - single_quotes
603
+ - double_quotes
604
+
605
+ Style/SpaceAroundBlockParameters:
606
+ EnforcedStyleInsidePipes: no_space
607
+ SupportedStyles:
608
+ - space
609
+ - no_space
610
+
611
+ Style/SpaceAroundEqualsInParameterDefault:
612
+ EnforcedStyle: space
613
+ SupportedStyles:
614
+ - space
615
+ - no_space
616
+
617
+ Style/SpaceAroundOperators:
618
+ AllowForAlignment:
619
+ - '='
620
+ - '=>'
621
+
622
+ Style/SpaceBeforeBlockBraces:
623
+ EnforcedStyle: space
624
+ SupportedStyles:
625
+ - space
626
+ - no_space
627
+
628
+ Style/SpaceInsideBlockBraces:
629
+ EnforcedStyle: space
630
+ SupportedStyles:
631
+ - space
632
+ - no_space
633
+ # Valid values are: space, no_space
634
+ EnforcedStyleForEmptyBraces: no_space
635
+ # Space between { and |. Overrides EnforcedStyle if there is a conflict.
636
+ SpaceBeforeBlockParameters: true
637
+
638
+ Style/SpaceInsideHashLiteralBraces:
639
+ EnforcedStyle: space
640
+ EnforcedStyleForEmptyBraces: no_space
641
+ SupportedStyles:
642
+ - space
643
+ - no_space
644
+
645
+ Style/SymbolProc:
646
+ # A list of method names to be ignored by the check.
647
+ # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
648
+ IgnoredMethods:
649
+ - respond_to
650
+
651
+ Style/TrailingBlankLines:
652
+ EnforcedStyle: final_newline
653
+ SupportedStyles:
654
+ - final_newline
655
+ - final_blank_line
656
+
657
+ Style/TrailingCommaInLiteral:
658
+ # If EnforcedStyleForMultiline is comma, the cop requires a comma after the
659
+ # last item of a list, but only for lists where each item is on its own line.
660
+ # If EnforcedStyleForMultiline is consistent_comma, the cop requires a comma
661
+ # after the last item of a list, for all lists.
662
+ EnforcedStyleForMultiline: comma
663
+ SupportedStyles:
664
+ - comma
665
+ - consistent_comma
666
+ - no_comma
667
+
668
+ # TrivialAccessors requires exact name matches and doesn't allow
669
+ # predicated methods by default.
670
+ Style/TrivialAccessors:
671
+ # When set to false the cop will suggest the use of accessor methods
672
+ # in situations like:
673
+ #
674
+ # def name
675
+ # @other_name
676
+ # end
677
+ #
678
+ # This way you can uncover "hidden" attributes in your code.
679
+ ExactNameMatch: true
680
+ AllowPredicates: false
681
+ # Allows trivial writers that don't end in an equal sign. e.g.
682
+ #
683
+ # def on_exception(action)
684
+ # @on_exception=action
685
+ # end
686
+ # on_exception :restart
687
+ #
688
+ # Commonly used in DSLs
689
+ AllowDSLWriters: false
690
+ IgnoreClassMethods: false
691
+ Whitelist:
692
+ - to_ary
693
+ - to_a
694
+ - to_c
695
+ - to_enum
696
+ - to_h
697
+ - to_hash
698
+ - to_i
699
+ - to_int
700
+ - to_io
701
+ - to_open
702
+ - to_path
703
+ - to_proc
704
+ - to_r
705
+ - to_regexp
706
+ - to_str
707
+ - to_s
708
+ - to_sym
709
+
710
+ Style/VariableName:
711
+ EnforcedStyle: snake_case
712
+ SupportedStyles:
713
+ - snake_case
714
+ - camelCase
715
+
716
+ Style/WhileUntilModifier:
717
+ MaxLineLength: 120
718
+
719
+ Style/WordArray:
720
+ MinSize: 0
721
+ # The regular expression WordRegex decides what is considered a word.
722
+ WordRegex: !ruby/regexp '/\A[\p{Word}]+\z/'
723
+
724
+ ##################### Metrics ##################################
725
+
726
+ Metrics/AbcSize:
727
+ # The ABC size is a calculated magnitude, so this number can be a Fixnum or
728
+ # a Float.
729
+ Max: 15
730
+
731
+ Metrics/BlockNesting:
732
+ Max: 3
733
+
734
+ Metrics/ClassLength:
735
+ CountComments: false # count full line comments?
736
+ Max: 100
737
+
738
+ Metrics/ModuleLength:
739
+ CountComments: false # count full line comments?
740
+ Max: 100
741
+
742
+ # Avoid complex methods.
743
+ Metrics/CyclomaticComplexity:
744
+ Max: 10
745
+
746
+ Metrics/LineLength:
747
+ Max: 120
748
+ # To make it possible to copy or click on URIs in the code, we allow lines
749
+ # contaning a URI to be longer than Max.
750
+ AllowURI: true
751
+ URISchemes:
752
+ - http
753
+ - https
754
+
755
+ Metrics/MethodLength:
756
+ CountComments: false # count full line comments?
757
+ Max: 20
758
+
759
+ Metrics/ParameterLists:
760
+ Max: 5
761
+ CountKeywordArgs: true
762
+
763
+ Metrics/PerceivedComplexity:
764
+ Max: 10
765
+
766
+ ##################### Lint ##################################
767
+
768
+ # Allow safe assignment in conditions.
769
+ Lint/AssignmentInCondition:
770
+ AllowSafeAssignment: true
771
+
772
+ # Align ends correctly.
773
+ Lint/EndAlignment:
774
+ # The value `keyword` means that `end` should be aligned with the matching
775
+ # keyword (if, while, etc.).
776
+ # The value `variable` means that in assignments, `end` should be aligned
777
+ # with the start of the variable on the left hand side of `=`. In all other
778
+ # situations, `end` should still be aligned with the keyword.
779
+ AlignWith: keyword
780
+ SupportedStyles:
781
+ - keyword
782
+ - variable
783
+ AutoCorrect: false
784
+
785
+ Lint/DefEndAlignment:
786
+ # The value `def` means that `end` should be aligned with the def keyword.
787
+ # The value `start_of_line` means that `end` should be aligned with method
788
+ # calls like `private`, `public`, etc, if present in front of the `def`
789
+ # keyword on the same line.
790
+ AlignWith: start_of_line
791
+ SupportedStyles:
792
+ - start_of_line
793
+ - def
794
+ AutoCorrect: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pushyd (0.3.0)
4
+ pushyd (0.3.1)
5
5
  bunny
6
6
  chamber
7
7
  daemons
@@ -14,7 +14,7 @@ GEM
14
14
  specs:
15
15
  addressable (2.4.0)
16
16
  amq-protocol (2.0.1)
17
- ast (2.2.0)
17
+ ast (2.3.0)
18
18
  astrolabe (1.3.1)
19
19
  parser (~> 2.2)
20
20
  bunny (2.3.1)
@@ -68,7 +68,7 @@ GEM
68
68
  rainbow (>= 1.99.1, < 3.0)
69
69
  ruby-progressbar (~> 1.4)
70
70
  ruby-progressbar (1.8.1)
71
- terminal-table (1.5.2)
71
+ terminal-table (1.6.0)
72
72
  thor (0.19.1)
73
73
  unf (0.1.4)
74
74
  unf_ext
data/README.md CHANGED
@@ -1 +1,59 @@
1
- # pushyd
1
+ pushyd
2
+ ====================================================================================
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/pushyd.svg)](http://badge.fury.io/rb/pushyd)
5
+ [![Code Climate](https://codeclimate.com/github/bmedici/pushyd/badges/gpa.svg)](https://codeclimate.com/github/bmedici/pushyd)
6
+ [![Test Coverage](https://codeclimate.com/github/bmedici/pushyd/badges/coverage.svg)](https://codeclimate.com/github/bmedici/pushyd/coverage)
7
+ [ ![Codeship](https://codeship.com/projects/72fcb0f0-0fa7-0134-fb73-16f75abdb9e2/status?branch=master)](https://codeship.com/projects/156725)
8
+
9
+ This is a basic proxy listenning to a RabbitMQ bus, and repeating selected messages in POST requests when matching filters
10
+
11
+
12
+ Known bugs
13
+ ------------------------------------------------------------------------------------
14
+
15
+ None at this time
16
+
17
+
18
+ Contributing
19
+ ------------------------------------------------------------------------------------
20
+
21
+ Contributions are more than welcome, be it for documentation, features, tests,
22
+ refactoring, you name it. If you are unsure of where to start, the [Code
23
+ Climate](https://codeclimate.com/github/bmedici/pushyd) report will
24
+ provide you with improvement directions. And of course, if in doubt, do not
25
+ hesitate to open an issue. (Please note that this project has adopted a [code
26
+ of conduct](CODE_OF_CONDUCT.md).)
27
+
28
+ If you want your contribution to adopted in the smoothest and fastest way, don't
29
+ forget to:
30
+
31
+ * provide sufficient documentation in you commit and pull request
32
+ * add proper testing (we know full grown solid test coverage is still lacking and
33
+ need to up the game)
34
+ * use the [RuboCop](https://github.com/bbatsov/rubocop) guidelines provided
35
+ (there are all sorts of editor integration plugins available)
36
+
37
+ So,
38
+
39
+ 1. Fork the project
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Code
42
+ * add proper tests if adding a feature
43
+ * run the tests using `rake`
44
+ * check for RuboCop style guide violations
45
+
46
+ 4. Commit your changes
47
+ 5. Push to the branch (`git push origin my-new-feature`)
48
+
49
+ 6. Create new Pull Request
50
+
51
+
52
+ About
53
+ ------------------------------------------------------------------------------------
54
+
55
+ This project has been initiated and originally written by
56
+ Bruno MEDICI Consultant (http://bmconseil.com/)
57
+
58
+
59
+
data/bin/pushyd CHANGED
@@ -46,7 +46,7 @@ rescue OptionParser::InvalidOption => e
46
46
  abort "EXITING: option parser: #{e.message}"
47
47
  rescue PushyDaemon::ConfigParseError => e
48
48
  abort "EXITING: ConfigParseError: #{e.message}"
49
- rescue Exception => e
49
+ rescue StandardError => e
50
50
  abort "EXITING: Exception: #{e.message}"
51
51
  end
52
52
 
data/lib/pushyd/conf.rb CHANGED
@@ -17,19 +17,19 @@ module PushyDaemon
17
17
 
18
18
  def self.prepare args = {}
19
19
  # Context parameters
20
- raise PushyDaemon::ConfigMissingParameter, "missing root" unless (@root = args[:root])
21
- raise PushyDaemon::ConfigMissingParameter, "missing env" unless (@env = args[:env])
20
+ fail PushyDaemon::ConfigMissingParameter, "missing root" unless (@root = args[:root])
21
+ fail PushyDaemon::ConfigMissingParameter, "missing env" unless (@env = args[:env])
22
22
 
23
23
  # Gemspec parameter
24
24
  gemspec_path = "#{args[:root]}/#{args[:gemspec]}.gemspec"
25
- raise PushyDaemon::ConfigMissingParameter, "missing gemspec" unless args[:gemspec]
26
- raise PushyDaemon::ConfigMissingParameter, "gemspec file not found: #{gemspec_path}" unless File.exist?(gemspec_path)
25
+ fail PushyDaemon::ConfigMissingParameter, "missing gemspec" unless args[:gemspec]
26
+ fail PushyDaemon::ConfigMissingParameter, "gemspec file not found: #{gemspec_path}" unless File.exist?(gemspec_path)
27
27
 
28
28
  # Load Gemspec
29
29
  @spec = Gem::Specification::load gemspec_path
30
30
  @name = @spec.name
31
31
  @version = @spec.version
32
- raise PushyDaemon::ConfigMissingParameter, "missing name" unless @name
32
+ fail PushyDaemon::ConfigMissingParameter, "missing name" unless @name
33
33
 
34
34
  # Init Chamber (defaults, etc, cmdline)
35
35
  @files = ["#{args[:root]}/defaults.yml"]
@@ -46,10 +46,10 @@ module PushyDaemon
46
46
  self[:log] = args[:log].to_s if args[:log]
47
47
 
48
48
  rescue Psych::SyntaxError => e
49
- raise PushyDaemon::ConfigParseError, e.message
49
+ fail PushyDaemon::ConfigParseError, e.message
50
50
 
51
51
  rescue Exception => e
52
- raise PushyDaemon::ConfigParseError, e.message
52
+ fail PushyDaemon::ConfigParseError, e.message
53
53
 
54
54
  end
55
55
 
data/lib/pushyd/daemon.rb CHANGED
@@ -11,10 +11,14 @@ module PushyDaemon
11
11
  # Create a new shouter
12
12
  s = Shouter.new
13
13
 
14
- # Start infinite loop
14
+ # Start shout loop
15
15
  s.shout
16
16
 
17
- rescue Errno::EACCES, Exception => e
17
+ # Backup infinite loop in case shout does nothing
18
+ loop do
19
+ end
20
+
21
+ rescue Errno::EACCES, StandardError => e
18
22
  abort "EXITING #{e.class}: #{e.message}"
19
23
  end
20
24
 
@@ -1,5 +1,5 @@
1
1
  require 'bunny'
2
- require 'securerandom'
2
+ require "securerandom"
3
3
 
4
4
  module PushyDaemon
5
5
  class EndpointConnexionContext < StandardError; end
@@ -15,7 +15,7 @@ module PushyDaemon
15
15
 
16
16
  # Create the logger
17
17
  @logger = PushyLogger.new(logfile, LOG_ROTATION)
18
- @logger.add Logger::INFO, "starting #{self.class.name.to_s}"
18
+ @logger.add Logger::INFO, "starting #{self.class.name}"
19
19
 
20
20
  # Declare we're now logging
21
21
  puts "#{self.class} logging to #{logfile}"
@@ -25,7 +25,6 @@ module PushyDaemon
25
25
 
26
26
  def error message, lines = {}
27
27
  @logger.add Logger::ERROR, "#{self.class}: #{message}", lines
28
- #raise "ABORT #{self.class}: #{message}"
29
28
  end
30
29
 
31
30
  def info message, lines = {}
@@ -34,7 +33,6 @@ module PushyDaemon
34
33
 
35
34
  def message params = {}
36
35
  # Indenting
37
- #indent = " " * (params[:way].length)
38
36
  lines = []
39
37
 
40
38
  # Header
@@ -68,7 +66,7 @@ module PushyDaemon
68
66
 
69
67
  # Start connexion to RabbitMQ
70
68
  def connect_channel busconf
71
- raise PushyDaemon::EndpointConnexionContext, "invalid bus host/port" unless (busconf.is_a? Hash) &&
69
+ fail PushyDaemon::EndpointConnexionContext, "invalid bus host/port" unless (busconf.is_a? Hash) &&
72
70
  busconf[:host] && busconf[:port]
73
71
 
74
72
  info "connecting to #{busconf[:host]} port #{busconf[:port]}"
@@ -83,9 +81,9 @@ module PushyDaemon
83
81
  channel = conn.create_channel
84
82
 
85
83
  rescue Bunny::TCPConnectionFailedForAllHosts, Bunny::AuthenticationFailureError, AMQ::Protocol::EmptyResponseError => e
86
- raise PushyDaemon::EndpointConnectionError, "error connecting (#{e.class})"
87
- rescue Exception => e
88
- raise PushyDaemon::EndpointConnectionError, "unknow (#{e.inspect})"
84
+ fail PushyDaemon::EndpointConnectionError, "error connecting (#{e.class})"
85
+ rescue StandardError => e
86
+ fail PushyDaemon::EndpointConnectionError, "unknow (#{e.inspect})"
89
87
  else
90
88
  return channel
91
89
  end
@@ -103,8 +101,8 @@ module PushyDaemon
103
101
  rule_topic = rule[:topic].to_s
104
102
  rule_routes = rule[:routes].to_s.split(' ')
105
103
  rule_queue = "#{Conf.name}-#{PROXY_SCOPE}-#{rule[:name]}"
106
- raise PushyDaemon::EndpointSubscribeContext, "rule [#{rule_name}] lacking topic" unless rule_topic
107
- raise PushyDaemon::EndpointSubscribeContext, "rule [#{rule_name}] lacking routes" if rule_routes.empty?
104
+ fail PushyDaemon::EndpointSubscribeContext, "rule [#{rule_name}] lacking topic" unless rule_topic
105
+ fail PushyDaemon::EndpointSubscribeContext, "rule [#{rule_name}] lacking routes" if rule_routes.empty?
108
106
 
109
107
  # Create queue for this rule (remove it beforehand)
110
108
  #conn.create_channel.queue_delete(rule_queue_name)
@@ -130,10 +128,10 @@ module PushyDaemon
130
128
  end
131
129
 
132
130
  rescue Bunny::PreconditionFailed => e
133
- raise PushyDaemon::EndpointSubscribeError, "PreconditionFailed: [#{rule_topic}] code(#{e.channel_close.reply_code}) message(#{e.channel_close.reply_text})"
131
+ fail PushyDaemon::EndpointSubscribeError, "PreconditionFailed: [#{rule_topic}] code(#{e.channel_close.reply_code}) message(#{e.channel_close.reply_text})"
134
132
 
135
- rescue Exception => e
136
- raise PushyDaemon::EndpointSubscribeError, "unhandled (#{e.inspect})"
133
+ rescue StandardError => e
134
+ fail PushyDaemon::EndpointSubscribeError, "unhandled (#{e.inspect})"
137
135
 
138
136
  end
139
137
 
data/lib/pushyd/proxy.rb CHANGED
@@ -98,7 +98,7 @@ module PushyDaemon
98
98
  response = RestClient.post relay_url.to_s, JSON.pretty_generate(post_body), :content_type => :json
99
99
  info "#{id}: #{response.body}"
100
100
 
101
- rescue Exception => e
101
+ rescue StandardError => e
102
102
  error "propagate: #{e.message}"
103
103
  end
104
104
 
@@ -7,7 +7,7 @@ class PushyLogger < Logger
7
7
  super
8
8
 
9
9
  # And the formatter
10
- self.formatter = proc do |severity, datetime, progname, messages|
10
+ self.formatter = proc do |severity, datetime, _progname, messages|
11
11
  # Build common line prefix
12
12
  prefix = "%s %s\t" % [
13
13
  datetime.strftime(LOG_FORMAT_TIME),
@@ -17,14 +17,11 @@ module PushyDaemon
17
17
  super
18
18
  @keys = []
19
19
 
20
- # Start connexion to RabbitMQ and create channel
21
- @channel = connect_channel Conf.bus
22
- info "channel connected"
23
-
24
20
  # Check config
25
21
  config_shout = Conf[:shout]
26
- if config_shout.empty? || (!config_shout.is_a? Enumerable)
27
- abort "prepare: empty [shout] section"
22
+ unless config_shout && config_shout.any? && config_shout.is_a?(Enumerable)
23
+ error "prepare: empty [shout] section"
24
+ return
28
25
  end
29
26
 
30
27
  # Extract information
@@ -32,35 +29,38 @@ module PushyDaemon
32
29
  @topic = config_shout[:topic]
33
30
  @period = config_shout[:period] || 0
34
31
 
32
+ # Start connexion to RabbitMQ and create channel
33
+ @channel = connect_channel Conf.bus
34
+ info "channel connected"
35
+
35
36
  # Create exchange
36
- raise PushyDaemon::EndpointTopicContext unless @topic
37
+ fail PushyDaemon::EndpointTopicContext unless @topic
37
38
  @exchange = @channel.topic(@topic, durable: true, persistent: true)
38
- info "initialized with parameters:", {topic: @topic, period: @period, keys: @keys}
39
+ info "initialized with parameters:", { topic: @topic, period: @period, keys: @keys }
39
40
 
40
41
  rescue Bunny::TCPConnectionFailedForAllHosts => e
41
42
  error "ERROR: cannot connect to RabbitMQ hosts (#{e.inspect})"
42
43
  end
43
44
 
44
45
  def shout
46
+ return unless @exchange
47
+
45
48
  # Prepare exchange
46
49
  loop do
47
- if true # shout_exchange
48
- random_string = SecureRandom.hex
49
- random_key = @keys.sample || "random"
50
- channel_shout [:ping, random_key, random_string], {}
51
- end
50
+ random_string = SecureRandom.hex
51
+ random_key = @keys.sample || "random"
52
+ channel_shout [:ping, random_key, random_string], {}
52
53
  sleep @period
53
54
  end
54
55
  rescue AMQ::Protocol::EmptyResponseError => e
55
- raise PushyDaemon::ShouterResponseError, "#{e.class} (#{e.inspect})"
56
+ fail PushyDaemon::ShouterResponseError, "#{e.class} (#{e.inspect})"
56
57
  rescue Bunny::ChannelAlreadyClosed => e
57
- raise PushyDaemon::ShouterChannelClosed, "#{e.class} (#{e.inspect})"
58
+ fail PushyDaemon::ShouterChannelClosed, "#{e.class} (#{e.inspect})"
58
59
  rescue Bunny::PreconditionFailed => e
59
- raise PushyDaemon::ShouterPreconditionFailed, "#{e.class} (#{e.inspect})"
60
-
60
+ fail PushyDaemon::ShouterPreconditionFailed, "#{e.class} (#{e.inspect})"
61
61
  rescue Interrupt => e
62
62
  @channel.close
63
- raise PushyDaemon::ShouterInterrupted, "#{e.class} (#{e.inspect})"
63
+ fail PushyDaemon::ShouterInterrupted, "#{e.class} (#{e.inspect})"
64
64
  end
65
65
 
66
66
  private
@@ -69,7 +69,7 @@ module PushyDaemon
69
69
  # Prepare headers
70
70
  headers = {
71
71
  sent_at: DateTime.now.iso8601,
72
- sent_by: Conf.name
72
+ sent_by: Conf.name,
73
73
  }
74
74
 
75
75
  # Prepare exchange_name and routing_key
data/pushyd.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  # Project version
4
- spec.version = "0.3.0"
4
+ spec.version = "0.3.1"
5
5
 
6
6
  # Project description
7
7
  spec.name = "pushyd"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushyd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
@@ -172,6 +172,7 @@ extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
174
  - ".gitignore"
175
+ - ".rubocop.yml"
175
176
  - Gemfile
176
177
  - Gemfile.lock
177
178
  - README.md