Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Merge job changes into head branch #418

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
inherit_from: .rubocop_todo.yml

AllCops:
Exclude:
- 'db/schema.rb'

# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Exclude:
- 'db/**/*'

# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
#turn off end of line checks, git will fix this
EndOfLine:
Enabled: false

Metrics/ClassLength:
Exclude:
- 'db/schema.rb'
- 'test/models/user_test.rb'
60 changes: 42 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,72 +1,96 @@
RAILS_CONTAINER := web
include Makefile.in

.PHONY: all
all: run

.PHONY: nuke
nuke:
$(DOCKER) system prune -a --volumes

.PHONY:
minty-fresh:
$(DOCKER_COMPOSE) down --rmi all --volumes

.PHONY: rmi
rmi:
$(DOCKER) images -q | xargs docker rmi -f

.PHONY: rmdi
rmdi:
$(DOCKER) images -a --filter=dangling=true -q | xargs $(DOCKER) rmi

.PHONY: rm-exited-containers
rm-exited-containers:
$(DOCKER) ps -a -q -f status=exited | xargs $(DOCKER) rm -v

.PHONY: fresh-restart
fresh-restart: minty-fresh setup test run

.PHONY: console-sandbox
console-sandbox:
docker-compose run ${RAILS_CONTAINER} rails console --sandbox
console-sandbox:
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rails console --sandbox

.PHONY: run
run:
docker-compose up --build
$(DOCKER_COMPOSE) up --build

.PHONY: bg
bg:
docker-compose up --build -d
$(DOCKER_COMPOSE) up --build -d

.PHONY: open
open:
open http://localhost:3000

.PHONY: build
build:
docker-compose build
$(DOCKER_COMPOSE) build

.PHONY: console
console:
docker-compose run ${RAILS_CONTAINER} rails console
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rails console

.PHONY: routes
routes:
docker-compose run ${RAILS_CONTAINER} rake routes
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake routes

.PHONY: db_create
db_create:
docker-compose run ${RAILS_CONTAINER} rake db:create
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake db:create

.PHONY: db_migrate
db_migrate:
docker-compose run ${RAILS_CONTAINER} rake db:migrate
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake db:migrate

.PHONY: db_status
db_status:
docker-compose run ${RAILS_CONTAINER} rake db:migrate:status
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake db:migrate:status

.PHONY: db_rollback
db_rollback:
docker-compose run ${RAILS_CONTAINER} rake db:rollback
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake db:rollback

.PHONY: db_seed
db_seed:
docker-compose run ${RAILS_CONTAINER} rake db:seed
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake db:seed

.PHONY: test
test: bg
docker-compose run operationcode-psql bash -c "while ! psql --host=operationcode-psql --username=postgres -c 'SELECT 1'; do sleep 5; done;"
docker-compose run ${RAILS_CONTAINER} bash -c 'export RAILS_ENV=test && rake db:test:prepare && rake test && rubocop'
$(DOCKER_COMPOSE) run operationcode-psql bash -c "while ! psql --host=operationcode-psql --username=postgres -c 'SELECT 1'; do sleep 5; done;"
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) bash -c 'export RAILS_ENV=test && rake db:test:prepare && rake test || echo -e "$(RED)Unit tests have failed$(NC)" '
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) bash -c 'rubocop' || echo -e "$(RED)Linting has failed$(NC)"

.PHONY: rubocop
rubocop:
docker-compose run ${RAILS_CONTAINER} rubocop
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rubocop

.PHONY: rubocop_auto_correct
rubocop_auto_correct:
docker-compose run ${RAILS_CONTAINER} rubocop -a --auto-correct
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rubocop -a --auto-correct

.PHONY: bundle
bundle:
docker-compose run ${RAILS_CONTAINER} bash -c 'cd /app && bundle'
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) bash -c 'cd /app && bundle'

setup: build db_create db_migrate

Expand Down
10 changes: 10 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
RAILS_CONTAINER:= web
DOCKER_COMPOSE:= docker-compose
DOCKER:= docker
RED=\033[0;31m
GREEN=\032[0;32m
NC=\033[0m


.DELETE_ON_ERROR:
.SILENT:
2 changes: 1 addition & 1 deletion apiary.apib
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f
"state": "VA",
"country": "USA",
"description": "Our job is fun!",
"status": "active",
"open": false,
"remote": false,
"created_at": "2018-06-01T16:21:59.462Z",
"updated_at": "2018-06-01T16:21:59.462Z"
Expand Down
6 changes: 3 additions & 3 deletions app/admin/job.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ActiveAdmin.register Job do
permit_params :title, :source_url, :source, :city, :state, :country, :description, :status, :remote
permit_params :title, :source_url, :source, :city, :state, :country, :description, :is_open, :remote

index do
selectable_column
Expand All @@ -12,7 +12,7 @@
column :state
column :country
column :description
column :status
column :is_open
column :remote

actions
Expand All @@ -27,7 +27,7 @@
f.input :state
f.input :country
f.input :description
f.input :status
f.input :is_open
f.input :remote
end

Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20180531004341_create_jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def change
t.string :state
t.string :country
t.text :description
t.string :status
t.boolean :is_open, default: true
t.boolean :remote, default: false

t.timestamps
Expand Down
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180531004341) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -123,7 +124,7 @@
t.string "state"
t.string "country"
t.text "description"
t.string "status"
t.boolean "is_open", default: true
t.boolean "remote", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
Expand Down
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
end

# Create jobs
Job.create!(title: "A great job", source_url: "www.applyhere.com", source: "Company A", city: "Virginia Beach", state: "VA", country: "USA", description: "Our job is fun!", status: "active", remote: "false")
Job.create!(title: "A great job", source_url: "www.applyhere.com", source: "Company A", city: "Virginia Beach", state: "VA", country: "USA", description: "Our job is fun!", is_open: true, remote: false)

# Create team members
SeedTeamMembers.seed_all
Expand Down
2 changes: 1 addition & 1 deletion test/factories/jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
state Faker::Address.state
country Faker::Address.country
description Faker::Lorem.paragraph
status 'active'
is_open true
remote false
end
end