Update and connect to drone #1

Merged
atomaka merged 11 commits from deploy into main 2023-03-08 19:25:28 -05:00
17 changed files with 215 additions and 170 deletions

46
.drone.yml Normal file
View file

@ -0,0 +1,46 @@
name: default
kind: pipeline
steps:
- name: install
image: ruby:3.2.0
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bin/bundle install --jobs=3 --retry=3
- name: autoload
image: ruby:3.2.0
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bin/rails zeitwerk:check
depends_on:
- install
- name: lint
image: ruby:3.2.0
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bin/bundle exec standardrb
depends_on:
- install
- name: test
image: ruby:3.2.0
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bin/rails assets:precompile
- bin/rails test
depends_on:
- install
volumes:
- name: bundle
temp: {}

View file

@ -1 +1 @@
3.1.2 3.2.0

50
Gemfile
View file

@ -1,71 +1,31 @@
source "https://rubygems.org" source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" } git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.2" ruby "3.2.0"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem "rails", "7.0.4.2"
gem "rails", "~> 7.0.4"
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails" gem "sprockets-rails"
gem "sqlite3"
# Use sqlite3 as the database for Active Record gem "puma"
gem "sqlite3", "~> 1.4"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails" gem "importmap-rails"
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails" gem "turbo-rails"
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails" gem "stimulus-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder" gem "jbuilder"
# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false gem "bootsnap", require: false
# Use Sass to process CSS
# gem "sassc-rails"
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2" # gem "image_processing", "~> 1.2"
group :development, :test do group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[mri mingw x64_mingw] gem "debug", platforms: %i[mri mingw x64_mingw]
end end
group :development do group :development do
# Use console on exceptions pages [https://github.com/rails/web-console] gem "standard"
gem "web-console" gem "web-console"
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
# gem "rack-mini-profiler"
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
end end
group :test do group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara" gem "capybara"
gem "selenium-webdriver" gem "selenium-webdriver"
gem "webdrivers" gem "webdrivers"

View file

@ -1,73 +1,74 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (7.0.4) actioncable (7.0.4.2)
actionpack (= 7.0.4) actionpack (= 7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (7.0.4) actionmailbox (7.0.4.2)
actionpack (= 7.0.4) actionpack (= 7.0.4.2)
activejob (= 7.0.4) activejob (= 7.0.4.2)
activerecord (= 7.0.4) activerecord (= 7.0.4.2)
activestorage (= 7.0.4) activestorage (= 7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
mail (>= 2.7.1) mail (>= 2.7.1)
net-imap net-imap
net-pop net-pop
net-smtp net-smtp
actionmailer (7.0.4) actionmailer (7.0.4.2)
actionpack (= 7.0.4) actionpack (= 7.0.4.2)
actionview (= 7.0.4) actionview (= 7.0.4.2)
activejob (= 7.0.4) activejob (= 7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
net-imap net-imap
net-pop net-pop
net-smtp net-smtp
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (7.0.4) actionpack (7.0.4.2)
actionview (= 7.0.4) actionview (= 7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
rack (~> 2.0, >= 2.2.0) rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.4) actiontext (7.0.4.2)
actionpack (= 7.0.4) actionpack (= 7.0.4.2)
activerecord (= 7.0.4) activerecord (= 7.0.4.2)
activestorage (= 7.0.4) activestorage (= 7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
globalid (>= 0.6.0) globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (7.0.4) actionview (7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.4) activejob (7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (7.0.4) activemodel (7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
activerecord (7.0.4) activerecord (7.0.4.2)
activemodel (= 7.0.4) activemodel (= 7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
activestorage (7.0.4) activestorage (7.0.4.2)
actionpack (= 7.0.4) actionpack (= 7.0.4.2)
activejob (= 7.0.4) activejob (= 7.0.4.2)
activerecord (= 7.0.4) activerecord (= 7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
marcel (~> 1.0) marcel (~> 1.0)
mini_mime (>= 1.1.0) mini_mime (>= 1.1.0)
activesupport (7.0.4) activesupport (7.0.4.2)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
tzinfo (~> 2.0) tzinfo (~> 2.0)
addressable (2.8.1) addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0) public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.14.0) bootsnap (1.14.0)
msgpack (~> 1.2) msgpack (~> 1.2)
@ -84,6 +85,7 @@ GEM
childprocess (4.1.0) childprocess (4.1.0)
concurrent-ruby (1.1.10) concurrent-ruby (1.1.10)
crass (1.0.6) crass (1.0.6)
date (3.3.3)
debug (1.6.3) debug (1.6.3)
irb (>= 1.3.6) irb (>= 1.3.6)
reline (>= 0.3.1) reline (>= 0.3.1)
@ -101,66 +103,92 @@ GEM
jbuilder (2.11.5) jbuilder (2.11.5)
actionview (>= 5.0.0) actionview (>= 5.0.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
loofah (2.19.0) json (2.6.3)
language_server-protocol (3.17.0.3)
loofah (2.19.1)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.8.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2) marcel (1.0.2)
matrix (0.4.2) matrix (0.4.2)
method_source (1.0.0) method_source (1.0.0)
mini_mime (1.1.2) mini_mime (1.1.2)
minitest (5.16.3) minitest (5.16.3)
msgpack (1.6.0) msgpack (1.6.0)
net-imap (0.3.1) net-imap (0.3.4)
date
net-protocol net-protocol
net-pop (0.1.2) net-pop (0.1.2)
net-protocol net-protocol
net-protocol (0.1.3) net-protocol (0.2.1)
timeout timeout
net-smtp (0.3.3) net-smtp (0.3.3)
net-protocol net-protocol
nio4r (2.5.8) nio4r (2.5.8)
nokogiri (1.13.9-x86_64-linux) nokogiri (1.14.2-x86_64-linux)
racc (~> 1.4) racc (~> 1.4)
parallel (1.22.1)
parser (3.2.1.1)
ast (~> 2.4.1)
public_suffix (5.0.0) public_suffix (5.0.0)
puma (5.6.5) puma (6.1.1)
nio4r (~> 2.0) nio4r (~> 2.0)
racc (1.6.0) racc (1.6.0)
rack (2.2.4) rack (2.2.4)
rack-test (2.0.2) rack-test (2.0.2)
rack (>= 1.3) rack (>= 1.3)
rails (7.0.4) rails (7.0.4.2)
actioncable (= 7.0.4) actioncable (= 7.0.4.2)
actionmailbox (= 7.0.4) actionmailbox (= 7.0.4.2)
actionmailer (= 7.0.4) actionmailer (= 7.0.4.2)
actionpack (= 7.0.4) actionpack (= 7.0.4.2)
actiontext (= 7.0.4) actiontext (= 7.0.4.2)
actionview (= 7.0.4) actionview (= 7.0.4.2)
activejob (= 7.0.4) activejob (= 7.0.4.2)
activemodel (= 7.0.4) activemodel (= 7.0.4.2)
activerecord (= 7.0.4) activerecord (= 7.0.4.2)
activestorage (= 7.0.4) activestorage (= 7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 7.0.4) railties (= 7.0.4.2)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.4.3) rails-html-sanitizer (1.5.0)
loofah (~> 2.3) loofah (~> 2.19, >= 2.19.1)
railties (7.0.4) railties (7.0.4.2)
actionpack (= 7.0.4) actionpack (= 7.0.4.2)
activesupport (= 7.0.4) activesupport (= 7.0.4.2)
method_source method_source
rake (>= 12.2) rake (>= 12.2)
thor (~> 1.0) thor (~> 1.0)
zeitwerk (~> 2.5) zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6) rake (13.0.6)
regexp_parser (2.6.1) regexp_parser (2.6.1)
reline (0.3.1) reline (0.3.1)
io-console (~> 0.5) io-console (~> 0.5)
rexml (3.2.5) rexml (3.2.5)
rubocop (1.44.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.24.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.27.0)
parser (>= 3.2.1.0)
rubocop-performance (1.15.2)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-progressbar (1.13.0)
rubyzip (2.3.2) rubyzip (2.3.2)
selenium-webdriver (4.6.1) selenium-webdriver (4.6.1)
childprocess (>= 0.5, < 5.0) childprocess (>= 0.5, < 5.0)
@ -174,19 +202,24 @@ GEM
actionpack (>= 5.2) actionpack (>= 5.2)
activesupport (>= 5.2) activesupport (>= 5.2)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.5.4-x86_64-linux) sqlite3 (1.6.1-x86_64-linux)
standard (1.24.3)
language_server-protocol (~> 3.17.0.2)
rubocop (= 1.44.1)
rubocop-performance (= 1.15.2)
stimulus-rails (1.1.1) stimulus-rails (1.1.1)
railties (>= 6.0.0) railties (>= 6.0.0)
tailwindcss-rails (2.0.21-x86_64-linux) tailwindcss-rails (2.0.21-x86_64-linux)
railties (>= 6.0.0) railties (>= 6.0.0)
thor (1.2.1) thor (1.2.1)
timeout (0.3.0) timeout (0.3.2)
turbo-rails (1.3.2) turbo-rails (1.4.0)
actionpack (>= 6.0.0) actionpack (>= 6.0.0)
activejob (>= 6.0.0) activejob (>= 6.0.0)
railties (>= 6.0.0) railties (>= 6.0.0)
tzinfo (2.0.5) tzinfo (2.0.5)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
web-console (4.2.0) web-console (4.2.0)
actionview (>= 6.0.0) actionview (>= 6.0.0)
activemodel (>= 6.0.0) activemodel (>= 6.0.0)
@ -213,20 +246,20 @@ DEPENDENCIES
debug debug
importmap-rails importmap-rails
jbuilder jbuilder
puma (~> 5.0) puma
rails (~> 7.0.4) rails (= 7.0.4.2)
selenium-webdriver selenium-webdriver
sprockets-rails sprockets-rails
sqlite3 (~> 1.4) sqlite3
standard
stimulus-rails stimulus-rails
tailwindcss-rails (~> 2.0) tailwindcss-rails (~> 2.0)
turbo-rails turbo-rails
tzinfo-data
web-console web-console
webdrivers webdrivers
RUBY VERSION RUBY VERSION
ruby 3.1.2p20 ruby 3.2.0p0
BUNDLED WITH BUNDLED WITH
2.3.26 2.4.7

View file

@ -58,6 +58,7 @@ class CreditCardBillsController < ApplicationController
end end
private private
# Use callbacks to share common setup or constraints between actions. # Use callbacks to share common setup or constraints between actions.
def set_credit_card_bill def set_credit_card_bill
@credit_card_bill = CreditCardBill.find(params[:id]) @credit_card_bill = CreditCardBill.find(params[:id])

View file

@ -58,6 +58,7 @@ class ExpensesController < ApplicationController
end end
private private
# Use callbacks to share common setup or constraints between actions. # Use callbacks to share common setup or constraints between actions.
def set_expense def set_expense
@expense = Expense.find(params[:id]) @expense = Expense.find(params[:id])

View file

@ -58,6 +58,7 @@ class IncomesController < ApplicationController
end end
private private
# Use callbacks to share common setup or constraints between actions. # Use callbacks to share common setup or constraints between actions.
def set_income def set_income
@income = Income.find(params[:id]) @income = Income.find(params[:id])

View file

@ -58,6 +58,7 @@ class MembersController < ApplicationController
end end
private private
# Use callbacks to share common setup or constraints between actions. # Use callbacks to share common setup or constraints between actions.
def set_member def set_member
@member = Member.find(params[:id]) @member = Member.find(params[:id])

View file

@ -3,7 +3,7 @@ class Expense < ApplicationRecord
monthly: 12, monthly: 12,
annually: 1, annually: 1,
weekly: 52, weekly: 52,
quarterly: 4, quarterly: 4
}.freeze }.freeze
enum :period, PERIOD_OCCURENCES.keys enum :period, PERIOD_OCCURENCES.keys

View file

@ -1,5 +1,5 @@
class Member < ApplicationRecord class Member < ApplicationRecord
has_many :incomes has_many :incomes, dependent: :destroy
def income def income
incomes.sum(&:amount) incomes.sum(&:amount)
@ -15,6 +15,8 @@ class Member < ApplicationRecord
def burden_percent def burden_percent
((Income.total - others_included_income) / Income.total).round(2) ((Income.total - others_included_income) / Income.total).round(2)
rescue
0
end end
def burden_amount(total_amount: Expense.monthly_total) def burden_amount(total_amount: Expense.monthly_total)

View file

@ -83,7 +83,7 @@ Rails.application.configure do
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
if ENV["RAILS_LOG_TO_STDOUT"].present? if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT) logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger) config.logger = ActiveSupport::TaggedLogging.new(logger)
end end

View file

@ -4,7 +4,7 @@
# the maximum value specified for Puma. Default is set to 5 threads for minimum # the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record. # and maximum; this matches the default thread size of Active Record.
# #
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count threads min_threads_count, max_threads_count
@ -15,7 +15,7 @@ worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
# Specifies the `port` that Puma will listen on to receive requests; default is 3000. # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
# #
port ENV.fetch("PORT") { 3000 } port ENV.fetch("PORT", 3000)
# Specifies the `environment` that Puma will run in. # Specifies the `environment` that Puma will run in.
# #