Merge branch 'dev'
This commit is contained in:
commit
8176b5afa0
9 changed files with 134 additions and 81 deletions
100
Gemfile.lock
100
Gemfile.lock
|
@ -21,25 +21,25 @@ GEM
|
|||
CFPropertyList (2.3.6)
|
||||
aasm (5.0.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
actioncable (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
actioncable (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
actionview (= 5.2.0)
|
||||
activejob (= 5.2.0)
|
||||
actionmailer (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
actionview (= 5.2.1)
|
||||
activejob (= 5.2.1)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.2.0)
|
||||
actionview (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
actionpack (5.2.1)
|
||||
actionview (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
rack (~> 2.0)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
actionview (5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
|
@ -52,24 +52,24 @@ GEM
|
|||
activemodel (>= 4.1, < 6)
|
||||
case_transform (>= 0.2)
|
||||
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
||||
activejob (5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
activejob (5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
activemodel (5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
activemodel-serializers-xml (1.0.2)
|
||||
activemodel (> 5.x)
|
||||
activesupport (> 5.x)
|
||||
builder (~> 3.1)
|
||||
activerecord (5.2.0)
|
||||
activemodel (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
activerecord (5.2.1)
|
||||
activemodel (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
arel (>= 9.0)
|
||||
activestorage (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
activerecord (= 5.2.0)
|
||||
activestorage (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
activerecord (= 5.2.1)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (5.2.0)
|
||||
activesupport (5.2.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
|
@ -100,7 +100,7 @@ GEM
|
|||
htmlentities (~> 4.3.1)
|
||||
nokogiri (>= 1.4.1)
|
||||
rubyzip (~> 1.0.0)
|
||||
bcrypt (3.1.11)
|
||||
bcrypt (3.1.12)
|
||||
bindata (2.4.3)
|
||||
bindex (0.5.0)
|
||||
bootstrap-sass (3.3.7)
|
||||
|
@ -134,7 +134,7 @@ GEM
|
|||
carrierwave-i18n (0.2.0)
|
||||
case_transform (0.2)
|
||||
activesupport
|
||||
chartkick (2.3.5)
|
||||
chartkick (3.0.1)
|
||||
childprocess (0.8.0)
|
||||
ffi (~> 1.0, >= 1.0.11)
|
||||
chunky_png (1.3.10)
|
||||
|
@ -173,7 +173,7 @@ GEM
|
|||
delayed_job (> 2.0.3)
|
||||
rack-protection (>= 1.5.5)
|
||||
sinatra (>= 1.4.4)
|
||||
devise (4.4.3)
|
||||
devise (4.5.0)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0, < 6.0)
|
||||
|
@ -205,11 +205,11 @@ GEM
|
|||
eventmachine (1.2.7)
|
||||
excon (0.62.0)
|
||||
execjs (2.7.0)
|
||||
factory_bot (4.10.0)
|
||||
factory_bot (4.11.0)
|
||||
activesupport (>= 3.0.0)
|
||||
faraday (0.12.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.9.23)
|
||||
ffi (1.9.25)
|
||||
fission (0.5.0)
|
||||
CFPropertyList (~> 2.2)
|
||||
flipflop (2.4.0)
|
||||
|
@ -420,7 +420,7 @@ GEM
|
|||
domain_name (~> 0.5)
|
||||
http_parser.rb (0.6.0)
|
||||
httpclient (2.8.3)
|
||||
i18n (1.0.1)
|
||||
i18n (1.1.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
inflecto (0.0.2)
|
||||
ipaddress (0.8.3)
|
||||
|
@ -484,7 +484,7 @@ GEM
|
|||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2016.0521)
|
||||
mimemagic (0.3.2)
|
||||
mini_mime (1.0.0)
|
||||
mini_mime (1.0.1)
|
||||
mini_portile2 (2.3.0)
|
||||
minitest (5.11.3)
|
||||
momentjs-rails (2.20.1)
|
||||
|
@ -534,7 +534,7 @@ GEM
|
|||
parser (2.5.1.2)
|
||||
ast (~> 2.4.0)
|
||||
pdf-core (0.7.0)
|
||||
pg (1.0.0)
|
||||
pg (1.1.2)
|
||||
powerpack (0.1.2)
|
||||
prawn (2.2.2)
|
||||
pdf-core (~> 0.7.0)
|
||||
|
@ -573,18 +573,18 @@ GEM
|
|||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.2.0)
|
||||
actioncable (= 5.2.0)
|
||||
actionmailer (= 5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
actionview (= 5.2.0)
|
||||
activejob (= 5.2.0)
|
||||
activemodel (= 5.2.0)
|
||||
activerecord (= 5.2.0)
|
||||
activestorage (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
rails (5.2.1)
|
||||
actioncable (= 5.2.1)
|
||||
actionmailer (= 5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
actionview (= 5.2.1)
|
||||
activejob (= 5.2.1)
|
||||
activemodel (= 5.2.1)
|
||||
activerecord (= 5.2.1)
|
||||
activestorage (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.2.0)
|
||||
railties (= 5.2.1)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.2)
|
||||
actionpack (~> 5.x, >= 5.0.1)
|
||||
|
@ -595,12 +595,12 @@ GEM
|
|||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.0.4)
|
||||
loofah (~> 2.2, >= 2.2.2)
|
||||
railties (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
railties (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
rainbow (3.0.0)
|
||||
raindrops (0.19.0)
|
||||
rake (12.3.1)
|
||||
|
@ -751,14 +751,14 @@ GEM
|
|||
timecop (0.9.1)
|
||||
trollop (2.1.2)
|
||||
ttfunk (1.5.1)
|
||||
turbolinks (5.1.1)
|
||||
turbolinks-source (~> 5.1)
|
||||
turbolinks-source (5.1.0)
|
||||
turbolinks (5.2.0)
|
||||
turbolinks-source (~> 5.2)
|
||||
turbolinks-source (5.2.0)
|
||||
typhoeus (1.3.0)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (1.2.5)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (4.1.17)
|
||||
uglifier (4.1.18)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
|
@ -774,7 +774,7 @@ GEM
|
|||
activemodel (>= 3.0.0)
|
||||
addressable
|
||||
vcr (4.0.0)
|
||||
web-console (3.6.2)
|
||||
web-console (3.7.0)
|
||||
actionview (>= 5.0)
|
||||
activemodel (>= 5.0)
|
||||
bindex (>= 0.4.0)
|
||||
|
|
|
@ -82,7 +82,11 @@ class StatsController < ApplicationController
|
|||
total = procedures.count
|
||||
last_30_days_count = procedures.where(published_at: 1.month.ago..Time.now).count
|
||||
previous_count = procedures.where(published_at: 2.months.ago..1.month.ago).count
|
||||
evolution = (((last_30_days_count.to_f / previous_count) - 1) * 100).round(0)
|
||||
if previous_count != 0
|
||||
evolution = (((last_30_days_count.to_f / previous_count) - 1) * 100).round(0)
|
||||
else
|
||||
evolution = 0
|
||||
end
|
||||
formatted_evolution = sprintf("%+d", evolution)
|
||||
|
||||
{
|
||||
|
@ -96,7 +100,11 @@ class StatsController < ApplicationController
|
|||
total = dossiers.count
|
||||
last_30_days_count = dossiers.where(en_construction_at: 1.month.ago..Time.now).count
|
||||
previous_count = dossiers.where(en_construction_at: 2.months.ago..1.month.ago).count
|
||||
evolution = (((last_30_days_count.to_f / previous_count) - 1) * 100).round(0)
|
||||
if previous_count != 0
|
||||
evolution = (((last_30_days_count.to_f / previous_count) - 1) * 100).round(0)
|
||||
else
|
||||
evolution = 0
|
||||
end
|
||||
formatted_evolution = sprintf("%+d", evolution)
|
||||
|
||||
{
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
class BaseUploader < CarrierWave::Uploader::Base
|
||||
def cache_dir
|
||||
if Rails.env.production?
|
||||
'/tmp/tps-cache'
|
||||
else
|
||||
'/tmp/tps-dev-cache'
|
||||
end
|
||||
Rails.application.secrets.carrierwave[:cache_dir]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,10 +6,10 @@ default: &default
|
|||
|
||||
development:
|
||||
<<: *default
|
||||
database: tps_development
|
||||
host: localhost
|
||||
username: tps_development
|
||||
password: tps_development
|
||||
database: <%= ENV["DB_DATABASE"] %>
|
||||
host: <%= ENV["DB_HOST"] %>
|
||||
username: <%= ENV["DB_USERNAME"] %>
|
||||
password: <%= ENV["DB_PASSWORD"] %>
|
||||
|
||||
test:
|
||||
<<: *default
|
||||
|
|
|
@ -1,14 +1,60 @@
|
|||
APP_NAME="tps_local"
|
||||
APP_HOST="localhost:3000"
|
||||
SOURCE="tps_local"
|
||||
|
||||
GITHUB_CLIENT_ID=""
|
||||
GITHUB_CLIENT_SECRET=""
|
||||
SECRET_KEY_BASE="05a2d479d8e412198dabd08ef0eee9d6e180f5cbb48661a35fd1cae287f0a93d40b5f1da08f06780d698bbd458a0ea97f730f83ee780de5d4e31f649a0130cf0"
|
||||
SIGNING_KEY="aef3153a9829fa4ba10acb02927ac855df6b92795b1ad265d654443c4b14a017"
|
||||
|
||||
DB_DATABASE="tps_development"
|
||||
DB_HOST="localhost"
|
||||
DB_POOL=""
|
||||
DB_USERNAME="tps_development"
|
||||
DB_PASSWORD="tps_development"
|
||||
|
||||
BASIC_AUTH_ENABLED="disabled"
|
||||
BASIC_AUTH_USERNAME=""
|
||||
BASIC_AUTH_PASSWORD=""
|
||||
|
||||
FOG_OPENSTACK_TENANT=""
|
||||
FOG_OPENSTACK_API_KEY=""
|
||||
FOG_OPENSTACK_USERNAME=""
|
||||
FOG_OPENSTACK_AUTH_URL=""
|
||||
FOG_OPENSTACK_REGION=""
|
||||
FOG_DIRECTORY=""
|
||||
FOG_ENABLED=""
|
||||
CARRIERWAVE_CACHE_DIR="/tmp/tps-local-cache"
|
||||
|
||||
CLEVER_CLOUD_ACCESS_KEY_ID=""
|
||||
CLEVER_CLOUD_SECRET_ACCESS_KEY=""
|
||||
CLEVER_CLOUD_BUCKET=""
|
||||
|
||||
FC_PARTICULIER_ID=""
|
||||
FC_PARTICULIER_SECRET=""
|
||||
FC_PARTICULIER_BASE_URL=""
|
||||
|
||||
GITHUB_CLIENT_ID=""
|
||||
GITHUB_CLIENT_SECRET=""
|
||||
|
||||
HELPSCOUT_MAILBOX_ID=""
|
||||
HELPSCOUT_CLIENT_ID=""
|
||||
HELPSCOUT_CLIENT_SECRET=""
|
||||
HELPSCOUT_WEBHOOK_SECRET=""
|
||||
|
||||
SENTRY_ENABLED="disabled"
|
||||
SENTRY_DSN_RAILS=""
|
||||
SENTRY_DSN_JS=""
|
||||
|
||||
MAILTRAP_ENABLED="disabled"
|
||||
MAILTRAP_USERNAME=""
|
||||
MAILTRAP_PASSWORD=""
|
||||
|
||||
MAILJET_API_KEY=""
|
||||
MAILJET_SECRET_KEY=""
|
||||
|
||||
API_ENTREPRISE_KEY=""
|
||||
API_ENTREPRISE_BASE_URL="https://entreprise.api.gouv.fr/v2"
|
||||
|
||||
PIPEDRIVE_KEY=""
|
||||
|
||||
SKYLIGHT_AUTHENTICATION_KEY=""
|
||||
|
||||
LOGRAGE_ENABLED="disabled"
|
||||
|
|
|
@ -26,7 +26,7 @@ Flipflop.configure do
|
|||
feature :remote_storage,
|
||||
default: ENV['FOG_ENABLED'] == 'enabled'
|
||||
feature :weekly_overview,
|
||||
default: Rails.env.production?
|
||||
default: ENV['APP_NAME'] == 'tps'
|
||||
end
|
||||
|
||||
feature :pre_maintenance_mode
|
||||
|
|
13
config/initializers/env_vars.rb
Normal file
13
config/initializers/env_vars.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Ensure that the environment variables defined in the reference env vars file
|
||||
# are present in the execution environment.
|
||||
#
|
||||
# This protects against an out-to-date environment leading to runtime errors.
|
||||
|
||||
if ENV['RAILS_ENV'] != 'test' && File.basename($0) != 'rake'
|
||||
reference_env_file = File.join('config', 'env.example')
|
||||
Dotenv::Environment.new(Rails.root.join(reference_env_file)).each do |key, value|
|
||||
if !ENV.key?(key.to_s)
|
||||
raise "Configuration error: `#{key}` is not present in the process’ environment variables (declared in `#{reference_env_file}`)"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -39,8 +39,9 @@ defaults: &defaults
|
|||
openstack_username: <%= ENV['FOG_OPENSTACK_USERNAME'] %>
|
||||
openstack_auth_url: <%= ENV['FOG_OPENSTACK_AUTH_URL'] %>
|
||||
openstack_region: <%= ENV['FOG_OPENSTACK_REGION'] %>
|
||||
base_url: <%= ENV['FOG_BASE_URL'] %>
|
||||
directory: <%= ENV['FOG_DIRECTORY'] %>
|
||||
carrierwave:
|
||||
cache_dir: <%= ENV['CARRIERWAVE_CACHE_DIR'] %>
|
||||
mailtrap:
|
||||
username: <%= ENV['MAILTRAP_USERNAME'] %>
|
||||
password: <%= ENV['MAILTRAP_PASSWORD'] %>
|
||||
|
@ -52,8 +53,6 @@ defaults: &defaults
|
|||
|
||||
development:
|
||||
<<: *defaults
|
||||
secret_key_base: 05a2d479d8e412198dabd08ef0eee9d6e180f5cbb48661a35fd1cae287f0a93d40b5f1da08f06780d698bbd458a0ea97f730f83ee780de5d4e31f649a0130cf0
|
||||
signing_key: aef3153a9829fa4ba10acb02927ac855df6b92795b1ad265d654443c4b14a017
|
||||
|
||||
test:
|
||||
<<: *defaults
|
||||
|
@ -62,8 +61,9 @@ test:
|
|||
api_entreprise:
|
||||
key: api_entreprise_test_key
|
||||
fog:
|
||||
base_url: https://storage.apientreprise.fr
|
||||
directory: tps_dev
|
||||
carrierwave:
|
||||
cache_dir: /tmp/tps-test-cache
|
||||
pipedrive:
|
||||
key: pipedrive_test_key
|
||||
france_connect_particulier:
|
||||
|
@ -77,5 +77,5 @@ test:
|
|||
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
production: &production
|
||||
production:
|
||||
<<: *defaults
|
||||
|
|
|
@ -6,16 +6,6 @@ describe BaseUploader do
|
|||
describe '#cache_dir' do
|
||||
subject { uploader.cache_dir }
|
||||
|
||||
context 'when rails env is not production' do
|
||||
it { is_expected.to eq '/tmp/tps-dev-cache' }
|
||||
end
|
||||
|
||||
context 'when rails env is not production' do
|
||||
before do
|
||||
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production"))
|
||||
end
|
||||
|
||||
it { is_expected.to eq '/tmp/tps-cache' }
|
||||
end
|
||||
it { is_expected.to eq '/tmp/tps-test-cache' }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue