Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Release of Money Tally Application #4

Merged
merged 90 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
096baf1
chore: add initial project files
lily4178993 Jan 15, 2024
22e6c8b
test: add factories and specs for Group, Expense, and User models
lily4178993 Jan 15, 2024
860c829
chore: update routes.rb to use custom sessions controller
lily4178993 Jan 16, 2024
c8c20dc
chore: delete and add profile photo assets
lily4178993 Jan 16, 2024
d79b558
db: add confirmable module to User model
lily4178993 Jan 16, 2024
e44b469
feat: add confirmable module to User model and update default profile…
lily4178993 Jan 16, 2024
cff29b4
test: add default URL options for Action Mailer in test environment
lily4178993 Jan 16, 2024
6154216
test: add SplashController and its spec file
lily4178993 Jan 17, 2024
a04d9d2
db: update precision and scale for amount column in expenses table
lily4178993 Jan 17, 2024
322b4a8
refactor(User): Refactor profile photo default path
lily4178993 Jan 17, 2024
27fb34c
config(Devise): Update mailer sender address
lily4178993 Jan 17, 2024
66f0b64
feat: Add new SVG icons
lily4178993 Jan 17, 2024
a16abf3
routes: Update to include new and expenses actions in groups controller
lily4178993 Jan 17, 2024
c696cf9
model(Group): Add recent_groups method
lily4178993 Jan 17, 2024
9e5c1ec
model(Expense): add recent_expenses method
lily4178993 Jan 17, 2024
2664ce9
controller(Users): Add sessions controller for user authentication
lily4178993 Jan 17, 2024
fb9fba1
lint: Fix RuboCop warnings
lily4178993 Jan 17, 2024
efdba3c
Add sessions controller spec for user sign in and sign out
lily4178993 Jan 17, 2024
da494bb
feat: Add GroupsController and GroupsControllerSpec
lily4178993 Jan 18, 2024
f6cd7b6
feat: Add ExpensesController and its specs
lily4178993 Jan 18, 2024
4e34f35
lint(controllers): Fix RuboCop warnings
lily4178993 Jan 18, 2024
13915b2
refactor(ApplicationController): Update sign up params
lily4178993 Jan 18, 2024
29db959
chore: Remove unused helper and test files
lily4178993 Jan 18, 2024
c3e0644
refactor(Group): update total_groups method to count groups for a spe…
lily4178993 Jan 19, 2024
2ae9e6f
refactor(Expense): update expense calculations
lily4178993 Jan 19, 2024
8737c31
test(User): update user factory and user model specs
lily4178993 Jan 19, 2024
8a486ac
refactor(user routes): update user resource routes to restrict actions
lily4178993 Jan 19, 2024
c891542
feat(UsersController): Add UsersController with show, edit, update, a…
lily4178993 Jan 19, 2024
3124f3c
refactor(user model): update validations and add password change func…
lily4178993 Jan 19, 2024
eb3170e
refactor(user controller): improve code readability and performance
lily4178993 Jan 19, 2024
20739da
refactor: refactor expense amount precision in migration and schema
lily4178993 Jan 20, 2024
941694f
refactor: update precision and scale of amount field in expenses table
lily4178993 Jan 20, 2024
c9a669b
feat: add chartkick gem and import chartkick and Chart.bundle in appl…
lily4178993 Jan 20, 2024
0668eae
feat(Devise): Add mailer views for password change, confirmation inst…
lily4178993 Jan 20, 2024
64f82b8
feat(Menu): Add icons
lily4178993 Jan 20, 2024
8062023
feat: Add new views for expenses and groups
lily4178993 Jan 20, 2024
59e52f2
feat(Menu): add main navigation and toggle functionality
lily4178993 Jan 20, 2024
955b7e7
feat: add CSS styles
lily4178993 Jan 20, 2024
79be29f
faeat: Add splash page with sign up and log in links
lily4178993 Jan 20, 2024
f9e0466
feat: Add user profile edit and show views
lily4178993 Jan 20, 2024
72ea7b6
feat: Update application.css styles
lily4178993 Jan 20, 2024
bf7f758
Merge pull request #1 from lily4178993/features/first-release
lily4178993 Jan 20, 2024
e3d5515
chore(dependencies): Update gem versions in Gemfile.lock
lily4178993 Jan 22, 2024
c6f3056
feat(Splash screen): update layout and add styling
lily4178993 Jan 22, 2024
425b88d
feat(Splash logo): add styles
lily4178993 Jan 22, 2024
75b4312
feat(Login page): Add CSS styles
lily4178993 Jan 23, 2024
bf5c0ed
feat: Refactor forgot password form layout
lily4178993 Jan 23, 2024
37f4cf4
feat: update picture CSS style in modal content
lily4178993 Jan 23, 2024
1024447
style(Category page): Remove height property from .pictures-wrapper
lily4178993 Jan 23, 2024
ba13fff
feat: Add profile and statistics routes
lily4178993 Jan 23, 2024
5808c4c
feat(Menu): Add menuStatistic.svg and update profile photo
lily4178993 Jan 23, 2024
3fea042
refactor(Expense model): Update total_expenses method to calculate ex…
lily4178993 Jan 24, 2024
f368c71
refactor(Group model): Add before_destroy callback to destroy associa…
lily4178993 Jan 24, 2024
89a52b5
refacto(GroupsController): Add before_action for set_group and update…
lily4178993 Jan 24, 2024
2662cb6
refactor(ExpensesController): Update expense creation and deletion
lily4178993 Jan 24, 2024
33d91d2
refactor(Group view): Update group paths
lily4178993 Jan 24, 2024
e61ba9a
refactor(Expense view): Update form links
lily4178993 Jan 24, 2024
00f90e7
refactor(Group model): udpate destroy_expenses method
lily4178993 Jan 24, 2024
8a9b8ed
feat(authentication): add registrations controller to devise_for users
lily4178993 Jan 24, 2024
9cba51e
refactor(User model and User spec): remove unused methods, update def…
lily4178993 Jan 24, 2024
909b532
test(UsersController): Add Devise and Warden test helpers to rails_he…
lily4178993 Jan 24, 2024
f9268a9
feat(UserProfile): Add user profile view
lily4178993 Jan 24, 2024
f8e9af7
feat(UserStatistics): Add user statistics view
lily4178993 Jan 24, 2024
d9ab1f6
style(ProfileCard, DeleteButton): Add styles for profile card and acc…
lily4178993 Jan 24, 2024
db09bfc
feat: Add new background images and update CSS styles
lily4178993 Jan 24, 2024
b01fd58
refactor(PictureCheckboxes, CategoryPictureBox): Refactor picture che…
lily4178993 Jan 24, 2024
448d620
style(PageTitles): Update page titles and styles
lily4178993 Jan 24, 2024
021107f
style(NavigationLinks): Update main navigation links with click events
lily4178993 Jan 24, 2024
1583411
style(ExpenseCreationDate): Update expense creation date format
lily4178993 Jan 25, 2024
25172e2
test(ControllerSpecs): Fix controller specs and add missing parameters
lily4178993 Jan 25, 2024
f509e76
test(User model): Update user profile photo file extension
lily4178993 Jan 25, 2024
0f235ce
test(Group index feature): Update user profile photo and add feature …
lily4178993 Jan 25, 2024
e8af9e5
test(GroupNewFeature): Add group new feature spec
lily4178993 Jan 25, 2024
d56b526
test(group-show): Refactor group factory and add group show feature spec
lily4178993 Jan 25, 2024
a0de0a3
test(ExpenseNew): Add expense_new_spec.rb test file
lily4178993 Jan 25, 2024
198d307
test(UserProfile): Add user profile feature spec
lily4178993 Jan 25, 2024
af55729
test(UserStatistics): Add user statistics feature spec
lily4178993 Jan 25, 2024
fc68c6a
test: Add splash index feature spec
lily4178993 Jan 25, 2024
d2a8bee
refactor(Menu): Refactor menu functionality and add alert box
lily4178993 Jan 25, 2024
54154af
style(AuthPages): Update registration and login page styles
lily4178993 Jan 25, 2024
f608724
feat(Mailer): Add SMTP settings for action mailer in production envir…
lily4178993 Jan 26, 2024
08dff64
Merge pull request #2 from lily4178993/features/first-release
lily4178993 Jan 26, 2024
c21f7c8
feat: Add linux platform to Gemfile.lock
lily4178993 Jan 26, 2024
1233ef5
feat: Add require 'devise' to devise.rb
lily4178993 Jan 26, 2024
7768ddc
fix(Gemfile): Move Devise gem outside development and test group
lily4178993 Jan 26, 2024
7c2cd16
fix(Gemfile): Move Cancancan gem outside development and test group
lily4178993 Jan 26, 2024
8eb0211
feat(Mailer): Use environment variable for Action Mailer host in prod…
lily4178993 Jan 26, 2024
d6c207e
docs(README): Update with Money Tally app details and instructions
lily4178993 Jan 27, 2024
bb2e9cc
doc: Delete README.md file
lily4178993 Jan 27, 2024
55e5e71
doc: Add Money Tally README.md file
lily4178993 Jan 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.

# Ignore git directory.
/.git/

# Ignore bundler config.
/.bundle

# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all default key files.
/config/master.key
/config/credentials/*.key

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/.keep

# Ignore assets.
/node_modules/
/app/assets/builds/*
!/app/assets/builds/.keep
/public/assets
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.

# Mark the database schema as having been generated.
db/schema.rb linguist-generated

# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
config/credentials/*.yml.enc diff=rails_credentials
config/credentials.yml.enc diff=rails_credentials
44 changes: 44 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Linters

on: pull_request

env:
FORCE_COLOR: 1

jobs:
rubocop:
name: Rubocop
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-ruby@v1
with:
ruby-version: 3.1.x
- name: Setup Rubocop
run: |
gem install --no-document rubocop -v '>= 1.0, < 2.0' # https://docs.rubocop.org/en/stable/installation/
[ -f .rubocop.yml ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.rubocop.yml
- name: Rubocop Report
run: rubocop --color
stylelint:
name: Stylelint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Setup Stylelint
run: |
npm install --save-dev [email protected] [email protected] [email protected] [email protected]
[ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.stylelintrc.json
- name: Stylelint Report
run: npx stylelint "**/*.{css,scss}"
nodechecker:
name: node_modules checker
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Check node_modules existence
run: |
if [ -d "node_modules/" ]; then echo -e "\e[1;31mThe node_modules/ folder was pushed to the repo. Please remove it from the GitHub repository and try again."; echo -e "\e[1;32mYou can set up a .gitignore file with this folder included on it to prevent this from happening in the future." && exit 1; fi
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore modules
/node_modules/

