From c2aa3e5acc4afe4be6ae3f38cc8414b875bab133 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Tue, 8 Jun 2021 18:03:44 +0700 Subject: [PATCH 01/13] [#4] Fix name of Heroku app and use GitHub token for Docker Registry --- .github/workflows/deploy_heroku.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy_heroku.yml b/.github/workflows/deploy_heroku.yml index 417968f2..932f143d 100644 --- a/.github/workflows/deploy_heroku.yml +++ b/.github/workflows/deploy_heroku.yml @@ -7,7 +7,7 @@ on: branches: - master - main - - development + - develop types: - completed workflow_dispatch: @@ -15,7 +15,7 @@ on: env: DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }} DOCKER_REGISTRY_USERNAME: ${{ github.repository_owner }} - DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }} + DOCKER_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }} DOCKER_IMAGE: ${{ github.repository }} HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} @@ -42,9 +42,9 @@ jobs: run: | if [[ $BRANCH_TAG = "latest" ]] then - echo "HEROKU_APP=google_search_ruby" >> $GITHUB_ENV + echo "HEROKU_APP=google-search-ruby" >> $GITHUB_ENV else - echo "HEROKU_APP=google_search_ruby-staging" >> $GITHUB_ENV + echo "HEROKU_APP=google-search-ruby-staging" >> $GITHUB_ENV fi - name: Login to Docker registry From 6977569bb6237403b1da7dc208bb662f9e389138 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Tue, 8 Jun 2021 18:07:20 +0700 Subject: [PATCH 02/13] [#4] Fix develop branch name for production test workflow --- .github/workflows/test_production_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_production_build.yml b/.github/workflows/test_production_build.yml index 2e2b780a..5aa2f398 100644 --- a/.github/workflows/test_production_build.yml +++ b/.github/workflows/test_production_build.yml @@ -5,7 +5,7 @@ on: branches-ignore: - master - main - - development + - develop env: DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }} From 9478ccaf4e4bd48b8814a1be6947ac3a649f2663 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Tue, 8 Jun 2021 20:21:15 +0700 Subject: [PATCH 03/13] [#4] Update precompiled ENV variable to fix app crash on Heroku --- config/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.yml b/config/application.yml index 4faef12c..f2bea559 100644 --- a/config/application.yml +++ b/config/application.yml @@ -21,4 +21,4 @@ test: # Because it initializes the app, so all variables need to exist in the Docker build stage (used in bin/docker-assets-precompile). docker_build: <<: *default - SECRET_KEY_BASE: + MAILER_DEFAULT_HOST: From 565cea9c234cc3b8e42e620542b14ef274d59ee4 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Tue, 8 Jun 2021 20:40:08 +0700 Subject: [PATCH 04/13] [#4] Reset SECRET_KEY_BASE and add defaults for docker_build in database.yml --- config/application.yml | 2 +- config/database.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/application.yml b/config/application.yml index f2bea559..4faef12c 100644 --- a/config/application.yml +++ b/config/application.yml @@ -21,4 +21,4 @@ test: # Because it initializes the app, so all variables need to exist in the Docker build stage (used in bin/docker-assets-precompile). docker_build: <<: *default - MAILER_DEFAULT_HOST: + SECRET_KEY_BASE: diff --git a/config/database.yml b/config/database.yml index 7d986fdf..e93efb37 100644 --- a/config/database.yml +++ b/config/database.yml @@ -18,4 +18,5 @@ test: database: <%= ENV['DB_NAME'] %>_test production: + <<: *default url: <%= ENV['DATABASE_URL'] %> From 5e4c4b1cacf16ee0dd4255509cfb904902e3c322 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Wed, 9 Jun 2021 10:02:16 +0700 Subject: [PATCH 05/13] [#4] Add default route and empty controller-view to test deployment --- app/assets/stylesheets/keyword.scss | 3 +++ app/controllers/keyword_controller.rb | 5 +++++ app/helpers/keyword_helper.rb | 4 ++++ app/views/keyword/index.html.erb | 2 ++ config/routes.rb | 2 ++ spec/helpers/keyword_helper_spec.rb | 17 +++++++++++++++++ spec/views/keyword/index.html.erb_spec.rb | 7 +++++++ 7 files changed, 40 insertions(+) create mode 100644 app/assets/stylesheets/keyword.scss create mode 100644 app/controllers/keyword_controller.rb create mode 100644 app/helpers/keyword_helper.rb create mode 100644 app/views/keyword/index.html.erb create mode 100644 spec/helpers/keyword_helper_spec.rb create mode 100644 spec/views/keyword/index.html.erb_spec.rb diff --git a/app/assets/stylesheets/keyword.scss b/app/assets/stylesheets/keyword.scss new file mode 100644 index 00000000..bbdb7d01 --- /dev/null +++ b/app/assets/stylesheets/keyword.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the keyword controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: https://sass-lang.com/ diff --git a/app/controllers/keyword_controller.rb b/app/controllers/keyword_controller.rb new file mode 100644 index 00000000..8ea94c3d --- /dev/null +++ b/app/controllers/keyword_controller.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class KeywordController < ApplicationController + def index; end +end diff --git a/app/helpers/keyword_helper.rb b/app/helpers/keyword_helper.rb new file mode 100644 index 00000000..68f48182 --- /dev/null +++ b/app/helpers/keyword_helper.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +module KeywordHelper +end diff --git a/app/views/keyword/index.html.erb b/app/views/keyword/index.html.erb new file mode 100644 index 00000000..14932748 --- /dev/null +++ b/app/views/keyword/index.html.erb @@ -0,0 +1,2 @@ +

Keyword#index

+

Find me in app/views/keyword/index.html.erb

diff --git a/config/routes.rb b/config/routes.rb index c06383a1..b13fbb69 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ Rails.application.routes.draw do + root to: 'keyword#index' + get 'keyword/index' # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end diff --git a/spec/helpers/keyword_helper_spec.rb b/spec/helpers/keyword_helper_spec.rb new file mode 100644 index 00000000..bc8df598 --- /dev/null +++ b/spec/helpers/keyword_helper_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the KeywordHelper. For example: +# +# describe KeywordHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe KeywordHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/keyword/index.html.erb_spec.rb b/spec/views/keyword/index.html.erb_spec.rb new file mode 100644 index 00000000..b27e5bf1 --- /dev/null +++ b/spec/views/keyword/index.html.erb_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'keyword/index.html.erb', type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end From 5962a2eef1edc1ee332a8e0044b9b366326bb315 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Wed, 9 Jun 2021 10:36:49 +0700 Subject: [PATCH 06/13] [#4] Remove unused tests and helpers --- app/helpers/keyword_helper.rb | 4 ---- spec/helpers/.keep | 0 spec/helpers/keyword_helper_spec.rb | 17 ----------------- spec/views/.keep | 0 spec/views/keyword/index.html.erb_spec.rb | 7 ------- 5 files changed, 28 deletions(-) delete mode 100644 app/helpers/keyword_helper.rb create mode 100644 spec/helpers/.keep delete mode 100644 spec/helpers/keyword_helper_spec.rb create mode 100644 spec/views/.keep delete mode 100644 spec/views/keyword/index.html.erb_spec.rb diff --git a/app/helpers/keyword_helper.rb b/app/helpers/keyword_helper.rb deleted file mode 100644 index 68f48182..00000000 --- a/app/helpers/keyword_helper.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -module KeywordHelper -end diff --git a/spec/helpers/.keep b/spec/helpers/.keep new file mode 100644 index 00000000..e69de29b diff --git a/spec/helpers/keyword_helper_spec.rb b/spec/helpers/keyword_helper_spec.rb deleted file mode 100644 index bc8df598..00000000 --- a/spec/helpers/keyword_helper_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -# Specs in this file have access to a helper object that includes -# the KeywordHelper. For example: -# -# describe KeywordHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# expect(helper.concat_strings("this","that")).to eq("this that") -# end -# end -# end -RSpec.describe KeywordHelper, type: :helper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/views/.keep b/spec/views/.keep new file mode 100644 index 00000000..e69de29b diff --git a/spec/views/keyword/index.html.erb_spec.rb b/spec/views/keyword/index.html.erb_spec.rb deleted file mode 100644 index b27e5bf1..00000000 --- a/spec/views/keyword/index.html.erb_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe 'keyword/index.html.erb', type: :view do - pending "add some examples to (or delete) #{__FILE__}" -end From f310bfd6fb247c22dfda639a238b7ecd0b7a4b62 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Wed, 9 Jun 2021 14:57:31 +0700 Subject: [PATCH 07/13] [#4] Rename keyword controller to plural and use resources base route --- app/assets/stylesheets/keyword.scss | 3 --- .../{keyword_controller.rb => keywords_controller.rb} | 2 +- app/views/{keyword => keywords}/index.html.erb | 2 +- config/routes.rb | 3 +-- 4 files changed, 3 insertions(+), 7 deletions(-) delete mode 100644 app/assets/stylesheets/keyword.scss rename app/controllers/{keyword_controller.rb => keywords_controller.rb} (51%) rename app/views/{keyword => keywords}/index.html.erb (68%) diff --git a/app/assets/stylesheets/keyword.scss b/app/assets/stylesheets/keyword.scss deleted file mode 100644 index bbdb7d01..00000000 --- a/app/assets/stylesheets/keyword.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the keyword controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: https://sass-lang.com/ diff --git a/app/controllers/keyword_controller.rb b/app/controllers/keywords_controller.rb similarity index 51% rename from app/controllers/keyword_controller.rb rename to app/controllers/keywords_controller.rb index 8ea94c3d..22006d8a 100644 --- a/app/controllers/keyword_controller.rb +++ b/app/controllers/keywords_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class KeywordController < ApplicationController +class KeywordsController < ApplicationController def index; end end diff --git a/app/views/keyword/index.html.erb b/app/views/keywords/index.html.erb similarity index 68% rename from app/views/keyword/index.html.erb rename to app/views/keywords/index.html.erb index 14932748..6d0bb5a1 100644 --- a/app/views/keyword/index.html.erb +++ b/app/views/keywords/index.html.erb @@ -1,2 +1,2 @@ -

Keyword#index

+

Keywords#index

Find me in app/views/keyword/index.html.erb

diff --git a/config/routes.rb b/config/routes.rb index b13fbb69..81f34000 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,4 @@ Rails.application.routes.draw do - root to: 'keyword#index' - get 'keyword/index' + resources :keywords, only: :index # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end From 56990406d7d5d437e6eda0e8d0c78941ea7282ec Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Wed, 9 Jun 2021 14:59:02 +0700 Subject: [PATCH 08/13] [#4] Re-add root route --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index 81f34000..6a1910bb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,5 @@ Rails.application.routes.draw do + root to: 'keywords#index' resources :keywords, only: :index # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end From 8d727807435f1952bf88bfd3889b457bb2005ac6 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY <77609814+malparty@users.noreply.github.com> Date: Thu, 10 Jun 2021 10:55:00 +0700 Subject: [PATCH 09/13] [#4] Add new line after root route Co-authored-by: Junan Chakma --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index 6a1910bb..c2cc3f02 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,6 @@ Rails.application.routes.draw do root to: 'keywords#index' + resources :keywords, only: :index # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end From 158b80a27dc9eb3469a4eac01efb04d984539c28 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY <77609814+malparty@users.noreply.github.com> Date: Thu, 10 Jun 2021 12:56:42 +0700 Subject: [PATCH 10/13] [#4] Remove new line after root route Co-authored-by: Junan Chakma --- config/routes.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index c2cc3f02..6a1910bb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,5 @@ Rails.application.routes.draw do root to: 'keywords#index' - resources :keywords, only: :index # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end From 5047a67c83cc94246a1150267197184a4f56bc97 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Thu, 10 Jun 2021 15:10:34 +0700 Subject: [PATCH 11/13] [#4] Remove trailing space --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index 6a1910bb..fdbc5d0a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,6 @@ Rails.application.routes.draw do root to: 'keywords#index' + resources :keywords, only: :index # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end From 6854d81bf7bf06b9f46ccac560373716e860e842 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Thu, 10 Jun 2021 15:19:01 +0700 Subject: [PATCH 12/13] [#4] Add staging/prod url in Readme.me --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 5921cb76..e289bfb3 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ > Google Search Ruby is a Web app that extract large amounts of data from the Google search results page. > Feed it with a CSV File containing your keywords, and the app will do the rest for you! +## Web Application + +[Staging](https://google-search-ruby-staging.herokuapp.com/) + +[Production](https://google-search-ruby.herokuapp.com/) + ## Project Setup ### Prerequisites From b010fbd90287a72f4130ed0692b7d44ee58d7db2 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Thu, 10 Jun 2021 15:24:36 +0700 Subject: [PATCH 13/13] [#4] Add aboud at the end of Readme.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index e289bfb3..9b52ac48 100644 --- a/README.md +++ b/README.md @@ -120,3 +120,11 @@ rspec [rspec-params] - Create a [Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) from bot account with `public_repo` scope, and set it as `DANGER_GITHUB_API_TOKEN` secret on the CI Environment Settings. + + +## About +![Nimble](https://assets.nimblehq.co/logo/dark/logo-dark-text-160.png) + +This project is created to complete **Web Certification Path** using **Ruby** at [Nimble][nimble] + +[nimble]: https://nimblehq.co