Ruby on Rails application pour préparer et exécuter un draft
- create
properties.private
- insert
MY_URL=my.site.com
bash build.sh
docker-compose build --no-cache --force-rm
docker-compose up
docker container prune
docker volume rm pool_hockey_rails_pool_ruby_gems
https://api.rubyonrails.org/v4.2.9/classes/ActiveRecord/QueryMethods.html#method-i-where
redraft.each do |r|
k = Player.where(['season = ? AND name = ?', '2021-2022-keeper', r.name]).take
k.my_rank_position = r.my_rank_position
k.save
end
apt install libsqlite3-dev
apt install libssl-dev
- activate router rule for internal/external port 80
- open http in firewall
- stop Rails server because certbot needs port 80
certbot certonly --standalone
- activate router rule for internal/external port 80
- open http in firewall
certbot renew --dry-run
certbot renew
cd /etc/letsencrypt/live/my.site.com/
cp cert.pem /etc/ssl/private/my.site.com
cp privkey.pem /etc/ssl/private/my.site.com
problem was TERM=xterm
fix1: TERM=dumb bundle exec rails console
fix2: apt install ncurses-bin
- uncomment python
print(section_name)
and comment the stuff below - Clean section name by removing stuff after the opening bracket
Defense (useless here)
cat sections.txt | sed -n 's/\([^(]*\).*/\1/p' | sed 's/ \+$//g' | sort -u > sections_unique.txt
curl -o teams.json 'https://statsapi.web.nhl.com/api/v1/teams?expand=team.roster&season=20232024'
cat teams.json | jq -r '.teams | .[] | .roster | .roster | .[] | "\(.person.fullName);\(.position.code)"'
Make sure you end each line in the csv with a separator ;
docker exec -it CONTAINER bundle exec rails console
p = Player.where("season = ?", '2022-2023-keeper')
p.destroy
p.destroy_all
- You need to
require '/myapp/get_nhl_cap/imp.rb'
every time you change the CSV - It appears the csv file is loaded at the same time the ruby file is
require
docker compose up
docker exec -it pool_hockey_rails-web-1 /bin/bash
bin/rails generate migration AddPartNumberToProducts
bin/rake db:migrate
bin/rake db:rollback