Skip to content

Commit 715ff4d

Browse files
committed
Merge branch 'dev' into fix/coverage
2 parents 5992c97 + 13d8a29 commit 715ff4d

14 files changed

+105
-102
lines changed

.travis.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,22 @@ cache:
77
- tmp/cache/assets/test/sprockets
88
env:
99
matrix:
10-
- GROWSTUFF_ELASTICSEARCH='true' RSPEC_TAG=elasticsearch STATIC_CHECKS=false
11-
- GROWSTUFF_ELASTICSEARCH='false' RSPEC_TAG=~elasticsearch STATIC_CHECKS=false
10+
- GROWSTUFF_ELASTICSEARCH='true' RSPEC_TAG=elasticsearch STATIC_CHECKS=false COVERAGE=true
11+
- GROWSTUFF_ELASTICSEARCH='false' RSPEC_TAG=~elasticsearch
1212
- STATIC_CHECKS=true
1313
global:
1414
- GROWSTUFF_SITE_NAME="Growstuff (travis)"
1515
- RAILS_SECRET_TOKEN='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
1616
- secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4="
1717
before_install:
18-
- ./script/install_phantomjs
18+
- ./script/install_phantomjs.sh
1919
- export PATH=$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH
2020
# Force Travis to use Elastic Search 2.4.0
21-
- >
22-
if [ "${GROWSTUFF_ELASTICSEARCH}" = "true" ]; then
23-
./scripts/install_elasticsearch.sh;
24-
./scripts/install_codeclimate.sh;
25-
fi
21+
- ./scripts/install_codeclimate.sh
22+
- ./scripts/install_linters.sh
2623
before_script:
27-
- set -e
28-
- >
29-
if [ "${STATIC_CHECKS}" = "true" ]; then
30-
./script/install_linters;
31-
else
32-
RAILS_ENV=test bundle exec rake db:create db:migrate;
33-
bundle exec rake assets:precompile;
34-
fi
35-
- >
36-
if [ "${GROWSTUFF_ELASTICSEARCH}" = "true" ]; then
37-
./cc-test-reporter before-build;
38-
fi
39-
- set +e
24+
- RAILS_ENV=test bundle exec rake db:create db:migrate
25+
- bundle exec rake assets:precompile
4026
script:
4127
- set -e
4228
- >
@@ -50,7 +36,7 @@ script:
5036
- set +e
5137
after_script:
5238
- >
53-
if [ "${GROWSTUFF_ELASTICSEARCH}" = "true" ]; then
39+
if [ "${COVERAGE}" = "true" ]; then
5440
./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT;
5541
fi
5642
before_deploy:

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,4 @@ end
155155
group :travis do
156156
gem 'platform-api'
157157
end
158+
gem 'rack-protection', '>= 2.0.1'

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ GEM
378378
public_suffix (3.0.1)
379379
quiet_assets (1.1.0)
380380
railties (>= 3.1, < 5.0)
381-
rack (1.6.8)
382-
rack-protection (2.0.0)
381+
rack (1.6.9)
382+
rack-protection (2.0.1)
383383
rack
384384
rack-test (0.6.3)
385385
rack (>= 1.0)
@@ -606,6 +606,7 @@ DEPENDENCIES
606606
poltergeist
607607
pry
608608
quiet_assets
609+
rack-protection (>= 2.0.1)
609610
rails (~> 4.2.8)
610611
rails-assets-leaflet.markercluster!
611612
rails_12factor
@@ -629,6 +630,5 @@ DEPENDENCIES
629630

630631
RUBY VERSION
631632
ruby 2.4.1p111
632-
633633
BUNDLED WITH
634634
1.16.1

app/assets/stylesheets/overrides.sass

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,6 @@ p.stats
9494
dd
9595
margin-left: auto
9696

