├── .gitattributes ├── .github └── workflows │ └── linters.yml ├── .gitignore ├── .rspec ├── .rubocop.yml ├── .ruby-version ├── .stylelintrc.json ├── Gemfile ├── Gemfile.lock ├── LICENSE.md ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ ├── .keep │ │ ├── food-page.png │ │ ├── home-page.png │ │ ├── log-in.png │ │ ├── public recipe.png │ │ ├── recipe-page.png │ │ ├── recipe-show.png │ │ ├── shopping-list.png │ │ └── sign-up.png │ └── stylesheets │ │ └── application.css ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ ├── foods_controller.rb │ ├── home_page_controller.rb │ ├── public_recipes_controller.rb │ ├── recipe_foods_controller.rb │ ├── recipes_controller.rb │ └── shopping_list_controller.rb ├── helpers │ ├── application_helper.rb │ └── foods_helper.rb ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── ability.rb │ ├── application_record.rb │ ├── concerns │ │ └── .keep │ ├── food.rb │ ├── recipe.rb │ ├── recipe_food.rb │ └── user.rb └── views │ ├── devise │ ├── confirmations │ │ └── new.html.erb │ ├── mailer │ │ ├── confirmation_instructions.html.erb │ │ ├── email_changed.html.erb │ │ ├── password_change.html.erb │ │ ├── reset_password_instructions.html.erb │ │ └── unlock_instructions.html.erb │ ├── passwords │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── registrations │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── sessions │ │ └── new.html.erb │ ├── shared │ │ ├── _error_messages.html.erb │ │ └── _links.html.erb │ └── unlocks │ │ └── new.html.erb │ ├── foods │ ├── index.html.erb │ └── new.html.erb │ ├── home_page │ └── index.html.erb │ ├── layouts │ ├── application.html.erb │ ├── mailer.html.erb │ └── mailer.text.erb │ ├── public_recipes │ └── index.html.erb │ ├── recipe_foods │ ├── edit.html.erb │ └── new.html.erb │ ├── recipes │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb │ ├── shared │ ├── _footer.html.erb │ └── _header.html.erb │ └── shopping_list │ └── index.html.erb ├── bin ├── bundle ├── bundle.cmd ├── rails ├── rake └── setup ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── credentials.yml.enc ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── assets.rb │ ├── content_security_policy.rb │ ├── devise.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ └── permissions_policy.rb ├── locales │ ├── devise.en.yml │ └── en.yml ├── puma.rb ├── routes.rb └── storage.yml ├── db ├── migrate │ ├── 20220411103734_devise_create_users.rb │ ├── 20220411103905_add_name_to_users.rb │ ├── 20220411132003_create_foods.rb │ ├── 20220411152448_add_role_to_users.rb │ ├── 20220412074110_create_recipes.rb │ └── 20220412175100_create_recipe_foods.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── log └── .keep ├── package-lock.json ├── package.json ├── public ├── 404.html ├── 422.html ├── 500.html ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── favicon.ico └── robots.txt ├── spec ├── models │ ├── food_spec.rb │ ├── recipe_food_spec.rb │ ├── recipe_spec.rb │ └── user_spec.rb ├── rails_helper.rb ├── spec_helper.rb └── views │ ├── foods │ └── foods_index_spec.rb │ ├── login_spec.rb │ ├── public_recipes │ └── public_recipes_index_spec.rb │ ├── recipes │ ├── recipes_index_spec.rb │ └── recipes_show_spec.rb │ └── shopping_list │ └── shopping_list_index_spec.rb ├── storage └── .keep ├── test ├── application_system_test_case.rb ├── channels │ └── application_cable │ │ └── connection_test.rb ├── controllers │ └── .keep ├── fixtures │ └── files │ │ └── .keep ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ └── .keep ├── system │ └── .keep └── test_helper.rb ├── tmp ├── .keep ├── pids │ └── .keep └── storage │ └── .keep └── vendor └── .keep /.gitattributes: -------------------------------------------------------------------------------- 1 | # See https://git-scm.com/docs/gitattributes for more about git attribute files. 2 | 3 | # Mark the database schema as having been generated. 4 | db/schema.rb linguist-generated 5 | 6 | # Mark any vendored files as having been vendored. 7 | vendor/* linguist-vendored 8 | -------------------------------------------------------------------------------- /.github/workflows/linters.yml: -------------------------------------------------------------------------------- 1 | name: Linters 2 | 3 | on: pull_request 4 | 5 | env: 6 | FORCE_COLOR: 1 7 | 8 | jobs: 9 | rubocop: 10 | name: Rubocop 11 | runs-on: ubuntu-18.04 12 | steps: 13 | - uses: actions/checkout@v2 14 | - uses: actions/setup-ruby@v1 15 | with: 16 | ruby-version: 3.0.x 17 | - name: Setup Rubocop 18 | run: | 19 | gem install --no-document rubocop -v '>= 1.0, < 2.0' # https://docs.rubocop.org/en/stable/installation/ 20 | [ -f .rubocop.yml ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.rubocop.yml 21 | - name: Rubocop Report 22 | run: rubocop --color 23 | stylelint: 24 | name: Stylelint 25 | runs-on: ubuntu-18.04 26 | steps: 27 | - uses: actions/checkout@v2 28 | - uses: actions/setup-node@v1 29 | with: 30 | node-version: "12.x" 31 | - name: Setup Stylelint 32 | run: | 33 | npm install --save-dev stylelint@13.x stylelint-scss@3.x stylelint-config-standard@21.x stylelint-csstree-validator@1.x 34 | [ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.stylelintrc.json 35 | - name: Stylelint Report 36 | run: npx stylelint "**/*.{css,scss}" 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all logfiles and tempfiles. 11 | /log/* 12 | /tmp/* 13 | !/log/.keep 14 | !/tmp/.keep 15 | 16 | # Ignore pidfiles, but keep the directory. 17 | /tmp/pids/* 18 | !/tmp/pids/ 19 | !/tmp/pids/.keep 20 | 21 | # Ignore uploaded files in development. 22 | /storage/* 23 | !/storage/.keep 24 | /tmp/storage/* 25 | !/tmp/storage/ 26 | !/tmp/storage/.keep 27 | 28 | /public/assets 29 | 30 | # Ignore node modules 31 | /node_modules 32 | 33 | # Ignore master key for decrypting credentials and more. 34 | /config/master.key 35 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --require spec_helper 2 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | NewCops: enable 3 | Exclude: 4 | - "db/**/*" 5 | - "bin/*" 6 | - "config/**/*" 7 | - "Guardfile" 8 | - "Rakefile" 9 | - "node_modules/**/*" 10 | 11 | DisplayCopNames: true 12 | 13 | Layout/LineLength: 14 | Max: 120 15 | Metrics/MethodLength: 16 | Include: 17 | - "app/controllers/*" 18 | - "app/models/*" 19 | Max: 20 20 | Metrics/AbcSize: 21 | Include: 22 | - "app/controllers/*" 23 | - "app/models/*" 24 | Max: 50 25 | Metrics/ClassLength: 26 | Max: 150 27 | Metrics/BlockLength: 28 | IgnoredMethods: ['describe'] 29 | Max: 30 30 | 31 | Style/Documentation: 32 | Enabled: false 33 | Style/ClassAndModuleChildren: 34 | Enabled: false 35 | Style/EachForSimpleLoop: 36 | Enabled: false 37 | Style/AndOr: 38 | Enabled: false 39 | Style/DefWithParentheses: 40 | Enabled: false 41 | Style/FrozenStringLiteralComment: 42 | EnforcedStyle: always 43 | 44 | Layout/HashAlignment: 45 | EnforcedColonStyle: key 46 | Layout/ExtraSpacing: 47 | AllowForAlignment: false 48 | Layout/MultilineMethodCallIndentation: 49 | Enabled: true 50 | EnforcedStyle: indented 51 | Lint/RaiseException: 52 | Enabled: false 53 | Lint/StructNewOverride: 54 | Enabled: false 55 | Style/HashEachMethods: 56 | Enabled: false 57 | Style/HashTransformKeys: 58 | Enabled: false 59 | Style/HashTransformValues: 60 | Enabled: false 61 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | ruby-3.1.1 2 | -------------------------------------------------------------------------------- /.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["stylelint-config-standard"], 3 | "plugins": ["stylelint-scss", "stylelint-csstree-validator"], 4 | "rules": { 5 | "at-rule-no-unknown": null, 6 | "scss/at-rule-no-unknown": true, 7 | "csstree/validator": true 8 | }, 9 | "ignoreFiles": ["build/**", "dist/**", "**/reset*.css", "**/bootstrap*.css"] 10 | } 11 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' 4 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 5 | 6 | ruby '3.1.1' 7 | 8 | # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" 9 | gem 'rails', '~> 7.0.2', '>= 7.0.2.3' 10 | 11 | # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] 12 | gem 'sprockets-rails' 13 | 14 | # Use postgresql as the database for Active Record 15 | gem 'pg', '~> 1.1' 16 | 17 | # Use the Puma web server [https://github.com/puma/puma] 18 | gem 'puma', '~> 5.0' 19 | 20 | # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] 21 | gem 'importmap-rails' 22 | 23 | # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] 24 | gem 'turbo-rails' 25 | 26 | # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] 27 | gem 'stimulus-rails' 28 | 29 | # Build JSON APIs with ease [https://github.com/rails/jbuilder] 30 | gem 'jbuilder' 31 | 32 | # Use Redis adapter to run Action Cable in production 33 | # gem "redis", "~> 4.0" 34 | 35 | # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] 36 | # gem "kredis" 37 | 38 | # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] 39 | gem 'bcrypt', '~> 3.1.7' 40 | 41 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 42 | gem 'tzinfo-data' 43 | 44 | gem 'ffi' 45 | 46 | gem 'rails-controller-testing' 47 | 48 | # Reduces boot times through caching; required in config/boot.rb 49 | gem 'bootsnap', require: false 50 | 51 | # Add devise gem for authentication 52 | 53 | gem 'devise' 54 | 55 | # Add cancancan for authorization 56 | 57 | gem 'cancancan', '~> 3.3' 58 | 59 | # font-awesome 60 | 61 | gem 'font-awesome-rails' 62 | 63 | # Use Sass to process CSS 64 | # gem "sassc-rails" 65 | 66 | # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] 67 | # gem "image_processing", "~> 1.2" 68 | 69 | # generate aoi docs 70 | 71 | gem 'rswag' 72 | 73 | # rspec core 74 | 75 | gem 'rspec-core', '~> 3.4', '>= 3.4.4' 76 | 77 | group :development, :test do 78 | # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem 79 | gem 'debug', platforms: %i[mri mingw x64_mingw] 80 | 81 | # Database clearner 82 | gem 'database_cleaner' 83 | 84 | # rspec tests 85 | gem 'rspec-rails', '~> 5.0.0' 86 | end 87 | 88 | group :development do 89 | # Use console on exceptions pages [https://github.com/rails/web-console] 90 | gem 'web-console' 91 | 92 | # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] 93 | # gem "rack-mini-profiler" 94 | 95 | # Speed up commands on slow machines / big apps [https://github.com/rails/spring] 96 | # gem "spring" 97 | end 98 | 99 | group :test do 100 | # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] 101 | gem 'capybara' 102 | gem 'selenium-webdriver' 103 | gem 'webdrivers' 104 | end 105 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (7.0.2.3) 5 | actionpack (= 7.0.2.3) 6 | activesupport (= 7.0.2.3) 7 | nio4r (~> 2.0) 8 | websocket-driver (>= 0.6.1) 9 | actionmailbox (7.0.2.3) 10 | actionpack (= 7.0.2.3) 11 | activejob (= 7.0.2.3) 12 | activerecord (= 7.0.2.3) 13 | activestorage (= 7.0.2.3) 14 | activesupport (= 7.0.2.3) 15 | mail (>= 2.7.1) 16 | net-imap 17 | net-pop 18 | net-smtp 19 | actionmailer (7.0.2.3) 20 | actionpack (= 7.0.2.3) 21 | actionview (= 7.0.2.3) 22 | activejob (= 7.0.2.3) 23 | activesupport (= 7.0.2.3) 24 | mail (~> 2.5, >= 2.5.4) 25 | net-imap 26 | net-pop 27 | net-smtp 28 | rails-dom-testing (~> 2.0) 29 | actionpack (7.0.2.3) 30 | actionview (= 7.0.2.3) 31 | activesupport (= 7.0.2.3) 32 | rack (~> 2.0, >= 2.2.0) 33 | rack-test (>= 0.6.3) 34 | rails-dom-testing (~> 2.0) 35 | rails-html-sanitizer (~> 1.0, >= 1.2.0) 36 | actiontext (7.0.2.3) 37 | actionpack (= 7.0.2.3) 38 | activerecord (= 7.0.2.3) 39 | activestorage (= 7.0.2.3) 40 | activesupport (= 7.0.2.3) 41 | globalid (>= 0.6.0) 42 | nokogiri (>= 1.8.5) 43 | actionview (7.0.2.3) 44 | activesupport (= 7.0.2.3) 45 | builder (~> 3.1) 46 | erubi (~> 1.4) 47 | rails-dom-testing (~> 2.0) 48 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 49 | activejob (7.0.2.3) 50 | activesupport (= 7.0.2.3) 51 | globalid (>= 0.3.6) 52 | activemodel (7.0.2.3) 53 | activesupport (= 7.0.2.3) 54 | activerecord (7.0.2.3) 55 | activemodel (= 7.0.2.3) 56 | activesupport (= 7.0.2.3) 57 | activestorage (7.0.2.3) 58 | actionpack (= 7.0.2.3) 59 | activejob (= 7.0.2.3) 60 | activerecord (= 7.0.2.3) 61 | activesupport (= 7.0.2.3) 62 | marcel (~> 1.0) 63 | mini_mime (>= 1.1.0) 64 | activesupport (7.0.2.3) 65 | concurrent-ruby (~> 1.0, >= 1.0.2) 66 | i18n (>= 1.6, < 2) 67 | minitest (>= 5.1) 68 | tzinfo (~> 2.0) 69 | addressable (2.8.0) 70 | public_suffix (>= 2.0.2, < 5.0) 71 | bcrypt (3.1.17) 72 | bindex (0.8.1) 73 | bootsnap (1.11.1) 74 | msgpack (~> 1.2) 75 | builder (3.2.4) 76 | cancancan (3.3.0) 77 | capybara (3.36.0) 78 | addressable 79 | matrix 80 | mini_mime (>= 0.1.3) 81 | nokogiri (~> 1.8) 82 | rack (>= 1.6.0) 83 | rack-test (>= 0.6.3) 84 | regexp_parser (>= 1.5, < 3.0) 85 | xpath (~> 3.2) 86 | childprocess (4.1.0) 87 | concurrent-ruby (1.1.10) 88 | crass (1.0.6) 89 | database_cleaner (2.0.1) 90 | database_cleaner-active_record (~> 2.0.0) 91 | database_cleaner-active_record (2.0.1) 92 | activerecord (>= 5.a) 93 | database_cleaner-core (~> 2.0.0) 94 | database_cleaner-core (2.0.1) 95 | debug (1.5.0) 96 | irb (>= 1.3.6) 97 | reline (>= 0.2.7) 98 | devise (4.8.1) 99 | bcrypt (~> 3.0) 100 | orm_adapter (~> 0.1) 101 | railties (>= 4.1.0) 102 | responders 103 | warden (~> 1.2.3) 104 | diff-lcs (1.5.0) 105 | digest (3.1.0) 106 | erubi (1.10.0) 107 | ffi (1.15.5) 108 | ffi (1.15.5-x64-mingw-ucrt) 109 | font-awesome-rails (4.7.0.8) 110 | railties (>= 3.2, < 8.0) 111 | globalid (1.0.0) 112 | activesupport (>= 5.0) 113 | i18n (1.10.0) 114 | concurrent-ruby (~> 1.0) 115 | importmap-rails (1.0.3) 116 | actionpack (>= 6.0.0) 117 | railties (>= 6.0.0) 118 | io-console (0.5.11) 119 | irb (1.4.1) 120 | reline (>= 0.3.0) 121 | jbuilder (2.11.5) 122 | actionview (>= 5.0.0) 123 | activesupport (>= 5.0.0) 124 | json-schema (2.8.1) 125 | addressable (>= 2.4) 126 | loofah (2.16.0) 127 | crass (~> 1.0.2) 128 | nokogiri (>= 1.5.9) 129 | mail (2.7.1) 130 | mini_mime (>= 0.1.1) 131 | marcel (1.0.2) 132 | matrix (0.4.2) 133 | method_source (1.0.0) 134 | mini_mime (1.1.2) 135 | minitest (5.15.0) 136 | msgpack (1.5.1) 137 | net-imap (0.2.3) 138 | digest 139 | net-protocol 140 | strscan 141 | net-pop (0.1.1) 142 | digest 143 | net-protocol 144 | timeout 145 | net-protocol (0.1.3) 146 | timeout 147 | net-smtp (0.3.1) 148 | digest 149 | net-protocol 150 | timeout 151 | nio4r (2.5.8) 152 | nokogiri (1.13.3-x64-mingw-ucrt) 153 | racc (~> 1.4) 154 | nokogiri (1.13.3-x86_64-linux) 155 | racc (~> 1.4) 156 | orm_adapter (0.5.0) 157 | pg (1.3.5) 158 | pg (1.3.5-x64-mingw-ucrt) 159 | public_suffix (4.0.6) 160 | puma (5.6.4) 161 | nio4r (~> 2.0) 162 | racc (1.6.0) 163 | rack (2.2.3) 164 | rack-test (1.1.0) 165 | rack (>= 1.0, < 3) 166 | rails (7.0.2.3) 167 | actioncable (= 7.0.2.3) 168 | actionmailbox (= 7.0.2.3) 169 | actionmailer (= 7.0.2.3) 170 | actionpack (= 7.0.2.3) 171 | actiontext (= 7.0.2.3) 172 | actionview (= 7.0.2.3) 173 | activejob (= 7.0.2.3) 174 | activemodel (= 7.0.2.3) 175 | activerecord (= 7.0.2.3) 176 | activestorage (= 7.0.2.3) 177 | activesupport (= 7.0.2.3) 178 | bundler (>= 1.15.0) 179 | railties (= 7.0.2.3) 180 | rails-controller-testing (1.0.5) 181 | actionpack (>= 5.0.1.rc1) 182 | actionview (>= 5.0.1.rc1) 183 | activesupport (>= 5.0.1.rc1) 184 | rails-dom-testing (2.0.3) 185 | activesupport (>= 4.2.0) 186 | nokogiri (>= 1.6) 187 | rails-html-sanitizer (1.4.2) 188 | loofah (~> 2.3) 189 | railties (7.0.2.3) 190 | actionpack (= 7.0.2.3) 191 | activesupport (= 7.0.2.3) 192 | method_source 193 | rake (>= 12.2) 194 | thor (~> 1.0) 195 | zeitwerk (~> 2.5) 196 | rake (13.0.6) 197 | regexp_parser (2.3.0) 198 | reline (0.3.1) 199 | io-console (~> 0.5) 200 | responders (3.0.1) 201 | actionpack (>= 5.0) 202 | railties (>= 5.0) 203 | rexml (3.2.5) 204 | rspec-core (3.11.0) 205 | rspec-support (~> 3.11.0) 206 | rspec-expectations (3.11.0) 207 | diff-lcs (>= 1.2.0, < 2.0) 208 | rspec-support (~> 3.11.0) 209 | rspec-mocks (3.11.1) 210 | diff-lcs (>= 1.2.0, < 2.0) 211 | rspec-support (~> 3.11.0) 212 | rspec-rails (5.0.3) 213 | actionpack (>= 5.2) 214 | activesupport (>= 5.2) 215 | railties (>= 5.2) 216 | rspec-core (~> 3.10) 217 | rspec-expectations (~> 3.10) 218 | rspec-mocks (~> 3.10) 219 | rspec-support (~> 3.10) 220 | rspec-support (3.11.0) 221 | rswag (2.5.1) 222 | rswag-api (= 2.5.1) 223 | rswag-specs (= 2.5.1) 224 | rswag-ui (= 2.5.1) 225 | rswag-api (2.5.1) 226 | railties (>= 3.1, < 7.1) 227 | rswag-specs (2.5.1) 228 | activesupport (>= 3.1, < 7.1) 229 | json-schema (~> 2.2) 230 | railties (>= 3.1, < 7.1) 231 | rswag-ui (2.5.1) 232 | actionpack (>= 3.1, < 7.1) 233 | railties (>= 3.1, < 7.1) 234 | rubyzip (2.3.2) 235 | selenium-webdriver (4.1.0) 236 | childprocess (>= 0.5, < 5.0) 237 | rexml (~> 3.2, >= 3.2.5) 238 | rubyzip (>= 1.2.2) 239 | sprockets (4.0.3) 240 | concurrent-ruby (~> 1.0) 241 | rack (> 1, < 3) 242 | sprockets-rails (3.4.2) 243 | actionpack (>= 5.2) 244 | activesupport (>= 5.2) 245 | sprockets (>= 3.0.0) 246 | stimulus-rails (1.0.4) 247 | railties (>= 6.0.0) 248 | strscan (3.0.1) 249 | thor (1.2.1) 250 | timeout (0.2.0) 251 | turbo-rails (1.0.1) 252 | actionpack (>= 6.0.0) 253 | railties (>= 6.0.0) 254 | tzinfo (2.0.4) 255 | concurrent-ruby (~> 1.0) 256 | tzinfo-data (1.2022.1) 257 | tzinfo (>= 1.0.0) 258 | warden (1.2.9) 259 | rack (>= 2.0.9) 260 | web-console (4.2.0) 261 | actionview (>= 6.0.0) 262 | activemodel (>= 6.0.0) 263 | bindex (>= 0.4.0) 264 | railties (>= 6.0.0) 265 | webdrivers (5.0.0) 266 | nokogiri (~> 1.6) 267 | rubyzip (>= 1.3.0) 268 | selenium-webdriver (~> 4.0) 269 | websocket-driver (0.7.5) 270 | websocket-extensions (>= 0.1.0) 271 | websocket-extensions (0.1.5) 272 | xpath (3.2.0) 273 | nokogiri (~> 1.8) 274 | zeitwerk (2.5.4) 275 | 276 | PLATFORMS 277 | x64-mingw-ucrt 278 | x86_64-linux 279 | 280 | DEPENDENCIES 281 | bcrypt (~> 3.1.7) 282 | bootsnap 283 | cancancan (~> 3.3) 284 | capybara 285 | database_cleaner 286 | debug 287 | devise 288 | ffi 289 | font-awesome-rails 290 | importmap-rails 291 | jbuilder 292 | pg (~> 1.1) 293 | puma (~> 5.0) 294 | rails (~> 7.0.2, >= 7.0.2.3) 295 | rails-controller-testing 296 | rspec-core (~> 3.4, >= 3.4.4) 297 | rspec-rails (~> 5.0.0) 298 | rswag 299 | selenium-webdriver 300 | sprockets-rails 301 | stimulus-rails 302 | turbo-rails 303 | tzinfo-data 304 | web-console 305 | webdrivers 306 | 307 | RUBY VERSION 308 | ruby 3.1.1p18 309 | 310 | BUNDLED WITH 311 | 2.3.7 312 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Ranjeet Singh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://img.shields.io/badge/thecodechaser-blueviolet) 2 | 3 | # Recipe-App 4 | 5 | > The Recipe app is a classic example of a recipe website. It's a functional website that shows the list of foods and recipes and empower readers to interact with them by adding new foods and recipes. Users can access the services of the application by creatinf a new account or by login in if they already have account. 6 | 7 | ## Preview 8 | 9 | ### Home Page 10 | 11 | ![screenshot](./app/assets/images/home-page.png) 12 | 13 | ### Sign-up Page 14 | 15 | ![screenshot](./app/assets/images/sign-up.png) 16 | 17 | ### Foods Page 18 | 19 | ![screenshot](./app/assets/images/food-page.png) 20 | 21 | ### Recipe-details page 22 | 23 | ![screenshot](./app/assets/images/recipe-show.png) 24 | 25 | ### Shopping-list page 26 | 27 | ![screenshot](./app/assets/images/shopping-list.png) 28 | 29 | ## Built With 30 | 31 | - Major languages (Ruby) 32 | - Framworks (Ruby on Rails) 33 | - Testing libraries(Rspec) 34 | - Markup (HTML) 35 | - Styles (CSS, Bootstrap) 36 | 37 | ## Live version 38 | 39 | - Visit [Recipe-App](https://recipe-app-thecodechaser.herokuapp.com/) 40 | 41 | ## Getting Started 42 | 43 | To get a local copy up and running follow these simple example steps. 44 | 45 | ### Prerequisites 46 | - A text editor(preferably Visual Studio Code) 47 | 48 | ### Install 49 | - Ruby 50 | - Ruby on Rails 51 | - PostgresSQL 52 | - Rspec 53 | 54 | ### Using it Locally 55 | 56 | - Clone the project 57 | 58 | ``` 59 | git clone git@github.com:thecodechaser/recipe-app.git 60 | 61 | cd recipe-app 62 | 63 | ``` 64 | 65 | ### Setup 66 | 67 | Install gems with: 68 | 69 | ``` 70 | bundle install 71 | ``` 72 | 73 | Setup database with: 74 | 75 | ``` 76 | rails db:create 77 | rails db:migrate 78 | ``` 79 | 80 | ### Usage 81 | 82 | Start server with: 83 | 84 | ``` 85 | rails server 86 | ``` 87 | 88 | Visit http://localhost:3000/ in your browser. 89 | 90 | ### Run tests 91 | 92 | Install npm with: 93 | 94 | ``` 95 | npm i 96 | ``` 97 | 98 | Install rspec with: 99 | 100 | ``` 101 | bundle install 102 | ``` 103 | 104 | and 105 | 106 | ``` 107 | rails generate rspec:install 108 | ``` 109 | 110 | run the test with: 111 | 112 | ``` 113 | rspec spec 114 | ``` 115 | 116 | ### Open API documentation 117 | 118 | ``` 119 | Coming soon! 120 | ``` 121 | 122 | 123 | ## Visit And Open Files 124 | 125 | [Visit Repo](https://github.com/thecodechaser/recipe-app) 126 | 127 | ## Download Repo 128 | 129 | [Download Repo](https://github.com/thecodechaser/recipe-app/archive/refs/heads/main.zip) 130 | 131 | 132 | ## Authors 133 | 134 | 👤 **Ranjeet Singh** 135 | 136 | - GitHub: [@thecodechaser](https://github.com/thecodechaser) 137 | - Twitter: [@thecodechaser](https://twitter.com/thecodechaser) 138 | - LinkedIn: [thecodechaser](https://linkedin.com/in/thecodechaser) 139 | 140 | 👤 **Ritta Buyaki** 141 | 142 | - GitHub: [@Buyaki01](https://github.com/Buyaki01) 143 | - Twitter: [@BuyakiRitta](https://twitter.com/BuyakiRitta) 144 | - LinkedIn: [ritta-sweta](https://www.linkedin.com/in/ritta-sweta/) 145 | 146 | ## 🤝 Contributing 147 | 148 | Contributions, issues, and feature requests are welcome! 149 | 150 | Feel free to check the [issues page](https://github.com/thecodechaser/recipe-app/issues). 151 | 152 | ## Show your support 153 | 154 | Give a ⭐️ if you like this project! 155 | 156 | ## Acknowledgments 157 | 158 | - Inspiration: Microverse 159 | 160 | ## 📝 License 161 | 162 | This project is [MIT](./LICENSE.md) licensed. 163 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative "config/application" 5 | 6 | Rails.application.load_tasks 7 | 8 | begin 9 | require 'rspec/core/rake_task' 10 | RSpec::Core::RakeTask.new(:spec) 11 | rescue LoadError 12 | end -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/images/food-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/assets/images/food-page.png -------------------------------------------------------------------------------- /app/assets/images/home-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/assets/images/home-page.png -------------------------------------------------------------------------------- /app/assets/images/log-in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/assets/images/log-in.png -------------------------------------------------------------------------------- /app/assets/images/public recipe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/assets/images/public recipe.png -------------------------------------------------------------------------------- /app/assets/images/recipe-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/assets/images/recipe-page.png -------------------------------------------------------------------------------- /app/assets/images/recipe-show.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/assets/images/recipe-show.png -------------------------------------------------------------------------------- /app/assets/images/shopping-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/assets/images/shopping-list.png -------------------------------------------------------------------------------- /app/assets/images/sign-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/assets/images/sign-up.png -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | *= require font-awesome 3 | */ 4 | 5 | @import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap'); 6 | @import url('https://fonts.googleapis.com/css2?family=Nunito&family=Poppins&display=swap'); 7 | @import url('https://fonts.googleapis.com/css2?family=Anton&family=Nunito&family=Poppins&display=swap'); 8 | 9 | /* application-layout styles */ 10 | 11 | body { 12 | background-color: #fff; 13 | font-family: 'Poppins', sans-serif; 14 | margin-top: -15px; 15 | } 16 | 17 | .notice-alert { 18 | margin-left: 30px; 19 | margin-top: 15px; 20 | color: #2276f4; 21 | font-size: 18px; 22 | font-family: 'Anton', sans-serif; 23 | } 24 | 25 | .session-msg { 26 | display: flex; 27 | justify-content: end; 28 | margin: 100px 50px 50px 0; 29 | font-size: 15px; 30 | } 31 | 32 | .sign-out-btn { 33 | text-decoration: none; 34 | color: #fff; 35 | background-color: #2276f4; 36 | padding: 4px 8px; 37 | border-radius: 8px; 38 | margin-top: -3px; 39 | } 40 | 41 | .header { 42 | display: flex; 43 | justify-content: space-between; 44 | padding: 15px 50px; 45 | box-shadow: 0 5px #ededed; 46 | width: 100%; 47 | margin-top: 10px; 48 | } 49 | 50 | .logo { 51 | text-decoration: none; 52 | font-size: 20px; 53 | font-weight: bold; 54 | } 55 | 56 | .menu-optns { 57 | display: flex; 58 | } 59 | 60 | .nav-link { 61 | font-size: 17px; 62 | } 63 | 64 | .nav-link:hover { 65 | font-weight: 600; 66 | } 67 | 68 | .footer { 69 | display: flex; 70 | justify-content: center; 71 | } 72 | 73 | .footer-links { 74 | text-decoration: none; 75 | font-weight: 500; 76 | font-family: 'Nunito', sans-serif; 77 | } 78 | 79 | /* users sessions styles */ 80 | 81 | .session-h2 { 82 | color: #2276f4; 83 | } 84 | 85 | .session-c { 86 | display: flex; 87 | flex-direction: column; 88 | align-items: center; 89 | } 90 | 91 | .session-btn { 92 | background-color: #2276f4; 93 | border: none; 94 | padding: 10px 20px; 95 | border-radius: 5px; 96 | color: #fff; 97 | margin-top: 20px; 98 | } 99 | 100 | /* home-page styles */ 101 | 102 | .home-c { 103 | display: flex; 104 | flex-direction: column; 105 | align-items: center; 106 | margin: 20px 100px; 107 | margin-top: 70px; 108 | } 109 | 110 | .home-h1 { 111 | font-size: 35px; 112 | color: #2276f4; 113 | } 114 | 115 | .home-p { 116 | margin-top: 50px; 117 | } 118 | 119 | /* foods-page styles */ 120 | 121 | .foods-c { 122 | margin-top: 70px; 123 | } 124 | 125 | .foods-h3 { 126 | text-align: center; 127 | color: #2276f4; 128 | } 129 | 130 | .food-new-btn { 131 | background-color: #2276f4; 132 | border: none; 133 | padding: 10px; 134 | border-radius: 5px; 135 | margin-right: 40px; 136 | } 137 | 138 | .food-new-btn-t { 139 | color: #fff; 140 | text-decoration: none; 141 | } 142 | 143 | .food-dlt-btn { 144 | background-color: #2276f4; 145 | border: none; 146 | padding: 8px 16px; 147 | border-radius: 5px; 148 | color: #fff; 149 | } 150 | 151 | .foods-new-c { 152 | display: flex; 153 | flex-direction: column; 154 | align-items: center; 155 | } 156 | 157 | .foods-new-h3 { 158 | color: #2276f4; 159 | } 160 | 161 | .foods-new-div { 162 | margin-top: 15px; 163 | } 164 | 165 | .foods-new-btn { 166 | background-color: #2276f4; 167 | border: none; 168 | padding: 10px 20px; 169 | border-radius: 5px; 170 | color: white; 171 | margin-top: 15px; 172 | } 173 | 174 | /* recipes-page index styles */ 175 | 176 | .recipes-c { 177 | margin-top: 70px; 178 | } 179 | 180 | .recipes-desc { 181 | margin-left: 40px; 182 | } 183 | 184 | .recipes-h3 { 185 | text-align: center; 186 | color: #2276f4; 187 | } 188 | 189 | .recipe-new-btn { 190 | background-color: #2276f4; 191 | border: none; 192 | padding: 10px; 193 | border-radius: 5px; 194 | margin-right: 40px; 195 | } 196 | 197 | .recipe-new-btn-t { 198 | color: #fff; 199 | text-decoration: none; 200 | } 201 | 202 | .recipes-col { 203 | display: flex; 204 | flex-direction: column; 205 | gap: 50px; 206 | } 207 | 208 | .each-recipe-c { 209 | margin: 0 200px; 210 | display: flex; 211 | justify-content: space-between; 212 | } 213 | 214 | .recipe-dlt-btn { 215 | background-color: #2276f4; 216 | border: none; 217 | padding: 8px 16px; 218 | border-radius: 5px; 219 | color: #fff; 220 | } 221 | 222 | .each-recipe-link { 223 | text-decoration: none; 224 | color: #000; 225 | box-shadow: 5px 5px #ededed; 226 | margin: 5px 150px; 227 | padding: 20px; 228 | border: 2px solid #ededed; 229 | } 230 | 231 | /* recipes-page show styles */ 232 | 233 | .recipe-show-c { 234 | margin-top: 50px; 235 | } 236 | 237 | .recipe-show-h2 { 238 | text-align: center; 239 | color: #2276f4; 240 | } 241 | 242 | .recipe-show-d1 { 243 | margin: 10px 50px; 244 | } 245 | 246 | .recipe-show-prep-t { 247 | font-size: 20px; 248 | } 249 | 250 | .recipe-show-publcT { 251 | font-size: 20px; 252 | } 253 | 254 | .public-btn { 255 | border: none; 256 | background-color: #fff; 257 | margin: -10px 0 0 5px; 258 | } 259 | 260 | .show-cook-time, 261 | .show-steps { 262 | font-size: 20px; 263 | margin: 15px 45px; 264 | } 265 | 266 | .shopping-list-btn { 267 | background-color: #2276f4; 268 | border: none; 269 | padding: 10px; 270 | border-radius: 5px; 271 | margin-left: 40px; 272 | } 273 | 274 | .shopping-list-btn-t { 275 | color: #fff; 276 | text-decoration: none; 277 | } 278 | 279 | .add-ingre-btn { 280 | background-color: #2276f4; 281 | border: none; 282 | padding: 10px; 283 | border-radius: 5px; 284 | margin-right: 40px; 285 | } 286 | 287 | .add-ingre-btn-t { 288 | color: #fff; 289 | text-decoration: none; 290 | } 291 | 292 | .show-btns { 293 | display: flex; 294 | gap: 10px; 295 | } 296 | 297 | .show-modify-btn, 298 | .show-dlt-btn { 299 | background-color: #2276f4; 300 | border: none; 301 | padding: 5px 8px; 302 | border-radius: 5px; 303 | color: #fff; 304 | text-decoration: none; 305 | } 306 | 307 | .recipes-new-c { 308 | display: flex; 309 | flex-direction: column; 310 | align-items: center; 311 | } 312 | 313 | .recipes-new-h3 { 314 | color: #2276f4; 315 | } 316 | 317 | /* public-recipes styles */ 318 | 319 | .each-public-recipe { 320 | text-decoration: none; 321 | } 322 | 323 | .public-recipe-h2 { 324 | text-align: center; 325 | color: #2276f4; 326 | } 327 | 328 | .public-recipe-2c { 329 | box-shadow: 5px 5px #ededed; 330 | margin: 50px 150px; 331 | padding: 20px 0 20px 180px; 332 | color: #000; 333 | } 334 | 335 | .public-recipe-user { 336 | margin-top: 10px; 337 | } 338 | 339 | .public-recipe-price { 340 | margin-top: 30px; 341 | } 342 | 343 | .public-recipe-2c2 { 344 | margin-left: 70px; 345 | } 346 | 347 | .public-recipe-2c:hover { 348 | color: #2276f4; 349 | } 350 | 351 | /* recipe-food-page styles */ 352 | 353 | .recipe-food-new, 354 | .recipe-food-edit { 355 | display: flex; 356 | flex-direction: column; 357 | margin: 50px 0 20px 600px; 358 | } 359 | 360 | .recipe-food-btns, 361 | .recipe-food-edit-btns { 362 | display: flex; 363 | gap: 50px; 364 | } 365 | 366 | .form-control2 { 367 | padding: 10px 48px; 368 | } 369 | 370 | .recipe-food-new-h3 { 371 | color: #2276f4; 372 | } 373 | 374 | /* shopping-list styles */ 375 | 376 | .shop-heads { 377 | color: #2276f4; 378 | } 379 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationCable 4 | class Channel < ActionCable::Channel::Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationCable 4 | class Connection < ActionCable::Connection::Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationController < ActionController::Base 4 | protect_from_forgery with: :exception 5 | 6 | before_action :update_allowed_parameters, if: :devise_controller? 7 | 8 | protected 9 | 10 | def update_allowed_parameters 11 | devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:name, :email, :password) } 12 | devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:name, :email, :password, :current_password) } 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/foods_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class FoodsController < ApplicationController 4 | def index 5 | @foods = Food.all 6 | end 7 | 8 | def new 9 | redirect_to foods_path, flash: { alert: 'Please sign up or login!' } unless current_user 10 | 11 | @food = Food.new 12 | end 13 | 14 | def create 15 | @new_food = current_user.foods.new(food_params) 16 | if @new_food.save 17 | redirect_to foods_path, flash: { alert: 'Your food is saved' } 18 | else 19 | redirect_to new_food_path, flash: { alert: 'Could not save your food' } 20 | end 21 | end 22 | 23 | def destroy 24 | @food = Food.find(params[:id]) 25 | @food.destroy! 26 | flash[:notice] = 'You have deleted the food!' 27 | redirect_to foods_path 28 | end 29 | 30 | private 31 | 32 | def food_params 33 | params.require(:food).permit(:name, :measurement_unit, :price) 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /app/controllers/home_page_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class HomePageController < ApplicationController 4 | def index; end 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/public_recipes_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class PublicRecipesController < ApplicationController 4 | def index 5 | @public_recipes = Recipe.includes(:recipe_foods, 6 | :foods).where(public: true).order(created_at: :desc).map do |public_recipe| 7 | { 8 | id: public_recipe.id, 9 | name: public_recipe.name, 10 | user: public_recipe.name, 11 | description: public_recipe.description, 12 | food_items: public_recipe.recipe_foods.count, 13 | recipe_foods: public_recipe.recipe_foods 14 | } 15 | end 16 | 17 | @total_price = [] 18 | 19 | @public_recipes.each do |public_recipe| 20 | total_price = 0 21 | 22 | public_recipe[:recipe_foods].each do |recipe_food| 23 | total_price += recipe_food.food.price * recipe_food.quantity 24 | end 25 | @total_price.push(total_price) 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /app/controllers/recipe_foods_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RecipeFoodsController < ApplicationController 4 | def new 5 | @recipe_food = RecipeFood.new 6 | @recipe_id = params[:recipe_id] 7 | end 8 | 9 | def create 10 | @recipe = Recipe.find(params[:recipe_id]) 11 | @recipe_food = @recipe.recipe_foods.create(recipe_food_params) 12 | if @recipe_food.save 13 | redirect_to recipe_path(params[:recipe_id]), flash: { alert: 'Your food is saved' } 14 | else 15 | redirect_to new_recipe_recipe_food_path, flash: { alert: 'Could not save your food' } 16 | end 17 | end 18 | 19 | def destroy 20 | @recipe_food = RecipeFood.find(params[:id]) 21 | @recipe_food.destroy! 22 | flash[:notice] = 'You have deleted the recipe food!' 23 | redirect_to recipe_path(params[:recipe_id]) 24 | end 25 | 26 | def edit 27 | @recipe_id = params[:recipe_id] 28 | end 29 | 30 | def update 31 | @recipe_food = RecipeFood.find(params[:id]) 32 | @recipe_food.update(edit_recipe_food_params) 33 | flash[:notice] = 'You have updated the recipe food successfully' 34 | redirect_to recipe_path(params[:recipe_id]) 35 | end 36 | 37 | private 38 | 39 | def edit_recipe_food_params 40 | params.require(:edit_recipe_food).permit(:quantity, :food_id) 41 | end 42 | 43 | def recipe_food_params 44 | params.require(:recipe_food).permit(:quantity, :food_id) 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /app/controllers/recipes_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RecipesController < ApplicationController 4 | def index 5 | @recipes = Recipe.all 6 | end 7 | 8 | def show 9 | @recipe = Recipe.find(params[:id]) 10 | end 11 | 12 | def new 13 | redirect_to recipes_path, flash: { alert: 'Please sign up or login!' } unless current_user 14 | 15 | @recipe = Recipe.new 16 | end 17 | 18 | def create 19 | @new_recipe = current_user.recipes.new(recipe_params) 20 | if @new_recipe.save! 21 | redirect_to recipes_path, flash: { alert: 'Your recipe is saved' } 22 | else 23 | redirect_to new_recipe_path, flash: { alert: 'Could not save your recipe' } 24 | end 25 | end 26 | 27 | def destroy 28 | @recipe = Recipe.find(params[:id]) 29 | @recipe.destroy! 30 | flash[:notice] = 'You have deleted the food!' 31 | redirect_to recipes_path 32 | end 33 | 34 | def update 35 | if current_user 36 | 37 | @recipe = Recipe.find(params[:id]) 38 | if @recipe.public 39 | @recipe.update(public: false) 40 | flash[:notice] = 'You have updated the recipe status to private' 41 | else 42 | @recipe.update(public: true) 43 | flash[:notice] = 'You have updated the recipe status to public' 44 | end 45 | redirect_to recipe_path 46 | else 47 | redirect_to recipe_path(params[:id]), flash: { alert: 'Please sign up or login!' } 48 | end 49 | end 50 | 51 | private 52 | 53 | def recipe_params 54 | params.require(:recipe).permit(:name, :prepration_time, :cooking_time, :description) 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /app/controllers/shopping_list_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ShoppingListController < ApplicationController 4 | def index 5 | @food_amount = 0 6 | 7 | current_user.recipes.each do |recipe| 8 | @food_amount += recipe.recipe_foods.count 9 | end 10 | 11 | @total_price = 0 12 | 13 | current_user.recipes.each do |recipe| 14 | recipe.recipe_foods.each do |recipe_food| 15 | @total_price += recipe_food.food.price * recipe_food.quantity 16 | end 17 | end 18 | 19 | @recipe_foods = [] 20 | 21 | current_user.recipes.each do |recipe| 22 | @recipe_foods.push(recipe.recipe_foods) 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationHelper 4 | end 5 | -------------------------------------------------------------------------------- /app/helpers/foods_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module FoodsHelper 4 | end 5 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationJob < ActiveJob::Base 4 | # Automatically retry jobs that encountered a deadlock 5 | # retry_on ActiveRecord::Deadlocked 6 | 7 | # Most jobs are safe to ignore if the underlying records are no longer available 8 | # discard_on ActiveJob::DeserializationError 9 | end 10 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationMailer < ActionMailer::Base 4 | default from: 'from@example.com' 5 | layout 'mailer' 6 | end 7 | -------------------------------------------------------------------------------- /app/models/ability.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Ability 4 | include CanCan::Ability 5 | 6 | def initialize(user) 7 | # Define abilities for the passed in user here. For example: 8 | # 9 | user ||= User.new # guest user (not logged in) 10 | can :read, :all 11 | if user.admin? :admin 12 | can :manage, :all 13 | else 14 | can :manage, Recipe, user_id: user.id 15 | can :manage, Food, user_id: user.id 16 | can :read, :all 17 | end 18 | # 19 | # The first argument to `can` is the action you are giving the user 20 | # permission to do. 21 | # If you pass :manage it will apply to every action. Other common actions 22 | # here are :read, :create, :update and :destroy. 23 | # 24 | # The second argument is the resource the user can perform the action on. 25 | # If you pass :all it will apply to every resource. Otherwise pass a Ruby 26 | # class of the resource. 27 | # 28 | # The third argument is an optional hash of conditions to further filter the 29 | # objects. 30 | # For example, here the user can only update published articles. 31 | # 32 | # can :update, Article, :published => true 33 | # 34 | # See the wiki for details: 35 | # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationRecord < ActiveRecord::Base 4 | primary_abstract_class 5 | end 6 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/food.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Food < ApplicationRecord 4 | belongs_to :user 5 | has_many :recipe_foods, dependent: :destroy 6 | has_many :recipes, through: :recipe_foods 7 | 8 | validates :name, presence: true, length: { in: 1..50 } 9 | validates :measurement_unit, presence: true, length: { in: 1..20 } 10 | validates :price, presence: true, numericality: { greater_than_or_equal_to: 1 } 11 | end 12 | -------------------------------------------------------------------------------- /app/models/recipe.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Recipe < ApplicationRecord 4 | belongs_to :user 5 | has_many :recipe_foods, dependent: :destroy 6 | has_many :foods, through: :recipe_foods 7 | 8 | validates :name, presence: true, length: { in: 1..50 } 9 | validates :prepration_time, presence: true, length: { in: 1..100 } 10 | validates :cooking_time, presence: true, length: { in: 1..100 } 11 | validates :description, presence: true, length: { in: 1..300 } 12 | end 13 | -------------------------------------------------------------------------------- /app/models/recipe_food.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RecipeFood < ApplicationRecord 4 | belongs_to :recipe 5 | belongs_to :food 6 | 7 | validates :quantity, presence: true, numericality: { greater_than_or_equal_to: 1 } 8 | end 9 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class User < ApplicationRecord 4 | has_many :foods 5 | has_many :recipes 6 | # Include default devise modules. Others available are: 7 | # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable 8 | devise :database_authenticatable, :registerable, 9 | :recoverable, :rememberable, :validatable 10 | 11 | validates :name, presence: true, length: { in: 1..50 } 12 | 13 | def admin?(requested_role) 14 | role == requested_role.to_s 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/views/devise/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend confirmation instructions

