WIP - Upgraded to Ruby 2.6

pull/1109/head
Rick Carlino 2019-02-07 14:35:32 -06:00
parent c2fbb77e42
commit 5f73ea6dca
6 changed files with 29 additions and 9 deletions

View File

@ -1,5 +1,5 @@
source "https://rubygems.org"
ruby "~> 2.5.0"
ruby "~> 2.6.0"
gem "active_model_serializers"
gem "bunny"

View File

@ -396,7 +396,7 @@ DEPENDENCIES
zero_downtime_migrations
RUBY VERSION
ruby 2.5.1p57
ruby 2.6.1p33
BUNDLED WITH
1.17.2

View File

@ -11,6 +11,16 @@ module Api
of the following values: %s
XYZ
# WHY 1000?:
# * This limit is placed for _technical_ reasons, not business reasons.
# * 2019 RPis + Frontend UI cannot reliably handle > 1000 points.
# * Bots with > 800 points are outliers. Most users simply don't have that
# many plants
# * An XL bot at 100% capacity and 1000 evenly space plants =
# 5 inch point grid. Smaller bed = higher resolution.
POINT_HARD_LIMIT = 10 #00 # Not allowed to exceed this.
POINT_SOFT_LIMIT = (POINT_HARD_LIMIT * 0.8).to_i
rescue_from BadPointerType do |exc|
sorry BAD_POINTER_TYPE.split(/\n+/).join(" ") % [ALL_POINTERS], 422
end
@ -29,7 +39,14 @@ module Api
end
def create
mutate pointer_klass::Create.run(raw_json, device_params)
case point_count Point.where(device_id: current_device.id).count
when (0..POINT_SOFT_LIMIT)
mutate pointer_klass::Create.run(raw_json, device_params)
when (POINT_SOFT_LIMIT..POINT_HARD_LIMIT)
raise "Do a soft warning here."
when (POINT_HARD_LIMIT..nil) # nil means Infinity
raise "Do a hard warning here."
end
end
def update
@ -55,6 +72,8 @@ module Api
# STI is the current mecahnism. The method is a relic from previous
# iterations
def pointer_klass
puts "TODO: Unify these in to a single mutation in prep for HTTP free "\
"resource creation"
case raw_json&.dig(:pointer_type)
when "GenericPointer" then Points
when "ToolSlot" then ToolSlots

View File

@ -51,11 +51,11 @@ services:
- RABBITMQ_CONFIG_FILE=/farmbot/farmbot_rmq_config
volumes:
- ./docker_volumes/rabbit:/farmbot
typescript:
<<: *base_config
<<: *rails
depends_on: ["parcel"]
command: node_modules/typescript/bin/tsc -w --noEmit
# typescript:
# <<: *base_config
# <<: *rails
# depends_on: ["parcel"]
# command: node_modules/typescript/bin/tsc -w --noEmit
parcel: # ====================
<<: *base_config
<<: *rails

View File

@ -1,4 +1,4 @@
FROM ruby:2.5
FROM ruby:2.6
# WHY: We need Postgres 10, not the default (9)
RUN wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add -
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

View File

@ -66,6 +66,7 @@ sudo docker-compose up
# shut down the server, create a database backup
# and run commands below.
git pull https://github.com/FarmBot/Farmbot-Web-App.git master
sudo docker-compose build
sudo docker-compose run web bundle install # <== ⚠ UPGRADE USERS ONLY
sudo docker-compose run web npm install # <== ⚠ UPGRADE USERS ONLY
sudo docker-compose run web rails db:migrate # <== ⚠ UPGRADE USERS ONLY