97-
@media (min-width: $screen-md-min)
98-
.planting-thumbnail
99-
dl.planting-attributes
100-
width: 100%
101-
102-
dt
103-
text-align: left
104-
width: 120px
105-
dd
106-
padding-left: 120px
107-
margin-left: auto
108-
109-
.navbar .navbar-form
110-
width: 250px
111-
11297

11398
#placesmap, #cropmap
11499
height: 500px
@@ -254,24 +239,6 @@ html, body
254239
a
255240
font-weight: 800
256241

257-
// Overrides applying only to mobile view. This must be at the end of the overrides file.
258-
259-
@media only screen and (max-width: 767px)
260-
.sidebar
261-
margin-left: 0
262-
border-left: none
263-
padding-left: 0
264-
265-
#map
266-
height: 300px
267-
268-
.navbar .nav > li
269-
display: block
270-
271-
.navbar .navbar-form
272-
width: 185px
273-
padding-left: 0
274-
padding-right: 0
275242

276243
/* override "info" alert boxes to be green, not blue, on Growstuff */
277244
$state-info-text: darken($green, 10%)
@@ -326,3 +293,44 @@ ul.thumbnail-buttons
326293

327294
.hover-wrapper:hover .text
328295
visibility: visible
296+
297+
.homepage-listing
298+
padding-bottom: 6px
299+
300+
@media (min-width: $screen-md-min)
301+
.planting-thumbnail
302+
dl.planting-attributes
303+
width: 100%
304+
305+
dt
306+
text-align: left
307+
width: 120px
308+
dd
309+
padding-left: 120px
310+
margin-left: auto
311+
312+
.navbar .navbar-form
313+
width: 250px
314+
315+
// Overrides applying only to mobile view. This must be at the end of the overrides file.
316+
@media only screen and (max-width: 767px)
317+
.sidebar
318+
margin-left: 0
319+
border-left: none
320+
padding-left: 0
321+
322+
#map
323+
height: 300px
324+
325+
.navbar .nav > li
326+
display: block
327+
328+
.navbar .navbar-form
329+
width: 185px
330+
padding-left: 0
331+
padding-right: 0
332+
.homepage
333+
.thumbnail
334+
height: 180px
335+
.seed-thumbnail
336+
height: 220px

app/views/home/_crops.html.haml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- cache cache_key_for(Crop, 'interesting'), expires_in: 1.day do
22
.row
33
%h2= t('.our_crops')
4-
- Crop.interesting.includes(:scientific_names, :photos).limit(7).each do |c|
5-
.col-md-4.col-xs-4= render 'crops/thumbnail', crop: c
4+
- Crop.interesting.includes(:scientific_names, :photos).limit(8).each do |c|
5+
.col-md-4.col-sm-3.col-xs-6= render 'crops/thumbnail', crop: c

app/views/home/_plantings.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
- cache cache_key_for(Planting, 'home'), expires_in: 1.day do
22
%h2= t('.recently_planted')
3-
= render 'plantings/list', plantings: Planting.includes(:crop, garden: :owner).has_photos.recent.first(5)
3+
= render 'plantings/list', plantings: Planting.includes(:crop, garden: :owner).has_photos.recent.limit(5)

app/views/home/_seeds.html.haml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
%h2= t('.title')
33
.row
44
- Seed.current.tradable.order(created_at: :desc).limit(6).each do |seed|
5-
.col-md-2.col-xs-4
6-
.thumbnail
5+
.col-md-2.col-sm-2.col-xs-6
6+
.thumbnail.seed-thumbnail
77
- cache cache_key_for(Crop, seed.id) do
88
= link_to image_tag(seed_image_path(seed),
99
alt: seed.crop.name, class: 'img'),
@@ -13,9 +13,10 @@
1313
.trade-to
1414
%p= seed.owner.location
1515
%p
16-
Will trade to:
17-
%br/
18-
#{seed.tradable_to}
16+
%small
17+
Will trade to:
18+
%br/
19+
%em= seed.tradable_to
1920

