Skip to content

Commit dc37547

Browse files
authored
Merge pull request #662 from PecanProject/release/5.2.1
Release/5.2.1
2 parents afe4f4b + 4b5453e commit dc37547

21 files changed

+486
-41
lines changed

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruby-2.3.0
1+
ruby-2.3.8

.travis.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,19 @@ sudo: false
77
# versions of ruby to use
88
# see the list at http://rubies.travis-ci.org/
99
rvm:
10-
- 2.2.4
11-
- 2.3.0
10+
- 2.2.9
11+
- 2.3.8
12+
- 2.4.6
13+
- 2.5.5
14+
- 2.6.3
15+
16+
matrix:
17+
fast_finish: true
18+
allow_failures:
19+
- rvm: 2.2.9
20+
- rvm: 2.4.6
21+
- rvm: 2.5.5
22+
- rvm: 2.6.3
1223

1324
# used for all ruby tasks to specify the database
1425
env:
@@ -25,7 +36,7 @@ addons:
2536
postgresql: 9.5
2637
apt:
2738
packages:
28-
- postgresql-9.5-postgis-2.3
39+
- postgresql-9.5-postgis-2.4
2940

3041
# notifications should go to gitter
3142
notifications:
@@ -42,6 +53,9 @@ notifications:
4253
services:
4354
- postgresql
4455

56+
install:
57+
- bundle install --jobs=3 --retry=3 --with docker --without "javascript_testing"
58+
4559
before_script:
4660
- psql -U postgres -c "CREATE EXTENSION postgis"
4761
- psql -U postgres -c "CREATE USER bety WITH SUPERUSER CREATEDB UNENCRYPTED PASSWORD 'bety'";

.zenodo.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
},
5050
{
5151
"name": "Chris Black"
52+
},
53+
{
54+
"affiliation": "University of Arizona",
55+
"name": "Chris Schnaufer"
5256
}
5357
],
5458
"language": "eng",

CHANGELOG.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ section for the next release.
55

66
For more information about this file see also [Keep a Changelog](http://keepachangelog.com/) .
77

8+
## [5.2.1] - 2019-08-07
9+
10+
Currently the tested and recommended version of Ruby to be used with BETY is 2.3. BETY compiles and passes tests with 2.4, 2.5 and 2.6 but have not been tested thoroughly with these versions.
11+
12+
### Added
13+
14+
- #643 : Moved `reindex.bety.sh` and `vacuum.bety.sh` scripts from PEcAn to BETY and provided access through entrypoint.
15+
16+
### Changed
17+
18+
- Documentation updates, now point to new [documentation location](https://pecanproject.github.io/bety-documentation/index.html)
19+
- #652 : Better list of soil choices
20+
- Ruby 2.3.8 is now default ruby when using RVM.
21+
22+
### Fixed
23+
24+
- Updated GEM list to fix security fixes as recommended by dependbot on GitHub.
25+
- Restores method assignment in Bulk Uploads
26+
- Fixed travis build, testing with 2.2, 2.3, 2.4, 2.5 and 2.6 of Ruby.
27+
- Fixed errors when running BETY with 2.4, 2.5 and 2.6
28+
- #668 : show "not found" page for invalid citations.
29+
830
## [5.2.0] - 2019-03-11
931

1032
### Added
@@ -15,7 +37,7 @@ For more information about this file see also [Keep a Changelog](http://keepacha
1537

1638
## [5.1.0] - 2019-01-14
1739

18-
### Fixes
40+
### Fixed
1941

2042
- #611 : could not close alerts
2143
- #585 : Pressing "Show" on the Covariates Edit page attempts an update
@@ -26,34 +48,34 @@ For more information about this file see also [Keep a Changelog](http://keepacha
2648

2749
## [5.0.5] - 2018-10-23
2850

29-
### Fixes
51+
### Fixed
3052

3153
- #603 : Restores Rails route to make method completion work in Bulk Upload Wizard
3254

3355
## [5.0.4] - 2018-10-11
3456

35-
### Fixes
57+
### Fixed
3658

3759
- #600 : Error when starting BETY as docker container due to frozen variable.
3860

3961
## [5.0.3] - 2018-09-28
4062

41-
### Fixes
63+
### Fixed
4264

4365
- #593 : Replaces references to gitter with references to slack.
44-
- #598 : Fixes issue in docker where the entrypoint referenced a wrong URL to download the initial schema from.
66+
- #598 : Fixed issue in docker where the entrypoint referenced a wrong URL to download the initial schema from.
4567

4668
## [5.0.2] - 2018-08-09
4769

48-
### Fixes
70+
### Fixed
4971
- Update to sprockets gem
5072

5173
## [5.0.1] - 2018-08-08
5274

53-
### Fixes
54-
- Fixes fuzzy matching used in search queries
75+
### Fixed
76+
- Fixed fuzzy matching used in search queries
5577

5678
## [5.0.0] - 2018-08-07
5779

58-
### Fixes
80+
### Fixed
5981
- Major upgrade to rails 5, make sure to read documentation on how to upgrade.

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ gem 'rails3-restful-authentication', '~> 3.0.1'
2222
gem 'dynamic_form'
2323
gem 'rabl'
2424
gem 'yajl-ruby', '~> 1.3.1'
25-
gem 'rubyzip', '~> 1.2.1'
25+
gem 'rubyzip', '~> 1.2.2'
2626
gem 'activerecord-session_store' # no longer part of Rails proper
2727
gem 'protected_attributes_continued' # Use this until and unless we start using Strong Parameters.
2828
gem 'sass-rails'

Gemfile.lock

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ GEM
6363
rack (>= 1.0.0)
6464
rack-test (>= 0.5.4)
6565
xpath (>= 2.0, < 4.0)
66-
capybara-webkit (1.15.0)
66+
capybara-webkit (1.15.1)
6767
capybara (>= 2.3, < 4.0)
6868
json
6969
childprocess (0.9.0)
@@ -85,7 +85,7 @@ GEM
8585
dynamic_form (1.1.4)
8686
erubi (1.7.1)
8787
execjs (2.7.0)
88-
ffi (1.9.23)
88+
ffi (1.11.1)
8989
globalid (0.4.1)
9090
activesupport (>= 4.2.0)
9191
i18n (0.9.5)
@@ -100,7 +100,7 @@ GEM
100100
json-schema (2.8.0)
101101
addressable (>= 2.4)
102102
kgio (2.11.2)
103-
loofah (2.2.2)
103+
loofah (2.2.3)
104104
crass (~> 1.0.2)
105105
nokogiri (>= 1.5.9)
106106
mail (2.7.0)
@@ -114,7 +114,7 @@ GEM
114114
mustache (1.0.5)
115115
narray (0.6.0.4)
116116
nio4r (2.3.0)
117-
nokogiri (1.8.2)
117+
nokogiri (1.8.5)
118118
mini_portile2 (~> 2.3.0)
119119
passenger (5.3.4)
120120
rack
@@ -133,7 +133,7 @@ GEM
133133
public_suffix (3.0.2)
134134
rabl (0.13.1)
135135
activesupport (>= 2.3.14)
136-
rack (2.0.5)
136+
rack (2.0.7)
137137
rack-test (1.0.0)
138138
rack (>= 1.0, < 3)
139139
railroad (0.5.0)
@@ -202,7 +202,7 @@ GEM
202202
mustache (~> 1.0, >= 0.99.4)
203203
rspec (~> 3.0)
204204
ruby-graphviz (1.0.8)
205-
rubyzip (1.2.1)
205+
rubyzip (1.2.2)
206206
safe_attributes (1.0.10)
207207
activerecord (>= 3.0.0)
208208
sass (3.5.6)
@@ -245,7 +245,7 @@ GEM
245245
xpath (3.0.0)
246246
nokogiri (~> 1.8)
247247
yajl-ruby (1.3.1)
248-
yard (0.9.12)
248+
yard (0.9.20)
249249

250250
PLATFORMS
251251
ruby
@@ -286,7 +286,7 @@ DEPENDENCIES
286286
rspec-rails (~> 3.0)
287287
rspec_api_documentation
288288
ruby-graphviz (= 1.0.8)
289-
rubyzip (~> 1.2.1)
289+
rubyzip (~> 1.2.2)
290290
safe_attributes
291291
sass-rails
292292
seer (= 0.10.0)
@@ -298,3 +298,6 @@ DEPENDENCIES
298298
will_paginate
299299
yajl-ruby (~> 1.3.1)
300300
yard
301+
302+
BUNDLED WITH
303+
1.17.3

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ docker run -e RAILS_RELATIVE_URL_ROOT="/bety" pecan/bety
3535

3636
## Documentation.
3737

38-
* Technical Documentation: https://pecan.gitbooks.io/betydb-documentation/content/
39-
* Data Entry: https://pecan.gitbooks.io/betydbdoc-dataentry/content/
40-
* Data Access: https://pecan.gitbooks.io/betydb-data-access/content/
38+
* Technical Documentation: https://pecanproject.github.io/bety-documentation/technical/
39+
* Data Entry: https://pecanproject.github.io/bety-documentation/dataentry/
40+
* Data Access: https://pecan.gitbook.io/betydb-data-access/
4141

app/controllers/citations_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ def index
123123
# GET /citations/1
124124
# GET /citations/1.xml
125125
def show
126-
@citation = Citation.where(:id => params[:id]).includes(params[:include]).first
126+
# find_by! throws an ActiveRecord::RecordNotFound exception if no citation
127+
# with the given id exists so that we don't attempt to display a nil
128+
# citation.
129+
@citation = Citation.includes(params[:include]).find_by!(:id => params[:id])
127130

128131
respond_to do |format|
129132
format.html # show.html.erb

app/models/bulk_upload_data_set.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,9 @@ def get_insertion_data
19001900
# Get interactively-specified values, or set to empty hash if nil; since we
19011901
# are going to alter interactively_specified_values, we use clone to make a
19021902
# copy so that the session value remains as is.
1903-
interactively_specified_values = @session["global_values"].clone rescue ActionController::Parameters.new
1903+
interactively_specified_values = @session.has_key?(:global_values) \
1904+
? @session[:global_values].clone \
1905+
: ActionController::Parameters.new
19041906

19051907
# TO DO: decide if this code serves any useful purpose:
19061908
# Double-check that all form fields are were non-empty:

app/models/site.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def city_state
231231

232232
def sitename_state_country
233233
output = ""
234-
234+
235235
#city = city.chomp if !city.nil?
236236
if !sitename.blank?
237237
output += "#{sitename}"
@@ -262,6 +262,17 @@ def autocomplete_label
262262
"#{sitename.squish} (#{city.squish}, #{!(state.nil? || state.empty?) ? " #{state.squish}," : ""} #{country.squish})"
263263
end
264264

265+
### Class methods
266+
267+
def self.soil_classes
268+
269+
@soil_classes ||= ['clay', 'clay loam', 'loam', 'loamy sand', 'sand',
270+
'sandy clay', 'sandy clay loam', 'sandy loam',
271+
'silt', 'silt loam', 'silty clay', 'silty clay loam',
272+
'peat', 'bedrock', 'other'].freeze
273+
end
274+
275+
265276
private
266277

267278
## Validation methods

app/views/layouts/application.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@
200200

201201
<li class="menu-docs"> <a>Docs</a>
202202
<ul class="sub-menu">
203-
<li><%= link_to "Data Entry", "https://pecan.gitbooks.io/betydbdoc-dataentry/content/", :target =>"_blank" %></li>
204-
<li><%= link_to "Data Access", "https://pecan.gitbooks.io/betydb-data-access/content/", :target =>"_blank" %>></li>
205-
<li><%= link_to "Implementation", "https://pecan.gitbooks.io/betydb-documentation/content/", :target =>"_blank" %></li>
203+
<li><%= link_to "Data Entry", "https://pecanproject.github.io/bety-documentation/dataentry", :target =>"_blank" %></li>
204+
<li><%= link_to "Data Access", "https://pecan.gitbook.io/betydb-data-access/", :target =>"_blank" %>></li>
205+
<li><%= link_to "Implementation", "https://pecanproject.github.io/bety-documentation/technical/", :target =>"_blank" %></li>
206206
<li><%= link_to "Schema", schemas_path %>></li>
207207
</ul>
208208
</li>
@@ -292,7 +292,7 @@
292292
<h3><strong>BETY</strong>db</h3>
293293
<ul class="unstyled">
294294
<li><%= link_to "Homepage", root_path %></li>
295-
<li><%= link_to "Documentation", "https://pecan.gitbooks.io/betydb-documentation/content/", :target =>"_blank" %></li>
295+
<li><%= link_to "Documentation", "https://pecanproject.github.io/bety-documentation/", :target =>"_blank" %></li>
296296
<% if CONFIG[:show_crop_map_links] %>
297297
<li><%= link_to "Maps & Data", maps_path %></li>
298298
<% end %>

app/views/sites/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
<%= f.label :lon %>
312312
<%= geometry_aware_text_field(f, :lon, { class: "input-full" }) %>
313313
<%= f.label :soil %>
314-
<%= f.select :soil, %w(sandloamy sandsandy loamsilt loamloamsandy clay loamsilty clay loamclay loamsandy claysilty clayclaypeat), { :include_blank => true }, :class => "input-full" %>
314+
<%= f.select :soil, Site.soil_classes, { :include_blank => true }, :class => "input-full" %>
315315

316316
<div class="two columns alpha">
317317
<%= f.label :clay_pct, "% Clay" %>

app/views/sites/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@
309309
<%= f.text_field :lon, :class => "input-full" %>
310310
<br /><br />
311311
<%= f.label :soil %>
312-
<%= f.select :soil, %w(sandloamy sandsandy loamsilt loamloamsandy clay loamsilty clay loamclay loamsandy claysilty clayclaypeat), { :include_blank => true }, :class => "input-full" %>
312+
<%= f.select :soil, Site.soil_classes, { :include_blank => true }, :class => "input-full" %>
313313

314314
<div class="two columns alpha">
315315
<%= f.label :clay_pct, "% Clay" %>

docker/entrypoint.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ case $1 in
2323
echo "Migrate database."
2424
rake db:migrate SKIP_SCHEMASPY=YES
2525
;;
26+
"reindex" )
27+
echo "Reindexing database tables"
28+
./script/reindex.bety.sh -d "bety" -p "-h postgres -p 5432 -U postgres"
29+
;;
30+
"reindex-all" )
31+
echo "Reindexing entire database"
32+
./script/reindex.bety.sh -d "bety" -p "-h postgres -p 5432 -U postgres" -s
33+
;;
2634
"server" )
2735
echo "Start running BETY (rails server)"
2836
exec rails s
@@ -35,6 +43,18 @@ case $1 in
3543
echo "Start running BETY (unicorn)"
3644
exec bundle exec unicorn -c config/unicorn.rb
3745
;;
46+
"vacuum" )
47+
echo "Vacuuming database tables"
48+
./script/vacuum.bety.sh -d "bety" -p "-h postgres -p 5432 -U postgres" -s
49+
;;
50+
"vacuum-all" )
51+
echo "Vacuuming entire database (not VACUUM FULL)"
52+
./script/vacuum.bety.sh -d "bety" -p "-h postgres -p 5432 -U postgres"
53+
;;
54+
"vacuum-full" )
55+
echo "Full vacuuming of entire database: VACUUM FULL"
56+
./script/vacuum.bety.sh -d "bety" -p "-h postgres -p 5432 -U postgres" -f
57+
;;
3858
"autoserver" )
3959
echo "Migrate database."
4060
rake db:migrate SKIP_SCHEMASPY=YES
@@ -50,8 +70,13 @@ case $1 in
5070
echo "sync : synchronize database with remote servers ${REMOTE_SERVERS}"
5171
echo "dump : dumps local database"
5272
echo "migrate : migrates the database to a new version of bety"
73+
echo "reindex : maintentance: reindex the tables in the database"
74+
echo "reindex-all: maintentance: reindex all of the database, do this sparingly"
5375
echo "server : runs the server (using rails server)"
5476
echo "unicorn : runs the server (using unicorn)"
77+
echo "vacuum : maintenance: vaccum the tables of the database"
78+
echo "vacuum-all : maintenance: vaccum the entire database (not VACUUM FULL)"
79+
echo "vacuum-full: maintenance: full vaccum of the database. Specify rarely, if ever"
5580
echo "autoserver : runs the server (using unicorn) after running a migrate"
5681
echo "help : this text"
5782
echo ""