2 | 3 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= render "devise/shared/error_messages", resource: resource %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> 9 |
10 | 11 |
12 | <%= f.submit "Resend confirmation instructions" %> 13 |
14 | <% end %> 15 | 16 | <%= render "devise/shared/links" %> 17 | -------------------------------------------------------------------------------- /app/views/devise/mailer/confirmation_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome <%= @email %>!

2 | 3 |

You can confirm your account email through the link below:

4 | 5 |

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

6 | -------------------------------------------------------------------------------- /app/views/devise/mailer/email_changed.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @email %>!

2 | 3 | <% if @resource.try(:unconfirmed_email?) %> 4 |

We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.

5 | <% else %> 6 |

We're contacting you to notify you that your email has been changed to <%= @resource.email %>.

7 | <% end %> 8 | -------------------------------------------------------------------------------- /app/views/devise/mailer/password_change.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

We're contacting you to notify you that your password has been changed.

4 | -------------------------------------------------------------------------------- /app/views/devise/mailer/reset_password_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Someone has requested a link to change your password. You can do this through the link below.

4 | 5 |

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

6 | 7 |

If you didn't request this, please ignore this email.

8 |

Your password won't change until you access the link above and create a new one.

9 | -------------------------------------------------------------------------------- /app/views/devise/mailer/unlock_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