2021
%p.text-right
21-
= link_to "#{t('.view_all')} »", seeds_path
22+
= link_to "#{t('.view_all')} »", seeds_path

app/views/home/index.html.haml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
.row
1+
.homepage.row
22
.col-md-12
33
- if member_signed_in?
44
%h1= t('.welcome', site_name: ENV['GROWSTUFF_SITE_NAME'], member_name: current_member)
55

6-
= render partial: 'stats'
6+
= render 'stats'
77
%p
88
.btn-group
99
= link_to t('.plant'), new_planting_path, class: 'btn btn-default'
@@ -14,17 +14,17 @@
1414
- else
1515
.hidden-xs
1616
.jumbotron
17-
= render partial: 'blurb'
17+
= render 'blurb'
1818
.visible-xs
19-
= render partial: 'blurb'
19+
= render 'blurb'
2020

2121
.row
22-
.col-md-6
23-
= render partial: 'crops'
24-
.col-md-3
25-
= render partial: 'plantings'
26-
.col-md-3
27-
= render partial: 'harvests'
22+
.col-md-6.col-sm-12
23+
= render 'crops'
24+
.col-md-3.col-sm-6
25+
= render 'plantings'
26+
.col-md-3.col-sm-6
27+
= render 'harvests'
2828
.col-md-12
2929
- cache cache_key_for(Crop, 'recent') do
3030
%p{ style: 'margin-top: 11.25px' }
@@ -36,8 +36,8 @@
3636
= link_to "#{t('home.crops.view_all')} »", crops_path
3737
.row
3838
.col-md-12
39-
= render partial: 'seeds'
40-
= render partial: 'members'
39+
= render 'seeds'
40+
= render 'members'
4141
.row
4242
.col-md-12
43-
= render partial: 'discuss'
43+
= render 'discuss'

app/views/plantings/_list.html.haml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
- plantings.each do |p|
22
- cache p do
33
.row
4-
.col-md-3.col-xs-4{ style: 'padding-bottom: 6px' }
5-
= render partial: 'plantings/image_with_popover', locals: { planting: p }
4+
.col-md-3.col-xs-4.homepage-listing
5+
= render 'plantings/image_with_popover', planting: p
66
.col-md-9.col-xs-4
77
= link_to p.crop, p.crop
88
in

script/install_codeclimate.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash
2+
set -euv
23

3-
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
4-
chmod +x ./cc-test-reporter
4+
if [ "${COVERAGE}" = "true" ]; then
5+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter;
6+
chmod +x ./cc-test-reporter;
7+
fi

script/install_elasticsearch.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash
22
set -euv
33

4-
sudo dpkg -r elasticsearch;
5-
curl -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.0/elasticsearch-2.4.0.deb
6-
sudo dpkg -i --force-confnew elasticsearch-2.4.0.deb
7-
sudo service elasticsearch start
8-
sleep 10
9-
curl localhost:9200
4+
if [ "${GROWSTUFF_ELASTICSEARCH}" = "true" ]; then
5+
sudo dpkg -r elasticsearch
6+
curl -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.0/elasticsearch-2.4.0.deb
7+
sudo dpkg -i --force-confnew elasticsearch-2.4.0.deb
8+
sudo service elasticsearch start
9+
sleep 10
10+
curl -v localhost:9200
11+
fi

script/install_linters

Lines changed: 0 additions & 12 deletions
This file was deleted.

script/install_linters.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -euv
3+
4+
if [ "${STATIC_CHECKS}" = "true" ]; then
5+
gem install --update overcommit rubocop haml-lint bundler-audit;
6+
npm install;
7+
pip install yamllint --user;
8+
9+
overcommit --install;
10+
overcommit --sign;
11+
overcommit --sign pre-commit;
12+
13+
bundle-audit update;
14+
fi
File renamed without changes.

0 commit comments

Comments
 (0)