commit
d2b730e2e8
8 changed files with 46 additions and 43 deletions
47
.rubocop.yml
47
.rubocop.yml
|
@ -806,37 +806,39 @@ Style/Alias:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/AndOr:
|
Style/AndOr:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/ArrayJoin:
|
Style/ArrayJoin:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/AsciiComments:
|
Style/AsciiComments:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/Attr:
|
Style/Attr:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/AutoResourceCleanup:
|
Style/AutoResourceCleanup:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/BarePercentLiterals:
|
Style/BarePercentLiterals:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/BeginBlock:
|
Style/BeginBlock:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/BlockComments:
|
Style/BlockComments:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/BlockDelimiters:
|
Style/BlockDelimiters:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
Exclude:
|
||||||
|
- "spec/**/*"
|
||||||
|
|
||||||
Style/BracesAroundHashParameters:
|
Style/BracesAroundHashParameters:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/CaseEquality:
|
Style/CaseEquality:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/CharacterLiteral:
|
Style/CharacterLiteral:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -845,10 +847,10 @@ Style/ClassAndModuleChildren:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/ClassCheck:
|
Style/ClassCheck:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/ClassMethods:
|
Style/ClassMethods:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/ClassVars:
|
Style/ClassVars:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -857,7 +859,7 @@ Style/CollectionMethods:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/ColonMethodCall:
|
Style/ColonMethodCall:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/ColonMethodDefinition:
|
Style/ColonMethodDefinition:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -881,7 +883,7 @@ Style/DateTime:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/DefWithParentheses:
|
Style/DefWithParentheses:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/Dir:
|
Style/Dir:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -896,7 +898,7 @@ Style/DoubleNegation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/EachForSimpleLoop:
|
Style/EachForSimpleLoop:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/EachWithObject:
|
Style/EachWithObject:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -914,43 +916,44 @@ Style/EmptyLambdaParameter:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Style/EmptyLiteral:
|
Style/EmptyLiteral:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/EmptyMethod:
|
Style/EmptyMethod:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/Encoding:
|
Style/Encoding:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/EndBlock:
|
Style/EndBlock:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/EvalWithLocation:
|
Style/EvalWithLocation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/EvenOdd:
|
Style/EvenOdd:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/ExpandPathArguments:
|
Style/ExpandPathArguments:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Style/FlipFlop:
|
Style/FlipFlop:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/For:
|
Style/For:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/FormatString:
|
Style/FormatString:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/FormatStringToken:
|
Style/FormatStringToken:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
EnforcedStyle: template
|
||||||
|
|
||||||
Style/FrozenStringLiteralComment:
|
Style/FrozenStringLiteralComment:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/GlobalVars:
|
Style/GlobalVars:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/GuardClause:
|
Style/GuardClause:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
|
@ -517,7 +517,7 @@ GEM
|
||||||
rspec-support (3.8.0)
|
rspec-support (3.8.0)
|
||||||
rspec_junit_formatter (0.4.1)
|
rspec_junit_formatter (0.4.1)
|
||||||
rspec-core (>= 2, < 4, != 2.12.0)
|
rspec-core (>= 2, < 4, != 2.12.0)
|
||||||
rubocop (0.60.0)
|
rubocop (0.61.1)
|
||||||
jaro_winkler (~> 1.5.1)
|
jaro_winkler (~> 1.5.1)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.5, != 2.5.1.1)
|
parser (>= 2.5, != 2.5.1.1)
|
||||||
|
|
|
@ -93,7 +93,7 @@ class StatsController < ApplicationController
|
||||||
else
|
else
|
||||||
evolution = 0
|
evolution = 0
|
||||||
end
|
end
|
||||||
formatted_evolution = sprintf("%+d", evolution)
|
formatted_evolution = format("%+d", evolution)
|
||||||
|
|
||||||
{
|
{
|
||||||
total: total.to_s,
|
total: total.to_s,
|
||||||
|
@ -111,7 +111,7 @@ class StatsController < ApplicationController
|
||||||
else
|
else
|
||||||
evolution = 0
|
evolution = 0
|
||||||
end
|
end
|
||||||
formatted_evolution = sprintf("%+d", evolution)
|
formatted_evolution = format("%+d", evolution)
|
||||||
|
|
||||||
{
|
{
|
||||||
total: total.to_s,
|
total: total.to_s,
|
||||||
|
|
|
@ -41,11 +41,11 @@ class FileSizeValidator < ActiveModel::EachValidator
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_each(record, attribute, value)
|
def validate_each(record, attribute, value)
|
||||||
if !value.kind_of?(CarrierWave::Uploader::Base)
|
if !value.is_a?(CarrierWave::Uploader::Base)
|
||||||
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected")
|
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected")
|
||||||
end
|
end
|
||||||
|
|
||||||
if value.kind_of?(String)
|
if value.is_a?(String)
|
||||||
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value)
|
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -167,13 +167,13 @@ module TagsSubstitutionConcern
|
||||||
end
|
end
|
||||||
|
|
||||||
def types_de_champ_tags(types_de_champ, available_for_states)
|
def types_de_champ_tags(types_de_champ, available_for_states)
|
||||||
types_de_champ.map { |tdc|
|
types_de_champ.map do |tdc|
|
||||||
{
|
{
|
||||||
libelle: tdc.libelle,
|
libelle: tdc.libelle,
|
||||||
description: tdc.description,
|
description: tdc.description,
|
||||||
available_for_states: available_for_states
|
available_for_states: available_for_states
|
||||||
}
|
}
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def replace_tags(text, dossier)
|
def replace_tags(text, dossier)
|
||||||
|
|
|
@ -5,5 +5,5 @@ class TypeDePieceJustificative < ApplicationRecord
|
||||||
|
|
||||||
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
|
||||||
validates :lien_demarche, format: { with: URI::regexp }, allow_blank: true, allow_nil: true
|
validates :lien_demarche, format: { with: URI.regexp }, allow_blank: true, allow_nil: true
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,8 +22,8 @@ namespace :cloudstorage do
|
||||||
Rake::Task['cloudstorage:init'].invoke
|
Rake::Task['cloudstorage:init'].invoke
|
||||||
|
|
||||||
error_count = 0
|
error_count = 0
|
||||||
[Cerfa, PieceJustificative, Procedure].each { |c|
|
[Cerfa, PieceJustificative, Procedure].each do |c|
|
||||||
c.all.each { |entry|
|
c.all.each do |entry|
|
||||||
content = (c == Procedure) ? entry.logo : entry.content
|
content = (c == Procedure) ? entry.logo : entry.content
|
||||||
if !(content.current_path.nil? || File.exist?(File.dirname(content.current_path) + '/uploaded'))
|
if !(content.current_path.nil? || File.exist?(File.dirname(content.current_path) + '/uploaded'))
|
||||||
secure_token = SecureRandom.uuid
|
secure_token = SecureRandom.uuid
|
||||||
|
@ -56,8 +56,8 @@ namespace :cloudstorage do
|
||||||
puts "Skipping #{content.current_path}"
|
puts "Skipping #{content.current_path}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
end
|
||||||
}
|
end
|
||||||
|
|
||||||
puts "There were #{error_count} errors while uploading files. See upload_errors.report file for details."
|
puts "There were #{error_count} errors while uploading files. See upload_errors.report file for details."
|
||||||
puts 'Enf of migration'
|
puts 'Enf of migration'
|
||||||
|
@ -67,8 +67,8 @@ namespace :cloudstorage do
|
||||||
task :revert do
|
task :revert do
|
||||||
Rake::Task['cloudstorage:init'].invoke
|
Rake::Task['cloudstorage:init'].invoke
|
||||||
|
|
||||||
[Cerfa, PieceJustificative, Procedure].each { |c|
|
[Cerfa, PieceJustificative, Procedure].each do |c|
|
||||||
c.all.each { |entry|
|
c.all.each do |entry|
|
||||||
content = (c == Procedure) ? entry.logo : entry.content
|
content = (c == Procedure) ? entry.logo : entry.content
|
||||||
if content.current_path.present?
|
if content.current_path.present?
|
||||||
if File.exist?(File.dirname(content.current_path) + '/uploaded')
|
if File.exist?(File.dirname(content.current_path) + '/uploaded')
|
||||||
|
@ -86,26 +86,26 @@ namespace :cloudstorage do
|
||||||
FileUtils.rm(File.dirname(content.current_path) + '/secure_token_cloudstorage')
|
FileUtils.rm(File.dirname(content.current_path) + '/secure_token_cloudstorage')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
end
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Clear old documents in tenant'
|
desc 'Clear old documents in tenant'
|
||||||
task :clear do
|
task :clear do
|
||||||
Rake::Task['cloudstorage:init'].invoke
|
Rake::Task['cloudstorage:init'].invoke
|
||||||
|
|
||||||
@cont.objects.each { |object|
|
@cont.objects.each do |object|
|
||||||
puts "Removing #{object}"
|
puts "Removing #{object}"
|
||||||
@cont.delete_object(object)
|
@cont.delete_object(object)
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
task :clear_old_objects do
|
task :clear_old_objects do
|
||||||
Rake::Task['cloudstorage:init'].invoke
|
Rake::Task['cloudstorage:init'].invoke
|
||||||
|
|
||||||
@cont.objects_detail.each { |object, details|
|
@cont.objects_detail.each do |object, details|
|
||||||
last_modified = Time.zone.parse(details[:last_modified])
|
last_modified = Time.zone.parse(details[:last_modified])
|
||||||
@cont.delete_object(object) if last_modified.utc <= (Time.zone.now - 2.years).utc
|
@cont.delete_object(object) if last_modified.utc <= (Time.zone.now - 2.years).utc
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,7 +52,7 @@ class ProgressReport
|
||||||
|
|
||||||
def print_progress
|
def print_progress
|
||||||
elapsed = Time.zone.now - @start
|
elapsed = Time.zone.now - @start
|
||||||
percent = sprintf('%5.1f%%', @per_10_000 / 100.0)
|
percent = format('%5.1f%%', @per_10_000 / 100.0)
|
||||||
total = @total.to_s
|
total = @total.to_s
|
||||||
count = @count.to_s.rjust(total.length)
|
count = @count.to_s.rjust(total.length)
|
||||||
rake_print("\r#{percent} (#{count}/#{total}) [#{format_duration(elapsed)}/#{format_duration(elapsed * 10_000.0 / @per_10_000)}]")
|
rake_print("\r#{percent} (#{count}/#{total}) [#{format_duration(elapsed)}/#{format_duration(elapsed * 10_000.0 / @per_10_000)}]")
|
||||||
|
|
Loading…
Reference in a new issue