# Ignore bundler config.
/.bundle

# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

/public/assets

# Ignore master key for decrypting credentials and more.
/config/master.key
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
60 changes: 60 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
AllCops:
NewCops: enable
Exclude:
- "db/**/*"
- "bin/*"
- "config/**/*"
- "Guardfile"
- "Rakefile"
- "node_modules/**/*"

DisplayCopNames: true

Layout/LineLength:
Max: 120
Metrics/MethodLength:
Include:
- "app/controllers/*"
- "app/models/*"
Max: 20
Metrics/AbcSize:
Include:
- "app/controllers/*"
- "app/models/*"
Max: 50
Metrics/ClassLength:
Max: 150
Metrics/BlockLength:
AllowedMethods: ['describe']
Max: 30

Style/Documentation:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/EachForSimpleLoop:
Enabled: false
Style/AndOr:
Enabled: false
Style/DefWithParentheses:
Enabled: false
Style/FrozenStringLiteralComment:
EnforcedStyle: never

Layout/HashAlignment:
EnforcedColonStyle: key
Layout/ExtraSpacing:
AllowForAlignment: false
Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented
Lint/RaiseException:
Enabled: false
Lint/StructNewOverride:
Enabled: false
Style/HashEachMethods:
Enabled: false
Style/HashTransformKeys:
Enabled: false
Style/HashTransformValues:
Enabled: false
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-3.2.2
32 changes: 32 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"extends": ["stylelint-config-standard"],
"plugins": ["stylelint-scss", "stylelint-csstree-validator"],
"rules": {
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": [
"tailwind",
"apply",
"variants",
"responsive",
"screen"
]
}
],
"scss/at-rule-no-unknown": [
true,
{
"ignoreAtRules": [
"tailwind",
"apply",
"variants",
"responsive",
"screen"
]
}
],
"csstree/validator": true
},
"ignoreFiles": ["build/**", "dist/**", "**/reset*.css", "**/bootstrap*.css"]
}
67 changes: 67 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# syntax = docker/dockerfile:1

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.2.2
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base

# Rails app lives here
WORKDIR /rails

# Set production environment
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development"


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build gems
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config

# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile

# Copy application code
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/

# Adjust binfiles to be executable on Linux
RUN chmod +x bin/* && \
sed -i "s/\r$//g" bin/* && \
sed -i 's/ruby\.exe$/ruby/' bin/*

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile


# Final stage for app image
FROM base

# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl libvips postgresql-client && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /rails /rails

# Run and own only the runtime files as a non-root user for security
RUN useradd rails --create-home --shell /bin/bash && \
chown -R rails:rails db log storage tmp
USER rails:rails

# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]
74 changes: 74 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
source 'https://rubygems.org'

ruby '3.2.2'

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem 'rails', '~> 7.1.2'

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem 'sprockets-rails'

# Use postgresql as the database for Active Record
gem 'pg', '~> 1.1'

# 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'

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem 'turbo-rails'

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem 'stimulus-rails'

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem 'jbuilder'

# Use RuboCop for static code analysis. Constraint: >= 1.0 and < 2.0
gem 'rubocop', '>= 1.0', '< 2.0'

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[windows jruby]

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false

# Devise is a flexible authentication solution for Rails based on Warden [https://github.com/heartcombo/devise]
gem 'devise'

# CanCanCan is an authorization library for Ruby on Rails [https://github.com/CanCanCommunity/cancancan]
gem 'cancancan'

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

gem 'chartkick'

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'debug', platforms: %i[mri windows]

# FactoryBot is a fixtures replacement with a straightforward definition syntax
gem 'factory_bot_rails'

# Shoulda Matchers provides RSpec- and Minitest-compatible one-liners to test common Rails functionality
gem 'shoulda-matchers'
end

group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem 'web-console'

# Preview email in the default browser instead of sending it
gem 'letter_opener'
end

group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem 'capybara'
gem 'rails-controller-testing'
gem 'rspec-rails'
gem 'selenium-webdriver'
end
Loading
Loading