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

Commit 2c0596f

Browse files
Merge pull request #418 from wimo7083/issue365_add_jobs
Merge job changes into head branch
2 parents a1bcd87 + 75eed14 commit 2c0596f

File tree

9 files changed

+71
-29
lines changed

9 files changed

+71
-29
lines changed

.rubocop.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
inherit_from: .rubocop_todo.yml
22

3+
AllCops:
4+
Exclude:
5+
- 'db/schema.rb'
6+
37
# Cop supports --auto-correct.
48
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
59
# SupportedStyles: single_quotes, double_quotes
610
Style/StringLiterals:
711
Exclude:
812
- 'db/**/*'
913

10-
# Configuration parameters: CountComments, ExcludedMethods.
11-
Metrics/BlockLength:
14+
#turn off end of line checks, git will fix this
15+
EndOfLine:
16+
Enabled: false
17+
18+
Metrics/ClassLength:
1219
Exclude:
13-
- 'db/schema.rb'
20+
- 'test/models/user_test.rb'

Makefile

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,96 @@
1-
RAILS_CONTAINER := web
1+
include Makefile.in
22

33
.PHONY: all
44
all: run
55

6+
.PHONY: nuke
7+
nuke:
8+
$(DOCKER) system prune -a --volumes
9+
10+
.PHONY:
11+
minty-fresh:
12+
$(DOCKER_COMPOSE) down --rmi all --volumes
13+
14+
.PHONY: rmi
15+
rmi:
16+
$(DOCKER) images -q | xargs docker rmi -f
17+
18+
.PHONY: rmdi
19+
rmdi:
20+
$(DOCKER) images -a --filter=dangling=true -q | xargs $(DOCKER) rmi
21+
22+
.PHONY: rm-exited-containers
23+
rm-exited-containers:
24+
$(DOCKER) ps -a -q -f status=exited | xargs $(DOCKER) rm -v
25+
26+
.PHONY: fresh-restart
27+
fresh-restart: minty-fresh setup test run
28+
629
.PHONY: console-sandbox
7-
console-sandbox:
8-
docker-compose run ${RAILS_CONTAINER} rails console --sandbox
30+
console-sandbox:
31+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rails console --sandbox
932

1033
.PHONY: run
1134
run:
12-
docker-compose up --build
35+
$(DOCKER_COMPOSE) up --build
1336

1437
.PHONY: bg
1538
bg:
16-
docker-compose up --build -d
39+
$(DOCKER_COMPOSE) up --build -d
1740

1841
.PHONY: open
1942
open:
2043
open http://localhost:3000
2144

2245
.PHONY: build
2346
build:
24-
docker-compose build
47+
$(DOCKER_COMPOSE) build
2548

2649
.PHONY: console
2750
console:
28-
docker-compose run ${RAILS_CONTAINER} rails console
51+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rails console
2952

3053
.PHONY: routes
3154
routes:
32-
docker-compose run ${RAILS_CONTAINER} rake routes
55+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake routes
3356

3457
.PHONY: db_create
3558
db_create:
36-
docker-compose run ${RAILS_CONTAINER} rake db:create
59+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake db:create
3760

3861
.PHONY: db_migrate
3962
db_migrate:
40-
docker-compose run ${RAILS_CONTAINER} rake db:migrate
63+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake db:migrate
4164

4265
.PHONY: db_status
4366
db_status:
44-
docker-compose run ${RAILS_CONTAINER} rake db:migrate:status
67+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake db:migrate:status
4568

4669
.PHONY: db_rollback
4770
db_rollback:
48-
docker-compose run ${RAILS_CONTAINER} rake db:rollback
71+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake db:rollback
4972

5073
.PHONY: db_seed
5174
db_seed:
52-
docker-compose run ${RAILS_CONTAINER} rake db:seed
75+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rake db:seed
5376

