diff --git a/Dockerfile b/Dockerfile
index ac4ae8ad9..486bf17d9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,8 +2,9 @@ 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,9 +15,7 @@ RUN bundle install
COPY package.json /WebsiteOne/package.json
COPY package-lock.json /WebsiteOne/package-lock.json
-RUN npm install bower && npm install
-COPY . /WebsiteOne
+RUN npm install
-RUN /WebsiteOne/scripts/copy_javascript_dependencies.js
-RUN ls -al /WebsiteOne/vendor/assets/javascripts
+COPY . /WebsiteOne
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 1c8ce0a69..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:
@@ -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)
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 b19a2b915..868d6f44c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,8 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20180721104321) do
+
+ActiveRecord::Schema.define(version: 20180729040001) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -184,6 +185,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/docker-compose.yml b/docker-compose.yml
index df914ebec..74a194ec6 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
+ - ./docker/config/database.yml:/WebsiteOne/config/database.yml
ports:
- "3000:3000"
depends_on:
- - db
+ volumes:
+ dbVolume:
+ webVolume:
+
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 000000000..eddd89c59
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,67 @@
+# 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
+```
+
+## 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/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
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
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
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 "" on github
And I should see a link to "" on Pivotal Tracker
+ And I should see a link to the slack channel for ""
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