From d7b32e98226d2a10717ca5a32d3d08d3de1aa98a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 27 Jul 2018 18:47:34 +0900 Subject: [PATCH 01/25] Bump apipie-rails from 0.5.9 to 0.5.10 (#2494) Bumps [apipie-rails](https://github.com/Apipie/apipie-rails) from 0.5.9 to 0.5.10. - [Release notes](https://github.com/Apipie/apipie-rails/releases) - [Changelog](https://github.com/Apipie/apipie-rails/blob/master/CHANGELOG.md) - [Commits](https://github.com/Apipie/apipie-rails/compare/v0.5.9...v0.5.10) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1c8ce0a69..3f468ecb2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,7 +71,7 @@ GEM airbrake-ruby (~> 2.10) airbrake-ruby (2.10.0) andand (1.3.3) - apipie-rails (0.5.9) + apipie-rails (0.5.10) rails (>= 4.1) arel (8.0.0) autoprefixer-rails (8.1.0) From 28b69face84048b9c2138e46e737ee05123ba9a9 Mon Sep 17 00:00:00 2001 From: Nick Schimek Date: Sun, 29 Jul 2018 18:30:05 -0700 Subject: [PATCH 02/25] Add Slack channel link to the projects show page (#2498) * Add tests for viewing the projects API links * Add slack channel link to show page Added link for the projects slack channel. This is needed to so that individuals can easily find a projects slack channel. Fix #770 * Add slack channel name to tests Updated the background job to include the slack channel for the hello project * Update slack link assertion Updated the assertion to check for the slack channel name instead of the Project title since project title will not always be the same as the slack channel name. * Run migration to add slack channel name Added slack_channel_name to projects table. Storing the slack channel name for each project will allow us to create links that direct users to the correct slack channel for the project. * Update link to use the slack channel name * Fix grammar in cucumber test * Add CRUD tests for slack channel name * Update CRUD views to include slack channel name * Add test for when slack channel does not exist Added to test to check that the view renders revelant information when a slack channel does not exist. * Update view to render correct slack status The view was updated to render "not linked to Slack" when the project doesn't have a slack channel name associated to it. * Update test to check the views else route The github test is now failing for this, but it's working locally and in production which means there is a bug somewhere in the tests. * Remove building source repository When a github link is not present a source repository should not be built as this was causing the project to have a github source repository even though the link is nil. * Update tests now that source repo is not built There are three tests failing due to the source repository not being built for every project regardless if there is a valid github link. Source repo's should only exist when there are github links associated to a project. These three tests were trying to add github links to a project that didn't previously had a github link, hence the button needed to be clicked before the value could be filled in. * Replace hard link with param name * Permit slack channel name params --- app/controllers/projects_controller.rb | 2 +- app/views/projects/_connections.html.erb | 10 +++++ app/views/projects/_form.html.erb | 4 +- ...0001_add_slack_channel_name_to_projects.rb | 5 +++ db/schema.rb | 3 +- features/projects/connections.feature | 44 +++++++++++++++++++ features/projects/create_projects.feature | 4 +- features/projects/edit_project.feature | 8 ++++ features/step_definitions/projects_steps.rb | 7 ++- 9 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20180729040001_add_slack_channel_name_to_projects.rb create mode 100644 features/projects/connections.feature diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4d1ce5712..2730bce6d 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -107,6 +107,6 @@ def get_current_stories end def project_params - params.require(:project).permit(:title, :description, :pitch, :created, :status, :user_id, :github_url, :pivotaltracker_url, :pivotaltracker_id, :image_url, source_repositories_attributes: [:id, :url, :_destroy]) + params.require(:project).permit(:title, :description, :pitch, :created, :status, :user_id, :github_url, :pivotaltracker_url, :pivotaltracker_id, :slack_channel_name, :image_url, source_repositories_attributes: [:id, :url, :_destroy]) end end diff --git a/app/views/projects/_connections.html.erb b/app/views/projects/_connections.html.erb index e00e43b17..05658ad68 100644 --- a/app/views/projects/_connections.html.erb +++ b/app/views/projects/_connections.html.erb @@ -15,4 +15,14 @@ <% else %>

not linked to IssueTracker

<% end %> + + <% if @project.slack_channel_name.present? %> +

+ + <%= link_to "#{@project.title} ", "https://agileventures.slack.com/app_redirect?channel=#{@project.slack_channel_name}" %>on Slack + +

+ <% else %> +

not linked to Slack

+ <% end %> diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb index 75c06c300..191e73660 100644 --- a/app/views/projects/_form.html.erb +++ b/app/views/projects/_form.html.erb @@ -22,6 +22,8 @@ <%= awesome_text_field f, :pivotaltracker_url, label_text: 'Issue Tracker link', placeholder: 'https://www.pivotaltracker.com/s/projects/id' %> + <%= awesome_text_field f, :slack_channel_name, label_text: 'Slack channel name', placeholder: 'project_slack_channel_name' %> + <% if @project.new_record? %>

New project checklist

@@ -40,4 +42,4 @@
<% end %> - \ No newline at end of file + diff --git a/db/migrate/20180729040001_add_slack_channel_name_to_projects.rb b/db/migrate/20180729040001_add_slack_channel_name_to_projects.rb new file mode 100644 index 000000000..e38ea0229 --- /dev/null +++ b/db/migrate/20180729040001_add_slack_channel_name_to_projects.rb @@ -0,0 +1,5 @@ +class AddSlackChannelNameToProjects < ActiveRecord::Migration[5.1] + def change + add_column :projects, :slack_channel_name, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 88c99919d..2c41b51c2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180515093331) do +ActiveRecord::Schema.define(version: 20180729040001) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -183,6 +183,7 @@ t.integer "commit_count", default: 0 t.string "image_url" t.datetime "last_github_update" + t.string "slack_channel_name" t.index ["slug"], name: "index_projects_on_slug", unique: true t.index ["user_id"], name: "index_projects_on_user_id" end diff --git a/features/projects/connections.feature b/features/projects/connections.feature new file mode 100644 index 000000000..ba2c69bf1 --- /dev/null +++ b/features/projects/connections.feature @@ -0,0 +1,44 @@ +Feature: Projects should show links to the connected APIs + As a User + So that I can easily navigate to Project apps + I want to see all connected app links on the show page + + Background: + Given the following users exist + | first_name | last_name | email | receive_mailings | + | Bill | Bob | Bill@example.com | true | + + Given the following projects exist: + | title | description | status | author | pivotaltracker_url | github_url | slack_channel_name | + | hello | earthlings | active | Bill | https://www.pivotaltracker.com/n/projects/742821 | https://github.com/hello | hello_earthlings | + | Bat Man | All bat | active | Bill | | | | + + Scenario: I can see a link to the GitHub project page + When I go to the "hello" project "show" page + Then I should see "hello on GitHub" + And I should see a link to "hello" on github + + Scenario: I can see when a project is not connected to GitHub + When I go to the "Bat Man" project "show" page + Then I should not see "Bat Man on GitHub" + And I should see "not linked to GitHub" + + Scenario: I can see a link to the projects issue tracker + When I go to the "hello" project "show" page + Then I should see "hello on IssueTracker" + And I should see a link to "hello" on Pivotal Tracker + + Scenario: I can see when a project is not connected to issue tracker + When I go to the "Bat Man" project "show" page + Then I should not see "Bat Man on IssueTracker" + And I should see "not linked to IssueTracker" + + Scenario: I can see a link to the projects slack channel + When I go to the "hello" project "show" page + Then I should see "hello on Slack" + And I should see a link to the slack channel for "hello" + + Scenario: I can see when a project is not connected to slack + When I go to the "Bat Man" project "show" page + Then I should not see "Bat Man on Slack" + And I should see "not linked to Slack" diff --git a/features/projects/create_projects.feature b/features/projects/create_projects.feature index 3b8d8f3ab..40c91a21f 100644 --- a/features/projects/create_projects.feature +++ b/features/projects/create_projects.feature @@ -26,6 +26,7 @@ Feature: Create projects | Status | | GitHub url (primary) | | Issue Tracker link | + | Slack channel name | Scenario Outline: Saving a new project: success Given I have logged in @@ -35,6 +36,7 @@ Feature: Create projects And I fill in "Description" with "" And I fill in "GitHub url (primary)" with "" And I fill in "Issue Tracker link" with "" + And I fill in "Slack channel name" with "slackin" And I select "Status" to "Active" And I click the "Submit" button Then I should be on the "Show" page for project "" @@ -46,6 +48,7 @@ Feature: Create projects | ACTIVE | And I should see a link to "<title>" on github And I should see a link to "<title>" on Pivotal Tracker + And I should see a link to the slack channel for "<title>" Examples: | title | description | gh_link | pt_link | @@ -83,4 +86,3 @@ Feature: Create projects | ACTIVE | And I should see a link to "multiple repo project" on github And I should see a link to "multiple repo project" on Pivotal Tracker - diff --git a/features/projects/edit_project.feature b/features/projects/edit_project.feature index d744b7e91..ab1f69e68 100644 --- a/features/projects/edit_project.feature +++ b/features/projects/edit_project.feature @@ -33,18 +33,22 @@ Feature: Edit Project When I click "Back" Then I should be on the "Show" page for project "hello mars" + @javascript Scenario: Updating a project: success Given I have logged in And I am on the "Edit" page for project "hello mars" And I fill in "Description" with "Hello, Uranus!" + And I click "Add more repos" And I fill in "GitHub url (primary)" with "https://github.com/google/instant-hangouts" And I fill in "Issue Tracker link" with "https://www.pivotaltracker.com/s/projects/853345" + And I fill in "Slack channel name" with "slackin" And I click the "Submit" button Then I should be on the "Show" page for project "hello mars" And I should see a success flash "Project was successfully updated." And I should see "Hello, Uranus!" And I should see a link to "hello mars" on github And I should see a link to "hello mars" on Pivotal Tracker + And I should see a link to the slack channel for "hello mars" Scenario: Saving a project: failure Given I have logged in @@ -53,9 +57,11 @@ Feature: Edit Project And I click the "Submit" button Then I should see "Project was not updated." + @javascript Scenario: Update GitHub url if valid Given I have logged in And I am on the "Edit" page for project "hello mars" + And I click "Add more repos" And I fill in "GitHub url (primary)" with "https://github.com/google/instant-hangouts" And I click the "Submit" button Then I should be on the "Show" page for project "hello mars" @@ -69,9 +75,11 @@ Feature: Edit Project Then I should be on the "Show" page for project "hello mars" And I should see a link to "hello mars" on Pivotal Tracker + @javascript Scenario: Reject GitHub url update if invalid Given I have logged in And I am on the "Edit" page for project "hello mars" + And I click "Add more repos" And I fill in "GitHub url (primary)" with "https:/github.com/google/instant-hangouts" And I click the "Submit" button Then I should see "Project was not updated." diff --git a/features/step_definitions/projects_steps.rb b/features/step_definitions/projects_steps.rb index dcf0aa78d..5525aba4e 100644 --- a/features/step_definitions/projects_steps.rb +++ b/features/step_definitions/projects_steps.rb @@ -13,8 +13,6 @@ end if hash[:github_url].present? project.source_repositories.build(url: hash[:github_url]) - else - project.source_repositories.build end if hash[:tags] project.tag_list.add(hash[:tags], parse: true) @@ -116,6 +114,11 @@ step %Q{I #{option} see link "#{object.title}"} end +Then /^I should see a link to the slack channel for "([^"]*)"$/ do |project_title| + project = Project.find_by title: project_title + expect(page).to have_link project_title, href: "https://agileventures.slack.com/app_redirect?channel=#{project.slack_channel_name}" +end + Given(/^The project "([^"]*)" has (\d+) (.*)$/) do |title, num, item| project = Project.find_by_title(title) case item.downcase.pluralize From 068ecddd363b76e7a912df1b8e6131c1d6d81553 Mon Sep 17 00:00:00 2001 From: Nick Schimek <cfme00@gmail.com> Date: Mon, 30 Jul 2018 16:47:01 -0700 Subject: [PATCH 03/25] Use AgileVentures forked Gem (#2502) acts_as_follower is no longer maintained. Forked Gem to fix deprecation warning spamming the output of our tests. --- Gemfile | 2 +- Gemfile.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index e6d49ceca..81635bde9 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ ruby '2.5.1' gem 'rails', '~> 5.1' gem 'acts-as-taggable-on' -gem 'acts_as_follower', git: 'https://github.com/tcocca/acts_as_follower.git' +gem 'acts_as_follower', git: 'https://github.com/AgileVentures/acts_as_follower.git' gem 'acts_as_tree' gem 'acts_as_votable', '~> 0.11.1' gem 'airbrake' diff --git a/Gemfile.lock b/Gemfile.lock index 3f468ecb2..2faaba3e7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,10 @@ +GIT + remote: https://github.com/AgileVentures/acts_as_follower.git + revision: 894b44451c609a9facfdb8a15bca4fc17ea1eb76 + specs: + acts_as_follower (0.2.1) + activerecord (>= 4.0) + GIT remote: https://github.com/AgileVentures/codeclimate_badges revision: 88f15dfae8679a7895e8fa3cf6a9cb39f665745e @@ -13,13 +20,6 @@ GIT coffee-rails (>= 3.2.2) railties (>= 3.0) -GIT - remote: https://github.com/tcocca/acts_as_follower.git - revision: c5ac7b9601c4af01eb4d9112330b27be4d694ecc - specs: - acts_as_follower (0.2.1) - activerecord (>= 4.0) - GEM remote: https://rubygems.org/ specs: From c1316159a94aef0c0310eaea67e0138b3361f5f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jul 2018 11:23:34 +0100 Subject: [PATCH 04/25] Bump ice_cube from 0.16.2 to 0.16.3 (#2490) Bumps [ice_cube](https://github.com/seejohnrun/ice_cube) from 0.16.2 to 0.16.3. - [Release notes](https://github.com/seejohnrun/ice_cube/releases) - [Changelog](https://github.com/seejohnrun/ice_cube/blob/master/CHANGELOG.md) - [Commits](https://github.com/seejohnrun/ice_cube/compare/v0.16.2...v0.16.3) Signed-off-by: dependabot[bot] <support@dependabot.com> --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 2a2b515ef..cec0b902a 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ gem 'faker' gem 'font-awesome-rails' gem 'friendly_id' gem 'geocoder' -gem 'ice_cube', '0.16.2' +gem 'ice_cube', '0.16.3' gem 'jbuilder' gem 'jquery-rails' gem 'jquery-turbolinks', '2.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 01e67559a..273879037 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -300,7 +300,7 @@ GEM multi_xml (>= 0.5.2) i18n (1.0.1) concurrent-ruby (~> 1.0) - ice_cube (0.16.2) + ice_cube (0.16.3) inflecto (0.0.2) jasmine (3.1.0) jasmine-core (= 3.1.0) @@ -686,7 +686,7 @@ DEPENDENCIES guard-livereload guard-rspec hirb - ice_cube (= 0.16.2) + ice_cube (= 0.16.3) jasmine (~> 3.0) jasmine-jquery-rails (~> 2.0, >= 2.0.3) jbuilder From 999d22cad067d641566521b949a8f8db960df172 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jul 2018 11:23:56 +0100 Subject: [PATCH 05/25] Bump public_activity from 1.5.0 to 1.6.0 (#2487) Bumps [public_activity](https://github.com/pokonski/public_activity) from 1.5.0 to 1.6.0. - [Release notes](https://github.com/pokonski/public_activity/releases) - [Changelog](https://github.com/chaps-io/public_activity/blob/1-6-stable/CHANGELOG.md) - [Commits](https://github.com/pokonski/public_activity/commits) Signed-off-by: dependabot[bot] <support@dependabot.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 273879037..718aefc22 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -427,7 +427,7 @@ GEM pry (~> 0.10) pry-rails (0.3.6) pry (>= 0.10.4) - public_activity (1.5.0) + public_activity (1.6.0) actionpack (>= 3.0.0) activerecord (>= 3.0) i18n (>= 0.5.0) @@ -445,7 +445,7 @@ GEM rack (2.0.5) rack-cache (1.8.0) rack (>= 0.4) - rack-test (1.0.0) + rack-test (1.1.0) rack (>= 1.0, < 3) rack-timeout (0.5.1) railroady (1.5.3) From 8ec953b9e72ad60c8b5646b2afbce67a23548b34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jul 2018 11:24:06 +0100 Subject: [PATCH 06/25] Bump selenium-webdriver from 3.13.0 to 3.13.1 (#2486) Bumps [selenium-webdriver](https://github.com/SeleniumHQ/selenium) from 3.13.0 to 3.13.1. - [Release notes](https://github.com/SeleniumHQ/selenium/releases) - [Changelog](https://github.com/SeleniumHQ/selenium/blob/master/rb/CHANGES) - [Commits](https://github.com/SeleniumHQ/selenium/commits) Signed-off-by: dependabot[bot] <support@dependabot.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 718aefc22..e7a3d3323 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -545,7 +545,7 @@ GEM sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) - selenium-webdriver (3.13.0) + selenium-webdriver (3.13.1) childprocess (~> 0.5) rubyzip (~> 1.2) shellany (0.0.1) From 6e5dfb35f1910adc9074e66b2ba41d2b4ac51afb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jul 2018 15:45:34 +0100 Subject: [PATCH 07/25] Bump public_activity from 1.6.0 to 1.6.1 (#2492) Bumps [public_activity](https://github.com/pokonski/public_activity) from 1.6.0 to 1.6.1. - [Release notes](https://github.com/pokonski/public_activity/releases) - [Changelog](https://github.com/chaps-io/public_activity/blob/1-6-stable/CHANGELOG.md) - [Commits](https://github.com/pokonski/public_activity/commits/v1.6.1) Signed-off-by: dependabot[bot] <support@dependabot.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index e7a3d3323..8f40fc8e7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -427,7 +427,7 @@ GEM pry (~> 0.10) pry-rails (0.3.6) pry (>= 0.10.4) - public_activity (1.6.0) + public_activity (1.6.1) actionpack (>= 3.0.0) activerecord (>= 3.0) i18n (>= 0.5.0) From 1e400a79bf1ab4635c83e4dea5aa30ac09afad9e Mon Sep 17 00:00:00 2001 From: mattwr18 <mattwr18@gmail.com> Date: Tue, 24 Jul 2018 12:00:42 -0300 Subject: [PATCH 08/25] Add dockeriziation (#2493) --- .dockerignore | 0 Dockerfile | 8 ++++++++ Gemfile | 2 +- Gemfile.lock | 2 +- config/database.yml | 3 ++- docker-compose.yml | 15 +++++++++++++++ 6 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..e69de29bb diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..109000751 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM ruby:2.5 +RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x +RUN mkdir /WebsiteOne +WORKDIR /WebsiteOne +COPY Gemfile /WebsiteOne/Gemfile +COPY Gemfile.lock /WebsiteOne/Gemfile.lock +RUN bundle install +COPY . /WebsiteOne diff --git a/Gemfile b/Gemfile index cec0b902a..e6d49ceca 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '2.5.0' +ruby '2.5.1' gem 'rails', '~> 5.1' gem 'acts-as-taggable-on' diff --git a/Gemfile.lock b/Gemfile.lock index 8f40fc8e7..85294752a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -758,7 +758,7 @@ DEPENDENCIES zeus RUBY VERSION - ruby 2.5.0p0 + ruby 2.5.1p57 BUNDLED WITH 1.16.2 diff --git a/config/database.yml b/config/database.yml index 669b35507..7a85bd037 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,8 +3,9 @@ development: &dev encoding: unicode database: websiteone_development pool: 20 + host: db username: postgres - password: + password: test: &test <<: *dev database: websiteone_test diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..66fec220e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3' +services: + db: + image: postgres + volumes: + - ./tmp/db:/var/lib/postgresql/data:rw + web: + build: . + command: bundle exec rails s -p 3000 -b '0.0.0.0' + volumes: + - .:/WebsiteOne + ports: + - "3000:3000" + depends_on: + - db From 4cfabdd3ace4000939191ac8f9699bf07ad5b35d Mon Sep 17 00:00:00 2001 From: Matt Rider <mattwr18@gmail.com> Date: Wed, 25 Jul 2018 20:04:05 -0300 Subject: [PATCH 09/25] Ignore development in airbrake initializer To not track catch exceptions in development environment --- config/database.yml | 2 +- config/initializers/airbrake.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/database.yml b/config/database.yml index 7a85bd037..20ba99648 100644 --- a/config/database.yml +++ b/config/database.yml @@ -2,8 +2,8 @@ development: &dev adapter: postgresql encoding: unicode database: websiteone_development - pool: 20 host: db + pool: 20 username: postgres password: test: &test diff --git a/config/initializers/airbrake.rb b/config/initializers/airbrake.rb index 11d774de6..bb84f8796 100644 --- a/config/initializers/airbrake.rb +++ b/config/initializers/airbrake.rb @@ -39,7 +39,7 @@ # unwanted environments such as :test. # NOTE: This option *does not* work if you don't set the 'environment' option. # https://github.com/airbrake/airbrake-ruby#ignore_environments - c.ignore_environments = %w(test) + c.ignore_environments = %w(development test) # A list of parameters that should be filtered out of what is sent to # Airbrake. By default, all "password" attributes will have their contents From 8ce2071df0e7eedcba1c29e63d69d97e15cbe964 Mon Sep 17 00:00:00 2001 From: Matt Rider <mattwr18@gmail.com> Date: Wed, 25 Jul 2018 20:48:32 -0300 Subject: [PATCH 10/25] Add npm install globally, install dependencies To ensure latest npm version To install dependencies necessary for the project --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index 109000751..4d2f75e56 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,12 @@ FROM ruby:2.5 RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x +# ensures npm - not the latest version installed by apt-get +RUN npm install -g npm +RUN npm install -g phantomjs RUN mkdir /WebsiteOne WORKDIR /WebsiteOne COPY Gemfile /WebsiteOne/Gemfile COPY Gemfile.lock /WebsiteOne/Gemfile.lock RUN bundle install COPY . /WebsiteOne +RUN npm install From 4bd3f97b04a2087d700d182bc25676f60229a670 Mon Sep 17 00:00:00 2001 From: Matt Rider <mattwr18@gmail.com> Date: Wed, 25 Jul 2018 21:50:38 -0300 Subject: [PATCH 11/25] Add Dockerfile for node, update corejs-typehead npm install erroring out, was outdated --- Dockerfile | 4 ---- Dockerfile-node | 9 +++++++++ docker-compose.yml | 4 ++++ package.json | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 Dockerfile-node diff --git a/Dockerfile b/Dockerfile index 4d2f75e56..109000751 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,8 @@ FROM ruby:2.5 RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x -# ensures npm - not the latest version installed by apt-get -RUN npm install -g npm -RUN npm install -g phantomjs RUN mkdir /WebsiteOne WORKDIR /WebsiteOne COPY Gemfile /WebsiteOne/Gemfile COPY Gemfile.lock /WebsiteOne/Gemfile.lock RUN bundle install COPY . /WebsiteOne -RUN npm install diff --git a/Dockerfile-node b/Dockerfile-node new file mode 100644 index 000000000..7b8779a08 --- /dev/null +++ b/Dockerfile-node @@ -0,0 +1,9 @@ +FROM node:8.11.3-alpine + +RUN apk add --no-cache git + +WORKDIR /WebsiteOne + +ADD package.json . +RUN npm install bower -g +RUN npm install diff --git a/docker-compose.yml b/docker-compose.yml index 66fec220e..c537116a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,9 @@ version: '3' services: + node: + build: + context: . + dockerfile: Dockerfile-node db: image: postgres volumes: diff --git a/package.json b/package.json index 187ccf60d..b505b425d 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "bootstrap-timepicker": "^0.5.2", "bower": "^1.8.4", "copyfiles": "^1.0.0", - "corejs-typeahead": "^0.11.1", + "corejs-typeahead": "^1.2.1", "moment": "^2.13.0", "moment-timezone": "0.5.4", "nprogress": "^0.1.4" From 38b0684002b9f99eaac2332cb643bfea1b32b4b6 Mon Sep 17 00:00:00 2001 From: Matt Rider <mattwr18@gmail.com> Date: Wed, 25 Jul 2018 22:23:41 -0300 Subject: [PATCH 12/25] Install node from deb.nodesource.com --- Dockerfile | 2 ++ docker-compose.yml | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 109000751..7e52b1312 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ FROM ruby:2.5 +RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x RUN mkdir /WebsiteOne WORKDIR /WebsiteOne COPY Gemfile /WebsiteOne/Gemfile COPY Gemfile.lock /WebsiteOne/Gemfile.lock RUN bundle install +RUN npm install COPY . /WebsiteOne diff --git a/docker-compose.yml b/docker-compose.yml index c537116a4..2ba039676 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,9 @@ version: '3' services: - node: - build: - context: . - dockerfile: Dockerfile-node + # node: + # build: + # context: . + # dockerfile: Dockerfile-node db: image: postgres volumes: From 68cc651394b60001856f52150dd551cef82204ef Mon Sep 17 00:00:00 2001 From: Matt Rider <mattwr18@gmail.com> Date: Thu, 26 Jul 2018 10:11:30 -0300 Subject: [PATCH 13/25] Copy javascript dependencies to assets --- Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Dockerfile b/Dockerfile index 7e52b1312..9a90fbb4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,4 +7,11 @@ COPY Gemfile /WebsiteOne/Gemfile COPY Gemfile.lock /WebsiteOne/Gemfile.lock RUN bundle install RUN npm install +COPY 'node_modules/nprogress/nprogress.js' \ + 'node_modules/corejs-typeahead/dist/typeahead.jquery.js' \ + 'node_modules/bootstrap-timepicker/js/bootstrap-timepicker.min.js' \ + 'node_modules/bootstrap-datepicker/js/bootstrap-datepicker.js' \ + 'node_modules/moment/min/moment.min.js' \ + 'node_modules/moment-timezone/builds/moment-timezone-with-data-2010-2020.js' \ + /vendor/assets/javascripts/ COPY . /WebsiteOne From 80e7adc8b33f1f132eb1ae15b01a9da45bbe3e61 Mon Sep 17 00:00:00 2001 From: Matt Rider <mattwr18@gmail.com> Date: Thu, 26 Jul 2018 14:24:33 -0300 Subject: [PATCH 14/25] Run scripts inside Dockerfile, remove node Dockerfile Cleaner to run inside container Not needed as Node is being installed and run within Ruby container --- Dockerfile | 8 +------- Dockerfile-node | 9 --------- docker-compose.yml | 4 ---- 3 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 Dockerfile-node diff --git a/Dockerfile b/Dockerfile index 9a90fbb4a..d28618e69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,5 @@ COPY Gemfile /WebsiteOne/Gemfile COPY Gemfile.lock /WebsiteOne/Gemfile.lock RUN bundle install RUN npm install -COPY 'node_modules/nprogress/nprogress.js' \ - 'node_modules/corejs-typeahead/dist/typeahead.jquery.js' \ - 'node_modules/bootstrap-timepicker/js/bootstrap-timepicker.min.js' \ - 'node_modules/bootstrap-datepicker/js/bootstrap-datepicker.js' \ - 'node_modules/moment/min/moment.min.js' \ - 'node_modules/moment-timezone/builds/moment-timezone-with-data-2010-2020.js' \ - /vendor/assets/javascripts/ COPY . /WebsiteOne +RUN /WebsiteOne/scripts/copy_javascript_dependencies.js diff --git a/Dockerfile-node b/Dockerfile-node deleted file mode 100644 index 7b8779a08..000000000 --- a/Dockerfile-node +++ /dev/null @@ -1,9 +0,0 @@ -FROM node:8.11.3-alpine - -RUN apk add --no-cache git - -WORKDIR /WebsiteOne - -ADD package.json . -RUN npm install bower -g -RUN npm install diff --git a/docker-compose.yml b/docker-compose.yml index 2ba039676..66fec220e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,5 @@ version: '3' services: - # node: - # build: - # context: . - # dockerfile: Dockerfile-node db: image: postgres volumes: From ed5b81f2e5bc8f89d4e70b79ab14c1a3b6252543 Mon Sep 17 00:00:00 2001 From: Felipe Munhoz <felipe@felipemunhoz.com> Date: Thu, 26 Jul 2018 15:23:39 -0300 Subject: [PATCH 15/25] Copy package*.json files to the container before npm install --- Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d28618e69..f0c991a98 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,19 @@ FROM ruby:2.5 RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x + RUN mkdir /WebsiteOne + WORKDIR /WebsiteOne + COPY Gemfile /WebsiteOne/Gemfile COPY Gemfile.lock /WebsiteOne/Gemfile.lock RUN bundle install + +COPY package.json /WebsiteOne/package.json +COPY package-lock.json /WebsiteOne/package-lock.json RUN npm install + COPY . /WebsiteOne -RUN /WebsiteOne/scripts/copy_javascript_dependencies.js + +RUN /WebsiteOne/scripts/copy_javascript_dependencies.js \ No newline at end of file From beba65af2a2231a737f53195c5e1b8c6e8f981bc Mon Sep 17 00:00:00 2001 From: Felipe Munhoz <felipe@felipemunhoz.com> Date: Thu, 26 Jul 2018 15:24:03 -0300 Subject: [PATCH 16/25] Remove the pid file before run the rails server --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 66fec220e..df914ebec 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: - ./tmp/db:/var/lib/postgresql/data:rw web: build: . - command: bundle exec rails s -p 3000 -b '0.0.0.0' + command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'" volumes: - .:/WebsiteOne ports: From 4b91d2c269db3e5c2f5907d564a1b8bf341d714f Mon Sep 17 00:00:00 2001 From: Matt Rider <mattwr18@gmail.com> Date: Thu, 26 Jul 2018 20:38:23 -0300 Subject: [PATCH 17/25] Add npm install bower --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f0c991a98..ac4ae8ad9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,11 @@ FROM ruby:2.5 + RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - -RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x +RUN apt-get update -qq && apt-get install -y build-essential \ +libpq-dev nodejs qt5-default libqt5webkit5-dev \ +gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x RUN mkdir /WebsiteOne - WORKDIR /WebsiteOne COPY Gemfile /WebsiteOne/Gemfile @@ -12,8 +14,9 @@ RUN bundle install COPY package.json /WebsiteOne/package.json COPY package-lock.json /WebsiteOne/package-lock.json -RUN npm install +RUN npm install bower && npm install COPY . /WebsiteOne -RUN /WebsiteOne/scripts/copy_javascript_dependencies.js \ No newline at end of file +RUN /WebsiteOne/scripts/copy_javascript_dependencies.js +RUN ls -al /WebsiteOne/vendor/assets/javascripts From b2fba784da2d68a04851749799c533a3968cd484 Mon Sep 17 00:00:00 2001 From: Felipe Munhoz <felipe@felipemunhoz.com> Date: Sat, 28 Jul 2018 11:19:48 -0300 Subject: [PATCH 18/25] Trying to improve docker workflow --- Dockerfile | 6 +++--- docker-compose.yml | 8 ++++++-- docker/README.md | 35 +++++++++++++++++++++++++++++++++++ docker/setup.sh | 7 +++++++ docker/start.sh | 4 ++++ docker/stop.sh | 3 +++ 6 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 docker/README.md create mode 100755 docker/setup.sh create mode 100755 docker/start.sh create mode 100755 docker/stop.sh diff --git a/Dockerfile b/Dockerfile index ac4ae8ad9..5370b30e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ FROM ruby:2.5 RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - RUN apt-get update -qq && apt-get install -y build-essential \ -libpq-dev nodejs qt5-default libqt5webkit5-dev \ -gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x + libpq-dev nodejs qt5-default libqt5webkit5-dev \ + gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x RUN mkdir /WebsiteOne WORKDIR /WebsiteOne @@ -14,7 +14,7 @@ RUN bundle install COPY package.json /WebsiteOne/package.json COPY package-lock.json /WebsiteOne/package-lock.json -RUN npm install bower && npm install +RUN npm install COPY . /WebsiteOne diff --git a/docker-compose.yml b/docker-compose.yml index df914ebec..03a4c9a06 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,13 +3,17 @@ services: db: image: postgres volumes: - - ./tmp/db:/var/lib/postgresql/data:rw + - dbVolume:/var/lib/postgresql/data web: build: . command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'" volumes: - - .:/WebsiteOne + - webVolume:/WebsiteOne ports: - "3000:3000" depends_on: - db + +volumes: + dbVolume: + webVolume: \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..98eef6872 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,35 @@ +# How to use docker to spin up WebSiteOne + +## Setup docker + +Execute this setup just for the first time, or when you want to recreate everything from scratch. + +**BE AWARE IT WILL DELETE ALL YOUR DATA, including the Postgres Database.** + +``` +$ ./docker/setup.sh +``` + +## Start docker + +Start the application + +``` +$ ./docker/start.sh +``` + +## Stop docker + +Stop the application + +``` +$ ./docker/stop.sh +``` + +ps: those docker commands were tested under the following environment: + +- MacOS 10.13.6 +- Docker version 18.06.0-ce, build 0ffa825 +- docker-compose version 1.22.0, build f46880f + +If it doesn't work for you, try to check your docker version and consider upgrading it if you have an older version. diff --git a/docker/setup.sh b/docker/setup.sh new file mode 100755 index 000000000..34f469ad8 --- /dev/null +++ b/docker/setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +docker-compose down --rmi all --volumes --remove-orphans +docker-compose build --force-rm --no-cache +docker-compose run --rm web rake db:create +docker-compose run --rm web rake db:migrate RAILS_ENV=development +docker-compose run --rm web rake db:seed \ No newline at end of file diff --git a/docker/start.sh b/docker/start.sh new file mode 100755 index 000000000..f3f5275cb --- /dev/null +++ b/docker/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker-compose down +docker-compose up \ No newline at end of file diff --git a/docker/stop.sh b/docker/stop.sh new file mode 100755 index 000000000..8bff4e78e --- /dev/null +++ b/docker/stop.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker-compose down \ No newline at end of file From 1d78186a1c529751c3a3a149cca7e42eae090800 Mon Sep 17 00:00:00 2001 From: Matt Rider <mattwr18@gmail.com> Date: Mon, 30 Jul 2018 10:26:25 -0300 Subject: [PATCH 19/25] Configure docker database To work for local developers as well as docker users --- config/database.yml | 1 - docker-compose.yml | 3 ++- docker/config/database.yml | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 docker/config/database.yml diff --git a/config/database.yml b/config/database.yml index 20ba99648..5c3f1e025 100644 --- a/config/database.yml +++ b/config/database.yml @@ -2,7 +2,6 @@ development: &dev adapter: postgresql encoding: unicode database: websiteone_development - host: db pool: 20 username: postgres password: diff --git a/docker-compose.yml b/docker-compose.yml index 03a4c9a06..85777bf61 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'" volumes: - webVolume:/WebsiteOne + - ./docker/config/database.yml:/WebsiteOne/config/database.yml ports: - "3000:3000" depends_on: @@ -16,4 +17,4 @@ services: volumes: dbVolume: - webVolume: \ No newline at end of file + webVolume: diff --git a/docker/config/database.yml b/docker/config/database.yml new file mode 100644 index 000000000..20ba99648 --- /dev/null +++ b/docker/config/database.yml @@ -0,0 +1,18 @@ +development: &dev + adapter: postgresql + encoding: unicode + database: websiteone_development + host: db + pool: 20 + username: postgres + password: +test: &test + <<: *dev + database: websiteone_test + +production: + <<: *dev + database: websiteone_production + +cucumber: + <<: *test From b928a412e2123c030df9fa009e1cfdeb677c573c Mon Sep 17 00:00:00 2001 From: Matt Rider <mattwr18@gmail.com> Date: Mon, 30 Jul 2018 16:58:12 -0300 Subject: [PATCH 20/25] Clean up Dockerfile Remove explicit copy javascript dependencies as they are copied in a postinstall by running npm install Remove debugging list contents of vendor/assets/javascripts --- Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5370b30e1..35a961f12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,3 @@ COPY package-lock.json /WebsiteOne/package-lock.json RUN npm install COPY . /WebsiteOne - -RUN /WebsiteOne/scripts/copy_javascript_dependencies.js -RUN ls -al /WebsiteOne/vendor/assets/javascripts From 95fe28af8ec615233e6c2c949bea860c0eacd3bd Mon Sep 17 00:00:00 2001 From: faithngetich <faithngetich188@gmail.com> Date: Mon, 30 Jul 2018 17:39:04 +0300 Subject: [PATCH 21/25] Add docker installation notes --- docker/README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docker/README.md b/docker/README.md index 98eef6872..eddd89c59 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,11 +1,43 @@ # How to use docker to spin up WebSiteOne +## Prerequisites + +In order to run this container you'll need docker installation +* [Windows](https://docs.docker.com/docker-for-windows/) +* [OS X](https://docs.docker.com/docker-for-mac/) +* [Linux](https://docs.docker.com/linux/started/) + +## Setup your environment variables + +Create a .env file at the root of your directory. + +``` +touch .env +``` + +* You'll have to get the `.env` file content from one of the admins: @tansaku or @diraulo. The project won't work without it. You can send them a direct message (DM) on Slack. The `.env` file should go in the root of the WSO project. +* Add the following to that file: + +``` +RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI +RECAPTCHA_SECRET_KEY=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe +AIRBRAKE_API_KEY=blahblahblah +AIRBRAKE_PROJECT_ID=123 +SECRET_KEY_BASE=blabla +RACK_TIMEOUT_SERVICE_TIMEOUT=200000000 +``` + +the above are test keys from https://developers.google.com/recaptcha/docs/faq + ## Setup docker Execute this setup just for the first time, or when you want to recreate everything from scratch. **BE AWARE IT WILL DELETE ALL YOUR DATA, including the Postgres Database.** + + + ``` $ ./docker/setup.sh ``` From 66ffe05074e667056f19567cf9ef240d13b336f0 Mon Sep 17 00:00:00 2001 From: faithngetich <faithngetich188@gmail.com> Date: Mon, 30 Jul 2018 20:51:09 +0300 Subject: [PATCH 22/25] Link docker file to the project setup document --- docs/project_setup.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/project_setup.md b/docs/project_setup.md index 03f1de51b..c055fe039 100644 --- a/docs/project_setup.md +++ b/docs/project_setup.md @@ -48,7 +48,14 @@ git fetch upstream git pull upstream develop ``` -### Step 3: Install the gems with `bundle install` +### Step 3: There are two options of setting up, choose one. + +## Option 1 - Installation and Usage with Docker +See the [Docker Project Setup](../docker/README.md) documentation + +## Option 2 - Local Installation + +### Step 1: Install the gems with `bundle install` bundle install @@ -80,7 +87,7 @@ If you need to update rails, you can run `bundle update rails`. If you run into gem install libv8 -v '3.16.14.3' -- --with-system-v8 ``` -### Step 4: Install javascript dependencies using `npm` +### Step 2: Install javascript dependencies using `npm` * Use [npm](https://www.npmjs.com/) to install all of the javascript dependencies for WSO: `npm install` @@ -92,7 +99,7 @@ If you need to update rails, you can run `bundle update rails`. If you run into #### Phantomjs [Phantomjs](http://phantomjs.org/) is used to run tests. [Here are detailed instructions for installing it.](development_environment_set_up.md#phantomjs) -### Step 5: Request the .env file and confirm your locale +### Step 3: Request the .env file and confirm your locale * You'll have to get the `.env` file from one of the admins: @tansaku or @diraulo. The project won't work without it. You can send them a direct message (DM) on Slack. The `.env` file should go in the root of the WSO project. * Add the following to that file: @@ -110,13 +117,13 @@ the above are test keys from https://developers.google.com/recaptcha/docs/faq -### Step 6: Set up the database +### Step 4: Set up the database * Run the rake command to set up the database. Be sure to use `bundle exec` so that the gems specific to this project (listed in the Gemfile) are used: `bundle exec rake db:setup` -### Step 7: Run the tests +### Step 5: Run the tests Now you're ready to run the tests: @@ -126,7 +133,7 @@ Now you're ready to run the tests: Discuss any errors with the team on Slack, in a scrum, or in mob or pair programming. -### Step 8. Start the server +### Step 6. Start the server bundle exec rails s From 1ad446e72c209bb374c111d48e74997dc8633ce9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Jul 2018 18:47:34 +0900 Subject: [PATCH 23/25] Bump apipie-rails from 0.5.9 to 0.5.10 (#2494) Bumps [apipie-rails](https://github.com/Apipie/apipie-rails) from 0.5.9 to 0.5.10. - [Release notes](https://github.com/Apipie/apipie-rails/releases) - [Changelog](https://github.com/Apipie/apipie-rails/blob/master/CHANGELOG.md) - [Commits](https://github.com/Apipie/apipie-rails/compare/v0.5.9...v0.5.10) Signed-off-by: dependabot[bot] <support@dependabot.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 85294752a..455207e39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,7 +71,7 @@ GEM airbrake-ruby (~> 2.10) airbrake-ruby (2.10.0) andand (1.3.3) - apipie-rails (0.5.9) + apipie-rails (0.5.10) rails (>= 4.1) arel (8.0.0) autoprefixer-rails (8.1.0) From 709561561783ec9f959e1855377f4fc4b5ed93c4 Mon Sep 17 00:00:00 2001 From: Nick Schimek <cfme00@gmail.com> Date: Sun, 29 Jul 2018 18:30:05 -0700 Subject: [PATCH 24/25] Add Slack channel link to the projects show page (#2498) * Add tests for viewing the projects API links * Add slack channel link to show page Added link for the projects slack channel. This is needed to so that individuals can easily find a projects slack channel. Fix #770 * Add slack channel name to tests Updated the background job to include the slack channel for the hello project * Update slack link assertion Updated the assertion to check for the slack channel name instead of the Project title since project title will not always be the same as the slack channel name. * Run migration to add slack channel name Added slack_channel_name to projects table. Storing the slack channel name for each project will allow us to create links that direct users to the correct slack channel for the project. * Update link to use the slack channel name * Fix grammar in cucumber test * Add CRUD tests for slack channel name * Update CRUD views to include slack channel name * Add test for when slack channel does not exist Added to test to check that the view renders revelant information when a slack channel does not exist. * Update view to render correct slack status The view was updated to render "not linked to Slack" when the project doesn't have a slack channel name associated to it. * Update test to check the views else route The github test is now failing for this, but it's working locally and in production which means there is a bug somewhere in the tests. * Remove building source repository When a github link is not present a source repository should not be built as this was causing the project to have a github source repository even though the link is nil. * Update tests now that source repo is not built There are three tests failing due to the source repository not being built for every project regardless if there is a valid github link. Source repo's should only exist when there are github links associated to a project. These three tests were trying to add github links to a project that didn't previously had a github link, hence the button needed to be clicked before the value could be filled in. * Replace hard link with param name * Permit slack channel name params --- app/controllers/projects_controller.rb | 2 +- app/views/projects/_connections.html.erb | 10 +++++ app/views/projects/_form.html.erb | 4 +- ...0001_add_slack_channel_name_to_projects.rb | 5 +++ db/schema.rb | 3 +- features/projects/connections.feature | 44 +++++++++++++++++++ features/projects/create_projects.feature | 4 +- features/projects/edit_project.feature | 8 ++++ features/step_definitions/projects_steps.rb | 7 ++- 9 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20180729040001_add_slack_channel_name_to_projects.rb create mode 100644 features/projects/connections.feature diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4d1ce5712..2730bce6d 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -107,6 +107,6 @@ def get_current_stories end def project_params - params.require(:project).permit(:title, :description, :pitch, :created, :status, :user_id, :github_url, :pivotaltracker_url, :pivotaltracker_id, :image_url, source_repositories_attributes: [:id, :url, :_destroy]) + params.require(:project).permit(:title, :description, :pitch, :created, :status, :user_id, :github_url, :pivotaltracker_url, :pivotaltracker_id, :slack_channel_name, :image_url, source_repositories_attributes: [:id, :url, :_destroy]) end end diff --git a/app/views/projects/_connections.html.erb b/app/views/projects/_connections.html.erb index e00e43b17..05658ad68 100644 --- a/app/views/projects/_connections.html.erb +++ b/app/views/projects/_connections.html.erb @@ -15,4 +15,14 @@ <% else %> <p><i class="fa fa-gear fa-lg"></i> <span class="small">not linked to IssueTracker</span></p> <% end %> + + <% if @project.slack_channel_name.present? %> + <p><i class="fa fa-slack" aria-hidden="true"></i> + <span class="small"> + <%= link_to "#{@project.title} ", "https://agileventures.slack.com/app_redirect?channel=#{@project.slack_channel_name}" %>on Slack + </span> + </p> + <% else %> + <p><i class="fa fa-gear fa-lg"></i> <span class="small">not linked to Slack</span></p> + <% end %> </aside> diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb index 75c06c300..191e73660 100644 --- a/app/views/projects/_form.html.erb +++ b/app/views/projects/_form.html.erb @@ -22,6 +22,8 @@ <%= awesome_text_field f, :pivotaltracker_url, label_text: 'Issue Tracker link', placeholder: 'https://www.pivotaltracker.com/s/projects/id' %> + <%= awesome_text_field f, :slack_channel_name, label_text: 'Slack channel name', placeholder: 'project_slack_channel_name' %> + <% if @project.new_record? %> <div class="form-group"> <h3>New project checklist</h3> @@ -40,4 +42,4 @@ </div> <% end %> </div> -</div> \ No newline at end of file +</div> diff --git a/db/migrate/20180729040001_add_slack_channel_name_to_projects.rb b/db/migrate/20180729040001_add_slack_channel_name_to_projects.rb new file mode 100644 index 000000000..e38ea0229 --- /dev/null +++ b/db/migrate/20180729040001_add_slack_channel_name_to_projects.rb @@ -0,0 +1,5 @@ +class AddSlackChannelNameToProjects < ActiveRecord::Migration[5.1] + def change + add_column :projects, :slack_channel_name, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 88c99919d..2c41b51c2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180515093331) do +ActiveRecord::Schema.define(version: 20180729040001) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -183,6 +183,7 @@ t.integer "commit_count", default: 0 t.string "image_url" t.datetime "last_github_update" + t.string "slack_channel_name" t.index ["slug"], name: "index_projects_on_slug", unique: true t.index ["user_id"], name: "index_projects_on_user_id" end diff --git a/features/projects/connections.feature b/features/projects/connections.feature new file mode 100644 index 000000000..ba2c69bf1 --- /dev/null +++ b/features/projects/connections.feature @@ -0,0 +1,44 @@ +Feature: Projects should show links to the connected APIs + As a User + So that I can easily navigate to Project apps + I want to see all connected app links on the show page + + Background: + Given the following users exist + | first_name | last_name | email | receive_mailings | + | Bill | Bob | Bill@example.com | true | + + Given the following projects exist: + | title | description | status | author | pivotaltracker_url | github_url | slack_channel_name | + | hello | earthlings | active | Bill | https://www.pivotaltracker.com/n/projects/742821 | https://github.com/hello | hello_earthlings | + | Bat Man | All bat | active | Bill | | | | + + Scenario: I can see a link to the GitHub project page + When I go to the "hello" project "show" page + Then I should see "hello on GitHub" + And I should see a link to "hello" on github + + Scenario: I can see when a project is not connected to GitHub + When I go to the "Bat Man" project "show" page + Then I should not see "Bat Man on GitHub" + And I should see "not linked to GitHub" + + Scenario: I can see a link to the projects issue tracker + When I go to the "hello" project "show" page + Then I should see "hello on IssueTracker" + And I should see a link to "hello" on Pivotal Tracker + + Scenario: I can see when a project is not connected to issue tracker + When I go to the "Bat Man" project "show" page + Then I should not see "Bat Man on IssueTracker" + And I should see "not linked to IssueTracker" + + Scenario: I can see a link to the projects slack channel + When I go to the "hello" project "show" page + Then I should see "hello on Slack" + And I should see a link to the slack channel for "hello" + + Scenario: I can see when a project is not connected to slack + When I go to the "Bat Man" project "show" page + Then I should not see "Bat Man on Slack" + And I should see "not linked to Slack" diff --git a/features/projects/create_projects.feature b/features/projects/create_projects.feature index 3b8d8f3ab..40c91a21f 100644 --- a/features/projects/create_projects.feature +++ b/features/projects/create_projects.feature @@ -26,6 +26,7 @@ Feature: Create projects | Status | | GitHub url (primary) | | Issue Tracker link | + | Slack channel name | Scenario Outline: Saving a new project: success Given I have logged in @@ -35,6 +36,7 @@ Feature: Create projects And I fill in "Description" with "<description>" And I fill in "GitHub url (primary)" with "<gh_link>" And I fill in "Issue Tracker link" with "<pt_link>" + And I fill in "Slack channel name" with "slackin" And I select "Status" to "Active" And I click the "Submit" button Then I should be on the "Show" page for project "<title>" @@ -46,6 +48,7 @@ Feature: Create projects | ACTIVE | And I should see a link to "<title>" on github And I should see a link to "<title>" on Pivotal Tracker + And I should see a link to the slack channel for "<title>" Examples: | title | description | gh_link | pt_link | @@ -83,4 +86,3 @@ Feature: Create projects | ACTIVE | And I should see a link to "multiple repo project" on github And I should see a link to "multiple repo project" on Pivotal Tracker - diff --git a/features/projects/edit_project.feature b/features/projects/edit_project.feature index d744b7e91..ab1f69e68 100644 --- a/features/projects/edit_project.feature +++ b/features/projects/edit_project.feature @@ -33,18 +33,22 @@ Feature: Edit Project When I click "Back" Then I should be on the "Show" page for project "hello mars" + @javascript Scenario: Updating a project: success Given I have logged in And I am on the "Edit" page for project "hello mars" And I fill in "Description" with "Hello, Uranus!" + And I click "Add more repos" And I fill in "GitHub url (primary)" with "https://github.com/google/instant-hangouts" And I fill in "Issue Tracker link" with "https://www.pivotaltracker.com/s/projects/853345" + And I fill in "Slack channel name" with "slackin" And I click the "Submit" button Then I should be on the "Show" page for project "hello mars" And I should see a success flash "Project was successfully updated." And I should see "Hello, Uranus!" And I should see a link to "hello mars" on github And I should see a link to "hello mars" on Pivotal Tracker + And I should see a link to the slack channel for "hello mars" Scenario: Saving a project: failure Given I have logged in @@ -53,9 +57,11 @@ Feature: Edit Project And I click the "Submit" button Then I should see "Project was not updated." + @javascript Scenario: Update GitHub url if valid Given I have logged in And I am on the "Edit" page for project "hello mars" + And I click "Add more repos" And I fill in "GitHub url (primary)" with "https://github.com/google/instant-hangouts" And I click the "Submit" button Then I should be on the "Show" page for project "hello mars" @@ -69,9 +75,11 @@ Feature: Edit Project Then I should be on the "Show" page for project "hello mars" And I should see a link to "hello mars" on Pivotal Tracker + @javascript Scenario: Reject GitHub url update if invalid Given I have logged in And I am on the "Edit" page for project "hello mars" + And I click "Add more repos" And I fill in "GitHub url (primary)" with "https:/github.com/google/instant-hangouts" And I click the "Submit" button Then I should see "Project was not updated." diff --git a/features/step_definitions/projects_steps.rb b/features/step_definitions/projects_steps.rb index dcf0aa78d..5525aba4e 100644 --- a/features/step_definitions/projects_steps.rb +++ b/features/step_definitions/projects_steps.rb @@ -13,8 +13,6 @@ end if hash[:github_url].present? project.source_repositories.build(url: hash[:github_url]) - else - project.source_repositories.build end if hash[:tags] project.tag_list.add(hash[:tags], parse: true) @@ -116,6 +114,11 @@ step %Q{I #{option} see link "#{object.title}"} end +Then /^I should see a link to the slack channel for "([^"]*)"$/ do |project_title| + project = Project.find_by title: project_title + expect(page).to have_link project_title, href: "https://agileventures.slack.com/app_redirect?channel=#{project.slack_channel_name}" +end + Given(/^The project "([^"]*)" has (\d+) (.*)$/) do |title, num, item| project = Project.find_by_title(title) case item.downcase.pluralize From b2c6ba7c20e72240eefcce8d6c634689078fa577 Mon Sep 17 00:00:00 2001 From: Nick Schimek <cfme00@gmail.com> Date: Mon, 30 Jul 2018 16:47:01 -0700 Subject: [PATCH 25/25] Use AgileVentures forked Gem (#2502) acts_as_follower is no longer maintained. Forked Gem to fix deprecation warning spamming the output of our tests. --- Gemfile | 2 +- Gemfile.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index e6d49ceca..81635bde9 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ ruby '2.5.1' gem 'rails', '~> 5.1' gem 'acts-as-taggable-on' -gem 'acts_as_follower', git: 'https://github.com/tcocca/acts_as_follower.git' +gem 'acts_as_follower', git: 'https://github.com/AgileVentures/acts_as_follower.git' gem 'acts_as_tree' gem 'acts_as_votable', '~> 0.11.1' gem 'airbrake' diff --git a/Gemfile.lock b/Gemfile.lock index 455207e39..f30c41372 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,10 @@ +GIT + remote: https://github.com/AgileVentures/acts_as_follower.git + revision: 894b44451c609a9facfdb8a15bca4fc17ea1eb76 + specs: + acts_as_follower (0.2.1) + activerecord (>= 4.0) + GIT remote: https://github.com/AgileVentures/codeclimate_badges revision: 88f15dfae8679a7895e8fa3cf6a9cb39f665745e @@ -13,13 +20,6 @@ GIT coffee-rails (>= 3.2.2) railties (>= 3.0) -GIT - remote: https://github.com/tcocca/acts_as_follower.git - revision: c5ac7b9601c4af01eb4d9112330b27be4d694ecc - specs: - acts_as_follower (0.2.1) - activerecord (>= 4.0) - GEM remote: https://rubygems.org/ specs: