diff --git a/.rubocop.yml b/.rubocop.yml
index 1e3bae333..142ddf9c3 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,258 +1,658 @@
-require: rubocop-performance
-inherit_from: .rubocop_todo.yml
-
-# from https://github.com/rails/rails/blob/master/.rubocop.yml
+# from https://raw.githubusercontent.com/thoughtbot/guides/master/style/ruby/.rubocop.yml
+# modification: exclude "vendor/bundle/**/*"
AllCops:
- TargetRubyVersion: 2.5
- # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
- # to ignore them, so only the ones explicitly set in this file are enabled.
- DisabledByDefault: true
- Exclude:
- - '**/templates/**/*'
- - '**/vendor/**/*'
- - 'actionpack/lib/action_dispatch/journey/parser.rb'
- - 'railties/test/fixtures/tmp/**/*'
- - 'actionmailbox/test/dummy/**/*'
- - 'actiontext/test/dummy/**/*'
- - '**/node_modules/**/*'
-
-Performance:
Exclude:
- - '**/test/**/*'
-
-Rails:
- Enabled: true
-
-# Prefer assert_not over assert !
-Rails/AssertNot:
- Include:
- - '**/test/**/*'
-
-# Prefer assert_not_x over refute_x
-Rails/RefuteMethods:
- Include:
- - '**/test/**/*'
-
-# Prefer &&/|| over and/or.
-Style/AndOr:
- Enabled: true
-
-# Do not use braces for hash literals when they are the last argument of a
-# method call.
-Style/BracesAroundHashParameters:
- Enabled: true
- EnforcedStyle: context_dependent
-
-# Align `when` with `case`.
-Layout/CaseIndentation:
- Enabled: true
-
-# Align comments with method definitions.
-Layout/CommentIndentation:
- Enabled: true
-
-Layout/ElseAlignment:
- Enabled: true
-
-# Align `end` with the matching keyword or starting expression except for
-# assignments, where it should be aligned with the LHS.
-Layout/EndAlignment:
- Enabled: true
- EnforcedStyleAlignWith: variable
- AutoCorrect: true
-
-Layout/EmptyLineAfterMagicComment:
- Enabled: true
-
-Layout/EmptyLinesAroundBlockBody:
- Enabled: true
-
-# In a regular class definition, no empty lines around the body.
-Layout/EmptyLinesAroundClassBody:
- Enabled: true
-
-# In a regular method definition, no empty lines around the body.
-Layout/EmptyLinesAroundMethodBody:
- Enabled: true
-
-# In a regular module definition, no empty lines around the body.
-Layout/EmptyLinesAroundModuleBody:
- Enabled: true
-
-Layout/IndentFirstArgument:
- Enabled: true
-
-# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
-Style/HashSyntax:
- Enabled: true
-
-# Method definitions after `private` or `protected` isolated calls need one
-# extra level of indentation.
-Layout/IndentationConsistency:
- Enabled: true
- EnforcedStyle: rails
-
-# Two spaces, no tabs (for indentation).
-Layout/IndentationWidth:
- Enabled: true
-
-Layout/LeadingCommentSpace:
- Enabled: true
-
-Layout/SpaceAfterColon:
- Enabled: true
-
-Layout/SpaceAfterComma:
- Enabled: true
-
-Layout/SpaceAfterSemicolon:
- Enabled: true
-
-Layout/SpaceAroundEqualsInParameterDefault:
- Enabled: true
-
-Layout/SpaceAroundKeyword:
- Enabled: true
-
-Layout/SpaceAroundOperators:
- Enabled: true
-
-Layout/SpaceBeforeComma:
- Enabled: true
-
-Layout/SpaceBeforeComment:
- Enabled: true
-
-Layout/SpaceBeforeFirstArg:
- Enabled: true
-
-Style/DefWithParentheses:
- Enabled: true
+ - db/schema.rb
+ - vendor/bundle/**/*
+
+require:
+ - rubocop-rails
+ - rubocop-performance
+
+Naming/AccessorMethodName:
+ Description: Check the naming of accessor methods for get_/set_.
+ Enabled: false
+
+Style/Alias:
+ Description: 'Use alias_method instead of alias.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
+ Enabled: false
+
+Style/ArrayJoin:
+ Description: 'Use Array#join instead of Array#*.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
+ Enabled: false
+
+Style/AsciiComments:
+ Description: 'Use only ascii symbols in comments.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
+ Enabled: false
+
+Naming/AsciiIdentifiers:
+ Description: 'Use only ascii symbols in identifiers.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
+ Enabled: false
+
+Style/Attr:
+ Description: 'Checks for uses of Module#attr.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
+ Enabled: false
+
+Metrics/BlockNesting:
+ Description: 'Avoid excessive block nesting'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
+ Enabled: false
+
+Style/CaseEquality:
+ Description: 'Avoid explicit use of the case equality operator(===).'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
+ Enabled: false
+
+Style/CharacterLiteral:
+ Description: 'Checks for uses of character literals.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
+ Enabled: false
+
+Style/ClassAndModuleChildren:
+ Description: 'Checks style of children classes and modules.'
+ Enabled: true
+ EnforcedStyle: nested
+
+Metrics/ClassLength:
+ Description: 'Avoid classes longer than 100 lines of code.'
+ Enabled: false
+
+Metrics/ModuleLength:
+ Description: 'Avoid modules longer than 100 lines of code.'
+ Enabled: false
+
+Style/ClassVars:
+ Description: 'Avoid the use of class variables.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
+ Enabled: false
+
+Style/CollectionMethods:
+ Enabled: true
+ PreferredMethods:
+ find: detect
+ inject: reduce
+ collect: map
+ find_all: select
-# Defining a method with parameters needs parentheses.
-Style/MethodDefParentheses:
- Enabled: true
+Style/ColonMethodCall:
+ Description: 'Do not use :: for method call.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
+ Enabled: false
+
+Style/CommentAnnotation:
+ Description: >-
+ Checks formatting of special comments
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
+ Enabled: false
+
+Metrics/AbcSize:
+ Description: >-
+ A calculated magnitude based on number of assignments,
+ branches, and conditions.
+ Enabled: false
+
+Metrics/BlockLength:
+ CountComments: true # count full line comments?
+ Max: 25
+ ExcludedMethods: []
+ Exclude:
+ - "spec/**/*"
+
+Metrics/CyclomaticComplexity:
+ Description: >-
+ A complexity metric that is strongly correlated to the number
+ of test cases needed to validate a method.
+ Enabled: false
+
+Rails/Delegate:
+ Description: 'Prefer delegate method for delegations.'
+ Enabled: false
+
+Style/PreferredHashMethods:
+ Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
+ StyleGuide: '#hash-key'
+ Enabled: false
+
+Style/Documentation:
+ Description: 'Document classes and non-namespace modules.'
+ Enabled: false
+
+Style/DoubleNegation:
+ Description: 'Checks for uses of double negation (!!).'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
+ Enabled: false
+
+Style/EachWithObject:
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
+ Enabled: false
+
+Style/EmptyLiteral:
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
+ Enabled: false
+
+# Checks whether the source file has a utf-8 encoding comment or not
+# AutoCorrectEncodingComment must match the regex
+# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
+Style/Encoding:
+ Enabled: false
+
+Style/EvenOdd:
+ Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
+ Enabled: false
+
+Naming/FileName:
+ Description: 'Use snake_case for source file names.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
+ Enabled: false
Style/FrozenStringLiteralComment:
- Enabled: true
- EnforcedStyle: always
+ Description: >-
+ Add the frozen_string_literal comment to the top of files
+ to help transition from Ruby 2.3.0 to Ruby 3.0.
+ Enabled: false
+
+Lint/FlipFlop:
+ Description: 'Checks for flip flops'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
+ Enabled: false
+
+Style/FormatString:
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
+ Enabled: false
+
+Style/GlobalVars:
+ Description: 'Do not introduce global variables.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
+ Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
+ Enabled: false
+
+Style/GuardClause:
+ Description: 'Check for conditionals that can be replaced with guard clauses'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
+ Enabled: false
+
+Style/IfUnlessModifier:
+ Description: >-
+ Favor modifier if/unless usage when you have a
+ single-line body.
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
+ Enabled: false
+
+Style/IfWithSemicolon:
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
+ Enabled: false
+
+Style/InlineComment:
+ Description: 'Avoid inline comments.'
+ Enabled: false
+
+Style/Lambda:
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
+ Enabled: false
+
+Style/LambdaCall:
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
+ Enabled: false
+
+Style/LineEndConcatenation:
+ Description: >-
+ Use \ instead of + or << to concatenate two string literals at
+ line end.
+ Enabled: false
+
+Metrics/LineLength:
+ Description: 'Limit lines to 80 characters.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
+ Max: 80
+
+Metrics/MethodLength:
+ Description: 'Avoid methods longer than 10 lines of code.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
+ Enabled: false
+
+Style/ModuleFunction:
+ Description: 'Checks for usage of `extend self` in modules.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
+ Enabled: false
+
+Style/MultilineBlockChain:
+ Description: 'Avoid multi-line chains of blocks.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
+ Enabled: false
+
+Style/NegatedIf:
+ Description: >-
+ Favor unless over if for negative conditions
+ (or control flow or).
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
+ Enabled: false
+
+Style/NegatedWhile:
+ Description: 'Favor until over while for negative conditions.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
+ Enabled: false
+
+Style/Next:
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
+ Enabled: false
+
+Style/NilComparison:
+ Description: 'Prefer x.nil? to x == nil.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
+ Enabled: false
+
+Style/Not:
+ Description: 'Use ! instead of not.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
+ Enabled: false
+
+Style/NumericLiterals:
+ Description: >-
+ Add underscores to large numeric literals to improve their
+ readability.
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
+ Enabled: false
+
+Style/OneLineConditional:
+ Description: >-
+ Favor the ternary operator(?:) over
+ if/then/else/end constructs.
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
+ Enabled: false
+
+Naming/BinaryOperatorParameterName:
+ Description: 'When defining binary operators, name the argument other.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
+ Enabled: false
+
+Metrics/ParameterLists:
+ Description: 'Avoid parameter lists longer than three or four parameters.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
+ Enabled: false
+
+Style/PercentLiteralDelimiters:
+ Description: 'Use `%`-literal delimiters consistently'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
+ Enabled: false
+
+Style/PerlBackrefs:
+ Description: 'Avoid Perl-style regex back references.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
+ Enabled: false
+
+Naming/PredicateName:
+ Description: 'Check the names of predicate methods.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
+ ForbiddenPrefixes:
+ - is_
Exclude:
- - 'actionview/test/**/*.builder'
- - 'actionview/test/**/*.ruby'
- - 'actionpack/test/**/*.builder'
- - 'actionpack/test/**/*.ruby'
- - 'activestorage/db/migrate/**/*.rb'
- - 'activestorage/db/update_migrate/**/*.rb'
- - 'actionmailbox/db/migrate/**/*.rb'
- - 'actiontext/db/migrate/**/*.rb'
-
-Style/RedundantFreeze:
- Enabled: true
-
-# Use `foo {}` not `foo{}`.
-Layout/SpaceBeforeBlockBraces:
- Enabled: true
+ - spec/**/*
+
+Style/Proc:
+ Description: 'Use proc instead of Proc.new.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
+ Enabled: false
+
+Style/RaiseArgs:
+ Description: 'Checks the arguments passed to raise/fail.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
+ Enabled: false
+
+Style/RegexpLiteral:
+ Description: 'Use / or %r around regular expressions.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
+ Enabled: false
+
+Style/Sample:
+ Description: >-
+ Use `sample` instead of `shuffle.first`,
+ `shuffle.last`, and `shuffle[Fixnum]`.
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
+ Enabled: false
+
+Style/SelfAssignment:
+ Description: >-
+ Checks for places where self-assignment shorthand should have
+ been used.
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
+ Enabled: false
+
+Style/SingleLineBlockParams:
+ Description: 'Enforces the names of some block params.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
+ Enabled: false
+
+Style/SingleLineMethods:
+ Description: 'Avoid single-line methods.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
+ Enabled: false
+
+Style/SignalException:
+ Description: 'Checks for proper usage of fail and raise.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
+ Enabled: false
+
+Style/SpecialGlobalVars:
+ Description: 'Avoid Perl-style global variables.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
+ Enabled: false
-# Use `foo { bar }` not `foo {bar}`.
-Layout/SpaceInsideBlockBraces:
- Enabled: true
- EnforcedStyleForEmptyBraces: space
-
-# Use `{ a: 1 }` not `{a:1}`.
-Layout/SpaceInsideHashLiteralBraces:
- Enabled: true
-
-Layout/SpaceInsideParens:
- Enabled: true
-
-# Check quotes usage according to lint rule below.
Style/StringLiterals:
- Enabled: true
+ Description: 'Checks if uses of quotes match the configured preference.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
EnforcedStyle: double_quotes
-
-# Detect hard tabs, no hard tabs.
-Layout/Tab:
Enabled: true
-# Blank lines should not have any spaces.
-Layout/TrailingBlankLines:
+Style/TrailingCommaInArguments:
+ Description: 'Checks for trailing comma in argument lists.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
+ EnforcedStyleForMultiline: comma
+ SupportedStylesForMultiline:
+ - comma
+ - consistent_comma
+ - no_comma
Enabled: true
-# No trailing whitespace.
-Layout/TrailingWhitespace:
+Style/TrailingCommaInArrayLiteral:
+ Description: 'Checks for trailing comma in array literals.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
+ EnforcedStyleForMultiline: comma
+ SupportedStylesForMultiline:
+ - comma
+ - consistent_comma
+ - no_comma
Enabled: true
-# Use quotes for string literals when they are enough.
-Style/UnneededPercentQ:
+Style/TrailingCommaInHashLiteral:
+ Description: 'Checks for trailing comma in hash literals.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
+ EnforcedStyleForMultiline: comma
+ SupportedStylesForMultiline:
+ - comma
+ - consistent_comma
+ - no_comma
Enabled: true
+Style/TrivialAccessors:
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
+ Enabled: false
+
+Style/VariableInterpolation:
+ Description: >-
+ Don't interpolate global, instance and class variables
+ directly in strings.
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
+ Enabled: false
+
+Style/WhenThen:
+ Description: 'Use when x then ... for one-line cases.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
+ Enabled: false
+
+Style/WhileUntilModifier:
+ Description: >-
+ Favor modifier while/until usage when you have a
+ single-line body.
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
+ Enabled: false
+
+Style/WordArray:
+ Description: 'Use %w or %W for arrays of words.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
+ Enabled: false
+
+# Layout
+
+Layout/ParameterAlignment:
+ Description: 'Here we check if the parameters on a multi-line method call or definition are aligned.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
+ Enabled: false
+
+Layout/ConditionPosition:
+ Description: >-
+ Checks for condition placed in a confusing position relative to
+ the keyword.
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
+ Enabled: false
+
+Layout/DotPosition:
+ Description: 'Checks the position of the dot in multi-line method calls.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
+ EnforcedStyle: trailing
+
+Layout/ExtraSpacing:
+ Description: 'Do not use unnecessary spacing.'
+ Enabled: true
+
+Layout/MultilineOperationIndentation:
+ Description: >-
+ Checks indentation of binary operations that span more than
+ one line.
+ Enabled: true
+ EnforcedStyle: indented
+
+Layout/MultilineMethodCallIndentation:
+ Description: >-
+ Checks indentation of method calls with the dot operator
+ that span more than one line.
+ Enabled: true
+ EnforcedStyle: indented
+
+Layout/InitialIndentation:
+ Description: >-
+ Checks the indentation of the first non-blank non-comment line in a file.
+ Enabled: false
+
+# Lint
+
Lint/AmbiguousOperator:
- Enabled: true
+ Description: >-
+ Checks for ambiguous operators in the first argument of a
+ method invocation without parentheses.
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
+ Enabled: false
Lint/AmbiguousRegexpLiteral:
- Enabled: true
-
-Lint/ErbNewArguments:
- Enabled: true
-
-# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
-Lint/RequireParentheses:
- Enabled: true
+ Description: >-
+ Checks for ambiguous regexp literals in the first argument of
+ a method invocation without parenthesis.
+ Enabled: false
-Lint/ShadowingOuterLocalVariable:
- Enabled: true
+Lint/AssignmentInCondition:
+ Description: "Don't use assignment in conditions."
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
+ Enabled: false
-Lint/StringConversionInInterpolation:
- Enabled: true
-
-Lint/UriEscapeUnescape:
- Enabled: true
-
-Lint/UselessAssignment:
- Enabled: true
+Lint/CircularArgumentReference:
+ Description: "Don't refer to the keyword argument in the default value."
+ Enabled: false
Lint/DeprecatedClassMethods:
- Enabled: true
-
-Style/ParenthesesAroundCondition:
- Enabled: true
-
-Style/RedundantBegin:
- Enabled: true
-
-Style/RedundantReturn:
- Enabled: true
- AllowMultipleReturnValues: true
-
-Style/Semicolon:
- Enabled: true
- AllowAsExpressionSeparator: true
+ Description: 'Check for deprecated class method calls.'
+ Enabled: false
+
+Lint/DuplicateHashKey:
+ Description: 'Check for duplicate keys in hash literals.'
+ Enabled: false
+
+Lint/EachWithObjectArgument:
+ Description: 'Check for immutable argument given to each_with_object.'
+ Enabled: false
+
+Lint/ElseLayout:
+ Description: 'Check for odd code arrangement in an else block.'
+ Enabled: false
+
+Lint/FormatParameterMismatch:
+ Description: 'The number of parameters to format/sprint must match the fields.'
+ Enabled: false
+
+Lint/SuppressedException:
+ Description: "Don't suppress exception."
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
+ Enabled: false
+
+Lint/LiteralAsCondition:
+ Description: 'Checks of literals used in conditions.'
+ Enabled: false
+
+Lint/LiteralInInterpolation:
+ Description: 'Checks for literals used in interpolation.'
+ Enabled: false
+
+Lint/Loop:
+ Description: >-
+ Use Kernel#loop with break rather than begin/end/until or
+ begin/end/while for post-loop tests.
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
+ Enabled: false
+
+Lint/NestedMethodDefinition:
+ Description: 'Do not use nested method definitions.'
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
+ Enabled: false
+
+Lint/NonLocalExitFromIterator:
+ Description: 'Do not use return in iterator to cause non-local exit.'
+ Enabled: false
+
+Lint/ParenthesesAsGroupedExpression:
+ Description: >-
+ Checks for method calls with a space before the opening
+ parenthesis.
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
+ Enabled: false
-# Prefer Foo.method over Foo::method
-Style/ColonMethodCall:
- Enabled: true
-
-Style/TrivialAccessors:
- Enabled: true
+Lint/RequireParentheses:
+ Description: >-
+ Use parentheses in the method call to avoid confusion
+ about precedence.
+ Enabled: false
+
+Lint/UnderscorePrefixedVariableName:
+ Description: 'Do not use prefix `_` for a variable that is used.'
+ Enabled: false
+
+Lint/RedundantCopDisableDirective:
+ Description: >-
+ Checks for rubocop:disable comments that can be removed.
+ Note: this cop is not disabled when disabling all cops.
+ It must be explicitly disabled.
+ Enabled: false
+
+Lint/Void:
+ Description: 'Possible use of operator/literal/variable in void context.'
+ Enabled: false
+
+# Performance
+
+Performance/CaseWhenSplat:
+ Description: >-
+ Place `when` conditions that use splat at the end
+ of the list of `when` branches.
+ Enabled: false
+
+Performance/Count:
+ Description: >-
+ Use `count` instead of `select...size`, `reject...size`,
+ `select...count`, `reject...count`, `select...length`,
+ and `reject...length`.
+ Enabled: false
+
+Performance/Detect:
+ Description: >-
+ Use `detect` instead of `select.first`, `find_all.first`,
+ `select.last`, and `find_all.last`.
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
+ Enabled: false
Performance/FlatMap:
- Enabled: true
-
-Performance/RedundantMerge:
- Enabled: true
-
-Performance/StartWith:
- Enabled: true
-
-Performance/EndWith:
- Enabled: true
-
-Performance/RegexpMatch:
- Enabled: true
+ Description: >-
+ Use `Enumerable#flat_map`
+ instead of `Enumerable#map...Array#flatten(1)`
+ or `Enumberable#collect..Array#flatten(1)`
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
+ Enabled: false
Performance/ReverseEach:
- Enabled: true
-
-Performance/UnfreezeString:
- Enabled: true
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
+ Enabled: false
+
+Performance/Size:
+ Description: >-
+ Use `size` instead of `count` for counting
+ the number of elements in `Array` and `Hash`.
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
+ Enabled: false
+
+Performance/StringReplacement:
+ Description: >-
+ Use `tr` instead of `gsub` when you are replacing the same
+ number of characters. Use `delete` instead of `gsub` when
+ you are deleting characters.
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
+ Enabled: false
+
+# Rails
+
+Rails/ActionFilter:
+ Description: 'Enforces consistent use of action filter methods.'
+ Enabled: false
+
+Rails/Date:
+ Description: >-
+ Checks the correct usage of date aware methods,
+ such as Date.today, Date.current etc.
+ Enabled: false
+
+Rails/FindBy:
+ Description: 'Prefer find_by over where.first.'
+ Enabled: false
+
+Rails/FindEach:
+ Description: 'Prefer all.find_each over all.find.'
+ Enabled: false
+
+Rails/HasAndBelongsToMany:
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
+ Enabled: false
+
+Rails/Output:
+ Description: 'Checks for calls to puts, print, etc.'
+ Enabled: false
+
+Rails/ReadWriteAttribute:
+ Description: >-
+ Checks for read_attribute(:attr) and
+ write_attribute(:attr, val).
+ Enabled: false
+
+Rails/ScopeArgs:
+ Description: 'Checks the arguments of ActiveRecord scopes.'
+ Enabled: false
+
+Rails/TimeZone:
+ Description: 'Checks the correct usage of time zone aware methods.'
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
+ Enabled: false
+
+Rails/Validation:
+ Description: 'Use validates :attribute, hash of validations.'
+ Enabled: false
\ No newline at end of file
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
deleted file mode 100644
index 78917a801..000000000
--- a/.rubocop_todo.yml
+++ /dev/null
@@ -1,360 +0,0 @@
-# This configuration was generated by
-# `rubocop --auto-gen-config`
-# on 2019-05-10 08:56:41 +0200 using RuboCop version 0.68.1.
-# The point is for the user to remove these configuration records
-# one by one as the offenses are removed from the code base.
-# Note that changes in the inspected code, or installation of new
-# versions of RuboCop, may require this file to be generated again.
-
-# Offense count: 24
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
-# SupportedStyles: case, end
-Layout/CaseIndentation:
- Exclude:
- - 'app/controllers/dois_controller.rb'
- - 'app/controllers/works_controller.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-Layout/CommentIndentation:
- Exclude:
- - 'app/models/doi.rb'
-
-# Offense count: 24
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: empty_lines, no_empty_lines
-Layout/EmptyLinesAroundBlockBody:
- Exclude:
- - 'app/controllers/concerns/facetable.rb'
- - 'app/models/concerns/authorable.rb'
- - 'db/schema.rb'
- - 'spec/models/prefix_spec.rb'
- - 'spec/requests/dois_spec.rb'
- - 'spec/requests/providers_spec.rb'
- - 'spec/requests/random_spec.rb'
- - 'spec/routing/clients_routing_spec.rb'
- - 'spec/routing/dois_routing_spec.rb'
- - 'spec/routing/media_routing_spec.rb'
- - 'spec/routing/metadata_routing_spec.rb'
- - 'spec/routing/prefixes_routing_spec.rb'
- - 'spec/routing/providers_routing_spec.rb'
- - 'spec/support/task_helper.rb'
-
-# Offense count: 3
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
-Layout/EmptyLinesAroundClassBody:
- Exclude:
- - 'app/models/client.rb'
- - 'app/models/doi.rb'
- - 'app/models/provider.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-Layout/EmptyLinesAroundMethodBody:
- Exclude:
- - 'app/models/doi.rb'
- - 'app/models/provider.rb'
-
-# Offense count: 15
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity.
-# SupportedStylesAlignWith: keyword, variable, start_of_line
-Layout/EndAlignment:
- Exclude:
- - 'app/controllers/activities_controller.rb'
- - 'app/controllers/application_controller.rb'
- - 'app/controllers/client_prefixes_controller.rb'
- - 'app/controllers/clients_controller.rb'
- - 'app/controllers/data_centers_controller.rb'
- - 'app/controllers/dois_controller.rb'
- - 'app/controllers/media_controller.rb'
- - 'app/controllers/members_controller.rb'
- - 'app/controllers/metadata_controller.rb'
- - 'app/controllers/prefixes_controller.rb'
- - 'app/controllers/provider_prefixes_controller.rb'
- - 'app/controllers/providers_controller.rb'
- - 'app/controllers/works_controller.rb'
- - 'app/jobs/doi_import_one_job.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: normal, rails
-Layout/IndentationConsistency:
- Exclude:
- - 'app/models/resource_type.rb'
-
-# Offense count: 34
-# Cop supports --auto-correct.
-# Configuration parameters: Width, IgnoredPatterns.
-Layout/IndentationWidth:
- Enabled: false
-
-# Offense count: 7
-# Cop supports --auto-correct.
-Layout/LeadingCommentSpace:
- Exclude:
- - 'app/models/ability.rb'
- - 'app/models/provider.rb'
- - 'config/routes.rb'
- - 'spec/requests/dois_spec.rb'
-
-# Offense count: 10
-# Cop supports --auto-correct.
-Layout/SpaceAfterColon:
- Exclude:
- - 'spec/requests/client_prefixes_spec.rb'
- - 'spec/requests/clients_spec.rb'
- - 'spec/requests/dois_spec.rb'
- - 'spec/requests/provider_prefixes_spec.rb'
- - 'spec/requests/providers_spec.rb'
-
-# Offense count: 39
-# Cop supports --auto-correct.
-Layout/SpaceAfterComma:
- Exclude:
- - 'app/controllers/client_prefixes_controller.rb'
- - 'app/controllers/dois_controller.rb'
- - 'app/controllers/prefixes_controller.rb'
- - 'app/controllers/provider_prefixes_controller.rb'
- - 'app/controllers/providers_controller.rb'
- - 'app/models/ability.rb'
- - 'app/models/concerns/cacheable.rb'
- - 'app/models/provider.rb'
- - 'spec/concerns/crosscitable_spec.rb'
- - 'spec/models/client_spec.rb'
- - 'spec/models/doi_spec.rb'
- - 'spec/models/provider_spec.rb'
- - 'spec/requests/dois_spec.rb'
- - 'spec/requests/providers_spec.rb'
-
-# Offense count: 66
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: space, no_space
-Layout/SpaceAroundEqualsInParameterDefault:
- Enabled: false
-
-# Offense count: 664
-# Cop supports --auto-correct.
-# Configuration parameters: AllowForAlignment.
-Layout/SpaceAroundOperators:
- Enabled: false
-
-# Offense count: 157
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
-# SupportedStyles: space, no_space
-# SupportedStylesForEmptyBraces: space, no_space
-Layout/SpaceBeforeBlockBraces:
- Exclude:
- - 'app/serializers/provider_serializer.rb'
- - 'spec/models/ability_spec.rb'
-
-# Offense count: 9
-# Cop supports --auto-correct.
-Layout/SpaceBeforeComma:
- Exclude:
- - 'app/controllers/providers_controller.rb'
- - 'app/models/doi.rb'
- - 'app/models/provider.rb'
- - 'spec/requests/client_prefixes_spec.rb'
- - 'spec/requests/prefixes_spec.rb'
- - 'spec/requests/provider_prefixes_spec.rb'
- - 'spec/requests/providers_spec.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-Layout/SpaceBeforeComment:
- Exclude:
- - 'app/models/ability.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: AllowForAlignment.
-Layout/SpaceBeforeFirstArg:
- Exclude:
- - 'app/models/media.rb'
-
-# Offense count: 31
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
-# SupportedStyles: space, no_space
-# SupportedStylesForEmptyBraces: space, no_space
-Layout/SpaceInsideBlockBraces:
- Exclude:
- - 'app/models/doi.rb'
- - 'spec/factories/default.rb'
- - 'spec/requests/client_prefixes_spec.rb'
- - 'spec/requests/clients_spec.rb'
- - 'spec/requests/dois_spec.rb'
- - 'spec/requests/media_spec.rb'
- - 'spec/requests/metadata_spec.rb'
- - 'spec/requests/prefixes_spec.rb'
- - 'spec/requests/provider_prefixes_spec.rb'
- - 'spec/requests/providers_spec.rb'
- - 'spec/requests/works_spec.rb'
-
-# Offense count: 480
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
-# SupportedStyles: space, no_space, compact
-# SupportedStylesForEmptyBraces: space, no_space
-Layout/SpaceInsideHashLiteralBraces:
- Enabled: false
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: space, no_space
-Layout/SpaceInsideParens:
- Exclude:
- - 'spec/requests/providers_spec.rb'
-
-# Offense count: 20
-# Cop supports --auto-correct.
-# Configuration parameters: IndentationWidth.
-Layout/Tab:
- Exclude:
- - 'spec/requests/clients_spec.rb'
- - 'spec/requests/media_spec.rb'
- - 'spec/requests/metadata_spec.rb'
-
-# Offense count: 65
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: final_newline, final_blank_line
-Layout/TrailingBlankLines:
- Enabled: false
-
-# Offense count: 191
-# Cop supports --auto-correct.
-# Configuration parameters: AllowInHeredoc.
-Layout/TrailingWhitespace:
- Enabled: false
-
-# Offense count: 1
-Lint/AmbiguousOperator:
- Exclude:
- - 'app/controllers/application_controller.rb'
-
-# Offense count: 4
-# Cop supports --auto-correct.
-Lint/StringConversionInInterpolation:
- Exclude:
- - 'app/models/concerns/helpable.rb'
- - 'spec/rails_helper.rb'
-
-# Offense count: 4
-Lint/UriEscapeUnescape:
- Exclude:
- - 'app/controllers/client_prefixes_controller.rb'
- - 'app/controllers/media_controller.rb'
- - 'app/controllers/metadata_controller.rb'
- - 'app/controllers/provider_prefixes_controller.rb'
-
-# Offense count: 23
-Lint/UselessAssignment:
- Exclude:
- - 'app/controllers/concerns/facetable.rb'
- - 'app/controllers/dois_controller.rb'
- - 'app/controllers/works_controller.rb'
- - 'app/models/concerns/cacheable.rb'
- - 'app/models/concerns/crosscitable.rb'
- - 'app/models/doi.rb'
- - 'app/models/funder.rb'
- - 'app/validators/xml_schema_validator.rb'
- - 'config/initializers/elasticsearch.rb'
- - 'config/initializers/flipper.rb'
- - 'lib/tasks/client.rake'
- - 'spec/concerns/crosscitable_spec.rb'
- - 'spec/models/media_spec.rb'
-
-# Offense count: 5
-# Cop supports --auto-correct.
-# Configuration parameters: MaxKeyValuePairs.
-Performance/RedundantMerge:
- Exclude:
- - 'app/controllers/dois_controller.rb'
- - 'app/models/concerns/authenticable.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-Performance/RegexpMatch:
- Exclude:
- - 'app/graphql/types_old/query_type.rb'
- - 'app/models/concerns/modelable.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: always, conditionals
-Style/AndOr:
- Exclude:
- - 'app/controllers/dois_controller.rb'
-
-# Offense count: 11
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: braces, no_braces, context_dependent
-Style/BracesAroundHashParameters:
- Exclude:
- - 'app/models/concerns/authenticable.rb'
- - 'app/models/concerns/crosscitable.rb'
- - 'app/models/concerns/indexable.rb'
- - 'app/models/doi.rb'
-
-# Offense count: 276
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: when_needed, always, never
-Style/FrozenStringLiteralComment:
- Enabled: false
-
-# Offense count: 326
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
-# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
-Style/HashSyntax:
- Enabled: false
-
-# Offense count: 3
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
-Style/MethodDefParentheses:
- Exclude:
- - 'app/models/concerns/cacheable.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: AllowSafeAssignment, AllowInMultilineConditions.
-Style/ParenthesesAroundCondition:
- Exclude:
- - 'app/serializers/work_serializer.rb'
-
-# Offense count: 5
-# Cop supports --auto-correct.
-Style/RedundantBegin:
- Exclude:
- - 'app/models/concerns/indexable.rb'
- - 'app/models/doi.rb'
- - 'config/initializers/mime_types.rb'
-
-# Offense count: 4
-# Cop supports --auto-correct.
-# Configuration parameters: AllowMultipleReturnValues.
-Style/RedundantReturn:
- Exclude:
- - 'app/models/concerns/authenticable.rb'
-
-# Offense count: 2693
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
-# SupportedStyles: single_quotes, double_quotes
-Style/StringLiterals:
- Enabled: false
diff --git a/Dockerfile b/Dockerfile
index da37d574e..163cfbf1f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,7 +15,7 @@ RUN bash -lc 'rvm --default use ruby-2.4.4'
# Update installed APT packages
RUN apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold" && \
- apt-get install ntp wget tzdata pandoc -y && \
+ apt-get install ntp wget tzdata -y && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Enable Passenger and Nginx and remove the default site
@@ -49,10 +49,6 @@ RUN mkdir -p tmp/pids && \
RUN rm -f /etc/service/sshd/down && \
/etc/my_init.d/00_regen_ssh_host_keys.sh
-# Install Ruby gems for middleman
-WORKDIR /home/app/webapp/vendor/middleman
-RUN /sbin/setuser app bundle install
-
# Add Runit script for shoryuken workers
WORKDIR /home/app/webapp
RUN mkdir /etc/service/shoryuken
@@ -60,10 +56,10 @@ ADD vendor/docker/shoryuken.sh /etc/service/shoryuken/run
# Run additional scripts during container startup (i.e. not at build time)
RUN mkdir -p /etc/my_init.d
+
# install custom ssh key during startup
COPY vendor/docker/10_ssh.sh /etc/my_init.d/10_ssh.sh
-COPY vendor/docker/70_index_page.sh /etc/my_init.d/70_index_page.sh
# COPY vendor/docker/80_flush_cache.sh /etc/my_init.d/80_flush_cache.sh
COPY vendor/docker/90_migrate.sh /etc/my_init.d/90_migrate.sh
diff --git a/Gemfile b/Gemfile
index 1b11575d3..e220118e6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,99 +1,100 @@
-source 'https://rubygems.org'
+# frozen_string_literal: true
-gem 'rails', '~> 5.2.0'
-gem 'bootsnap', '~> 1.4', '>= 1.4.4', require: false
-gem 'mysql2', '~> 0.4.4'
-gem 'dotenv'
-gem 'rake', '~> 12.0'
-gem 'multi_json'
-gem 'json', '~> 1.8', '>= 1.8.5'
-gem 'oj', '>= 2.8.3'
-gem 'jsonlint', '~> 0.2.0'
-gem 'equivalent-xml', '~> 0.6.0'
+source "https://rubygems.org"
+
+gem "rails", "~> 5.2.0"
+gem "bootsnap", "~> 1.4", ">= 1.4.4", require: false
+gem "mysql2", "~> 0.4.4"
+gem "dotenv"
+gem "rake", "~> 12.0"
+gem "oj", ">= 2.8.3"
+gem "oj_mimic_json", "~> 1.0", ">= 1.0.1"
+gem "jsonlint", "~> 0.2.0"
+gem "equivalent-xml", "~> 0.6.0"
gem "nokogiri", ">= 1.10.4"
-gem 'diffy', '~> 3.2', '>= 3.2.1'
-gem 'commonmarker', '~> 0.17.9'
-gem 'iso8601', '~> 0.9.0'
-gem 'maremma', '>= 4.1'
-gem 'bolognese', '~> 1.0'
-gem 'dalli', '~> 2.7', '>= 2.7.6'
-gem 'lograge', '~> 0.10.0'
-gem 'logstash-event', '~> 1.2', '>= 1.2.02'
-gem 'logstash-logger', '~> 0.26.1'
-gem 'sentry-raven', '~> 2.9'
-gem 'gender_detector', '~> 0.1.2'
-gem 'active_model_serializers', '~> 0.10.0'
-gem 'fast_jsonapi', '~> 1.3'
-gem 'jwt'
-gem 'bcrypt', '~> 3.1.7'
-gem 'pwqgen.rb', '~> 0.1.0'
-gem 'string_pattern'
-gem 'simple_command'
-gem 'kaminari', '~> 1.0', '>= 1.0.1'
-gem 'cancancan', '~> 2.0'
-gem 'country_select', '~> 3.1'
-gem 'countries', '~> 2.1', '>= 2.1.2'
-gem 'aasm', '~> 5.0', '>= 5.0.1'
+gem "diffy", "~> 3.2", ">= 3.2.1"
+gem "commonmarker", "~> 0.17.9"
+gem "iso8601", "~> 0.9.0"
+gem "maremma", ">= 4.1"
+gem "bolognese", "~> 1.0"
+gem "dalli", "~> 2.7", ">= 2.7.6"
+gem "lograge", "~> 0.11.2"
+gem "logstash-event", "~> 1.2", ">= 1.2.02"
+gem "logstash-logger", "~> 0.26.1"
+gem "sentry-raven", "~> 2.9"
+gem "gender_detector", "~> 0.1.2"
+gem "active_model_serializers", "~> 0.10.0"
+gem "fast_jsonapi", "~> 1.3"
+gem "jwt"
+gem "bcrypt", "~> 3.1.7"
+gem "pwqgen.rb", "~> 0.1.0"
+gem "string_pattern"
+gem "simple_command"
+gem "kaminari", "~> 1.0", ">= 1.0.1"
+gem "cancancan", "~> 2.0"
+gem "country_select", "~> 3.1"
+gem "countries", "~> 2.1", ">= 2.1.2"
+gem "aasm", "~> 5.0", ">= 5.0.1"
gem "facets", require: false
-gem 'shoryuken', '~> 4.0'
+gem "shoryuken", "~> 4.0"
gem "aws-sdk-s3", require: false
-gem 'aws-sdk-sqs', '~> 1.3'
-gem 'bergamasco', '~> 0.3.10'
-gem 'base32-url', '~> 0.3'
-gem 'mailgun-ruby', '~> 1.1', '>= 1.1.8'
-gem 'premailer', '~> 1.11', '>= 1.11.1'
-gem 'flipper', '~> 0.16.0'
-gem 'flipper-active_support_cache_store'
-gem 'rack-cors', '~> 1.0', :require => 'rack/cors'
-gem 'strip_attributes', '~> 1.8'
-gem 'slack-notifier', '~> 2.1'
-gem 'mini_magick', '~> 4.8'
-gem 'elasticsearch', '~> 7.1.0'
-gem 'elasticsearch-model', '~> 7.0', require: 'elasticsearch/model'
-gem 'elasticsearch-rails', '~> 7.0'
-gem 'faraday', '0.17.0'
-gem 'faraday_middleware-aws-sigv4', '~> 0.2.4'
-gem 'rack-utf8_sanitizer', '~> 1.6'
-gem 'oj_mimic_json', '~> 1.0', '>= 1.0.1'
-gem 'turnout', '~> 2.5'
-gem 'audited', '~> 4.8'
-gem 'git', '~> 1.5'
-gem 'graphql', '~> 1.9', '>= 1.9.15', git: "https://github.com/rmosolgo/graphql-ruby"
-gem 'graphql-errors', '~> 0.4.0'
-gem 'graphql-batch', '~> 0.4.1'
-gem 'batch-loader', '~> 1.4', '>= 1.4.1'
-gem 'graphql-cache', '~> 0.6.0', git: "https://github.com/stackshareio/graphql-cache"
-gem 'apollo-federation', '~> 0.5.1'
-gem 'google-protobuf', '3.10.0.rc.1'
-gem 'sprockets', '~> 3.7', '>= 3.7.2'
+gem "aws-sdk-sqs", "~> 1.3"
+gem "bergamasco", "~> 0.3.10"
+gem "base32-url", "~> 0.3"
+gem "mailgun-ruby", "~> 1.1", ">= 1.1.8"
+gem "premailer", "~> 1.11", ">= 1.11.1"
+gem "flipper", "~> 0.16.0"
+gem "flipper-active_support_cache_store"
+gem "rack-cors", "~> 1.0", require: "rack/cors"
+gem "strip_attributes", "~> 1.8"
+gem "slack-notifier", "~> 2.1"
+gem "mini_magick", "~> 4.8"
+gem "elasticsearch", "~> 7.1.0"
+gem "elasticsearch-model", "~> 7.0", require: "elasticsearch/model"
+gem "elasticsearch-rails", "~> 7.0"
+gem "faraday", "0.17.0"
+gem "faraday_middleware-aws-sigv4", "~> 0.2.4"
+gem "rack-utf8_sanitizer", "~> 1.6"
+gem "turnout", "~> 2.5"
+gem "audited", "~> 4.8"
+gem "git", "~> 1.5"
+gem "graphql", "~> 1.9", ">= 1.9.16"
+gem "graphql-errors", "~> 0.4.0"
+gem "graphql-batch", "~> 0.4.1"
+gem "batch-loader", "~> 1.4", ">= 1.4.1"
+gem "graphql-cache", "~> 0.6.0", git: "https://github.com/stackshareio/graphql-cache"
+gem "apollo-federation", "~> 0.5.1"
+gem "google-protobuf", "3.10.0.rc.1"
+gem "sprockets", "~> 3.7", ">= 3.7.2"
group :development, :test do
- gem 'rspec-rails', '~> 3.8', '>= 3.8.2'
- gem 'rspec-benchmark', '~> 0.4.0'
- gem 'rubocop', '~> 0.68.1', require: false
- gem 'rubocop-performance', '~> 1.2', require: false
+ gem "rspec-rails", "~> 3.8", ">= 3.8.2"
+ gem "rspec-benchmark", "~> 0.4.0"
+ gem 'rubocop', '~> 0.77.0'
+ gem 'rubocop-performance', '~> 1.5', '>= 1.5.1'
+ gem 'rubocop-rails', '~> 2.4'
gem "better_errors"
gem "binding_of_caller"
- gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
+ gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
- gem 'listen', '>= 3.0.5', '< 3.2'
- gem 'spring'
- gem 'spring-watcher-listen', '~> 2.0.0'
- gem 'spring-commands-rspec'
- # gem 'httplog', '~> 1.0'
+ gem "listen", ">= 3.0.5", "< 3.2"
+ gem "spring"
+ gem "spring-watcher-listen", "~> 2.0.0"
+ gem "spring-commands-rspec"
+ # gem "httplog", "~> 1.0"
end
group :test do
- gem 'capybara'
- gem 'webmock', '~> 3.1'
- gem 'hashdiff', ['>= 1.0.0.beta1', '< 2.0.0']
- gem 'vcr', '~> 3.0.3'
- gem 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.8'
- gem 'factory_bot_rails', '~> 4.8', '>= 4.8.2'
- gem 'shoulda-matchers', '~> 3.1'
- gem 'faker', '~> 1.9'
- gem 'database_cleaner'
- gem 'elasticsearch-extensions', '~> 0.0.29'
+ gem "capybara"
+ gem "webmock", "~> 3.1"
+ gem "hashdiff", [">= 1.0.0.beta1", "< 2.0.0"]
+ gem "vcr", "~> 3.0.3"
+ gem "codeclimate-test-reporter", "~> 1.0", ">= 1.0.8"
+ gem "factory_bot_rails", "~> 4.8", ">= 4.8.2"
+ gem "shoulda-matchers", "~> 3.1"
+ gem "faker", "~> 1.9"
+ gem "database_cleaner"
+ gem "elasticsearch-extensions", "~> 0.0.29"
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 9762d3ec8..da8f86038 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,9 +1,3 @@
-GIT
- remote: https://github.com/rmosolgo/graphql-ruby
- revision: b0e97e759c850cfbc03d75dfbb115f1bc443a985
- specs:
- graphql (1.9.16)
-
GIT
remote: https://github.com/stackshareio/graphql-cache
revision: 5a6fa5a3316cd267d0829815b122e1e159321e17
@@ -73,8 +67,8 @@ GEM
audited (4.9.0)
activerecord (>= 4.2, < 6.1)
aws-eventstream (1.0.3)
- aws-partitions (1.252.0)
- aws-sdk-core (3.85.0)
+ aws-partitions (1.255.0)
+ aws-sdk-core (3.86.0)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
@@ -140,7 +134,7 @@ GEM
thor (~> 0.19)
bootsnap (1.4.5)
msgpack (~> 1.0)
- builder (3.2.3)
+ builder (3.2.4)
byebug (11.0.1)
cancancan (2.3.0)
capybara (3.29.0)
@@ -247,6 +241,7 @@ GEM
globalid (0.4.2)
activesupport (>= 4.2.0)
google-protobuf (3.10.0.rc.1)
+ graphql (1.9.16)
graphql-batch (0.4.2)
graphql (>= 1.3, < 2)
promise.rb (~> 0.7.2)
@@ -268,7 +263,7 @@ GEM
iso8601 (0.9.1)
jaro_winkler (1.5.4)
jmespath (1.4.0)
- json (1.8.6)
+ json (2.3.0)
json-ld (3.0.2)
multi_json (~> 1.12)
rdf (>= 2.2.8, < 4.0)
@@ -299,7 +294,7 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
- lograge (0.10.0)
+ lograge (0.11.2)
actionpack (>= 4)
activesupport (>= 4)
railties (>= 4)
@@ -457,15 +452,18 @@ GEM
rspec-mocks (~> 3.9.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)
- rubocop (0.68.1)
+ rubocop (0.77.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
- parser (>= 2.5, != 2.5.1.1)
+ parser (>= 2.6)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
- unicode-display_width (>= 1.4.0, < 1.6)
- rubocop-performance (1.3.0)
- rubocop (>= 0.68.0)
+ unicode-display_width (>= 1.4.0, < 1.7)
+ rubocop-performance (1.5.1)
+ rubocop (>= 0.71.0)
+ rubocop-rails (2.4.0)
+ rack (>= 1.1)
+ rubocop (>= 0.72.0)
ruby-enum (0.7.2)
i18n
ruby-progressbar (1.10.1)
@@ -524,7 +522,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.6)
- unicode-display_width (1.5.0)
+ unicode-display_width (1.6.0)
unicode_utils (1.4.0)
vcr (3.0.3)
webmock (3.7.6)
@@ -582,24 +580,22 @@ DEPENDENCIES
gender_detector (~> 0.1.2)
git (~> 1.5)
google-protobuf (= 3.10.0.rc.1)
- graphql (~> 1.9, >= 1.9.15)!
+ graphql (~> 1.9, >= 1.9.16)
graphql-batch (~> 0.4.1)
graphql-cache (~> 0.6.0)!
graphql-errors (~> 0.4.0)
hashdiff (>= 1.0.0.beta1, < 2.0.0)
iso8601 (~> 0.9.0)
- json (~> 1.8, >= 1.8.5)
jsonlint (~> 0.2.0)
jwt
kaminari (~> 1.0, >= 1.0.1)
listen (>= 3.0.5, < 3.2)
- lograge (~> 0.10.0)
+ lograge (~> 0.11.2)
logstash-event (~> 1.2, >= 1.2.02)
logstash-logger (~> 0.26.1)
mailgun-ruby (~> 1.1, >= 1.1.8)
maremma (>= 4.1)
mini_magick (~> 4.8)
- multi_json
mysql2 (~> 0.4.4)
nokogiri (>= 1.10.4)
oj (>= 2.8.3)
@@ -612,8 +608,9 @@ DEPENDENCIES
rake (~> 12.0)
rspec-benchmark (~> 0.4.0)
rspec-rails (~> 3.8, >= 3.8.2)
- rubocop (~> 0.68.1)
- rubocop-performance (~> 1.2)
+ rubocop (~> 0.77.0)
+ rubocop-performance (~> 1.5, >= 1.5.1)
+ rubocop-rails (~> 2.4)
sentry-raven (~> 2.9)
shoryuken (~> 4.0)
shoulda-matchers (~> 3.1)
diff --git a/app/controllers/client_prefixes_controller.rb b/app/controllers/client_prefixes_controller.rb
index 36b899c16..3b87ea910 100644
--- a/app/controllers/client_prefixes_controller.rb
+++ b/app/controllers/client_prefixes_controller.rb
@@ -79,7 +79,6 @@ def show
end
def create
- logger = LogStashLogger.new(type: :stdout)
@client_prefix = ClientPrefix.new(safe_params)
authorize! :create, @client_prefix
diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb
index 31f08c7eb..b388287fe 100644
--- a/app/controllers/clients_controller.rb
+++ b/app/controllers/clients_controller.rb
@@ -105,7 +105,6 @@ def show
end
def create
- logger = LogStashLogger.new(type: :stdout)
@client = Client.new(safe_params)
authorize! :create, @client
@@ -122,7 +121,6 @@ def create
end
def update
- logger = LogStashLogger.new(type: :stdout)
if @client.update_attributes(safe_params)
options = {}
options[:meta] = { dois: doi_count(client_id: params[:id]) }
@@ -139,7 +137,6 @@ def update
# don't delete, but set deleted_at timestamp
# a client with dois or prefixes can't be deleted
def destroy
- logger = LogStashLogger.new(type: :stdout)
if @client.dois.present?
message = "Can't delete client that has DOIs."
status = 400
diff --git a/app/controllers/concerns/facetable.rb b/app/controllers/concerns/facetable.rb
index f73c6decf..f0e4eb937 100644
--- a/app/controllers/concerns/facetable.rb
+++ b/app/controllers/concerns/facetable.rb
@@ -342,8 +342,6 @@ def prefixes_totals(arr)
end
def clients_totals(arr)
- logger = LogStashLogger.new(type: :stdout)
-
clients = Client.all.pluck(:symbol, :name).to_h
arr = arr.map do |hsh|
@@ -356,7 +354,7 @@ def clients_totals(arr)
"last_year" => facet_annual(hsh.last_year.buckets),
"two_years_ago" => facet_annual(hsh.two_years_ago.buckets)
},
- "states" => facet_by_key(hsh.states.buckets)
+ "states" => facet_by_key(hsh.states.buckets)
}
end
end
diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb
index b2fe2a397..082d645f6 100644
--- a/app/controllers/dois_controller.rb
+++ b/app/controllers/dois_controller.rb
@@ -13,8 +13,6 @@ class DoisController < ApplicationController
def index
authorize! :read, Doi
- logger = LogStashLogger.new(type: :stdout)
-
sort = case params[:sort]
when "name" then { "doi" => { order: 'asc' }}
when "-name" then { "doi" => { order: 'desc' }}
@@ -260,9 +258,6 @@ def show
end
def validate
- logger = LogStashLogger.new(type: :stdout)
- # logger.info safe_params.inspect
-
@doi = Doi.new(safe_params.merge(only_validate: true))
authorize! :validate, @doi
@@ -283,9 +278,7 @@ def validate
end
def create
- logger = LogStashLogger.new(type: :stdout)
- # logger.info safe_params.inspect
- fail CanCan::AuthorizationNotPerformed unless current_user.present?
+ fail CanCan::AuthorizationNotPerformed if current_user.blank?
@doi = Doi.new(safe_params)
@@ -312,9 +305,6 @@ def create
end
def update
- logger = LogStashLogger.new(type: :stdout)
- # logger.info safe_params.inspect
-
@doi = Doi.where(doi: params[:id]).first
exists = @doi.present?
@@ -360,8 +350,6 @@ def update
end
def undo
- logger = LogStashLogger.new(type: :stdout)
-
@doi = Doi.where(doi: safe_params[:doi]).first
fail ActiveRecord::RecordNotFound unless @doi.present?
@@ -385,9 +373,8 @@ def undo
end
def destroy
- logger = LogStashLogger.new(type: :stdout)
@doi = Doi.where(doi: params[:id]).first
- fail ActiveRecord::RecordNotFound unless @doi.present?
+ fail ActiveRecord::RecordNotFound if @doi.blank?
authorize! :destroy, @doi
@@ -485,8 +472,6 @@ def set_include
private
def safe_params
- logger = LogStashLogger.new(type: :stdout)
-
fail JSON::ParserError, "You need to provide a payload following the JSONAPI spec" unless params[:data].present?
attributes = [
diff --git a/app/controllers/media_controller.rb b/app/controllers/media_controller.rb
index 29b15cbd9..b293864e0 100644
--- a/app/controllers/media_controller.rb
+++ b/app/controllers/media_controller.rb
@@ -49,7 +49,6 @@ def show
end
def create
- logger = LogStashLogger.new(type: :stdout)
authorize! :update, @doi
@media = Media.new(safe_params.merge(doi: @doi))
@@ -67,7 +66,6 @@ def create
end
def update
- logger = LogStashLogger.new(type: :stdout)
authorize! :update, @doi
if @media.update_attributes(safe_params.merge(doi: @doi))
@@ -83,7 +81,6 @@ def update
end
def destroy
- logger = LogStashLogger.new(type: :stdout)
authorize! :update, @doi
if @media.destroy
diff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rb
index dc75c306e..c4b35c42c 100644
--- a/app/controllers/metadata_controller.rb
+++ b/app/controllers/metadata_controller.rb
@@ -52,7 +52,6 @@ def show
end
def create
- logger = LogStashLogger.new(type: :stdout)
authorize! :update, @doi
# convert back to plain xml
@@ -72,7 +71,6 @@ def create
end
def destroy
- logger = LogStashLogger.new(type: :stdout)
authorize! :update, @doi
if @doi.draft?
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index a623e9efe..ef15c6903 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -132,7 +132,6 @@ def index
created
updated
deletedAt)
- puts response.records.to_a[0].to_json
format.csv { render request.format.to_sym => response.records.to_a, header: header }
end
rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception
diff --git a/app/controllers/prefixes_controller.rb b/app/controllers/prefixes_controller.rb
index 6a9e107ad..68e38c8e4 100644
--- a/app/controllers/prefixes_controller.rb
+++ b/app/controllers/prefixes_controller.rb
@@ -114,7 +114,6 @@ def show
end
def create
- logger = LogStashLogger.new(type: :stdout)
@prefix = Prefix.new(safe_params)
authorize! :create, @prefix
diff --git a/app/controllers/provider_prefixes_controller.rb b/app/controllers/provider_prefixes_controller.rb
index 7bdcd6a18..9dbb8b3e0 100644
--- a/app/controllers/provider_prefixes_controller.rb
+++ b/app/controllers/provider_prefixes_controller.rb
@@ -113,7 +113,6 @@ def show
end
def create
- logger = LogStashLogger.new(type: :stdout)
@provider_prefix = ProviderPrefix.new(safe_params)
authorize! :create, @provider_prefix
diff --git a/app/controllers/providers_controller.rb b/app/controllers/providers_controller.rb
index 781b9d7e4..bdecb2434 100644
--- a/app/controllers/providers_controller.rb
+++ b/app/controllers/providers_controller.rb
@@ -181,9 +181,7 @@ def show
end
def create
- logger = LogStashLogger.new(type: :stdout)
-
- # generate random symbol if not symbol is provided
+ # generate random symbol if no symbol is provided
@provider = Provider.new(safe_params.reverse_merge(symbol: generate_random_provider_symbol))
authorize! :create, @provider
@@ -219,8 +217,6 @@ def create
end
def update
- logger = LogStashLogger.new(type: :stdout)
- # logger.debug safe_params.inspect
if @provider.update_attributes(safe_params)
if params[:id] == "admin"
providers = provider_count(consortium_id: nil)
@@ -255,8 +251,7 @@ def update
# don't delete, but set deleted_at timestamp
# a provider with active clients or with prefixes can't be deleted
def destroy
- logger = LogStashLogger.new(type: :stdout)
- if active_client_count(provider_id: @provider.symbol) > 0
+ if active_client_count(provider_id: @provider.symbol).positive?
message = "Can't delete provider that has active clients."
status = 400
logger.warn message
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 7abf332cf..77c4b6bc8 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -104,7 +104,6 @@ def index
url
software
system_email)
- puts response.records.to_a[0].to_json
format.csv { render request.format.to_sym => response.records.to_a, header: header }
end
rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception
@@ -132,7 +131,6 @@ def show
end
def create
- logger = LogStashLogger.new(type: :stdout)
@client = Client.new(safe_params)
authorize! :create, @client
@@ -149,7 +147,6 @@ def create
end
def update
- logger = LogStashLogger.new(type: :stdout)
if @client.update_attributes(safe_params)
options = {}
options[:meta] = { dois: doi_count(client_id: params[:id]) }
@@ -166,7 +163,6 @@ def update
# don't delete, but set deleted_at timestamp
# a repository with dois or prefixes can't be deleted
def destroy
- logger = LogStashLogger.new(type: :stdout)
if @client.dois.present?
message = "Can't delete repository that has DOIs."
status = 400
diff --git a/app/controllers/repository_prefixes_controller.rb b/app/controllers/repository_prefixes_controller.rb
index 5e1321aef..af714a968 100644
--- a/app/controllers/repository_prefixes_controller.rb
+++ b/app/controllers/repository_prefixes_controller.rb
@@ -79,7 +79,6 @@ def show
end
def create
- logger = LogStashLogger.new(type: :stdout)
@client_prefix = ClientPrefix.new(safe_params)
authorize! :create, @client_prefix
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index 81def2a78..9f2ff7eed 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -45,9 +45,8 @@ def reset
private
def error_response(message)
- logger = LogStashLogger.new(type: :stdout)
status = 400
- logger.info message
+ logger.error message
render json: { errors: [{ status: status.to_s, title: message }] }.to_json, status: status
end
diff --git a/app/jobs/activity_convert_affiliation_by_id_job.rb b/app/jobs/activity_convert_affiliation_by_id_job.rb
index 91779dbea..d47393743 100644
--- a/app/jobs/activity_convert_affiliation_by_id_job.rb
+++ b/app/jobs/activity_convert_affiliation_by_id_job.rb
@@ -2,8 +2,7 @@ class ActivityConvertAffiliationByIdJob < ActiveJob::Base
queue_as :lupo_background
rescue_from ActiveJob::DeserializationError, Elasticsearch::Transport::Transport::Errors::BadRequest do |error|
- logger = LogStashLogger.new(type: :stdout)
- logger.error error.message
+ Rails.logger.error error.message
end
def perform(options={})
diff --git a/app/jobs/activity_import_by_id_job.rb b/app/jobs/activity_import_by_id_job.rb
index b1d3644d5..283db059e 100644
--- a/app/jobs/activity_import_by_id_job.rb
+++ b/app/jobs/activity_import_by_id_job.rb
@@ -2,8 +2,7 @@ class ActivityImportByIdJob < ActiveJob::Base
queue_as :lupo_background
rescue_from ActiveJob::DeserializationError, Elasticsearch::Transport::Transport::Errors::BadRequest do |error|
- logger = LogStashLogger.new(type: :stdout)
- logger.error error.message
+ Rails.logger.error error.message
end
def perform(options={})
diff --git a/app/jobs/affiliation_job.rb b/app/jobs/affiliation_job.rb
index f807d842d..b3a0aedc8 100644
--- a/app/jobs/affiliation_job.rb
+++ b/app/jobs/affiliation_job.rb
@@ -2,7 +2,6 @@ class AffiliationJob < ActiveJob::Base
queue_as :lupo_background
def perform(doi_id)
- logger = LogStashLogger.new(type: :stdout)
doi = Doi.where(doi: doi_id).first
if doi.present?
@@ -18,7 +17,7 @@ def perform(doi_id)
doi.__elasticsearch__.index_document
else
- logger.info "[Affiliation] Error updaing DOI " + doi_id + ": not found"
+ Rails.logger.error "[Affiliation] Error updaing DOI " + doi_id + ": not found"
end
end
end
diff --git a/app/jobs/crossref_doi_by_id_job.rb b/app/jobs/crossref_doi_by_id_job.rb
index 276ef1d23..5d3cbee6a 100644
--- a/app/jobs/crossref_doi_by_id_job.rb
+++ b/app/jobs/crossref_doi_by_id_job.rb
@@ -7,13 +7,10 @@ class CrossrefDoiByIdJob < ActiveJob::Base
# discard_on ActiveJob::DeserializationError
rescue_from ActiveJob::DeserializationError, Elasticsearch::Transport::Transport::Errors::BadRequest do |error|
- logger = LogStashLogger.new(type: :stdout)
- logger.error error.message
+ Rails.logger.error error.message
end
def perform(id, options={})
- logger = LogStashLogger.new(type: :stdout)
-
doi = doi_from_url(id)
return {} unless doi.present?
@@ -61,13 +58,13 @@ def perform(id, options={})
password: ENV["ADMIN_PASSWORD"])
if response.status == 201
- logger.info "DOI #{doi} record created."
+ Rails.logger.info "DOI #{doi} record created."
elsif response.status == 200
- logger.info "DOI #{doi} record updated."
+ Rails.logger.info "DOI #{doi} record updated."
elsif response.status == 404
- logger.warn "[Warn] #{ra} DOI #{doi} not found."
+ Rails.logger.warn "[Warn] #{ra} DOI #{doi} not found."
else
- logger.error "[Error parsing #{ra} DOI #{doi}]: " + response.body["errors"].inspect
+ Rails.logger.error "[Error parsing #{ra} DOI #{doi}]: " + response.body["errors"].inspect
end
end
diff --git a/app/jobs/delete_job.rb b/app/jobs/delete_job.rb
index 6efa73f48..7b8fb8c4e 100644
--- a/app/jobs/delete_job.rb
+++ b/app/jobs/delete_job.rb
@@ -2,14 +2,13 @@ class DeleteJob < ActiveJob::Base
queue_as :lupo_background
def perform(doi_id, options={})
- logger = LogStashLogger.new(type: :stdout)
doi = Doi.where(doi: doi_id).first
if doi.present?
doi.destroy
- logger.info "Deleted DOI " + doi_id + "."
+ Rails.logger.info "Deleted DOI " + doi_id + "."
else
- logger.info "Error deleting DOI " + doi_id + ": not found"
+ Rails.logger.error "Error deleting DOI " + doi_id + ": not found"
end
end
end
diff --git a/app/jobs/doi_convert_affiliation_by_id_job.rb b/app/jobs/doi_convert_affiliation_by_id_job.rb
index 9cde0d439..7ce196956 100644
--- a/app/jobs/doi_convert_affiliation_by_id_job.rb
+++ b/app/jobs/doi_convert_affiliation_by_id_job.rb
@@ -2,8 +2,7 @@ class DoiConvertAffiliationByIdJob < ActiveJob::Base
queue_as :lupo_background
rescue_from ActiveJob::DeserializationError, Elasticsearch::Transport::Transport::Errors::BadRequest do |error|
- logger = LogStashLogger.new(type: :stdout)
- logger.error error.message
+ Rails.logger.error error.message
end
def perform(options={})
diff --git a/app/jobs/doi_convert_container_by_id_job.rb b/app/jobs/doi_convert_container_by_id_job.rb
index db9acc6f4..73d10199e 100644
--- a/app/jobs/doi_convert_container_by_id_job.rb
+++ b/app/jobs/doi_convert_container_by_id_job.rb
@@ -2,8 +2,7 @@ class DoiConvertContainerByIdJob < ActiveJob::Base
queue_as :lupo_background
rescue_from ActiveJob::DeserializationError, Elasticsearch::Transport::Transport::Errors::BadRequest do |error|
- logger = LogStashLogger.new(type: :stdout)
- logger.error error.message
+ Rails.logger.error error.message
end
def perform(options={})
diff --git a/app/jobs/doi_import_by_id_job.rb b/app/jobs/doi_import_by_id_job.rb
index e17a08f36..bd8d4f618 100644
--- a/app/jobs/doi_import_by_id_job.rb
+++ b/app/jobs/doi_import_by_id_job.rb
@@ -2,8 +2,7 @@ class DoiImportByIdJob < ActiveJob::Base
queue_as :lupo_background
rescue_from ActiveJob::DeserializationError, Elasticsearch::Transport::Transport::Errors::BadRequest do |error|
- logger = LogStashLogger.new(type: :stdout)
- logger.error error.message
+ Rails.logger.error error.message
end
def perform(options={})
diff --git a/app/jobs/event_registrant_update_by_id_job.rb b/app/jobs/event_registrant_update_by_id_job.rb
index fbdf208c2..45cc4bc78 100644
--- a/app/jobs/event_registrant_update_by_id_job.rb
+++ b/app/jobs/event_registrant_update_by_id_job.rb
@@ -3,56 +3,50 @@ class EventRegistrantUpdateByIdJob < ActiveJob::Base
rescue_from ActiveJob::DeserializationError, Elasticsearch::Transport::Transport::Errors::BadRequest do |error|
- logger = LogStashLogger.new(type: :stdout)
- logger.error error.message
+ Rails.logger.error error.message
end
def perform(id, options={})
- logger = LogStashLogger.new(type: :stdout)
-
item = Event.where(uuid: id).first
- return false unless item.present?
+ return false if item.blank?
-
-
case item.source_id
when "datacite-crossref"
registrant_id = cached_get_crossref_member_id(item.obj_id) if cached_get_doi_ra(item.obj_id) == "Crossref"
- logger.info registrant_id
+ Rails.logger.info registrant_id
if registrant_id == "crossref.citations"
sleep(0.50)
registrant_id = get_crossref_member_id(item.obj_id)
end
obj = item.obj.merge("registrant_id" => registrant_id) unless registrant_id.nil?
- logger.info obj
+ Rails.logger.info obj.inspect
item.update_attributes(obj: obj) if obj.present?
when "crossref"
registrant_id = cached_get_crossref_member_id(item.subj_id) if cached_get_doi_ra(item.subj_id) == "Crossref"
- logger.info registrant_id
+ Rails.logger.info registrant_id
if registrant_id == "crossref.citations"
sleep(0.50)
registrant_id = get_crossref_member_id(item.subj_id)
end
subj = item.subj.merge("registrant_id" => registrant_id) unless registrant_id.nil?
- logger.info subj
+ Rails.logger.info subj.inspect
item.update_attributes(subj: subj) if subj.present?
end
- logger.error item.errors.full_messages.map { |message| { title: message } } if item.errors.any?
- logger.info "#{item.uuid} Updated" if item.errors.blank? && registrant_id
+ Rails.logger.error item.errors.full_messages.map { |message| { title: message } } if item.errors.any?
+ Rails.logger.info "#{item.uuid} Updated" if item.errors.blank? && registrant_id
end
def get_crossref_member_id(id, options={})
- logger = LogStashLogger.new(type: :stdout)
doi = doi_from_url(id)
# return "crossref.citations" unless doi.present?
url = "https://api.crossref.org/works/#{Addressable::URI.encode(doi)}?mailto=info@datacite.org"
sleep(0.24) # to avoid crossref rate limitting
response = Maremma.get(url, host: true)
- logger.info "[Crossref Response] [#{response.status}] for DOI #{doi} metadata"
+ Rails.logger.info "[Crossref Response] [#{response.status}] for DOI #{doi} metadata"
return "" if response.status == 404 ### for cases when DOI is not in the crossreaf api
return "crossref.citations" if response.status != 200 ### for cases any other errors
@@ -63,14 +57,12 @@ def get_crossref_member_id(id, options={})
def cached_get_doi_ra(doi)
Rails.cache.fetch("ras/#{doi}") do
- puts "#{doi} [RA] did not find key in cache, executing block ..."
get_doi_ra(doi)
end
end
def cached_get_crossref_member_id(doi)
Rails.cache.fetch("members_ids/#{doi}") do
- puts "#{doi} [Crossref Member] did not find key in cache, executing block ..."
get_crossref_member_id(doi)
end
end
diff --git a/app/jobs/handle_job.rb b/app/jobs/handle_job.rb
index b1cf96204..4890fb5c9 100644
--- a/app/jobs/handle_job.rb
+++ b/app/jobs/handle_job.rb
@@ -7,13 +7,12 @@ class HandleJob < ActiveJob::Base
# discard_on ActiveJob::DeserializationError
def perform(doi_id)
- logger = LogStashLogger.new(type: :stdout)
doi = Doi.where(doi: doi_id).first
if doi.present?
doi.register_url
else
- logger.info "[Handle] Error updating URL for DOI " + doi_id + ": not found"
+ Rails.logger.error "[Handle] Error updating URL for DOI " + doi_id + ": not found"
end
end
end
diff --git a/app/jobs/index_job.rb b/app/jobs/index_job.rb
index 33c1191a7..5b2803300 100644
--- a/app/jobs/index_job.rb
+++ b/app/jobs/index_job.rb
@@ -2,8 +2,7 @@ class IndexJob < ActiveJob::Base
queue_as :lupo
rescue_from ActiveJob::DeserializationError, Elasticsearch::Transport::Transport::Errors::BadRequest do |error|
- logger = LogStashLogger.new(type: :stdout)
- logger.error error.message
+ Rails.logger.error error.message
end
def perform(obj)
diff --git a/app/jobs/orcid_auto_update_by_id_job.rb b/app/jobs/orcid_auto_update_by_id_job.rb
index ec4dadc76..0388c5b30 100644
--- a/app/jobs/orcid_auto_update_by_id_job.rb
+++ b/app/jobs/orcid_auto_update_by_id_job.rb
@@ -7,8 +7,6 @@ class OrcidAutoUpdateByIdJob < ActiveJob::Base
# discard_on ActiveJob::DeserializationError
def perform(id, options={})
- logger = LogStashLogger.new(type: :stdout)
-
orcid = orcid_from_url(id)
return {} unless orcid.present?
@@ -46,9 +44,9 @@ def perform(id, options={})
password: ENV["ADMIN_PASSWORD"])
if [200, 201].include?(response.status)
- logger.info "ORCID #{orcid} added."
+ Rails.logger.info "ORCID #{orcid} added."
else
- logger.info "[Error for ORCID #{orcid}]: " + response.body["errors"].inspect
+ Rails.logger.error "[Error for ORCID #{orcid}]: " + response.body["errors"].inspect
end
end
diff --git a/app/jobs/transfer_job.rb b/app/jobs/transfer_job.rb
index fd67ccbc9..f832a8a67 100644
--- a/app/jobs/transfer_job.rb
+++ b/app/jobs/transfer_job.rb
@@ -7,7 +7,6 @@ class TransferJob < ActiveJob::Base
# discard_on ActiveJob::DeserializationError
def perform(doi_id, options={})
- logger = LogStashLogger.new(type: :stdout)
doi = Doi.where(doi: doi_id).first
if doi.present? && options[:target_id].present?
@@ -15,11 +14,11 @@ def perform(doi_id, options={})
doi.__elasticsearch__.index_document
- logger.info "[Transfer] Transferred DOI #{doi.doi}."
+ Rails.logger.info "[Transfer] Transferred DOI #{doi.doi}."
elsif doi.present?
- logger.info "[Transfer] Error transferring DOI " + doi_id + ": no target client"
+ Rails.logger.error "[Transfer] Error transferring DOI " + doi_id + ": no target client"
else
- logger.info "[Transfer] Error transferring DOI " + doi_id + ": not found"
+ Rails.logger.error "[Transfer] Error transferring DOI " + doi_id + ": not found"
end
end
end
diff --git a/app/jobs/update_state_job.rb b/app/jobs/update_state_job.rb
index f7fbb29d7..93d6a1816 100644
--- a/app/jobs/update_state_job.rb
+++ b/app/jobs/update_state_job.rb
@@ -2,15 +2,14 @@ class UpdateStateJob < ActiveJob::Base
queue_as :lupo_background
def perform(doi_id, options={})
- logger = LogStashLogger.new(type: :stdout)
doi = Doi.where(doi: doi_id).first
if doi.blank?
- logger.info "[State] Error updating state for DOI " + doi_id + ": not found"
+ Rails.logger.error "[State] Error updating state for DOI " + doi_id + ": not found"
elsif doi.update_attributes(aasm_state: options[:state])
- logger.info "[State] Successfully updated state for DOI " + doi_id
+ Rails.logger.info "[State] Successfully updated state for DOI " + doi_id
else
- logger.info "[State] Error updating state for DOI " + doi_id + ": " + errors.inspect
+ Rails.logger.error "[State] Error updating state for DOI " + doi_id + ": " + errors.inspect
end
end
end
\ No newline at end of file
diff --git a/app/jobs/url_job.rb b/app/jobs/url_job.rb
index 70a116ccf..2226b1125 100644
--- a/app/jobs/url_job.rb
+++ b/app/jobs/url_job.rb
@@ -7,7 +7,6 @@ class UrlJob < ActiveJob::Base
# discard_on ActiveJob::DeserializationError
def perform(doi_id)
- logger = LogStashLogger.new(type: :stdout)
doi = Doi.where(doi: doi_id).first
if doi.present?
@@ -24,12 +23,12 @@ def perform(doi_id)
doi.__elasticsearch__.index_document
- logger.info "[Handle] URL #{url} set for DOI #{doi.doi}." unless Rails.env.test?
+ Rails.logger.info "[Handle] URL #{url} set for DOI #{doi.doi}." unless Rails.env.test?
else
- logger.error "[Handle] Error updating URL for DOI #{doi.doi}: URL not found." unless Rails.env.test?
+ Rails.logger.error "[Handle] Error updating URL for DOI #{doi.doi}: URL not found." unless Rails.env.test?
end
else
- logger.info "[Handle] Error updating URL for DOI #{doi_id}: DOI not found" unless Rails.env.test?
+ Rails.logger.error "[Handle] Error updating URL for DOI #{doi_id}: DOI not found" unless Rails.env.test?
end
end
end
diff --git a/app/models/activity.rb b/app/models/activity.rb
index 7aec133de..9089fc775 100644
--- a/app/models/activity.rb
+++ b/app/models/activity.rb
@@ -211,8 +211,6 @@ def self.import_by_id(options={})
errors = 0
count = 0
- logger = LogStashLogger.new(type: :stdout)
-
Activity.where(id: id..(id + 499)).find_in_batches(batch_size: 500) do |activities|
response = Activity.__elasticsearch__.client.bulk \
index: index,
@@ -236,7 +234,7 @@ def self.import_by_id(options={})
count
rescue Elasticsearch::Transport::Transport::Errors::RequestEntityTooLarge, Faraday::ConnectionFailed, ActiveRecord::LockWaitTimeout => error
- logger.info "[Elasticsearch] Error #{error.message} importing activities with IDs #{id} - #{(id + 499)}."
+ logger.error "[Elasticsearch] Error #{error.message} importing activities with IDs #{id} - #{(id + 499)}."
count = 0
@@ -257,7 +255,7 @@ def self.convert_affiliations(options={})
# get every id between from_id and end_id
(from_id..until_id).step(500).each do |id|
ActivityConvertAffiliationByIdJob.perform_later(options.merge(id: id))
- puts "Queued converting affiliations for activities with IDs starting with #{id}." unless Rails.env.test?
+ Logger.info "Queued converting affiliations for activities with IDs starting with #{id}." unless Rails.env.test?
end
(from_id..until_id).to_a.length
@@ -269,8 +267,6 @@ def self.convert_affiliation_by_id(options={})
id = options[:id].to_i
count = 0
- logger = LogStashLogger.new(type: :stdout)
-
Activity.where(id: id..(id + 499)).find_each do |activity|
should_update = false
audited_changes = activity.audited_changes
diff --git a/app/models/concerns/authenticable.rb b/app/models/concerns/authenticable.rb
index 771032e12..de75a3ee1 100644
--- a/app/models/concerns/authenticable.rb
+++ b/app/models/concerns/authenticable.rb
@@ -13,8 +13,7 @@ def encode_token(payload)
private_key = OpenSSL::PKey::RSA.new(ENV['JWT_PRIVATE_KEY'].to_s.gsub('\n', "\n"))
JWT.encode(payload, private_key, 'RS256')
rescue OpenSSL::PKey::RSAError => e
- logger = LogStashLogger.new(type: :stdout)
- logger.error e.inspect + " for " + payload.inspect
+ Rails.logger.error e.inspect + " for " + payload.inspect
nil
end
@@ -27,16 +26,13 @@ def encode_alb_token(payload)
private_key = OpenSSL::PKey.read(File.read(Rails.root.join("spec", "fixtures", "certs", "ec256-private.pem").to_s))
JWT.encode(payload, private_key, 'ES256')
rescue OpenSSL::PKey::ECError => e
- logger = LogStashLogger.new(type: :stdout)
- logger.error e.inspect + " for " + payload.inspect
+ Rails.logger.error e.inspect + " for " + payload.inspect
nil
end
# decode JWT token using SHA-256 hash algorithm
def decode_token(token)
- logger = LogStashLogger.new(type: :stdout)
-
public_key = OpenSSL::PKey::RSA.new(ENV['JWT_PUBLIC_KEY'].to_s.gsub('\n', "\n"))
payload = (JWT.decode token, public_key, true, { :algorithm => 'RS256' }).first
@@ -45,21 +41,19 @@ def decode_token(token)
payload
rescue JWT::ExpiredSignature => error
- logger.error "JWT::ExpiredSignature: " + error.message + " for " + token
+ Rails.logger.error "JWT::ExpiredSignature: " + error.message + " for " + token
return { errors: "The token has expired." }
rescue JWT::DecodeError => error
- logger.error "JWT::DecodeError: " + error.message + " for " + token
+ Rails.logger.error "JWT::DecodeError: " + error.message + " for " + token
return { errors: "The token could not be decoded." }
rescue OpenSSL::PKey::RSAError => error
- public_key = ENV['JWT_PUBLIC_KEY'].presence || "nil"
- logger.error "OpenSSL::PKey::RSAError: " + error.message + " for " + public_key
+ public_key = ENV["JWT_PUBLIC_KEY"].presence || "nil"
+ Rails.logger.error "OpenSSL::PKey::RSAError: " + error.message + " for " + public_key
return { errors: "An error occured." }
end
# decode JWT token from AWS ALB using SHA-256 hash algorithm
def decode_alb_token(token)
- logger = LogStashLogger.new(type: :stdout)
-
if Rails.env.test?
public_key = OpenSSL::PKey.read(File.read(Rails.root.join("spec", "fixtures", "certs", "ec256-public.pem").to_s))
else
@@ -77,16 +71,16 @@ def decode_alb_token(token)
payload
rescue NoMethodError => error
- logger.error "NoMethodError: " + error.message + " for " + token
+ Rails.logger.error "NoMethodError: " + error.message + " for " + token
return { errors: "The token could not be decoded." }
rescue JWT::ExpiredSignature => error
- logger.error "JWT::ExpiredSignature: " + error.message + " for " + token
+ Rails.logger.error "JWT::ExpiredSignature: " + error.message + " for " + token
return { errors: "The token has expired." }
rescue JWT::DecodeError => error
- logger.error "JWT::DecodeError: " + error.message + " for " + token.to_s
+ Rails.logger.error "JWT::DecodeError: " + error.message + " for " + token.to_s
return { errors: "The token could not be decoded." }
rescue OpenSSL::PKey::ECError => error
- logger.error "OpenSSL::PKey::RSAError: " + error.message
+ Rails.logger.error "OpenSSL::PKey::RSAError: " + error.message
return { errors: "An error occured." }
end
@@ -169,8 +163,7 @@ def encode_token(payload)
private_key = OpenSSL::PKey::RSA.new(ENV['JWT_PRIVATE_KEY'].to_s.gsub('\n', "\n"))
JWT.encode(payload, private_key, 'RS256')
rescue OpenSSL::PKey::RSAError => e
- logger = LogStashLogger.new(type: :stdout)
- logger.error e.inspect + " for " + payload.inspect
+ Rails.logger.error e.inspect + " for " + payload.inspect
nil
end
@@ -182,8 +175,7 @@ def encode_alb_token(payload)
private_key = OpenSSL::PKey.read(File.read(Rails.root.join("spec", "fixtures", "certs", "ec256-private.pem").to_s))
JWT.encode(payload, private_key, 'ES256')
rescue OpenSSL::PKey::ECError => e
- logger = LogStashLogger.new(type: :stdout)
- logger.error e.inspect + " for " + payload.inspect
+ Rails.logger.error e.inspect + " for " + payload.inspect
nil
end
diff --git a/app/models/concerns/crosscitable.rb b/app/models/concerns/crosscitable.rb
index a03ea7029..d594b9cad 100644
--- a/app/models/concerns/crosscitable.rb
+++ b/app/models/concerns/crosscitable.rb
@@ -51,7 +51,6 @@ def parse_xml(input, options={})
rescue NoMethodError, ArgumentError => exception
Raven.capture_exception(exception)
- logger = LogStashLogger.new(type: :stdout)
logger.error "Error " + exception.message + " for doi " + @doi + "."
logger.error exception
@@ -118,7 +117,6 @@ def clean_xml(string)
doc = Nokogiri::XML(string) { |config| config.strict.noblanks }
doc.to_xml
rescue ArgumentError, Encoding::CompatibilityError => exception
- logger = LogStashLogger.new(type: :stdout)
logger.error "Error " + exception.message + "."
logger.error exception
diff --git a/app/models/concerns/helpable.rb b/app/models/concerns/helpable.rb
index 89358d1a3..4ff42a27d 100644
--- a/app/models/concerns/helpable.rb
+++ b/app/models/concerns/helpable.rb
@@ -13,8 +13,6 @@ module Helpable
include Bolognese::DoiUtils
def register_url
- logger = LogStashLogger.new(type: :stdout)
-
unless url.present?
logger.error "[Handle] Error updating DOI " + doi + ": url missing."
return OpenStruct.new(body: { "errors" => [{ "title" => "URL missing." }] })
@@ -47,7 +45,7 @@ def register_url
"type" => "URL",
"data" => {
"format" => "string",
- "value" => url
+ "value" => url,
}
}
].to_json
@@ -61,25 +59,22 @@ def register_url
logger.info "[Handle] URL for DOI " + doi + " updated to " + url + "." unless Rails.env.test?
self.__elasticsearch__.index_document
-
- response
else
logger.error "[Handle] Error updating URL for DOI " + doi + ": " + response.body.inspect unless Rails.env.test?
- response
end
+
+ response
end
def get_url
url = "#{ENV['HANDLE_URL']}/api/handles/#{doi}?index=1"
response = Maremma.get(url, ssl_self_signed: true, timeout: 10)
- if response.status == 200
- response
- else
- logger = LogStashLogger.new(type: :stdout)
+ if response.status != 200
logger.error "[Handle] Error fetching URL for DOI " + doi + ": " + response.body.inspect unless Rails.env.test?
- response
end
+
+ response
end
def generate_random_provider_symbol
@@ -143,14 +138,13 @@ def get_dois(options={})
else
text = "Error " + response.body["errors"].inspect
- logger = LogStashLogger.new(type: :stdout)
logger.error "[Handle] " + text
User.send_notification_to_slack(text, title: "Error #{response.status.to_s}", level: "danger") unless Rails.env.test?
end
end
end
- puts "#{total} DOIs found."
+ logger.info "#{total} DOIs found."
dois
end
@@ -162,16 +156,14 @@ def get_doi(options={})
url += "/api/handles/#{options[:doi]}"
response = Maremma.get(url, username: "300%3A#{ENV['HANDLE_USERNAME']}", password: ENV['HANDLE_PASSWORD'], ssl_self_signed: true, timeout: 10)
- if response.status == 200
- response
- else
+ if response.status != 200
text = "Error " + response.body["errors"].inspect
- logger = LogStashLogger.new(type: :stdout)
logger.error "[Handle] " + text
User.send_notification_to_slack(text, title: "Error #{response.status.to_s}", level: "danger") unless Rails.env.test?
- response
end
+
+ response
end
def delete_doi(options={})
@@ -186,7 +178,6 @@ def delete_doi(options={})
else
text = "Error " + response.body["errors"].inspect
- logger = LogStashLogger.new(type: :stdout)
logger.error "[Handle] " + text
User.send_notification_to_slack(text, title: "Error #{response.status.to_s}", level: "danger") unless Rails.env.test?
response
diff --git a/app/models/concerns/userable.rb b/app/models/concerns/userable.rb
index 9b3b3c0c6..cfdde76e4 100644
--- a/app/models/concerns/userable.rb
+++ b/app/models/concerns/userable.rb
@@ -3,11 +3,7 @@ module Userable
included do
def remove_users(id: nil, jwt: nil)
- logger = LogStashLogger.new(type: :stdout)
-
result = Maremma.get user_url
- logger.info result.inspect
-
Array.wrap(result.body["data"]).each do |user|
url = ENV["VOLPINO_URL"] + "/users/" + user.fetch("id")
data = { "data" => { "attributes" => { id => nil },
diff --git a/app/models/doi.rb b/app/models/doi.rb
index af5052579..2dfd15202 100644
--- a/app/models/doi.rb
+++ b/app/models/doi.rb
@@ -532,8 +532,6 @@ def self.find_by_id(ids, options={})
end
def self.import_one(doi_id: nil)
- logger = LogStashLogger.new(type: :stdout)
-
doi = Doi.where(doi: doi_id).first
unless doi.present?
logger.error "[MySQL] DOI " + doi_id + " not found."
@@ -568,7 +566,7 @@ def self.import_by_ids(options={})
# get every id between from_id and end_id
(from_id..until_id).step(500).each do |id|
DoiImportByIdJob.perform_later(options.merge(id: id))
- puts "Queued importing for DOIs with IDs starting with #{id}." unless Rails.env.test?
+ Logger.info "Queued importing for DOIs with IDs starting with #{id}." unless Rails.env.test?
end
(from_id..until_id).to_a.length
@@ -588,8 +586,6 @@ def self.import_by_id(options={})
errors = 0
count = 0
- logger = LogStashLogger.new(type: :stdout)
-
Doi.where(id: id..(id + 499)).find_in_batches(batch_size: 500) do |dois|
response = Doi.__elasticsearch__.client.bulk \
index: index,
@@ -667,20 +663,18 @@ def self.convert_affiliations(options={})
# get every id between from_id and end_id
(from_id..until_id).step(500).each do |id|
DoiConvertAffiliationByIdJob.perform_later(options.merge(id: id))
- puts "Queued converting affiliations for DOIs with IDs starting with #{id}." unless Rails.env.test?
+ logger.info "Queued converting affiliations for DOIs with IDs starting with #{id}." unless Rails.env.test?
end
(from_id..until_id).to_a.length
end
def self.convert_affiliation_by_id(options={})
- return nil unless options[:id].present?
+ return nil if options[:id].blank?
id = options[:id].to_i
count = 0
- logger = LogStashLogger.new(type: :stdout)
-
Doi.where(id: id..(id + 499)).find_each do |doi|
should_update = false
creators = Array.wrap(doi.creators).map do |c|
@@ -773,20 +767,18 @@ def self.convert_containers(options={})
# get every id between from_id and end_id
(from_id..until_id).step(500).each do |id|
DoiConvertContainerByIdJob.perform_later(options.merge(id: id))
- puts "Queued converting containers for DOIs with IDs starting with #{id}." unless Rails.env.test?
+ logger.info "Queued converting containers for DOIs with IDs starting with #{id}." unless Rails.env.test?
end
(from_id..until_id).to_a.length
end
def self.convert_container_by_id(options={})
- return nil unless options[:id].present?
+ return nil if options[:id].blank?
id = options[:id].to_i
count = 0
- logger = LogStashLogger.new(type: :stdout)
-
Doi.where(id: id..(id + 499)).find_each do |doi|
should_update = false
@@ -1044,10 +1036,8 @@ def check_container
# to be used after DOIs were transferred to another DOI RA
def self.delete_dois_by_prefix(prefix, options={})
- logger = LogStashLogger.new(type: :stdout)
-
if prefix.blank?
- Logger.error "[Error] No prefix provided."
+ logger.error "[Error] No prefix provided."
return nil
end
@@ -1080,8 +1070,6 @@ def self.delete_dois_by_prefix(prefix, options={})
# register DOIs in the handle system that have not been registered yet
# provider europ registers their DOIs in the handle system themselves and are ignored
def self.set_handle
- logger = LogStashLogger.new(type: :stdout)
-
response = Doi.query("-registered:* +url:* -aasm_state:draft -provider_id:europ -agency:Crossref", page: { size: 1, cursor: [] })
logger.info "#{response.results.total} DOIs found that are not registered in the Handle system."
@@ -1104,8 +1092,6 @@ def self.set_handle
end
def self.set_url
- logger = LogStashLogger.new(type: :stdout)
-
response = Doi.query("-url:* (+provider_id:ethz OR -aasm_status:draft)", page: { size: 1, cursor: [] })
logger.info "#{response.results.total} DOIs with no URL found in the database."
@@ -1113,9 +1099,9 @@ def self.set_url
# walk through results using cursor
cursor = []
- while response.results.results.length > 0 do
+ while response.results.results.length.postive? do
response = Doi.query("-url:* (+provider_id:ethz OR -aasm_status:draft)", page: { size: 1000, cursor: cursor })
- break unless response.results.results.length > 0
+ break unless response.results.results.length.positive?
logger.info "[Handle] Update URL for #{response.results.results.length} DOIs starting with _id #{response.results.to_a.first[:_id]}."
cursor = response.results.to_a.last[:sort]
@@ -1128,8 +1114,6 @@ def self.set_url
end
def self.set_minted
- logger = LogStashLogger.new(type: :stdout)
-
response = Doi.query("provider_id:ethz AND +aasm_state:draft +url:*", page: { size: 1, cursor: [] })
logger.info "#{response.results.total} draft DOIs from provider ETHZ found in the database."
@@ -1137,9 +1121,9 @@ def self.set_minted
# walk through results using cursor
cursor = []
- while response.results.results.length > 0 do
+ while response.results.results.length.positive? do
response = Doi.query("provider_id:ethz AND +aasm_state:draft +url:*", page: { size: 1000, cursor: cursor })
- break unless response.results.results.length > 0
+ break unless response.results.results.length.positive?
logger.info "[MySQL] Set minted for #{response.results.results.length} DOIs starting with _id #{response.results.to_a.first[:_id]}."
cursor = response.results.to_a.last[:sort]
@@ -1152,15 +1136,13 @@ def self.set_minted
end
def self.transfer(options={})
- logger = LogStashLogger.new(type: :stdout)
-
if options[:client_id].blank?
- Logger.error "[Transfer] No client provided."
+ logger.error "[Transfer] No client provided."
return nil
end
if options[:target_id].blank?
- Logger.error "[Transfer] No target client provided."
+ logger.error "[Transfer] No target client provided."
return nil
end
@@ -1174,9 +1156,9 @@ def self.transfer(options={})
# walk through results using cursor
cursor = []
- while response.results.results.length > 0 do
+ while response.results.results.length.positive? do
response = Doi.query(nil, client_id: options[:client_id], page: { size: size, cursor: cursor })
- break unless response.results.results.length > 0
+ break unless response.results.results.length.positive?
logger.info "[Transfer] Transferring #{response.results.results.length} DOIs starting with _id #{response.results.to_a.first[:_id]}."
cursor = response.results.to_a.last[:sort]
@@ -1202,7 +1184,6 @@ def set_defaults
end
def self.migrate_landing_page(options={})
- logger = LogStashLogger.new(type: :stdout)
logger.info "Starting migration"
# Handle camel casing first.
@@ -1218,7 +1199,7 @@ def self.migrate_landing_page(options={})
"schema-org-id" => "schemaOrgId",
"has-schema-org" => "hasSchemaOrg",
"redirect-count" => "redirectCount",
- "download-latency" => "downloadLatency"
+ "download-latency" => "downloadLatency",
}
result = result.map {|k, v| [mappings[k] || k, v] }.to_h
# doi.update_columns("last_landing_page_status_result": result)
diff --git a/app/models/event.rb b/app/models/event.rb
index 92948fd07..7cbec81d6 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -294,7 +294,7 @@ def self.import_by_ids(options = {})
# get every id between from_id and until_id
(from_id..until_id).step(500).each do |id|
EventImportByIdJob.perform_later(id: id)
- puts "Queued importing for events with IDs starting with #{id}." unless Rails.env.test?
+ logger.info "Queued importing for events with IDs starting with #{id}." unless Rails.env.test?
end
end
@@ -306,8 +306,6 @@ def self.import_by_id(options = {})
errors = 0
count = 0
- logger = LogStashLogger.new(type: :stdout)
-
Event.where(id: id..(id + 499)).find_in_batches(batch_size: 500) do |events|
response = Event.__elasticsearch__.client.bulk \
index: index,
@@ -342,8 +340,6 @@ def self.import_by_id(options = {})
end
def self.update_crossref(options = {})
- logger = LogStashLogger.new(type: :stdout)
-
size = (options[:size] || 1000).to_i
cursor = (options[:cursor] || [])
@@ -387,21 +383,7 @@ def self.update_datacite_op(options = {})
update_datacite_ra(options.merge(ra: "op"))
end
- def self.update_datacite_medra(options = {})
- update_datacite_ra(options.merge(ra: "medra"))
- end
-
- def self.update_datacite_medra(options = {})
- update_datacite_ra(options.merge(ra: "medra"))
- end
-
- def self.update_datacite_medra(options = {})
- update_datacite_ra(options.merge(ra: "medra"))
- end
-
def self.update_datacite_ra(options = {})
- logger = LogStashLogger.new(type: :stdout)
-
size = (options[:size] || 1000).to_i
cursor = (options[:cursor] || [])
ra = options[:ra] || "crossref"
@@ -430,8 +412,6 @@ def self.update_datacite_ra(options = {})
end
def self.update_registrant(options = {})
- logger = LogStashLogger.new(type: :stdout)
-
size = (options[:size] || 1000).to_i
cursor = (options[:cursor] || [])
# ra = options[:ra] || "crossref"
@@ -461,8 +441,6 @@ def self.update_registrant(options = {})
end
def self.update_datacite_orcid_auto_update(options = {})
- logger = LogStashLogger.new(type: :stdout)
-
size = (options[:size] || 1000).to_i
cursor = (options[:cursor] || []).to_i
diff --git a/app/models/handle.rb b/app/models/handle.rb
index 636cfc6aa..75b014bfa 100644
--- a/app/models/handle.rb
+++ b/app/models/handle.rb
@@ -48,9 +48,6 @@ def self.get_query_url(options={})
def self.parse_data(result, options={})
return nil if result.blank? || result['errors']
- logger = LogStashLogger.new(type: :stdout)
- logger.debug result
-
if options[:id]
response_code = result.body.dig("data", "responseCode")
return nil unless response_code == 1
diff --git a/config/application.rb b/config/application.rb
index 8b9dc7786..9df4f3da7 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -79,15 +79,7 @@ class Application < Rails::Application
config.api_only = true
# secret_key_base is not used by Rails API, as there are no sessions
- config.secret_key_base = 'blipblapblup'
-
- # Write all logs to STDOUT instead of file
- logger = ActiveSupport::Logger.new(STDOUT)
- logger.formatter = config.log_formatter
- config.logger = ActiveSupport::TaggedLogging.new(logger)
- config.log_level = ENV['LOG_LEVEL'].to_sym
-
- config.active_job.logger = config.logger
+ config.secret_key_base = "blipblapblup"
# configure caching
config.cache_store = :dalli_store, nil, { :namespace => ENV['APPLICATION'] }
diff --git a/config/environments/development.rb b/config/environments/development.rb
index df6fcfc1d..5e6e56db0 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -42,7 +42,3 @@
end
BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP']
-
-# HttpLog.configure do |config|
-# config.logger = ActiveSupport::Logger.new(STDOUT)
-# end
diff --git a/config/environments/stage.rb b/config/environments/stage.rb
index 997718fc6..82f044c09 100644
--- a/config/environments/stage.rb
+++ b/config/environments/stage.rb
@@ -56,10 +56,6 @@
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
- # Use a different logger for distributed setups.
- # require 'syslog/logger'
- # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
-
# Do not dump schema after migrations.
# config.active_record.dump_schema_after_migration = false
diff --git a/config/environments/test.rb b/config/environments/test.rb
index a1c87c6af..18ad5de98 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -12,9 +12,6 @@
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
- # don't use debug level
- config.log_level = :error
-
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
diff --git a/config/initializers/_shoryuken.rb b/config/initializers/_shoryuken.rb
index a3a1a9d0b..236139002 100644
--- a/config/initializers/_shoryuken.rb
+++ b/config/initializers/_shoryuken.rb
@@ -1,6 +1,27 @@
# frozen_string_literal: true
+# Shoryuken middleware to capture worker errors and send them on to Sentry.io
+module Shoryuken
+ module Middleware
+ module Server
+ class RavenReporter
+ def call(worker_instance, queue, sqs_msg, body)
+ tags = { job: body['job_class'], queue: queue }
+ context = { message: body }
+ Raven.capture(tags: tags, extra: context) do
+ yield
+ end
+ end
+ end
+ end
+ end
+end
+
Shoryuken.configure_server do |config|
+ config.server_middleware do |chain|
+ chain.add Shoryuken::Middleware::Server::RavenReporter
+ end
+
Rails.logger = Shoryuken::Logging.logger
Rails.logger.level = Logger.const_get(ENV["LOG_LEVEL"].upcase)
end
diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb
index 67c47d226..85c72dfbc 100644
--- a/config/initializers/lograge.rb
+++ b/config/initializers/lograge.rb
@@ -5,13 +5,16 @@
Rails.application.configure do
config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Logstash.new
- config.lograge.logger = LogStashLogger.new(type: :stdout)
+ config.lograge.logger = LogStashLogger.new(type: :stdout)
+ config.lograge.log_level = ENV["LOG_LEVEL"].to_sym
- config.lograge.ignore_actions = ['HeartbeatController#index', 'IndexController#index']
+ config.active_job.logger = config.logger
+
+ config.lograge.ignore_actions = ["HeartbeatController#index", "IndexController#index"]
config.lograge.ignore_custom = lambda do |event|
event.payload.inspect.length > 100000
end
- config.lograge.base_controller_class = 'ActionController::API'
+ config.lograge.base_controller_class = "ActionController::API"
config.lograge.custom_options = lambda do |event|
exceptions = %w(controller action format id)
diff --git a/spec/queries/events_query_spec.rb b/spec/queries/events_query_spec.rb
index 1aef5874d..1ea2b92a1 100644
--- a/spec/queries/events_query_spec.rb
+++ b/spec/queries/events_query_spec.rb
@@ -50,7 +50,6 @@
end
it "usage" do
- puts EventsQuery.new.usage("10.0260/co.2004960.v1")
expect(EventsQuery.new.usage("10.0260/co.2004960.v1").first).to eq(id: "https://doi.org/10.0260/co.2004960.v1", title: "https://doi.org/10.0260/co.2004960.v1", relationTypes: [{ id: "unique-dataset-requests-regular", title: "unique-dataset-requests-regular", sum: downloads.first.total }, { id: "unique-dataset-investigations-regular", title: "unique-dataset-investigations-regular", sum: views.first.total }])
end
end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index a2b0111dd..7722396d5 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -1,4 +1,4 @@
-ENV['RAILS_ENV'] = 'test'
+ENV["RAILS_ENV"] = "test"
ENV["TEST_CLUSTER_NODES"] = "1"
# set up Code Climate
diff --git a/spec/requests/dois_spec.rb b/spec/requests/dois_spec.rb
index ac4ce7aeb..96cfd9717 100644
--- a/spec/requests/dois_spec.rb
+++ b/spec/requests/dois_spec.rb
@@ -649,7 +649,7 @@
it 'updates the record' do
patch "/dois/#{doi.doi}", valid_attributes, headers
- puts last_response.body
+
expect(last_response.status).to eq(200)
expect(json.dig('data', 'attributes', 'url')).to eq("http://www.bl.uk/pdf/pat.pdf")
expect(json.dig('data', 'attributes', 'doi')).to eq(doi.doi.downcase)
@@ -1186,7 +1186,7 @@
it 'updates the record' do
patch "/dois/10.14454/8na3-9s47", valid_attributes, headers
- puts last_response.body
+
expect(last_response.status).to eq(201)
expect(json.dig('data', 'attributes', 'url')).to eq("https://ors.datacite.org/doi:/10.14454/8na3-9s47")
expect(json.dig('data', 'attributes', 'doi')).to eq("10.14454/8na3-9s47")
diff --git a/spec/requests/events_spec.rb b/spec/requests/events_spec.rb
index 2d54fa04c..930f50cd5 100644
--- a/spec/requests/events_spec.rb
+++ b/spec/requests/events_spec.rb
@@ -274,7 +274,7 @@
Event.import
sleep 1
get uri + "?doi=10.1016/j.jastp.2013.05.001", nil, headers
- puts json.dig("meta", "citationsHistogram")
+
expect(json.dig("meta", "citationsHistogram", "years", 0, "title")).to eq("2017")
end
end
@@ -652,7 +652,6 @@
expect(last_response.status).to eq(200)
response = JSON.parse(last_response.body)
- puts response
citations = (response.dig("meta", "uniqueCitations")).select { |item| item["id"] == doi }
# references = (response.dig("meta", "references")).select { |item| item["id"] == doi }
diff --git a/spec/support/task_helper.rb b/spec/support/task_helper.rb
index 8a21e2f57..1b72dedc6 100644
--- a/spec/support/task_helper.rb
+++ b/spec/support/task_helper.rb
@@ -23,9 +23,7 @@ module TaskExampleGroup
end
end
-
RSpec.configure do |config|
-
# Tag Rake specs with `:task` metadata or put them in the spec/tasks dir
config.define_derived_metadata(:file_path => %r{/spec/tasks/}) do |metadata|
metadata[:type] = :task
diff --git a/vendor/docker/70_index_page.sh b/vendor/docker/70_index_page.sh
deleted file mode 100755
index fad7b5b99..000000000
--- a/vendor/docker/70_index_page.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-cd vendor/middleman
-/sbin/setuser app bundle exec middleman build -e ${RAILS_ENV}
diff --git a/vendor/docker/webapp.conf b/vendor/docker/webapp.conf
index 5ef0e350f..1ac66a460 100644
--- a/vendor/docker/webapp.conf
+++ b/vendor/docker/webapp.conf
@@ -8,4 +8,8 @@ server {
passenger_ruby /usr/bin/ruby;
merge_slashes off;
client_max_body_size 10M;
+
+ location = / {
+ return 301 https://support.datacite.org/docs/api;
+ }
}
diff --git a/vendor/middleman/Gemfile b/vendor/middleman/Gemfile
deleted file mode 100644
index 3410f7d6b..000000000
--- a/vendor/middleman/Gemfile
+++ /dev/null
@@ -1,12 +0,0 @@
-# If you do not have OpenSSL installed, change
-# the following line to use 'http://'
-source 'https://rubygems.org'
-
-# Middleman Gems
-gem 'middleman', "~> 4.1"
-gem 'tilt', '~> 2.0', git: "https://github.com/datacite/tilt.git", branch: "pandoc-options"
-gem 'tilt-handlebars', '~> 1.4'
-gem 'middleman-data_source', '~> 0.8.1'
-gem 'middleman-livereload'
-gem 'middleman-syntax', '~> 2.0'
-gem 'pandoc-ruby', '~> 2.0'
diff --git a/vendor/middleman/Gemfile.lock b/vendor/middleman/Gemfile.lock
deleted file mode 100644
index fd3ba85c7..000000000
--- a/vendor/middleman/Gemfile.lock
+++ /dev/null
@@ -1,149 +0,0 @@
-GIT
- remote: https://github.com/datacite/tilt.git
- revision: 612652f9d03ff3c129c415b1826fb84b0c7a0845
- branch: pandoc-options
- specs:
- tilt (2.0.5)
-
-GEM
- remote: https://rubygems.org/
- specs:
- activesupport (5.0.6)
- concurrent-ruby (~> 1.0, >= 1.0.2)
- i18n (~> 0.7)
- minitest (~> 5.1)
- tzinfo (~> 1.1)
- addressable (2.5.2)
- public_suffix (>= 2.0.2, < 4.0)
- backports (3.10.3)
- borrower (0.10.0)
- coffee-script (2.4.1)
- coffee-script-source
- execjs
- coffee-script-source (1.12.2)
- compass-import-once (1.0.5)
- sass (>= 3.2, < 3.5)
- concurrent-ruby (1.0.5)
- contracts (0.13.0)
- dotenv (2.2.1)
- em-websocket (0.5.1)
- eventmachine (>= 0.12.9)
- http_parser.rb (~> 0.6.0)
- erubis (2.7.0)
- eventmachine (1.2.5)
- execjs (2.7.0)
- fast_blank (1.0.0)
- fastimage (2.1.1)
- ffi (1.9.18)
- haml (5.0.4)
- temple (>= 0.8.0)
- tilt
- hamster (3.0.0)
- concurrent-ruby (~> 1.0)
- handlebars (0.8.0)
- handlebars-source (~> 4.0.5)
- therubyracer (~> 0.12.1)
- handlebars-source (4.0.11)
- hashie (3.5.7)
- http_parser.rb (0.6.0)
- i18n (0.7.0)
- kramdown (1.16.2)
- libv8 (3.16.14.19)
- listen (3.0.8)
- rb-fsevent (~> 0.9, >= 0.9.4)
- rb-inotify (~> 0.9, >= 0.9.7)
- memoist (0.16.0)
- middleman (4.2.1)
- coffee-script (~> 2.2)
- compass-import-once (= 1.0.5)
- haml (>= 4.0.5)
- kramdown (~> 1.2)
- middleman-cli (= 4.2.1)
- middleman-core (= 4.2.1)
- sass (>= 3.4.0, < 4.0)
- middleman-cli (4.2.1)
- thor (>= 0.17.0, < 2.0)
- middleman-core (4.2.1)
- activesupport (>= 4.2, < 5.1)
- addressable (~> 2.3)
- backports (~> 3.6)
- bundler (~> 1.1)
- contracts (~> 0.13.0)
- dotenv
- erubis
- execjs (~> 2.0)
- fast_blank
- fastimage (~> 2.0)
- hamster (~> 3.0)
- hashie (~> 3.4)
- i18n (~> 0.7.0)
- listen (~> 3.0.0)
- memoist (~> 0.14)
- padrino-helpers (~> 0.13.0)
- parallel
- rack (>= 1.4.5, < 3)
- sass (>= 3.4)
- servolux
- tilt (~> 2.0)
- uglifier (~> 3.0)
- middleman-data_source (0.8.1)
- borrower (~> 0.9)
- middleman (>= 3.1)
- rack-test (~> 0.6.2)
- middleman-livereload (3.4.6)
- em-websocket (~> 0.5.1)
- middleman-core (>= 3.3)
- rack-livereload (~> 0.3.15)
- middleman-syntax (2.1.0)
- middleman-core (>= 3.2)
- rouge (~> 1.0)
- minitest (5.10.3)
- padrino-helpers (0.13.3.4)
- i18n (~> 0.6, >= 0.6.7)
- padrino-support (= 0.13.3.4)
- tilt (>= 1.4.1, < 3)
- padrino-support (0.13.3.4)
- activesupport (>= 3.1)
- pandoc-ruby (2.0.2)
- parallel (1.12.1)
- public_suffix (3.0.1)
- rack (2.0.3)
- rack-livereload (0.3.16)
- rack
- rack-test (0.6.3)
- rack (>= 1.0)
- rb-fsevent (0.10.2)
- rb-inotify (0.9.10)
- ffi (>= 0.5.0, < 2)
- ref (2.0.0)
- rouge (1.11.1)
- sass (3.4.25)
- servolux (0.13.0)
- temple (0.8.0)
- therubyracer (0.12.3)
- libv8 (~> 3.16.14.15)
- ref
- thor (0.20.0)
- thread_safe (0.3.6)
- tilt-handlebars (1.4.0)
- handlebars (~> 0.7)
- tilt (>= 1.3, < 3)
- tzinfo (1.2.4)
- thread_safe (~> 0.1)
- uglifier (3.2.0)
- execjs (>= 0.3.0, < 3)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- middleman (~> 4.1)
- middleman-data_source (~> 0.8.1)
- middleman-livereload
- middleman-syntax (~> 2.0)
- pandoc-ruby (~> 2.0)
- tilt (~> 2.0)!
- tilt-handlebars (~> 1.4)
-
-BUNDLED WITH
- 1.16.0
diff --git a/vendor/middleman/config.rb b/vendor/middleman/config.rb
deleted file mode 100644
index b03ba4ad8..000000000
--- a/vendor/middleman/config.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-###
-# Page options, layouts, aliases and proxies
-###
-
-# Default ENV variables
-ENV['CDN_URL'] ||= "https://assets.datacite.org"
-ENV['RAILS_ENV'] ||= "development"
-ENV['SITE_TITLE'] ||= "DataCite REST API"
-ENV['SITE_DESCRIPTION'] ||= "The DataCite API."
-ENV['TWITTER_HANDLE'] ||= "@datacite"
-
-# Build into /public
-set :build_dir, "../../public"
-
-# Per-page layout changes:
-#
-# With no layout
-page '/*.xml', layout: false
-page '/*.json', layout: false
-page '/*.txt', layout: false
-
-# General configuration
-
-# Reload the browser automatically whenever files change
-configure :development do
- activate :livereload
-end
-
-# Load data
-activate :data_source do |c|
- c.root = "#{ENV['CDN_URL']}/data"
- c.files = [
- "links.json"
- ]
-end
-
-# Set markdown template engine
-set :markdown_engine, :pandoc
-set :markdown, smartypants: true
-
-# use asset host
-activate :asset_host, host: ENV['CDN_URL']
-
-###
-# Helpers
-###
-# Methods defined in the helpers block are available in templates
-helpers do
- def stage?
- ENV['RAILS_ENV'] == "stage"
- end
-end
diff --git a/vendor/middleman/config.ru b/vendor/middleman/config.ru
deleted file mode 100644
index ece6fda7e..000000000
--- a/vendor/middleman/config.ru
+++ /dev/null
@@ -1,11 +0,0 @@
-require 'middleman-core/load_paths'
-::Middleman.setup_load_paths
-
-require 'middleman-core'
-require 'middleman-core/rack'
-
-require 'fileutils'
-
-app = ::Middleman::Application.new
-
-run ::Middleman::Rack.new(app).to_app
diff --git a/vendor/middleman/source/favicon.ico b/vendor/middleman/source/favicon.ico
deleted file mode 100755
index 34069edb6..000000000
Binary files a/vendor/middleman/source/favicon.ico and /dev/null differ
diff --git a/vendor/middleman/source/includes/_footer.html.hbs b/vendor/middleman/source/includes/_footer.html.hbs
deleted file mode 100644
index a10f67d10..000000000
--- a/vendor/middleman/source/includes/_footer.html.hbs
+++ /dev/null
@@ -1,61 +0,0 @@
-
diff --git a/vendor/middleman/source/includes/_google_analytics.html.hbs b/vendor/middleman/source/includes/_google_analytics.html.hbs
deleted file mode 100644
index 8b18f56af..000000000
--- a/vendor/middleman/source/includes/_google_analytics.html.hbs
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/vendor/middleman/source/includes/_header.html.hbs b/vendor/middleman/source/includes/_header.html.hbs
deleted file mode 100644
index 797adbfda..000000000
--- a/vendor/middleman/source/includes/_header.html.hbs
+++ /dev/null
@@ -1,20 +0,0 @@
-
<%= current_page.data.description %>
-