4 | 5 |

Click the link below to unlock your account:

6 | 7 |

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

8 | -------------------------------------------------------------------------------- /app/views/devise/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Change your password

2 | 3 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> 4 | <%= render "devise/shared/error_messages", resource: resource %> 5 | <%= f.hidden_field :reset_password_token %> 6 | 7 |
8 | <%= f.label :password, "New password" %>
9 | <% if @minimum_password_length %> 10 | (<%= @minimum_password_length %> characters minimum)
11 | <% end %> 12 | <%= f.password_field :password, autofocus: true, autocomplete: "new-password" %> 13 |
14 | 15 |
16 | <%= f.label :password_confirmation, "Confirm new password" %>
17 | <%= f.password_field :password_confirmation, autocomplete: "new-password" %> 18 |
19 | 20 |
21 | <%= f.submit "Change my password" %> 22 |
23 | <% end %> 24 | 25 | <%= render "devise/shared/links" %> 26 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Forgot your password?

3 | 4 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> 5 | <%= render "devise/shared/error_messages", resource: resource %> 6 | 7 |
8 | <%= f.label :email %>
9 | <%= f.email_field :email, autofocus: true, autocomplete: "email" %> 10 |
11 | 12 |
13 | <%= f.submit "Send me reset password instructions", class: "session-btn" %> 14 |
15 | <% end %> 16 | 17 | <%= render "devise/shared/links" %> 18 |
-------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Edit <%= resource_name.to_s.humanize %>