5477
.PHONY: test
5578
test: bg
56-
docker-compose run operationcode-psql bash -c "while ! psql --host=operationcode-psql --username=postgres -c 'SELECT 1'; do sleep 5; done;"
57-
docker-compose run ${RAILS_CONTAINER} bash -c 'export RAILS_ENV=test && rake db:test:prepare && rake test && rubocop'
79+
$(DOCKER_COMPOSE) run operationcode-psql bash -c "while ! psql --host=operationcode-psql --username=postgres -c 'SELECT 1'; do sleep 5; done;"
80+
$(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)" '
81+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) bash -c 'rubocop' || echo -e "$(RED)Linting has failed$(NC)"
5882

5983
.PHONY: rubocop
6084
rubocop:
61-
docker-compose run ${RAILS_CONTAINER} rubocop
85+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rubocop
6286

6387
.PHONY: rubocop_auto_correct
6488
rubocop_auto_correct:
65-
docker-compose run ${RAILS_CONTAINER} rubocop -a --auto-correct
89+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) rubocop -a --auto-correct
6690

6791
.PHONY: bundle
6892
bundle:
69-
docker-compose run ${RAILS_CONTAINER} bash -c 'cd /app && bundle'
93+
$(DOCKER_COMPOSE) run $(RAILS_CONTAINER) bash -c 'cd /app && bundle'
7094

7195
setup: build db_create db_migrate
7296

Makefile.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
RAILS_CONTAINER:= web
2+
DOCKER_COMPOSE:= docker-compose
3+
DOCKER:= docker
4+
RED=\033[0;31m
5+
GREEN=\032[0;32m
6+
NC=\033[0m
7+
8+
9+
.DELETE_ON_ERROR:
10+
.SILENT:

apiary.apib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f
451451
"state": "VA",
452452
"country": "USA",
453453
"description": "Our job is fun!",
454-
"status": "active",
454+
"open": false,
455455
"remote": false,
456456
"created_at": "2018-06-01T16:21:59.462Z",
457457
"updated_at": "2018-06-01T16:21:59.462Z"

app/admin/job.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ActiveAdmin.register Job do
2-
permit_params :title, :source_url, :source, :city, :state, :country, :description, :status, :remote
2+
permit_params :title, :source_url, :source, :city, :state, :country, :description, :is_open, :remote
33

44
index do
55
selectable_column
@@ -12,7 +12,7 @@
1212
column :state
1313
column :country
1414
column :description
15-
column :status
15+
column :is_open
1616
column :remote
1717

1818
actions
@@ -27,7 +27,7 @@
2727
f.input :state
2828
f.input :country
2929
f.input :description
30-
f.input :status
30+
f.input :is_open
3131
f.input :remote
3232
end
3333

db/migrate/20180531004341_create_jobs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def change
88
t.string :state
99
t.string :country
1010
t.text :description
11-
t.string :status
11+
t.boolean :is_open, default: true
1212
t.boolean :remote, default: false
1313

1414
t.timestamps

db/schema.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# It's strongly recommended that you check this file into your version control system.
1212

1313
ActiveRecord::Schema.define(version: 20180531004341) do
14+
1415
# These are extensions that must be enabled in order to support this database
1516
enable_extension "plpgsql"
1617

@@ -123,7 +124,7 @@
123124
t.string "state"
124125
t.string "country"
125126
t.text "description"
126-
t.string "status"
127+
t.boolean "is_open", default: true
127128
t.boolean "remote", default: false
128129
t.datetime "created_at", null: false
129130
t.datetime "updated_at", null: false

db/seeds.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
end
3434

3535
# Create jobs
36-
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")
36+
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)
3737

3838
# Create team members
3939
SeedTeamMembers.seed_all

test/factories/jobs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
state Faker::Address.state
88
country Faker::Address.country
99
description Faker::Lorem.paragraph
10-
status 'active'
10+
is_open true
1111
remote false
1212
end
1313
end

0 commit comments

Comments
 (0)