script/db_maintenance/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This script was motivated by the need to repair a database where the id numbers
1515
for new rows were allocated in the wrong range—to be specific, they were
1616
allocated starting at 99000000001 rather than starting at the number
1717
corresponding to the id number of the machine where the database resides. (See
18-
https://pecan.gitbook.io/betydb-documentation/betydb-system-administration/distributed-betydb#primary-key-allocations
18+
https://pecanproject.github.io/bety-documentation/technical/distributed-instances-of-betydb.html
1919
for a list of BETYdb instances and their corresponding primary key allocations.)
2020

2121
When id numbers have been mis-allocated, three things must be done to repair the

script/load.bety.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ ID_RANGE=1000000000
250250
# before anything is done, check to make sure database exists
251251
if ! psql ${PG_OPT} ${PG_USER} -lqt | cut -d \| -f 1 | grep -w "^ *${DATABASE} *$" > /dev/null ; then
252252
echo "Database ${DATABASE} does not exist, please create it:"
253-
echo "(see https://pecan.gitbooks.io/betydb-documentation/content/installing_betydb.html)"
253+
echo "(see https://pecanproject.github.io/bety-documentation/technical/deploying-a-production-copy-of-the-betydb-web-application.html)"
254254
echo " psql ${PG_OPT} ${PG_USER} -c \"CREATE ROLE ${OWNER} WITH LOGIN CREATEDB NOSUPERUSER NOCREATEROLE PASSWORD 'password'\""
255255
echo " psql ${PG_OPT} ${PG_USER} -c \"CREATE DATABASE ${DATABASE} WITH OWNER ${OWNER}\""
256256
exit 1

0 commit comments

Comments
 (0)