2 | 3 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> 4 | <%= render "devise/shared/error_messages", resource: resource %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true, autocomplete: "email" %> 9 |
10 | 11 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 12 |
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
13 | <% end %> 14 | 15 |
16 | <%= f.label :password %> (leave blank if you don't want to change it)
17 | <%= f.password_field :password, autocomplete: "new-password" %> 18 | <% if @minimum_password_length %> 19 |
20 | <%= @minimum_password_length %> characters minimum 21 | <% end %> 22 |
23 | 24 |
25 | <%= f.label :password_confirmation %>
26 | <%= f.password_field :password_confirmation, autocomplete: "new-password" %> 27 |
28 | 29 |
30 | <%= f.label :current_password %> (we need your current password to confirm your changes)
31 | <%= f.password_field :current_password, autocomplete: "current-password" %> 32 |
33 | 34 |
35 | <%= f.submit "Update" %> 36 |
37 | <% end %> 38 | 39 |

Cancel my account

40 | 41 |

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

42 | 43 | <%= link_to "Back", :back %> 44 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Sign up

3 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 4 | <%= render "devise/shared/error_messages", resource: resource %> 5 | 6 |
7 | <%= f.label :name %>
8 | <%= f.text_field :name %> 9 |
10 | 11 |
12 | <%= f.label :email %>
13 | <%= f.email_field :email, autofocus: true, autocomplete: "email" %> 14 |
15 | 16 |
17 | <%= f.label :password %> 18 | <% if @minimum_password_length %> 19 | (<%= @minimum_password_length %> characters minimum) 20 | <% end %>
21 | <%= f.password_field :password, autocomplete: "new-password" %> 22 |
23 | 24 |
25 | <%= f.label :password_confirmation %>
26 | <%= f.password_field :password_confirmation, autocomplete: "new-password" %> 27 |
28 | 29 |
30 | <%= f.submit "Sign up", class: "session-btn" %> 31 |
32 | <% end %> 33 | 34 | <%= render "devise/shared/links" %> 35 |
36 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Log in

3 | 4 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, autofocus: true, autocomplete: "email" %> 8 |
9 | 10 |
11 | <%= f.label :password %>
12 | <%= f.password_field :password, autocomplete: "current-password" %> 13 |
14 | 15 | <% if devise_mapping.rememberable? %> 16 |
17 | <%= f.check_box :remember_me %> 18 | <%= f.label :remember_me %> 19 |
20 | <% end %> 21 | 22 |
23 | <%= f.submit "Log in", class: "session-btn" %> 24 |
25 | <% end %> 26 | 27 | <%= render "devise/shared/links" %> 28 |
-------------------------------------------------------------------------------- /app/views/devise/shared/_error_messages.html.erb: -------------------------------------------------------------------------------- 1 | <% if resource.errors.any? %> 2 |
3 |

4 | <%= I18n.t("errors.messages.not_saved", 5 | count: resource.errors.count, 6 | resource: resource.class.model_name.human.downcase) 7 | %> 8 |

9 | 14 |
15 | <% end %> 16 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 | <%- if controller_name != 'sessions' %> 2 | <%= link_to "Log in", new_session_path(resource_name) %>
3 | <% end %> 4 | 5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end %> 8 | 9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> 10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end %> 12 | 13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end %> 16 | 17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end %> 20 | 21 | <%- if devise_mapping.omniauthable? %> 22 | <%- resource_class.omniauth_providers.each do |provider| %> 23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %>
24 | <% end %> 25 | <% end %> 26 | -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend unlock instructions

2 | 3 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= render "devise/shared/error_messages", resource: resource %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true, autocomplete: "email" %> 9 |
10 | 11 |
12 | <%= f.submit "Resend unlock instructions" %> 13 |
14 | <% end %> 15 | 16 | <%= render "devise/shared/links" %> 17 | -------------------------------------------------------------------------------- /app/views/foods/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

All Foods

3 |
4 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | <% @foods.each do |food| %> 19 | 20 | 21 | 22 | 23 | 28 | 29 | <% end %> 30 | 31 |
FoodMeasurement UnitUnit PriceActions
<%= food.name %> <%= food.measurement_unit %> $<%= food.price %> 24 | <% if can? :destroy, food %> 25 | <%= button_to "Delete", food_path(food.id ), :method => :delete, class: "food-dlt-btn" %> 26 | <% end %> 27 |
32 |
33 | -------------------------------------------------------------------------------- /app/views/foods/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Add Food

3 | <%= form_with url: foods_path, scope: :food do |form| %> 4 |
5 | <%= form.label :Name, class:"form-label" %>
6 | <%= form.text_field :name, class: 'form-control', require: true %> 7 |
8 | 9 |
10 | <%= form.label :Measurement_Unit, class:"form-label" %>
11 | <%= form.text_field :measurement_unit, class: 'form-control', require: true %> 12 |
13 | 14 |
15 | <%= form.label :Price, class:"form-label" %>
16 | <%= form.number_field :price, class: 'form-control', require: true %> 17 |
18 | 19 | <%= form.submit "Submit", class: "foods-new-btn" %> 20 | <% end %> 21 |
-------------------------------------------------------------------------------- /app/views/home_page/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 |

Welcome to Recipe App 🍔

4 |

5 | Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's 6 | standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make 7 | a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, 8 | remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing 9 | Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 10 |

11 | 12 |

13 | Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's 14 | standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make 15 | a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, 16 | remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing 17 | Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 18 |

19 |
-------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Recipe App 5 | 6 | <%= csrf_meta_tags %> 7 | <%= csp_meta_tag %> 8 | 9 | 10 | <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> 11 | <%= javascript_importmap_tags %> 12 | 13 | 14 | 15 | <%= render "shared/header" %> 16 | 17 |
18 |

<%= notice %>

19 |

<%= alert %>

20 |
21 | 22 | <%= yield %> 23 | 24 |
25 | <% if user_signed_in? %> 26 | Signed in as <%= current_user.name %>. This cannot be cheese?  <%= link_to "Sign out", destroy_user_session_path, :method => :delete, class: "sign-out-btn" %> 27 | <% else %> 28 | <%= link_to 'Register', new_user_registration_path, class: "sign-out-btn" %>  or  <%= link_to 'Sign in', new_user_session_path, class: "sign-out-btn"%> 29 | <% end %> 30 |
31 | 32 | <%= render "shared/footer" %> 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/views/public_recipes/index.html.erb: -------------------------------------------------------------------------------- 1 |

Public Recipes

2 | <% @public_recipes.each_with_index do |public_recipe, index| %> 3 | <%= link_to recipe_path(public_recipe[:id]), class: "each-public-recipe" do %> 4 |
5 |
6 |

<%= public_recipe[:name] %>

7 |

By: <%= public_recipe[:user] %>

8 |
9 |
10 |
Total food items: <%= public_recipe[:food_items] %>
11 |
Total price: $<%= @total_price[index] %>
12 |
13 |
14 | <% end %> 15 | <% end %> 16 | -------------------------------------------------------------------------------- /app/views/recipe_foods/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Add food to Recipe

3 | <%= form_with url: recipe_recipe_food_path, method: :patch, scope: :edit_recipe_food do |form| %> 4 |
- 5 |
6 | <%= form.label :food, class:"form-label" %>
7 | <%= form.select :food_id, current_user.foods.collect {|food| [food.name, food.id]},{ include_blank: true} , required: true, class:"form-select" %>
8 | 9 |
10 | 11 |
12 | <%= form.label :quantity, class:"form-label" %>
13 | <%= form.number_field :quantity , class:"form-control" , required: true, placeholder: '1', min: 1%>
14 |
15 | 16 |
17 | <%= form.submit "Update", class:"btn btn-primary form-control2" %> 18 | <%=link_to 'Back', recipe_path(@recipe_id), class:"btn btn-primary form-control2"%> 19 |
20 |
21 | <%end%> 22 |
-------------------------------------------------------------------------------- /app/views/recipe_foods/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Add food to Recipe

3 | <%= form_with url: recipe_recipe_foods_path, scope: :recipe_food do |form| %> 4 |
- 5 |
6 | <%= form.label :food, class:"form-label" %>
7 | <%= form.select :food_id, current_user.foods.collect {|food| [food.name, food.id]},{ include_blank: true} , class:"form-select" %>
8 | 9 |
10 | 11 |
12 | <%= form.label :quantity, class:"form-label" %>
13 | <%= form.number_field :quantity , class:"form-control" , required: true, placeholder: '1', min: 1%>
14 |
15 | 16 |
17 | <%= form.submit "Add", class:"btn btn-primary form-control2" %> 18 | <%=link_to 'Back', recipe_path(@recipe_id), class:"btn btn-primary form-control2"%> 19 |
20 | <%end%> 21 | 22 |
-------------------------------------------------------------------------------- /app/views/recipes/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

All Recipes

3 |
4 | 7 |
8 | 9 | 10 |
11 | <% @recipes.each do |recipe| %> 12 | <%= link_to recipe_path(recipe.id), class: "each-recipe-link" do %> 13 |
14 |
15 |

<%= recipe.name %>

16 | 17 | <% if can? :destroy, recipe %> 18 | <%= button_to "Remove", recipe_path(recipe.id ), :method => :delete, class: "recipe-dlt-btn" %> 19 | <% end %> 20 | 21 |
22 |
23 |

<%= recipe.description %>

24 |
25 |
26 | <% end %> 27 | <% end %> 28 |
29 | 30 |
-------------------------------------------------------------------------------- /app/views/recipes/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Add Recipe

3 | <%= form_with url: recipes_path, scope: :recipe do |form| %> 4 |
5 | <%= form.label :Name, class:"form-label" %>
6 | <%= form.text_field :name, class: 'form-control', require: true %> 7 |
8 | 9 |
10 | <%= form.label :Prepration_Time, class:"form-label" %>
11 | <%= form.text_field :prepration_time, class: 'form-control', require: true %> 12 |
13 | 14 |
15 | <%= form.label :Cooking_Time, class:"form-label" %>
16 | <%= form.text_field :cooking_time, class: 'form-control', require: true %> 17 |
18 | 19 |
20 | <%= form.label :Description, class:"form-label" %>
21 | <%= form.text_area :description, class: 'form-control', require: true %> 22 |
23 | 24 | <%= form.submit "Submit", class: "foods-new-btn" %> 25 | <% end %> 26 |
-------------------------------------------------------------------------------- /app/views/recipes/show.html.erb: -------------------------------------------------------------------------------- 1 | 2 |
3 |

<%= @recipe.name %>

4 | 5 |
6 |

Prepration time: <%= @recipe.prepration_time %>

7 |

Public

8 | 9 | <% if current_user.id == @recipe.user.id %> 10 | <%= button_to recipe_path(@recipe.id), :method => :patch, class: "align-self-end public-btn" do %> 11 | <% if @recipe.public %> 12 | 13 | <% else %> 14 | 15 | <% end %> 16 | <% end %> 17 | <% end %> 18 |
19 | 20 |

Cooking time: <%= @recipe.cooking_time %>

21 |

Steps goes here...

22 | 23 |
24 | <% if current_user.id == @recipe.user.id %> 25 | 28 | 31 | <% end %> 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | <% @recipe.recipe_foods.each do |recipe_food| %> 45 | 46 | 47 | 48 | 49 | 55 | 56 | <%end %> 57 | 58 |
FoodQuantityValueActions
<%= recipe_food.food.name %> <%= recipe_food.quantity %><%= recipe_food.food.measurement_unit %> $<%= recipe_food.food.price*recipe_food.quantity %> 50 | <% if can? :destroy, @recipe %> 51 | <%= link_to "Modify", edit_recipe_recipe_food_path(@recipe.id, recipe_food.id), class: "show-modify-btn" %> 52 | <%= button_to "Remove", recipe_recipe_food_path(@recipe.id, recipe_food.id), :method => :delete, class: "show-dlt-btn" %> 53 | <% end %> 54 |
59 | 60 |
-------------------------------------------------------------------------------- /app/views/shared/_footer.html.erb: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /app/views/shared/_header.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | 8 | 9 |
10 | -------------------------------------------------------------------------------- /app/views/shopping_list/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Shopping List

3 |
4 |

Amount of food items to buy: <%= @food_amount %>

5 |

Total value of food needed: $<%= @total_price %>

6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <% @recipe_foods.each do |recipe_food| %> 18 | <% recipe_food.each do |recipe_food2| %> 19 | 20 | 21 | 22 | 23 | 24 | <% end %> 25 | <%end %> 26 | 27 |
FoodQuantityPrice
<%= recipe_food2.food.name %> <%= recipe_food2.quantity %><%= recipe_food2.food.measurement_unit %> $<%= recipe_food2.food.price*recipe_food2.quantity %>
28 |
29 | 30 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'bundle' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "rubygems" 12 | 13 | m = Module.new do 14 | module_function 15 | 16 | def invoked_as_script? 17 | File.expand_path($0) == File.expand_path(__FILE__) 18 | end 19 | 20 | def env_var_version 21 | ENV["BUNDLER_VERSION"] 22 | end 23 | 24 | def cli_arg_version 25 | return unless invoked_as_script? # don't want to hijack other binstubs 26 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` 27 | bundler_version = nil 28 | update_index = nil 29 | ARGV.each_with_index do |a, i| 30 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN 31 | bundler_version = a 32 | end 33 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ 34 | bundler_version = $1 35 | update_index = i 36 | end 37 | bundler_version 38 | end 39 | 40 | def gemfile 41 | gemfile = ENV["BUNDLE_GEMFILE"] 42 | return gemfile if gemfile && !gemfile.empty? 43 | 44 | File.expand_path("../../Gemfile", __FILE__) 45 | end 46 | 47 | def lockfile 48 | lockfile = 49 | case File.basename(gemfile) 50 | when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) 51 | else "#{gemfile}.lock" 52 | end 53 | File.expand_path(lockfile) 54 | end 55 | 56 | def lockfile_version 57 | return unless File.file?(lockfile) 58 | lockfile_contents = File.read(lockfile) 59 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ 60 | Regexp.last_match(1) 61 | end 62 | 63 | def bundler_requirement 64 | @bundler_requirement ||= 65 | env_var_version || cli_arg_version || 66 | bundler_requirement_for(lockfile_version) 67 | end 68 | 69 | def bundler_requirement_for(version) 70 | return "#{Gem::Requirement.default}.a" unless version 71 | 72 | bundler_gem_version = Gem::Version.new(version) 73 | 74 | requirement = bundler_gem_version.approximate_recommendation 75 | 76 | return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0") 77 | 78 | requirement += ".a" if bundler_gem_version.prerelease? 79 | 80 | requirement 81 | end 82 | 83 | def load_bundler! 84 | ENV["BUNDLE_GEMFILE"] ||= gemfile 85 | 86 | activate_bundler 87 | end 88 | 89 | def activate_bundler 90 | gem_error = activation_error_handling do 91 | gem "bundler", bundler_requirement 92 | end 93 | return if gem_error.nil? 94 | require_error = activation_error_handling do 95 | require "bundler/version" 96 | end 97 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) 98 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" 99 | exit 42 100 | end 101 | 102 | def activation_error_handling 103 | yield 104 | nil 105 | rescue StandardError, LoadError => e 106 | e 107 | end 108 | end 109 | 110 | m.load_bundler! 111 | 112 | if m.invoked_as_script? 113 | load Gem.bin_path("bundler", "bundle") 114 | end 115 | -------------------------------------------------------------------------------- /bin/bundle.cmd: -------------------------------------------------------------------------------- 1 | @ruby -x "%~f0" %* 2 | @exit /b %ERRORLEVEL% 3 | 4 | #!/usr/bin/env ruby 5 | # frozen_string_literal: true 6 | 7 | # 8 | # This file was generated by Bundler. 9 | # 10 | # The application 'bundle' is installed as part of a gem, and 11 | # this file is here to facilitate running it. 12 | # 13 | 14 | require "rubygems" 15 | 16 | m = Module.new do 17 | module_function 18 | 19 | def invoked_as_script? 20 | File.expand_path($0) == File.expand_path(__FILE__) 21 | end 22 | 23 | def env_var_version 24 | ENV["BUNDLER_VERSION"] 25 | end 26 | 27 | def cli_arg_version 28 | return unless invoked_as_script? # don't want to hijack other binstubs 29 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` 30 | bundler_version = nil 31 | update_index = nil 32 | ARGV.each_with_index do |a, i| 33 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN 34 | bundler_version = a 35 | end 36 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ 37 | bundler_version = $1 38 | update_index = i 39 | end 40 | bundler_version 41 | end 42 | 43 | def gemfile 44 | gemfile = ENV["BUNDLE_GEMFILE"] 45 | return gemfile if gemfile && !gemfile.empty? 46 | 47 | File.expand_path("../../Gemfile", __FILE__) 48 | end 49 | 50 | def lockfile 51 | lockfile = 52 | case File.basename(gemfile) 53 | when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) 54 | else "#{gemfile}.lock" 55 | end 56 | File.expand_path(lockfile) 57 | end 58 | 59 | def lockfile_version 60 | return unless File.file?(lockfile) 61 | lockfile_contents = File.read(lockfile) 62 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ 63 | Regexp.last_match(1) 64 | end 65 | 66 | def bundler_requirement 67 | @bundler_requirement ||= 68 | env_var_version || cli_arg_version || 69 | bundler_requirement_for(lockfile_version) 70 | end 71 | 72 | def bundler_requirement_for(version) 73 | return "#{Gem::Requirement.default}.a" unless version 74 | 75 | bundler_gem_version = Gem::Version.new(version) 76 | 77 | requirement = bundler_gem_version.approximate_recommendation 78 | 79 | return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0") 80 | 81 | requirement += ".a" if bundler_gem_version.prerelease? 82 | 83 | requirement 84 | end 85 | 86 | def load_bundler! 87 | ENV["BUNDLE_GEMFILE"] ||= gemfile 88 | 89 | activate_bundler 90 | end 91 | 92 | def activate_bundler 93 | gem_error = activation_error_handling do 94 | gem "bundler", bundler_requirement 95 | end 96 | return if gem_error.nil? 97 | require_error = activation_error_handling do 98 | require "bundler/version" 99 | end 100 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) 101 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" 102 | exit 42 103 | end 104 | 105 | def activation_error_handling 106 | yield 107 | nil 108 | rescue StandardError, LoadError => e 109 | e 110 | end 111 | end 112 | 113 | m.load_bundler! 114 | 115 | if m.invoked_as_script? 116 | load Gem.bin_path("bundler", "bundle") 117 | end 118 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | APP_PATH = File.expand_path("../config/application", __dir__) 3 | require_relative "../config/boot" 4 | require "rails/commands" 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | require_relative "../config/boot" 3 | require "rake" 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | require "fileutils" 3 | 4 | # path to your application root. 5 | APP_ROOT = File.expand_path("..", __dir__) 6 | 7 | def system!(*args) 8 | system(*args) || abort("\n== Command #{args} failed ==") 9 | end 10 | 11 | FileUtils.chdir APP_ROOT do 12 | # This script is a way to set up or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at any time and get an expectable outcome. 14 | # Add necessary setup steps to this file. 15 | 16 | puts "== Installing dependencies ==" 17 | system! "gem install bundler --conservative" 18 | system("bundle check") || system!("bundle install") 19 | 20 | # puts "\n== Copying sample files ==" 21 | # unless File.exist?("config/database.yml") 22 | # FileUtils.cp "config/database.yml.sample", "config/database.yml" 23 | # end 24 | 25 | puts "\n== Preparing database ==" 26 | system! "bin/rails db:prepare" 27 | 28 | puts "\n== Removing old logs and tempfiles ==" 29 | system! "bin/rails log:clear tmp:clear" 30 | 31 | puts "\n== Restarting application server ==" 32 | system! "bin/rails restart" 33 | end 34 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file is used by Rack-based servers to start the application. 4 | 5 | require_relative 'config/environment' 6 | 7 | run Rails.application 8 | Rails.application.load_server 9 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative "boot" 2 | 3 | require "rails/all" 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module RecipeApp 10 | class Application < Rails::Application 11 | # Initialize configuration defaults for originally generated Rails version. 12 | config.load_defaults 7.0 13 | 14 | # Configuration for the application, engines, and railties goes here. 15 | # 16 | # These settings can be overridden in specific environments using the files 17 | # in config/environments, which are processed later. 18 | # 19 | # config.time_zone = "Central Time (US & Canada)" 20 | # config.eager_load_paths << Rails.root.join("extras") 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) 2 | 3 | require "bundler/setup" # Set up gems listed in the Gemfile. 4 | require "bootsnap/setup" # Speed up boot time by caching expensive operations. 5 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: recipe_app_production 11 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | Foe0SHAhhqoj10A3Y378fWduuuJkR9bqbVXhVMCZs3jKrzGdwAJdfr8FzOjoTVRrwy7hys4DZ+jQAdi4ifrECbaqDD15o9U4kb8EKzIDNbk6IqBhzQveAKJwpppAP25J73dxvNBjx64kOHqNieB5IUimKWh/4Nb3LfAWWNR9rci47vFmlEUN2B2ayTV3D3tDVZuBoHt0sXgbbjNMg1cqhJuYEu7pG3usC8JLuVm1+8eIPLa+NTs5wbg+y4KXKTMB47jOG/sNdu+7jM29sHJKXEcZBAyFpHNYLrEKoUk3rnSmzkXcxfPQXXAQknXUI9PtIz96XuktcsG3be6APmeQ3FA7LakL2iDmi9qNmzaqLll0+fj3KuZRv/TApbmzSu+GCBuYJyd6WeaPiOyjYh1u3Nr93/39a/Xuhlmj--TplFt+KjTKmf7DRF--EUXyc26+1J0yQaQseYoZyA== -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.3 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On macOS with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On macOS with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem "pg" 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | username: thecodechaser 21 | password: thecode123 22 | host: localhost 23 | # For details on connection pooling, see Rails configuration guide 24 | # https://guides.rubyonrails.org/configuring.html#database-pooling 25 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 26 | 27 | development: 28 | <<: *default 29 | database: recipe_app_development 30 | 31 | # The specified database role being used to connect to postgres. 32 | # To create additional roles in postgres see `$ createuser --help`. 33 | # When left blank, postgres will use the default role. This is 34 | # the same name as the operating system user running Rails. 35 | #username: recipe_app 36 | 37 | # The password associated with the postgres role (username). 38 | #password: 39 | 40 | # Connect on a TCP socket. Omitted by default since the client uses a 41 | # domain socket that doesn't need configuration. Windows does not have 42 | # domain sockets, so uncomment these lines. 43 | #host: localhost 44 | 45 | # The TCP port the server listens on. Defaults to 5432. 46 | # If your server runs on a different port number, change accordingly. 47 | #port: 5432 48 | 49 | # Schema search path. The server defaults to $user,public 50 | #schema_search_path: myapp,sharedapp,public 51 | 52 | # Minimum log levels, in increasing order: 53 | # debug5, debug4, debug3, debug2, debug1, 54 | # log, notice, warning, error, fatal, and panic 55 | # Defaults to warning. 56 | #min_messages: notice 57 | 58 | # Warning: The database defined as "test" will be erased and 59 | # re-generated from your development database when you run "rake". 60 | # Do not set this db to the same as development or production. 61 | test: 62 | <<: *default 63 | database: recipe_app_test 64 | 65 | # As with config/credentials.yml, you never want to store sensitive information, 66 | # like your database password, in your source code. If your source code is 67 | # ever seen by anyone, they now have access to your database. 68 | # 69 | # Instead, provide the password or a full connection URL as an environment 70 | # variable when you boot the app. For example: 71 | # 72 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 73 | # 74 | # If the connection URL is provided in the special DATABASE_URL environment 75 | # variable, Rails will automatically merge its configuration values on top of 76 | # the values provided in this file. Alternatively, you can specify a connection 77 | # URL environment variable explicitly: 78 | # 79 | # production: 80 | # url: <%= ENV["MY_APP_DATABASE_URL"] %> 81 | # 82 | # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database 83 | # for a full overview on how database connection configuration can be specified. 84 | # 85 | production: 86 | <<: *default 87 | database: recipe_app_production 88 | username: recipe_app 89 | password: <%= ENV["RECIPE_APP_DATABASE_PASSWORD"] %> 90 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative "application" 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # In the development environment your application's code is reloaded any time 7 | # it changes. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. 12 | config.eager_load = false 13 | 14 | # Show full error reports. 15 | config.consider_all_requests_local = true 16 | 17 | # Enable server timing 18 | config.server_timing = true 19 | 20 | # Enable/disable caching. By default caching is disabled. 21 | # Run rails dev:cache to toggle caching. 22 | if Rails.root.join("tmp/caching-dev.txt").exist? 23 | config.action_controller.perform_caching = true 24 | config.action_controller.enable_fragment_cache_logging = true 25 | 26 | config.cache_store = :memory_store 27 | config.public_file_server.headers = { 28 | "Cache-Control" => "public, max-age=#{2.days.to_i}" 29 | } 30 | else 31 | config.action_controller.perform_caching = false 32 | 33 | config.cache_store = :null_store 34 | end 35 | 36 | # Store uploaded files on the local file system (see config/storage.yml for options). 37 | config.active_storage.service = :local 38 | 39 | # Don't care if the mailer can't send. 40 | config.action_mailer.raise_delivery_errors = false 41 | 42 | config.action_mailer.perform_caching = false 43 | 44 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } 45 | 46 | # Print deprecation notices to the Rails logger. 47 | config.active_support.deprecation = :log 48 | 49 | # Raise exceptions for disallowed deprecations. 50 | config.active_support.disallowed_deprecation = :raise 51 | 52 | # Tell Active Support which deprecation messages to disallow. 53 | config.active_support.disallowed_deprecation_warnings = [] 54 | 55 | # Raise an error on page load if there are pending migrations. 56 | config.active_record.migration_error = :page_load 57 | 58 | # Highlight code that triggered database queries in logs. 59 | config.active_record.verbose_query_logs = true 60 | 61 | # Suppress logger output for asset requests. 62 | config.assets.quiet = true 63 | 64 | # Raises error for missing translations. 65 | # config.i18n.raise_on_missing_translations = true 66 | 67 | # Annotate rendered view with file names. 68 | # config.action_view.annotate_rendered_view_with_filenames = true 69 | 70 | # Uncomment if you wish to allow Action Cable access from any origin. 71 | # config.action_cable.disable_request_forgery_protection = true 72 | end 73 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # Code is not reloaded between requests. 7 | config.cache_classes = true 8 | 9 | # Eager load code on boot. This eager loads most of Rails and 10 | # your application in memory, allowing both threaded web servers 11 | # and those relying on copy on write to perform better. 12 | # Rake tasks automatically ignore this option for performance. 13 | config.eager_load = true 14 | 15 | # Full error reports are disabled and caching is turned on. 16 | config.consider_all_requests_local = false 17 | config.action_controller.perform_caching = true 18 | 19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 21 | # config.require_master_key = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? 26 | 27 | # Compress CSS using a preprocessor. 28 | # config.assets.css_compressor = :sass 29 | 30 | # Do not fallback to assets pipeline if a precompiled asset is missed. 31 | config.assets.compile = false 32 | 33 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 34 | # config.asset_host = "http://assets.example.com" 35 | 36 | # Specifies the header that your server uses for sending files. 37 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache 38 | # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX 39 | 40 | # Store uploaded files on the local file system (see config/storage.yml for options). 41 | config.active_storage.service = :local 42 | 43 | # Mount Action Cable outside main process or domain. 44 | # config.action_cable.mount_path = nil 45 | # config.action_cable.url = "wss://example.com/cable" 46 | # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] 47 | 48 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 49 | # config.force_ssl = true 50 | 51 | # Include generic and useful information about system operation, but avoid logging too much 52 | # information to avoid inadvertent exposure of personally identifiable information (PII). 53 | config.log_level = :info 54 | 55 | # Prepend all log lines with the following tags. 56 | config.log_tags = [ :request_id ] 57 | 58 | # Use a different cache store in production. 59 | # config.cache_store = :mem_cache_store 60 | 61 | # Use a real queuing backend for Active Job (and separate queues per environment). 62 | # config.active_job.queue_adapter = :resque 63 | # config.active_job.queue_name_prefix = "recipe_app_production" 64 | 65 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } 66 | 67 | config.action_mailer.perform_caching = false 68 | 69 | # Ignore bad email addresses and do not raise email delivery errors. 70 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 71 | # config.action_mailer.raise_delivery_errors = false 72 | 73 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 74 | # the I18n.default_locale when a translation cannot be found). 75 | config.i18n.fallbacks = true 76 | 77 | # Don't log any deprecations. 78 | config.active_support.report_deprecations = false 79 | 80 | # Use default logging formatter so that PID and timestamp are not suppressed. 81 | config.log_formatter = ::Logger::Formatter.new 82 | 83 | # Use a different logger for distributed setups. 84 | # require "syslog/logger" 85 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") 86 | 87 | if ENV["RAILS_LOG_TO_STDOUT"].present? 88 | logger = ActiveSupport::Logger.new(STDOUT) 89 | logger.formatter = config.log_formatter 90 | config.logger = ActiveSupport::TaggedLogging.new(logger) 91 | end 92 | 93 | # Do not dump schema after migrations. 94 | config.active_record.dump_schema_after_migration = false 95 | end 96 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | # The test environment is used exclusively to run your application's 4 | # test suite. You never need to work with it otherwise. Remember that 5 | # your test database is "scratch space" for the test suite and is wiped 6 | # and recreated between test runs. Don't rely on the data there! 7 | 8 | Rails.application.configure do 9 | # Settings specified here will take precedence over those in config/application.rb. 10 | 11 | # Turn false under Spring and add config.action_view.cache_template_loading = true. 12 | config.cache_classes = true 13 | 14 | # Eager loading loads your whole application. When running a single test locally, 15 | # this probably isn't necessary. It's a good idea to do in a continuous integration 16 | # system, or in some way before deploying your code. 17 | config.eager_load = ENV["CI"].present? 18 | 19 | # Configure public file server for tests with Cache-Control for performance. 20 | config.public_file_server.enabled = true 21 | config.public_file_server.headers = { 22 | "Cache-Control" => "public, max-age=#{1.hour.to_i}" 23 | } 24 | 25 | # Show full error reports and disable caching. 26 | config.consider_all_requests_local = true 27 | config.action_controller.perform_caching = false 28 | config.cache_store = :null_store 29 | 30 | # Raise exceptions instead of rendering exception templates. 31 | config.action_dispatch.show_exceptions = false 32 | 33 | # Disable request forgery protection in test environment. 34 | config.action_controller.allow_forgery_protection = false 35 | 36 | # Store uploaded files on the local file system in a temporary directory. 37 | config.active_storage.service = :test 38 | 39 | config.action_mailer.perform_caching = false 40 | 41 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } 42 | 43 | # Tell Action Mailer not to deliver emails to the real world. 44 | # The :test delivery method accumulates sent emails in the 45 | # ActionMailer::Base.deliveries array. 46 | config.action_mailer.delivery_method = :test 47 | 48 | # Print deprecation notices to the stderr. 49 | config.active_support.deprecation = :stderr 50 | 51 | # Raise exceptions for disallowed deprecations. 52 | config.active_support.disallowed_deprecation = :raise 53 | 54 | # Tell Active Support which deprecation messages to disallow. 55 | config.active_support.disallowed_deprecation_warnings = [] 56 | 57 | # Raises error for missing translations. 58 | # config.i18n.raise_on_missing_translations = true 59 | 60 | # Annotate rendered view with file names. 61 | # config.action_view.annotate_rendered_view_with_filenames = true 62 | end 63 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = "1.0" 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in the app/assets 11 | # folder are already added. 12 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 13 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy 4 | # For further information see the following documentation 5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 6 | 7 | # Rails.application.configure do 8 | # config.content_security_policy do |policy| 9 | # policy.default_src :self, :https 10 | # policy.font_src :self, :https, :data 11 | # policy.img_src :self, :https, :data 12 | # policy.object_src :none 13 | # policy.script_src :self, :https 14 | # policy.style_src :self, :https 15 | # # Specify URI for violation reports 16 | # # policy.report_uri "/csp-violation-report-endpoint" 17 | # end 18 | # 19 | # # Generate session nonces for permitted importmap and inline scripts 20 | # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } 21 | # config.content_security_policy_nonce_directives = %w(script-src) 22 | # 23 | # # Report CSP violations to a specified URI. See: 24 | # # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 25 | # # config.content_security_policy_report_only = true 26 | # end 27 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Assuming you have not yet modified this file, each configuration option below 4 | # is set to its default value. Note that some are commented out while others 5 | # are not: uncommented lines are intended to protect your configuration from 6 | # breaking changes in upgrades (i.e., in the event that future versions of 7 | # Devise change the default values for those options). 8 | # 9 | # Use this hook to configure devise mailer, warden hooks and so forth. 10 | # Many of these configuration options can be set straight in your model. 11 | Devise.setup do |config| 12 | # The secret key used by Devise. Devise uses this key to generate 13 | # random tokens. Changing this key will render invalid all existing 14 | # confirmation, reset password and unlock tokens in the database. 15 | # Devise will use the `secret_key_base` as its `secret_key` 16 | # by default. You can change it below and use your own secret key. 17 | # config.secret_key = '549c21a9ee5c0b0e76613116449765a2c707151bca4dcd35fb4fd8a23c43087f3c77b9daa473f77e1edd5afded8f56cb91238edd93db59e842f5cbbc203d0dc0' 18 | 19 | # ==> Controller configuration 20 | # Configure the parent class to the devise controllers. 21 | # config.parent_controller = 'DeviseController' 22 | 23 | # ==> Mailer Configuration 24 | # Configure the e-mail address which will be shown in Devise::Mailer, 25 | # note that it will be overwritten if you use your own mailer class 26 | # with default "from" parameter. 27 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' 28 | 29 | # Configure the class responsible to send e-mails. 30 | # config.mailer = 'Devise::Mailer' 31 | 32 | # Configure the parent class responsible to send e-mails. 33 | # config.parent_mailer = 'ActionMailer::Base' 34 | 35 | # ==> ORM configuration 36 | # Load and configure the ORM. Supports :active_record (default) and 37 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 38 | # available as additional gems. 39 | require 'devise/orm/active_record' 40 | 41 | # ==> Configuration for any authentication mechanism 42 | # Configure which keys are used when authenticating a user. The default is 43 | # just :email. You can configure it to use [:username, :subdomain], so for 44 | # authenticating a user, both parameters are required. Remember that those 45 | # parameters are used only when authenticating and not when retrieving from 46 | # session. If you need permissions, you should implement that in a before filter. 47 | # You can also supply a hash where the value is a boolean determining whether 48 | # or not authentication should be aborted when the value is not present. 49 | # config.authentication_keys = [:email] 50 | 51 | # Configure parameters from the request object used for authentication. Each entry 52 | # given should be a request method and it will automatically be passed to the 53 | # find_for_authentication method and considered in your model lookup. For instance, 54 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 55 | # The same considerations mentioned for authentication_keys also apply to request_keys. 56 | # config.request_keys = [] 57 | 58 | # Configure which authentication keys should be case-insensitive. 59 | # These keys will be downcased upon creating or modifying a user and when used 60 | # to authenticate or find a user. Default is :email. 61 | config.case_insensitive_keys = [:email] 62 | 63 | # Configure which authentication keys should have whitespace stripped. 64 | # These keys will have whitespace before and after removed upon creating or 65 | # modifying a user and when used to authenticate or find a user. Default is :email. 66 | config.strip_whitespace_keys = [:email] 67 | 68 | # Tell if authentication through request.params is enabled. True by default. 69 | # It can be set to an array that will enable params authentication only for the 70 | # given strategies, for example, `config.params_authenticatable = [:database]` will 71 | # enable it only for database (email + password) authentication. 72 | # config.params_authenticatable = true 73 | 74 | # Tell if authentication through HTTP Auth is enabled. False by default. 75 | # It can be set to an array that will enable http authentication only for the 76 | # given strategies, for example, `config.http_authenticatable = [:database]` will 77 | # enable it only for database authentication. 78 | # For API-only applications to support authentication "out-of-the-box", you will likely want to 79 | # enable this with :database unless you are using a custom strategy. 80 | # The supported strategies are: 81 | # :database = Support basic authentication with authentication key + password 82 | # config.http_authenticatable = false 83 | 84 | # If 401 status code should be returned for AJAX requests. True by default. 85 | # config.http_authenticatable_on_xhr = true 86 | 87 | # The realm used in Http Basic Authentication. 'Application' by default. 88 | # config.http_authentication_realm = 'Application' 89 | 90 | # It will change confirmation, password recovery and other workflows 91 | # to behave the same regardless if the e-mail provided was right or wrong. 92 | # Does not affect registerable. 93 | # config.paranoid = true 94 | 95 | # By default Devise will store the user in session. You can skip storage for 96 | # particular strategies by setting this option. 97 | # Notice that if you are skipping storage for all authentication paths, you 98 | # may want to disable generating routes to Devise's sessions controller by 99 | # passing skip: :sessions to `devise_for` in your config/routes.rb 100 | config.skip_session_storage = [:http_auth] 101 | 102 | # By default, Devise cleans up the CSRF token on authentication to 103 | # avoid CSRF token fixation attacks. This means that, when using AJAX 104 | # requests for sign in and sign up, you need to get a new CSRF token 105 | # from the server. You can disable this option at your own risk. 106 | # config.clean_up_csrf_token_on_authentication = true 107 | 108 | # When false, Devise will not attempt to reload routes on eager load. 109 | # This can reduce the time taken to boot the app but if your application 110 | # requires the Devise mappings to be loaded during boot time the application 111 | # won't boot properly. 112 | # config.reload_routes = true 113 | 114 | # ==> Configuration for :database_authenticatable 115 | # For bcrypt, this is the cost for hashing the password and defaults to 12. If 116 | # using other algorithms, it sets how many times you want the password to be hashed. 117 | # The number of stretches used for generating the hashed password are stored 118 | # with the hashed password. This allows you to change the stretches without 119 | # invalidating existing passwords. 120 | # 121 | # Limiting the stretches to just one in testing will increase the performance of 122 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 123 | # a value less than 10 in other environments. Note that, for bcrypt (the default 124 | # algorithm), the cost increases exponentially with the number of stretches (e.g. 125 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 126 | config.stretches = Rails.env.test? ? 1 : 12 127 | 128 | # Set up a pepper to generate the hashed password. 129 | # config.pepper = '20a1c7781b3a0bc17a225527f2956aea8a4d5e0a3da2d1ecc1f8ac5843ee18434a79db97dacd6906cbb9cd5ceb9083e3bbc8a6e60995f2c74faebcce2e8c952d' 130 | 131 | # Send a notification to the original email when the user's email is changed. 132 | # config.send_email_changed_notification = false 133 | 134 | # Send a notification email when the user's password is changed. 135 | # config.send_password_change_notification = false 136 | 137 | # ==> Configuration for :confirmable 138 | # A period that the user is allowed to access the website even without 139 | # confirming their account. For instance, if set to 2.days, the user will be 140 | # able to access the website for two days without confirming their account, 141 | # access will be blocked just in the third day. 142 | # You can also set it to nil, which will allow the user to access the website 143 | # without confirming their account. 144 | # Default is 0.days, meaning the user cannot access the website without 145 | # confirming their account. 146 | # config.allow_unconfirmed_access_for = 2.days 147 | 148 | # A period that the user is allowed to confirm their account before their 149 | # token becomes invalid. For example, if set to 3.days, the user can confirm 150 | # their account within 3 days after the mail was sent, but on the fourth day 151 | # their account can't be confirmed with the token any more. 152 | # Default is nil, meaning there is no restriction on how long a user can take 153 | # before confirming their account. 154 | # config.confirm_within = 3.days 155 | 156 | # If true, requires any email changes to be confirmed (exactly the same way as 157 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 158 | # db field (see migrations). Until confirmed, new email is stored in 159 | # unconfirmed_email column, and copied to email column on successful confirmation. 160 | config.reconfirmable = true 161 | 162 | # Defines which key will be used when confirming an account 163 | # config.confirmation_keys = [:email] 164 | 165 | # ==> Configuration for :rememberable 166 | # The time the user will be remembered without asking for credentials again. 167 | # config.remember_for = 2.weeks 168 | 169 | # Invalidates all the remember me tokens when the user signs out. 170 | config.expire_all_remember_me_on_sign_out = true 171 | 172 | # If true, extends the user's remember period when remembered via cookie. 173 | # config.extend_remember_period = false 174 | 175 | # Options to be passed to the created cookie. For instance, you can set 176 | # secure: true in order to force SSL only cookies. 177 | # config.rememberable_options = {} 178 | 179 | # ==> Configuration for :validatable 180 | # Range for password length. 181 | config.password_length = 6..128 182 | 183 | # Email regex used to validate email formats. It simply asserts that 184 | # one (and only one) @ exists in the given string. This is mainly 185 | # to give user feedback and not to assert the e-mail validity. 186 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ 187 | 188 | # ==> Configuration for :timeoutable 189 | # The time you want to timeout the user session without activity. After this 190 | # time the user will be asked for credentials again. Default is 30 minutes. 191 | # config.timeout_in = 30.minutes 192 | 193 | # ==> Configuration for :lockable 194 | # Defines which strategy will be used to lock an account. 195 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 196 | # :none = No lock strategy. You should handle locking by yourself. 197 | # config.lock_strategy = :failed_attempts 198 | 199 | # Defines which key will be used when locking and unlocking an account 200 | # config.unlock_keys = [:email] 201 | 202 | # Defines which strategy will be used to unlock an account. 203 | # :email = Sends an unlock link to the user email 204 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 205 | # :both = Enables both strategies 206 | # :none = No unlock strategy. You should handle unlocking by yourself. 207 | # config.unlock_strategy = :both 208 | 209 | # Number of authentication tries before locking an account if lock_strategy 210 | # is failed attempts. 211 | # config.maximum_attempts = 20 212 | 213 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 214 | # config.unlock_in = 1.hour 215 | 216 | # Warn on the last attempt before the account is locked. 217 | # config.last_attempt_warning = true 218 | 219 | # ==> Configuration for :recoverable 220 | # 221 | # Defines which key will be used when recovering the password for an account 222 | # config.reset_password_keys = [:email] 223 | 224 | # Time interval you can reset your password with a reset password key. 225 | # Don't put a too small interval or your users won't have the time to 226 | # change their passwords. 227 | config.reset_password_within = 6.hours 228 | 229 | # When set to false, does not sign a user in automatically after their password is 230 | # reset. Defaults to true, so a user is signed in automatically after a reset. 231 | # config.sign_in_after_reset_password = true 232 | 233 | # ==> Configuration for :encryptable 234 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default). 235 | # You can use :sha1, :sha512 or algorithms from others authentication tools as 236 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 237 | # for default behavior) and :restful_authentication_sha1 (then you should set 238 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). 239 | # 240 | # Require the `devise-encryptable` gem when using anything other than bcrypt 241 | # config.encryptor = :sha512 242 | 243 | # ==> Scopes configuration 244 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 245 | # "users/sessions/new". It's turned off by default because it's slower if you 246 | # are using only default views. 247 | # config.scoped_views = false 248 | 249 | # Configure the default scope given to Warden. By default it's the first 250 | # devise role declared in your routes (usually :user). 251 | # config.default_scope = :user 252 | 253 | # Set this configuration to false if you want /users/sign_out to sign out 254 | # only the current scope. By default, Devise signs out all scopes. 255 | # config.sign_out_all_scopes = true 256 | 257 | # ==> Navigation configuration 258 | # Lists the formats that should be treated as navigational. Formats like 259 | # :html, should redirect to the sign in page when the user does not have 260 | # access, but formats like :xml or :json, should return 401. 261 | # 262 | # If you have any extra navigational formats, like :iphone or :mobile, you 263 | # should add them to the navigational formats lists. 264 | # 265 | # The "*/*" below is required to match Internet Explorer requests. 266 | # config.navigational_formats = ['*/*', :html] 267 | 268 | # The default HTTP method used to sign out a resource. Default is :delete. 269 | config.sign_out_via = :get 270 | 271 | # ==> OmniAuth 272 | # Add a new OmniAuth provider. Check the wiki for more information on setting 273 | # up on your models and hooks. 274 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 275 | 276 | # ==> Warden configuration 277 | # If you want to use other strategies, that are not supported by Devise, or 278 | # change the failure app, you can configure them inside the config.warden block. 279 | # 280 | # config.warden do |manager| 281 | # manager.intercept_401 = false 282 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 283 | # end 284 | 285 | # ==> Mountable engine configurations 286 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 287 | # is mountable, there are some extra configurations to be taken into account. 288 | # The following options are available, assuming the engine is mounted as: 289 | # 290 | # mount MyEngine, at: '/my_engine' 291 | # 292 | # The router that invoked `devise_for`, in the example above, would be: 293 | # config.router_name = :my_engine 294 | # 295 | # When using OmniAuth, Devise cannot automatically set OmniAuth path, 296 | # so you need to do it manually. For the users scope, it would be: 297 | # config.omniauth_path_prefix = '/my_engine/users/auth' 298 | 299 | # ==> Turbolinks configuration 300 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: 301 | # 302 | # ActiveSupport.on_load(:devise_failure_app) do 303 | # include Turbolinks::Controller 304 | # end 305 | 306 | # ==> Configuration for :registerable 307 | 308 | # When set to false, does not sign a user in automatically after their password is 309 | # changed. Defaults to true, so a user is signed in automatically after changing a password. 310 | # config.sign_in_after_change_password = true 311 | end 312 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure parameters to be filtered from the log file. Use this to limit dissemination of 4 | # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported 5 | # notations and behaviors. 6 | Rails.application.config.filter_parameters += [ 7 | :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn 8 | ] 9 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, "\\1en" 8 | # inflect.singular /^(ox)en/i, "\\1" 9 | # inflect.irregular "person", "people" 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym "RESTful" 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/permissions_policy.rb: -------------------------------------------------------------------------------- 1 | # Define an application-wide HTTP permissions policy. For further 2 | # information see https://developers.google.com/web/updates/2018/06/feature-policy 3 | # 4 | # Rails.application.config.permissions_policy do |f| 5 | # f.camera :none 6 | # f.gyroscope :none 7 | # f.microphone :none 8 | # f.usb :none 9 | # f.fullscreen :self 10 | # f.payment :self, "https://secure.example.com" 11 | # end 12 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/heartcombo/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your email address has been successfully confirmed." 7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." 8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid %{authentication_keys} or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account is locked." 15 | not_found_in_database: "Invalid %{authentication_keys} or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your email address before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock instructions" 26 | email_changed: 27 | subject: "Email Changed" 28 | password_change: 29 | subject: "Password Changed" 30 | omniauth_callbacks: 31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 32 | success: "Successfully authenticated from %{kind} account." 33 | passwords: 34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." 35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." 37 | updated: "Your password has been changed successfully. You are now signed in." 38 | updated_not_active: "Your password has been changed successfully." 39 | registrations: 40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." 41 | signed_up: "Welcome! You have signed up successfully." 42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." 45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address." 46 | updated: "Your account has been updated successfully." 47 | updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again." 48 | sessions: 49 | signed_in: "Signed in successfully." 50 | signed_out: "Signed out successfully." 51 | already_signed_out: "Signed out successfully." 52 | unlocks: 53 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." 54 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." 55 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 56 | errors: 57 | messages: 58 | already_confirmed: "was already confirmed, please try signing in" 59 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 60 | expired: "has expired, please request a new one" 61 | not_found: "not found" 62 | not_locked: "was not locked" 63 | not_saved: 64 | one: "1 error prohibited this %{resource} from being saved:" 65 | other: "%{count} errors prohibited this %{resource} from being saved:" 66 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t "hello" 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t("hello") %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # "true": "foo" 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at https://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } 9 | threads min_threads_count, max_threads_count 10 | 11 | # Specifies the `worker_timeout` threshold that Puma will use to wait before 12 | # terminating a worker in development environments. 13 | # 14 | worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" 15 | 16 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 17 | # 18 | port ENV.fetch("PORT") { 3000 } 19 | 20 | # Specifies the `environment` that Puma will run in. 21 | # 22 | environment ENV.fetch("RAILS_ENV") { "development" } 23 | 24 | # Specifies the `pidfile` that Puma will use. 25 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } 26 | 27 | # Specifies the number of `workers` to boot in clustered mode. 28 | # Workers are forked web server processes. If using threads and workers together 29 | # the concurrency of the application would be max `threads` * `workers`. 30 | # Workers do not work on JRuby or Windows (both of which do not support 31 | # processes). 32 | # 33 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 34 | 35 | # Use the `preload_app!` method when specifying a `workers` number. 36 | # This directive tells Puma to first boot the application and load code 37 | # before forking the application. This takes advantage of Copy On Write 38 | # process behavior so workers use less memory. 39 | # 40 | # preload_app! 41 | 42 | # Allow puma to be restarted by `bin/rails restart` command. 43 | plugin :tmp_restart 44 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | devise_for :users 3 | resources :foods, only: [:index, :new, :create, :destroy] 4 | 5 | resources :recipes, only: [:index, :show, :new, :create, :destroy, :update] do 6 | resources :recipe_foods, only: [:new, :create, :destroy, :edit, :update] 7 | end 8 | 9 | resources :public_recipes, only: [:index] 10 | 11 | resources :shopping_list, only: [:index] 12 | # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html 13 | 14 | # Defines the root path route ("/") 15 | root "home_page#index" 16 | 17 | end 18 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket-<%= Rails.env %> 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket-<%= Rails.env %> 23 | 24 | # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name-<%= Rails.env %> 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /db/migrate/20220411103734_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DeviseCreateUsers < ActiveRecord::Migration[7.0] 4 | def change 5 | create_table :users do |t| 6 | ## Database authenticatable 7 | t.string :email, null: false, default: "" 8 | t.string :encrypted_password, null: false, default: "" 9 | 10 | ## Recoverable 11 | t.string :reset_password_token 12 | t.datetime :reset_password_sent_at 13 | 14 | ## Rememberable 15 | t.datetime :remember_created_at 16 | 17 | ## Trackable 18 | # t.integer :sign_in_count, default: 0, null: false 19 | # t.datetime :current_sign_in_at 20 | # t.datetime :last_sign_in_at 21 | # t.string :current_sign_in_ip 22 | # t.string :last_sign_in_ip 23 | 24 | ## Confirmable 25 | # t.string :confirmation_token 26 | # t.datetime :confirmed_at 27 | # t.datetime :confirmation_sent_at 28 | # t.string :unconfirmed_email # Only if using reconfirmable 29 | 30 | ## Lockable 31 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 32 | # t.string :unlock_token # Only if unlock strategy is :email or :both 33 | # t.datetime :locked_at 34 | 35 | 36 | t.timestamps null: false 37 | end 38 | 39 | add_index :users, :email, unique: true 40 | add_index :users, :reset_password_token, unique: true 41 | # add_index :users, :confirmation_token, unique: true 42 | # add_index :users, :unlock_token, unique: true 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /db/migrate/20220411103905_add_name_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddNameToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :name, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220411132003_create_foods.rb: -------------------------------------------------------------------------------- 1 | class CreateFoods < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :foods do |t| 4 | t.references :user, null: false, foreign_key: {to_table: 'users'}, index: true 5 | t.string :name 6 | t.string :measurement_unit 7 | t.decimal :price 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20220411152448_add_role_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddRoleToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :role, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220412074110_create_recipes.rb: -------------------------------------------------------------------------------- 1 | class CreateRecipes < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :recipes do |t| 4 | t.references :user, null: false, foreign_key: { to_table: 'users'}, index: true 5 | t.string :name 6 | t.string :prepration_time 7 | t.string :cooking_time 8 | t.text :description 9 | t.boolean :public, default: false 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20220412175100_create_recipe_foods.rb: -------------------------------------------------------------------------------- 1 | class CreateRecipeFoods < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :recipe_foods do |t| 4 | t.references :recipe, null: false, foreign_key: {to_table: 'recipes'}, index: true 5 | t.references :food, null: false, foreign_key: {to_table: 'foods'}, index: true 6 | t.integer :quantity, default: 1 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # This file is the source Rails uses to define your schema when running `bin/rails 6 | # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to 7 | # be faster and is potentially less error prone than running all of your 8 | # migrations from scratch. Old migrations may fail to apply correctly if those 9 | # migrations use external dependencies or application code. 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema[7.0].define(version: 2022_04_12_175100) do 14 | # These are extensions that must be enabled in order to support this database 15 | enable_extension "plpgsql" 16 | 17 | create_table "foods", force: :cascade do |t| 18 | t.bigint "user_id", null: false 19 | t.string "name" 20 | t.string "measurement_unit" 21 | t.decimal "price" 22 | t.datetime "created_at", null: false 23 | t.datetime "updated_at", null: false 24 | t.index ["user_id"], name: "index_foods_on_user_id" 25 | end 26 | 27 | create_table "recipe_foods", force: :cascade do |t| 28 | t.bigint "recipe_id", null: false 29 | t.bigint "food_id", null: false 30 | t.integer "quantity", default: 1 31 | t.datetime "created_at", null: false 32 | t.datetime "updated_at", null: false 33 | t.index ["food_id"], name: "index_recipe_foods_on_food_id" 34 | t.index ["recipe_id"], name: "index_recipe_foods_on_recipe_id" 35 | end 36 | 37 | create_table "recipes", force: :cascade do |t| 38 | t.bigint "user_id", null: false 39 | t.string "name" 40 | t.string "prepration_time" 41 | t.string "cooking_time" 42 | t.text "description" 43 | t.boolean "public", default: false 44 | t.datetime "created_at", null: false 45 | t.datetime "updated_at", null: false 46 | t.index ["user_id"], name: "index_recipes_on_user_id" 47 | end 48 | 49 | create_table "users", force: :cascade do |t| 50 | t.string "email", default: "", null: false 51 | t.string "encrypted_password", default: "", null: false 52 | t.string "reset_password_token" 53 | t.datetime "reset_password_sent_at" 54 | t.datetime "remember_created_at" 55 | t.datetime "created_at", null: false 56 | t.datetime "updated_at", null: false 57 | t.string "name" 58 | t.string "role" 59 | t.index ["email"], name: "index_users_on_email", unique: true 60 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true 61 | end 62 | 63 | add_foreign_key "foods", "users" 64 | add_foreign_key "recipe_foods", "foods" 65 | add_foreign_key "recipe_foods", "recipes" 66 | add_foreign_key "recipes", "users" 67 | end 68 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }]) 7 | # Character.create(name: "Luke", movie: movies.first) 8 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/lib/tasks/.keep -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "stylelint": "^13.13.1", 4 | "stylelint-config-standard": "^21.0.0", 5 | "stylelint-csstree-validator": "^1.9.0", 6 | "stylelint-scss": "^3.21.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /spec/models/food_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe Food, type: :model do 6 | describe 'Food model' do 7 | user = User.create(name: 'Ritta', email: 'ritta@example.com', password: '123456') 8 | subject { Food.new(user_id: user, name: 'Apple', measurement_unit: 'grams', price: 5) } 9 | before { subject.save } 10 | 11 | it 'check the name is not blank' do 12 | subject.name = nil 13 | expect(subject).to_not be_valid 14 | end 15 | 16 | it 'check if the name is not exceeding 50 characters' do 17 | subject.name = 'Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world 18 | Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world' 19 | expect(subject).to_not be_valid 20 | end 21 | 22 | it 'check the measurement unit is not blank' do 23 | subject.measurement_unit = nil 24 | expect(subject).to_not be_valid 25 | end 26 | 27 | it 'check if the measurement unit is not exceeding 20 characters' do 28 | subject.measurement_unit = 'Hello world Hello world Hello world Hello world Hello world Hello world' 29 | expect(subject).to_not be_valid 30 | end 31 | 32 | it 'check the price is not blank' do 33 | subject.price = nil 34 | expect(subject).to_not be_valid 35 | end 36 | 37 | it 'check if price is numeric' do 38 | subject.price = 'not-numeric' 39 | expect(subject).to_not be_valid 40 | end 41 | 42 | it 'check if price is equal or greater than one' do 43 | expect(subject.price).to be >= 1 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /spec/models/recipe_food_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe RecipeFood, type: :model do 6 | describe 'RecipeFood model' do 7 | user = User.create(name: 'Ritta', email: 'ritta@example.com', password: '123456') 8 | recipe = Recipe.new(user_id: user, name: 'Chicken Masala', prepration_time: '25 minutes', 9 | cooking_time: '50 minutes', description: 'It is a delicious meal') 10 | food = Food.new(user_id: user, name: 'Apple', measurement_unit: 'grams', price: 5) 11 | subject { RecipeFood.new(food_id: food, recipe_id: recipe, quantity: 5) } 12 | before { subject.save } 13 | 14 | it 'check the quantity is not blank' do 15 | subject.quantity = nil 16 | expect(subject).to_not be_valid 17 | end 18 | 19 | it 'check if quantity is numeric' do 20 | subject.quantity = 'not-numeric' 21 | expect(subject).to_not be_valid 22 | end 23 | 24 | it 'check if quantity is equal or greater than one' do 25 | expect(subject.quantity).to be >= 1 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /spec/models/recipe_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe Recipe, type: :model do 6 | describe 'Recipe model' do 7 | user = User.create(name: 'Ritta', email: 'ritta@example.com', password: '123456') 8 | subject do 9 | Recipe.new(user_id: user, name: 'Chicken Masala', prepration_time: '25 minutes', cooking_time: '50 minutes', 10 | description: 'It is a delicious meal') 11 | end 12 | before { subject.save } 13 | 14 | it 'check the name is not blank' do 15 | subject.name = nil 16 | expect(subject).to_not be_valid 17 | end 18 | 19 | it 'check if the name is not exceeding 50 characters' do 20 | subject.name = 'Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world 21 | Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world' 22 | expect(subject).to_not be_valid 23 | end 24 | 25 | it 'check the prepration_time is not blank' do 26 | subject.prepration_time = nil 27 | expect(subject).to_not be_valid 28 | end 29 | 30 | it 'check if the preparation time is not exceeding 100 characters' do 31 | subject.prepration_time = 'Hello world Hello world Hello world Hello world Hello world 32 | Hello world Hello world Hello world Hello world Hello world 33 | Hello world Hello world Hello world Hello world Hello world' 34 | expect(subject).to_not be_valid 35 | end 36 | 37 | it 'check the cooking_time is not blank' do 38 | subject.cooking_time = nil 39 | expect(subject).to_not be_valid 40 | end 41 | 42 | it 'check if the cooking_time is not exceeding 100 characters' do 43 | subject.cooking_time = 'Hello world Hello world Hello world Hello world Hello world 44 | Hello world Hello world Hello world Hello world Hello world 45 | Hello world Hello world Hello world Hello world Hello world' 46 | expect(subject).to_not be_valid 47 | end 48 | 49 | it 'check the description is not blank' do 50 | subject.description = nil 51 | expect(subject).to_not be_valid 52 | end 53 | 54 | it 'check if the description is not exceeding 300 characters' do 55 | subject.description = 'Hello world Hello world Hello world Hello world 56 | Hello world Hello world Hello world Hello world Hello world Hello world 57 | Hello world Hello world Hello world Hello world Hello world Hello world 58 | Hello world Hello world Hello world Hello world Hello world Hello world 59 | Hello world Hello world Hello world Hello world Hello world Hello world 60 | Hello world Hello world Hello world Hello world Hello world Hello world' 61 | expect(subject).to_not be_valid 62 | end 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /spec/models/user_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe User, type: :model do 6 | describe 'User model' do 7 | subject { User.new(name: 'Ritta', email: 'ritta@example.com', password: '123456') } 8 | before { subject.save } 9 | 10 | it 'check the name is not blank' do 11 | subject.name = nil 12 | expect(subject).to_not be_valid 13 | end 14 | 15 | it 'check the email is not blank' do 16 | subject.email = nil 17 | expect(subject).to_not be_valid 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file is copied to spec/ when you run 'rails generate rspec:install' 4 | require 'spec_helper' 5 | ENV['RAILS_ENV'] ||= 'test' 6 | require_relative '../config/environment' 7 | # Prevent database truncation if the environment is production 8 | abort('The Rails environment is running in production mode!') if Rails.env.production? 9 | require 'rspec/rails' 10 | # Add additional requires below this line. Rails is not loaded until this point! 11 | require 'capybara/rspec' 12 | 13 | # Requires supporting ruby files with custom matchers and macros, etc, in 14 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 15 | # run as spec files by default. This means that files in spec/support that end 16 | # in _spec.rb will both be required and run as specs, causing the specs to be 17 | # run twice. It is recommended that you do not name files matching this glob to 18 | # end with _spec.rb. You can configure this pattern with the --pattern 19 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 20 | # 21 | # The following line is provided for convenience purposes. It has the downside 22 | # of increasing the boot-up time by auto-requiring all files in the support 23 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 24 | # require only the support files necessary. 25 | # 26 | # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } 27 | 28 | # Checks for pending migrations and applies them before tests are run. 29 | # If you are not using ActiveRecord, you can remove these lines. 30 | begin 31 | ActiveRecord::Migration.maintain_test_schema! 32 | rescue ActiveRecord::PendingMigrationError => e 33 | puts e.to_s.strip 34 | exit 1 35 | end 36 | 37 | Capybara.register_driver :selenium_chrome do |app| 38 | Capybara::Selenium::Driver.new(app, browser: :chrome) 39 | end 40 | 41 | Capybara.javascript_driver = :selenium_chrome 42 | 43 | RSpec.configure do |config| 44 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 45 | config.fixture_path = "#{::Rails.root}/spec/fixtures" 46 | 47 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 48 | # examples within a transaction, remove the following line or assign false 49 | # instead of true. 50 | config.use_transactional_fixtures = false 51 | 52 | # You can uncomment this line to turn off ActiveRecord support entirely. 53 | # config.use_active_record = false 54 | 55 | # RSpec Rails can automatically mix in different behaviours to your tests 56 | # based on their file location, for example enabling you to call `get` and 57 | # `post` in specs under `spec/controllers`. 58 | # 59 | # You can disable this behaviour by removing the line below, and instead 60 | # explicitly tag your specs with their type, e.g.: 61 | # 62 | # RSpec.describe UsersController, type: :controller do 63 | # # ... 64 | # end 65 | # 66 | # The different available types are documented in the features, such as in 67 | # https://relishapp.com/rspec/rspec-rails/docs 68 | config.infer_spec_type_from_file_location! 69 | 70 | # Filter lines from Rails gems in backtraces. 71 | config.filter_rails_from_backtrace! 72 | # arbitrary gems may also be filtered via: 73 | # config.filter_gems_from_backtrace("gem name") 74 | 75 | config.before(:suite) do 76 | DatabaseCleaner.clean_with(:truncation) 77 | end 78 | 79 | config.before(:each) do 80 | DatabaseCleaner.strategy = :transaction 81 | end 82 | 83 | config.before(:each, js: true) do 84 | DatabaseCleaner.strategy = :truncation 85 | end 86 | 87 | # This block must be here, do not combine with the other `before(:each)` block. 88 | # This makes it so Capybara can see the database. 89 | config.before(:each) do 90 | DatabaseCleaner.start 91 | end 92 | 93 | config.after(:each) do 94 | DatabaseCleaner.clean 95 | end 96 | end 97 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all 4 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 5 | # The generated `.rspec` file contains `--require spec_helper` which will cause 6 | # this file to always be loaded, without a need to explicitly require it in any 7 | # files. 8 | # 9 | # Given that it is always loaded, you are encouraged to keep this file as 10 | # light-weight as possible. Requiring heavyweight dependencies from this file 11 | # will add to the boot time of your test suite on EVERY test run, even for an 12 | # individual file that may not need all of that loaded. Instead, consider making 13 | # a separate helper file that requires the additional dependencies and performs 14 | # the additional setup, and require it from the spec files that actually need 15 | # it. 16 | # 17 | # See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 18 | RSpec.configure do |config| 19 | # rspec-expectations config goes here. You can use an alternate 20 | # assertion/expectation library such as wrong or the stdlib/minitest 21 | # assertions if you prefer. 22 | config.expect_with :rspec do |expectations| 23 | # This option will default to `true` in RSpec 4. It makes the `description` 24 | # and `failure_message` of custom matchers include text for helper methods 25 | # defined using `chain`, e.g.: 26 | # be_bigger_than(2).and_smaller_than(4).description 27 | # # => "be bigger than 2 and smaller than 4" 28 | # ...rather than: 29 | # # => "be bigger than 2" 30 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 31 | end 32 | 33 | # rspec-mocks config goes here. You can use an alternate test double 34 | # library (such as bogus or mocha) by changing the `mock_with` option here. 35 | config.mock_with :rspec do |mocks| 36 | # Prevents you from mocking or stubbing a method that does not exist on 37 | # a real object. This is generally recommended, and will default to 38 | # `true` in RSpec 4. 39 | mocks.verify_partial_doubles = true 40 | end 41 | 42 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will 43 | # have no way to turn it off -- the option exists only for backwards 44 | # compatibility in RSpec 3). It causes shared context metadata to be 45 | # inherited by the metadata hash of host groups and examples, rather than 46 | # triggering implicit auto-inclusion in groups with matching metadata. 47 | config.shared_context_metadata_behavior = :apply_to_host_groups 48 | 49 | # The settings below are suggested to provide a good initial experience 50 | # with RSpec, but feel free to customize to your heart's content. 51 | # # This allows you to limit a spec run to individual examples or groups 52 | # # you care about by tagging them with `:focus` metadata. When nothing 53 | # # is tagged with `:focus`, all examples get run. RSpec also provides 54 | # # aliases for `it`, `describe`, and `context` that include `:focus` 55 | # # metadata: `fit`, `fdescribe` and `fcontext`, respectively. 56 | config.filter_run_when_matching :focus 57 | # 58 | # # Allows RSpec to persist some state between runs in order to support 59 | # # the `--only-failures` and `--next-failure` CLI options. We recommend 60 | # # you configure your source control system to ignore this file. 61 | config.example_status_persistence_file_path = 'spec/examples.txt' 62 | # 63 | # # Limits the available syntax to the non-monkey patched syntax that is 64 | # # recommended. For more details, see: 65 | # # https://relishapp.com/rspec/rspec-core/docs/configuration/zero-monkey-patching-mode 66 | config.disable_monkey_patching! 67 | # 68 | # # This setting enables warnings. It's recommended, but in some cases may 69 | # # be too noisy due to issues in dependencies. 70 | # config.warnings = true 71 | # 72 | # # Many RSpec users commonly either run the entire suite or an individual 73 | # # file, and it's useful to allow more verbose output when running an 74 | # # individual spec file. 75 | # if config.files_to_run.one? 76 | # # Use the documentation formatter for detailed output, 77 | # # unless a formatter has already been configured 78 | # # (e.g. via a command-line flag). 79 | config.default_formatter = 'doc' 80 | # end 81 | # 82 | # # Print the 10 slowest examples and example groups at the 83 | # # end of the spec run, to help surface which specs are running 84 | # # particularly slow. 85 | # config.profile_examples = 10 86 | # 87 | # # Run specs in random order to surface order dependencies. If you find an 88 | # # order dependency and want to debug it, you can fix the order by providing 89 | # # the seed, which is printed after each run. 90 | # # --seed 1234 91 | config.order = :random 92 | # 93 | # # Seed global randomization in this process using the `--seed` CLI option. 94 | # # Setting this allows you to use `--seed` to deterministically reproduce 95 | # # test failures related to randomization by passing the same `--seed` value 96 | # # as the one that triggered the failure. 97 | Kernel.srand config.seed 98 | end 99 | -------------------------------------------------------------------------------- /spec/views/foods/foods_index_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe 'Foods#index', type: :feature do 6 | describe 'Food' do 7 | before(:each) do 8 | @user = User.create(name: 'Ranjeet', email: 'amy@gmail.com', password: 'password') 9 | visit new_user_session_path 10 | fill_in 'Email', with: 'amy@gmail.com' 11 | fill_in 'Password', with: 'password' 12 | click_button 'Log in' 13 | 14 | @food1 = Food.new(user: @user, name: 'Apple', measurement_unit: 'grams', price: 5) 15 | @food2 = Food.new(user: @user, name: 'Apple', measurement_unit: 'grams', price: 5) 16 | @food3 = Food.new(user: @user, name: 'Apple', measurement_unit: 'grams', price: 5) 17 | @food4 = Food.new(user: @user, name: 'Apple', measurement_unit: 'grams', price: 5) 18 | 19 | visit(foods_path) 20 | end 21 | 22 | it 'shows the food name' do 23 | expect(page).to have_content('Food') 24 | end 25 | 26 | it 'shows the food measurment unit' do 27 | expect(page).to have_content('Measurement Unit') 28 | end 29 | 30 | it 'shows the food unit price' do 31 | expect(page).to have_content('Unit Price') 32 | end 33 | 34 | it 'shows the food actions' do 35 | expect(page).to have_content('Actions') 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /spec/views/login_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | # rubocop:disable Metrics/BlockLength 5 | RSpec.feature 'Logins', type: :feature do 6 | background { visit new_user_session_path } 7 | scenario 'displays email field' do 8 | expect(page).to have_field('user[email]') 9 | end 10 | 11 | scenario 'displays password field' do 12 | expect(page).to have_field('user[password]') 13 | end 14 | 15 | scenario 'displays login button' do 16 | expect(page).to have_button('Log in') 17 | end 18 | 19 | context 'Form Submission' do 20 | scenario 'Submit form without email and password' do 21 | click_button 'Log in' 22 | expect(page).to have_content 'Invalid Email or password.' 23 | end 24 | 25 | scenario 'Submit form with incorrect email and password' do 26 | within 'form' do 27 | fill_in 'Email', with: 'mymail@gmail.com' 28 | fill_in 'Password', with: '' 29 | end 30 | click_button 'Log in' 31 | expect(page).to have_content 'Invalid Email or password.' 32 | end 33 | 34 | scenario 'Submit form with correct email and password' do 35 | @user = User.create(name: 'Ranjeet', email: 'admin@gmail.com', password: 'password') 36 | within 'form' do 37 | fill_in 'Email', with: @user.email 38 | fill_in 'Password', with: @user.password 39 | end 40 | click_button 'Log in' 41 | expect(page).to have_current_path('/') 42 | end 43 | end 44 | # rubocop:enable Metrics/BlockLength 45 | end 46 | -------------------------------------------------------------------------------- /spec/views/public_recipes/public_recipes_index_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe 'public_recipes#index', type: :feature do 6 | describe 'Public_Recipe' do 7 | before(:each) do 8 | @user = User.create(name: 'Ranjeet', email: 'amy@gmail.com', password: 'password') 9 | visit new_user_session_path 10 | fill_in 'Email', with: 'amy@gmail.com' 11 | fill_in 'Password', with: 'password' 12 | click_button 'Log in' 13 | 14 | @recipe1 = Recipe.new(user: @user, name: 'Recipe 1', prepration_time: '25 minutes', cooking_time: '50 minutes', 15 | description: 'It is a delicious meal', public: true) 16 | @recipe2 = Recipe.new(user: @user, name: 'Recipe 2', prepration_time: '25 minutes', cooking_time: '50 minutes', 17 | description: 'It is a delicious meal', public: true) 18 | @recipe3 = Recipe.new(user: @user, name: 'Recipe 3', prepration_time: '25 minutes', cooking_time: '50 minutes', 19 | description: 'It is a delicious meal', public: true) 20 | @recipe4 = Recipe.new(user: @user, name: 'Recipe 4', prepration_time: '25 minutes', cooking_time: '50 minutes', 21 | description: 'It is a delicious meal', public: true) 22 | 23 | visit(public_recipes_path) 24 | end 25 | 26 | it 'shows the recipe name' do 27 | expect(page).to have_content('Public Recipes') 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /spec/views/recipes/recipes_index_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe 'recipes#index', type: :feature do 6 | describe 'Recipe' do 7 | before(:each) do 8 | @user = User.create(name: 'Ranjeet', email: 'amy@gmail.com', password: 'password') 9 | visit new_user_session_path 10 | fill_in 'Email', with: 'amy@gmail.com' 11 | fill_in 'Password', with: 'password' 12 | click_button 'Log in' 13 | 14 | @recipe1 = Recipe.new(user: @user, name: 'Recipe 1', prepration_time: '25 minutes', cooking_time: '50 minutes', 15 | description: 'It is a delicious meal') 16 | @recipe2 = Recipe.new(user: @user, name: 'Recipe 2', prepration_time: '25 minutes', cooking_time: '50 minutes', 17 | description: 'It is a delicious meal') 18 | @recipe3 = Recipe.new(user: @user, name: 'Recipe 3', prepration_time: '25 minutes', cooking_time: '50 minutes', 19 | description: 'It is a delicious meal') 20 | @recipe4 = Recipe.new(user: @user, name: 'Recipe 4', prepration_time: '25 minutes', cooking_time: '50 minutes', 21 | description: 'It is a delicious meal') 22 | 23 | visit(recipes_path) 24 | end 25 | 26 | it 'shows the recipe name' do 27 | expect(page).to have_content('All Recipes') 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /spec/views/recipes/recipes_show_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe 'Recipes#show', type: :feature do 6 | describe 'Recipe' do 7 | before(:each) do 8 | @user = User.create(name: 'Ranjeet', email: 'amy@gmail.com', password: 'password') 9 | @user2 = User.create(name: 'Ranjeet', email: 'amy@gmail.com', password: 'password') 10 | @user3 = User.create(name: 'Ranjeet', email: 'amy@gmail.com', password: 'password') 11 | 12 | visit new_user_session_path 13 | fill_in 'Email', with: 'amy@gmail.com' 14 | fill_in 'Password', with: 'password' 15 | click_button 'Log in' 16 | 17 | @recipe1 = Recipe.new(user: @user, name: 'Recipe 1', prepration_time: '25 minutes', cooking_time: '50 minutes', 18 | description: 'It is a delicious meal') 19 | @recipe2 = Recipe.new(user: @user, name: 'Recipe 2', prepration_time: '25 minutes', cooking_time: '50 minutes', 20 | description: 'It is a delicious meal') 21 | @recipe3 = Recipe.new(user: @user, name: 'Recipe 3', prepration_time: '25 minutes', cooking_time: '50 minutes', 22 | description: 'It is a delicious meal') 23 | @recipe4 = Recipe.new(user: @user, name: 'Recipe 4', prepration_time: '25 minutes', cooking_time: '50 minutes', 24 | description: 'It is a delicious meal') 25 | @recipe1.save! 26 | 27 | visit recipe_path(@recipe1) 28 | end 29 | 30 | it 'shows recipe name' do 31 | recipe = Recipe.first 32 | expect(page).to have_content(recipe.name) 33 | end 34 | 35 | it 'shows recipe has prepration time' do 36 | recipe = Recipe.first 37 | expect(page).to have_content(recipe.prepration_time) 38 | end 39 | 40 | it 'shows recipe has cooking time' do 41 | recipe = Recipe.first 42 | expect(page).to have_content(recipe.cooking_time) 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /spec/views/shopping_list/shopping_list_index_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe 'ShoppingList#index', type: :feature do 6 | describe 'Shopping List' do 7 | before(:each) do 8 | @user = User.create(name: 'Ranjeet', email: 'amy@gmail.com', password: 'password') 9 | visit new_user_session_path 10 | fill_in 'Email', with: 'amy@gmail.com' 11 | fill_in 'Password', with: 'password' 12 | click_button 'Log in' 13 | 14 | @food1 = Food.new(user: @user, name: 'Apple', measurement_unit: 'grams', price: 5) 15 | @food2 = Food.new(user: @user, name: 'Apple', measurement_unit: 'grams', price: 5) 16 | @food3 = Food.new(user: @user, name: 'Apple', measurement_unit: 'grams', price: 5) 17 | @food4 = Food.new(user: @user, name: 'Apple', measurement_unit: 'grams', price: 5) 18 | 19 | visit(shopping_list_index_path) 20 | end 21 | 22 | it 'Shopping list has food' do 23 | expect(page).to have_content('Food') 24 | end 25 | 26 | it 'Shopping list has quantity' do 27 | expect(page).to have_content('Quantity') 28 | end 29 | 30 | it 'Shopping list has price' do 31 | expect(page).to have_content('Price') 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/storage/.keep -------------------------------------------------------------------------------- /test/application_system_test_case.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase 6 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400] 7 | end 8 | -------------------------------------------------------------------------------- /test/channels/application_cable/connection_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase 6 | # test "connects with cookies" do 7 | # cookies.signed[:user_id] = 42 8 | # 9 | # connect 10 | # 11 | # assert_equal connection.user_id, "42" 12 | # end 13 | end 14 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/test/controllers/.keep -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/test/fixtures/files/.keep -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/test/models/.keep -------------------------------------------------------------------------------- /test/system/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/test/system/.keep -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ENV['RAILS_ENV'] ||= 'test' 4 | require_relative '../config/environment' 5 | require 'rails/test_help' 6 | 7 | class ActiveSupport::TestCase 8 | # Run tests in parallel with specified workers 9 | parallelize(workers: :number_of_processors, with: :threads) 10 | 11 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 12 | fixtures :all 13 | 14 | # Add more helper methods to be used by all tests here... 15 | end 16 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/tmp/.keep -------------------------------------------------------------------------------- /tmp/pids/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/tmp/pids/.keep -------------------------------------------------------------------------------- /tmp/storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/tmp/storage/.keep -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodechaser/recipe-app/f0a8e8727530430dc7799808ebbb62659095bfe8/vendor/.keep --------------------------------------------------------------------------------