From 48e0bf21a2c9c6f12d0ef6434d5f7d372717187e Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 29 Nov 2018 18:06:54 +0100 Subject: [PATCH 1/4] fix es_build_projects_index --- CHANGELOG.md | 2 ++ lib/tasks/fablab.rake | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0957e647..a26ed9982 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog Fab Manager +- Fix rake task fablab:es_build_projects_index for ElasticSearch > 1.7 + # v2.7.2 2018 November 29 - Allow running the ElasticSearch upgrade script while being root diff --git a/lib/tasks/fablab.rake b/lib/tasks/fablab.rake index 34ea66b98..752d5658d 100644 --- a/lib/tasks/fablab.rake +++ b/lib/tasks/fablab.rake @@ -137,12 +137,6 @@ namespace :fablab do unless client.indices.exists? index: Project.index_name Project.__elasticsearch__.create_index! force: true end - # delete doctype if exists - if client.indices.exists_type? index: Project.index_name, type: Project.document_type - client.indices.delete_mapping index: Project.index_name, type: Project.document_type - end - # create doctype - client.indices.put_mapping index: Project.index_name, type: Project.document_type, body: Project.mappings.to_hash # index requested documents if args.id From 177e087abfe5bce19e1f857d9646d705a8d11710 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 29 Nov 2018 18:19:59 +0100 Subject: [PATCH 2/4] fix yarn install in dockerfile --- CHANGELOG.md | 1 + Dockerfile | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a26ed9982..980daafd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog Fab Manager - Fix rake task fablab:es_build_projects_index for ElasticSearch > 1.7 +- Fix Dockerfile: yarn was not setup correctly # v2.7.2 2018 November 29 diff --git a/Dockerfile b/Dockerfile index d63c126cf..cf2d7db52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,8 +32,6 @@ COPY Gemfile /tmp/ COPY Gemfile.lock /tmp/ RUN bundle install --binstubs -# Run Yarn -RUN yarn install # Clean up APT when done. #RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* @@ -52,6 +50,11 @@ RUN mkdir -p /usr/src/app/tmp/pids WORKDIR /usr/src/app COPY docker/database.yml /usr/src/app/config/database.yml +COPY package.json /usr/src/app/package.json +COPY yarn.lock /usr/src/app/yarn.lock + +# Run Yarn +RUN yarn install COPY . /usr/src/app From 56a62e975c7bb2996e428ba68ba512196de44015 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 3 Dec 2018 10:22:10 +0100 Subject: [PATCH 3/4] updated uglifier with es6 support --- .rubocop.yml | 2 ++ CHANGELOG.md | 1 + Gemfile | 2 +- Gemfile.lock | 7 +++---- config/environments/production.rb | 6 ++---- config/routes.rb | 13 +++++++------ 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 262358bdc..9eb10ab14 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,3 +4,5 @@ Metrics/MethodLength: Max: 16 Style/BracesAroundHashParameters: EnforcedStyle: context_dependent +Style/RegexpLiteral: + EnforcedStyle: slashes diff --git a/CHANGELOG.md b/CHANGELOG.md index 980daafd9..1823ac370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Fix rake task fablab:es_build_projects_index for ElasticSearch > 1.7 - Fix Dockerfile: yarn was not setup correctly +- Updated Uglifier gem to support ES6 syntax # v2.7.2 2018 November 29 diff --git a/Gemfile b/Gemfile index af491f407..07dce838d 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gem 'rails', '4.2.10' gem 'sass-rails', '5.0.1' # Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' +gem 'uglifier', '>= 4.1.20' # See https://github.com/sstephenson/execjs#readme for more supported runtimes gem 'therubyracer', '= 0.12.0', platforms: :ruby diff --git a/Gemfile.lock b/Gemfile.lock index 8ff2a8124..5539afb1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -460,9 +460,8 @@ GEM tzinfo tzinfo (1.2.4) thread_safe (~> 0.1) - uglifier (2.7.1) - execjs (>= 0.3.0) - json (>= 1.8.0) + uglifier (4.1.20) + execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext unf_ext (0.0.6) @@ -564,7 +563,7 @@ DEPENDENCIES therubyracer (= 0.12.0) twitter twitter-text - uglifier (>= 1.3.0) + uglifier (>= 4.1.20) unicorn vcr web-console (~> 2.1.3) diff --git a/config/environments/production.rb b/config/environments/production.rb index 238ebcfd1..50161662a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -22,10 +22,8 @@ Rails.application.configure do # Disable Rails's static asset server (Apache or nginx will already do this). config.serve_static_files = false - # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier - # if you want disable variable name mangling - config.assets.js_compressor = Uglifier.new(mangle: false) + # Compress JavaScripts and CSS. We disable variable name mangling and enable ES6 support + config.assets.js_compressor = Uglifier.new(mangle: false, harmony: true) # config.assets.css_compressor = :sass diff --git a/config/routes.rb b/config/routes.rb index 0b4596592..9816030d7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -113,7 +113,7 @@ Rails.application.routes.draw do resources :event_themes resources :age_ranges resources :statistics, only: [:index] - resources :custom_assets, only: [:show, :create, :update] + resources :custom_assets, only: %i[show create update] resources :tags resources :stylesheets, only: [:show] resources :auth_providers do @@ -122,14 +122,15 @@ Rails.application.routes.draw do post 'send_code', action: 'send_code', on: :collection end resources :abuses, only: [:create] - resources :open_api_clients, only: [:index, :create, :update, :destroy] do + resources :open_api_clients, only: %i[index create update destroy] do patch :reset_token, on: :member end resources :price_categories resources :spaces # i18n - get 'translations/:locale/:state' => 'translations#show', :constraints => { :state => /[^\/]+/ } # allow dots in URL for 'state' + # regex allows using dots in URL for 'state' + get 'translations/:locale/:state' => 'translations#show', :constraints => { state: /[^\/]+/ } # XLSX exports get 'exports/:id/download' => 'exports#download' @@ -166,12 +167,12 @@ Rails.application.routes.draw do end end - %w(account event machine project subscription training user space).each do |path| + %w[account event machine project subscription training user space].each do |path| post "/stats/#{path}/_search", to: "api/statistics##{path}" post "/stats/#{path}/export", to: "api/statistics#export_#{path}" end - post '/stats/global/export', to: "api/statistics#export_global" - post '_search/scroll', to: "api/statistics#scroll" + post '/stats/global/export', to: 'api/statistics#export_global' + post '_search/scroll', to: 'api/statistics#scroll' match '/project_collaborator/:valid_token', to: 'api/projects#collaborator_valid', via: :get From 28f4245c1fd0d7a3dfeb27219561dbc9c0e6c814 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 3 Dec 2018 11:44:26 +0100 Subject: [PATCH 4/4] Version 2.7.3 --- CHANGELOG.md | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1823ac370..bffb14800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ # Changelog Fab Manager +# v2.7.3 2018 December 03 + +- Updated Uglifier gem to support ES6 syntax - Fix rake task fablab:es_build_projects_index for ElasticSearch > 1.7 - Fix Dockerfile: yarn was not setup correctly -- Updated Uglifier gem to support ES6 syntax +- Fix: unable to build assets # v2.7.2 2018 November 29 diff --git a/package.json b/package.json index 6b76395fc..842688ff3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "2.7.2", + "version": "2.7.3", "description": "FabManager is the FabLab management solution. It is web-based, open-source and totally free.", "keywords": [ "fablab",