Compare commits

...

181 Commits

Author SHA1 Message Date
Shiny
39b461c348 Merge pull request #1243 from Growstuff/dev
Release 21
2017-04-06 07:49:08 +12:00
pozorvlak
a8f7031447 Merge pull request #1303 from Br3nda/disable-eslint
Disable eslint

Fixes #1302, at least temporarily.
2017-04-05 11:15:10 +01:00
Shiny
17967b7c72 Merge branch 'dev' into disable-eslint 2017-04-04 09:07:02 +12:00
Brenda Wallace
e422c8b072 Disable eslint 2017-04-03 21:05:35 +00:00
Cesy
d42bbe7fa3 Merge pull request #1299 from Br3nda/gemfile-ruby-bump
Gemfile.lock bumping ruby version to match other files
2017-04-03 08:46:19 +01:00
Brenda Wallace
7e754b8293 Gemfile.lock bumping ruby version to match other files 2017-04-01 15:19:18 +13:00
pozorvlak
1dcd84009a Merge pull request #1298 from CloCkWeRX/ruby_234
Ruby 2.3.4
2017-03-31 14:07:36 +01:00
Daniel O'Connor
8615df264e Ruby 2.3.4 2017-03-31 16:29:21 +10:00
Daniel O'Connor
4e400cc899 Merge pull request #1295 from Growstuff/bundle-update-2017-03-30-121732
Bundle Update on 2017-03-30
2017-03-31 16:27:43 +10:00
Daniel O'Connor
3cead5fb6b Pin to earlier rubocop 2017-03-31 16:15:55 +10:00
Shiny
1decf6ea11 Merge branch 'dev' into bundle-update-2017-03-30-121732 2017-03-30 21:37:57 +13:00
Harry Brodsky
23c0f901c6 Add name to CONTRIBUTORS.md 2017-03-30 19:15:48 +13:00
Harry Brodsky
78f4b3dbf3 Update irregular crop pluralizations 2017-03-30 19:15:48 +13:00
deppbot
9340b8d7e5 Bundle Update on 2017-03-30 2017-03-30 12:17:33 +08:00
pozorvlak
0094473bbe Merge pull request #1287 from Br3nda/bw/readme-new-contributors
Readme update for new contributors - force-merging because it only touches README.md.
2017-03-28 23:56:37 +01:00
pozorvlak
743f482818 Merge pull request #1292 from Br3nda/query-optimising
Query optimising
2017-03-28 23:55:05 +01:00
Brenda Wallace
b8ea6116d4 Add photos to plantings to make them interesting in the spec 2017-03-29 10:46:15 +13:00
Brenda Wallace
2521e52d71 Remove test called to Planting.interesting(...)
Interesting plantings with no photos is not used in the code.
The method was converted to a scope.
2017-03-29 08:28:58 +13:00
Brenda Wallace
d44f9ef4e9 Removed assignment of useless variable 2017-03-29 08:21:34 +13:00
Brenda Wallace
63cee1edc9 Back to reading @garden.plantings 2017-03-29 08:21:02 +13:00
Brenda Wallace
3791b34fe3 One planting per owner (used for intersetingness) 2017-03-28 22:39:03 +13:00
Brenda Wallace
5d58be110e Fixed crop.interesting, no more duplicate crops 2017-03-28 19:33:34 +13:00
Brenda Wallace
911593b480 Reduces query numbes on gardens#show 2017-03-24 21:10:45 +13:00
Shiny
b72a3d6942 Merge branch 'dev' into query-optimising 2017-03-24 18:31:18 +13:00
Brenda Wallace
804ac8662a Rubocop fix ups 2017-03-24 17:29:39 +13:00
Brenda Wallace
1601e966ad Planting.interesting is in a scope 2017-03-24 16:59:09 +13:00
Brenda Wallace
e7553868f2 Removed variables on homes controller
following the comment there
2017-03-24 16:57:51 +13:00
Brenda Wallace
5e8ca392d2 Moved Member.interest near top of file 2017-03-24 16:45:55 +13:00
Brenda Wallace
815915d933 Loading child records of interesting crops 2017-03-24 16:45:36 +13:00
Brenda Wallace
6223076dae Pull in interesting members data in controller 2017-03-24 16:30:56 +13:00
Brenda Wallace
0182a99654 Optimising Member.interesting 2017-03-24 16:28:37 +13:00
Brenda Wallace
5baa357bb3 Use bullet to find queries to optomise 2017-03-24 16:07:05 +13:00
deppbot
0fb4d74685 Bundle Update on 2017-03-24 2017-03-24 09:24:40 +13:00
Daniel O'Connor
eebaef6fde Merge branch 'dev' into bw/readme-new-contributors 2017-03-21 14:03:22 +10:30
Daniel O'Connor
59fc550f3c Merge pull request #1290 from Growstuff/bundle-update-2017-03-19-161121
Bundle Update on 2017-03-19
2017-03-20 14:15:06 +10:30
Shiny
64ffaab1ec Merge branch 'dev' into bundle-update-2017-03-19-161121 2017-03-20 10:01:48 +13:00
Cesy
21f53e362f Merge pull request #1279 from Br3nda/plantings-harvests
View harvests for a planting
2017-03-19 09:46:57 +00:00
deppbot
20cfa0c5b2 Bundle Update on 2017-03-19 2017-03-19 16:11:22 +08:00
Shiny
204633d533 Merge branch 'dev' into bw/readme-new-contributors 2017-03-18 14:21:43 +13:00
Shiny
c77ed8c6d0 Merge branch 'dev' into plantings-harvests 2017-03-17 08:18:56 +13:00
Shiny
fe7ae18e7b Merge pull request #1285 from Growstuff/add-contributor-megan
Added Megan to contributors
2017-03-17 08:13:03 +13:00
Shiny
8746cc67e2 Merge branch 'dev' into plantings-harvests 2017-03-17 08:11:33 +13:00
Shiny
f1feb59818 Merge branch 'dev' into add-contributor-megan 2017-03-17 08:10:32 +13:00
Shiny
bb62b11070 Merge branch 'dev' into bw/readme-new-contributors 2017-03-16 21:15:30 +13:00
deppbot
1660d54c01 Bundle Update on 2017-03-16 2017-03-16 21:15:11 +13:00
Shiny
cb7715b6d9 Merge branch 'dev' into bw/readme-new-contributors 2017-03-16 15:35:22 +13:00
Shiny
a60d0faedd Merge branch 'dev' into add-contributor-megan 2017-03-16 15:35:15 +13:00
Shiny
7f592579cd Merge branch 'dev' into plantings-harvests 2017-03-16 15:35:06 +13:00
Brenda Wallace
998befb30f Limited plantings to member's own garden, and approved crops 2017-03-16 15:29:25 +13:00
Shiny
ebbf6df87d Merge branch 'dev' into plantings-harvests 2017-03-16 14:59:54 +13:00
Shiny
40e4f8df8a Merge branch 'dev' into add-contributor-megan 2017-03-16 14:59:26 +13:00
Brenda Wallace
81d41398a2 Link to waffle from readme 2017-03-16 14:55:30 +13:00
Brenda Wallace
4f02f45ae8 Updated wiki link 2017-03-16 14:55:22 +13:00
Arun Kumar
f7ec1826b0 Use presence instead of regex validation 2017-03-16 13:27:13 +13:00
Shiny
d619cd160d Added Megan to contributors 2017-03-16 13:04:31 +13:00
Daniel O'Connor
4a20f68d3a Merge branch 'dev' into plantings-harvests 2017-03-16 09:40:56 +10:30
Daniel O'Connor
62d2b5e9fb Merge pull request #1273 from Br3nda/yaml-cleanup
Yaml file clean up
2017-03-16 09:39:33 +10:30
Daniel O'Connor
5935d2e73f Merge pull request #1276 from Br3nda/bw/install-linters
Install npm modules locally
2017-03-16 09:38:54 +10:30
Daniel O'Connor
92b8972b24 Merge pull request #1278 from Br3nda/bw/crop-model-dupe
Reduced duplication of the term "approved" in crop model
2017-03-16 09:37:24 +10:30
Daniel O'Connor
12254fe0ca Merge pull request #1275 from Br3nda/bw/discourse-removal
Removing references to Discourse (talk.growstuff.org)
2017-03-16 09:36:29 +10:30
Daniel O'Connor
ea54fca2b2 Merge pull request #1282 from Br3nda/gardens-order
Gardens order
2017-03-16 09:35:17 +10:30
Daniel O'Connor
d7db9007fd Merge pull request #1280 from Br3nda/public-error-pages
Update public error pages
2017-03-16 09:32:52 +10:30
Daniel O'Connor
c2acb8cf73 Merge pull request #1274 from Br3nda/fix-traxis-badge
Tie travis badge to a branch
2017-03-16 09:30:27 +10:30
Shiny
8d04d4b223 Merge branch 'dev' into plantings-harvests 2017-03-15 23:10:15 +13:00
Shiny
35d9c8e9f1 Merge branch 'dev' into bw/crop-model-dupe 2017-03-15 23:09:31 +13:00
Shiny
b23118a9db Merge branch 'dev' into public-error-pages 2017-03-15 23:09:21 +13:00
Shiny
5585dbada1 Merge branch 'dev' into gardens-order 2017-03-15 23:09:09 +13:00
Thomas Countz
fa49234669 remove "add new garden" on other member's page (#1283)
* update garden#show view logic
* added name to contributors
Closes #1167
2017-03-15 23:06:32 +13:00
Shiny
8833571ab3 Merge branch 'dev' into bw/discourse-removal 2017-03-14 16:21:44 +13:00
Shiny
a54e66f2fd Merge branch 'dev' into bw/install-linters 2017-03-12 22:56:11 +13:00
Shiny
7913f85cf4 Merge branch 'dev' into yaml-cleanup 2017-03-12 22:55:11 +13:00
Shiny
bf46c0a6d2 Merge branch 'dev' into bw/crop-model-dupe 2017-03-12 22:54:32 +13:00
Shiny
082bdb035f Merge branch 'dev' into plantings-harvests 2017-03-12 22:54:17 +13:00
Shiny
15bedb1659 Merge branch 'dev' into public-error-pages 2017-03-12 22:54:03 +13:00
Shiny
5995812215 Merge branch 'dev' into gardens-order 2017-03-12 22:53:34 +13:00
Brenda Wallace
195d1bbdbb order gardens by recently updated 2017-03-12 20:12:28 +13:00
deppbot
55e0579384 Bundle Update on 2017-03-12 2017-03-12 18:50:42 +13:00
Megan Talbot
d167a427b9 Update public error pages
Author:    Megan Talbot <meganftalbot@gmail.com>
Date:      Wed Mar 1 15:55:30 2017 -0700
2017-03-12 14:46:40 +13:00
Brenda Wallace
c89c20e842 View harvests for a planting 2017-03-12 14:44:11 +13:00
Shiny
ad04a48c8f Merge branch 'dev' into bw/discourse-removal 2017-03-12 13:56:04 +13:00
Shiny
d3a47b3dc6 Merge branch 'dev' into fix-traxis-badge 2017-03-12 12:49:22 +13:00
Brenda Wallace
02de30f617 Reduced duplication of the term "approved" in crop model 2017-03-12 12:31:38 +13:00
Shiny
a4360a0fa5 Merge branch 'dev' into yaml-cleanup 2017-03-12 11:44:21 +13:00
Brenda Wallace
39d4dec294 Npm sourced linters in package.json 2017-03-12 11:26:50 +13:00
Brenda Wallace
4c189b4d56 Lock haml_lint to 0.20.0 and update other gems 2017-03-12 10:53:55 +13:00
Brenda Wallace
8267b7d16d Removing references to Discource (talk.growstuff.org)
and adding one link to github issues.
2017-03-12 10:51:25 +13:00
Brenda Wallace
bf9f86d516 Tie travis badge to a branch
Instead of showing the most recent buid (on any branch),
show the dev branch.
2017-03-12 10:42:17 +13:00
Brenda Wallace
a93c4e9fb8 Yaml file clean up 2017-03-12 10:38:39 +13:00
deppbot
3243716d13 Bundle Update on 2017-03-06 2017-03-08 10:41:52 +13:00
Cesy
685418507b Merge pull request #1266 from Br3nda/spec-fixups
bugfix in some spec expectations
2017-03-05 08:32:09 +00:00
Shiny
418c5fdcd0 Merge branch 'dev' into spec-fixups 2017-03-05 21:11:06 +13:00
Brenda Wallace
322f28eaa6 bugfix in some spec expectations 2017-03-05 00:36:10 +13:00
Cesy
7a06ab0b61 Merge pull request #1264 from Br3nda/js-clean
Added missing semicolons to js files
2017-03-04 11:07:19 +00:00
Shiny
a5dda8ab9b Merge branch 'dev' into js-clean 2017-03-04 23:58:04 +13:00
Cesy
54b5c139f3 Merge pull request #1263 from Br3nda/bundle-audit-update
Bundle audit needs updating in test runs
2017-03-04 10:34:39 +00:00
Shiny
864990dc8a Merge branch 'dev' into js-clean 2017-03-04 17:09:01 +13:00
Brenda Wallace
1e0ccd72a2 Added missing semicolons to js files 2017-03-04 17:06:29 +13:00
Shiny
513a8924d8 Merge branch 'dev' into bundle-audit-update 2017-03-04 16:52:19 +13:00
Brenda Wallace
478d68ee25 Bundle audit needs updating 2017-03-04 16:45:43 +13:00
deppbot
175780aa06 Bundle Update on 2017-03-03 2017-03-04 16:33:18 +13:00
Miles Gould
c9558be2d3 Add deppbot to CONTRIBUTORS.md
This prevents deppbot-generated pull requests from failing the "are you
in CONTRIBUTORS.md?" check in CI.
2017-03-04 16:16:28 +13:00
Miles Gould
f1d3a70bbd Install git-guilt linter 2017-03-03 14:25:03 +13:00
Miles Gould
d3dd6f88f2 Fix typo in CONTRIBUTING.md 2017-03-03 14:25:03 +13:00
Brenda Wallace
882d641683 Photo changes expire homepage too 2017-03-03 08:49:24 +13:00
pozorvlak
a53f6073a6 Merge pull request #1253 from Br3nda/rubocop-progress
Rubocop progress
2017-03-02 17:45:39 +00:00
pozorvlak
7c7020f50a Merge branch 'dev' into rubocop-progress 2017-03-02 14:31:39 +00:00
pozorvlak
41b3c0f4fc Merge pull request #1254 from Br3nda/bw/unneeded-percent-q
Rubocop fix for unneeded %Q
2017-03-02 14:29:05 +00:00
pozorvlak
314087321c Merge branch 'dev' into bw/unneeded-percent-q 2017-03-02 13:41:01 +00:00
pozorvlak
c67067acaf Merge pull request #1247 from Br3nda/overcommit
Run the linters etc from overcommit
2017-03-02 13:11:19 +00:00
Shiny
d23be43c2f Merge branch 'dev' into overcommit 2017-03-02 22:24:18 +13:00
Brenda Wallace
6c282ffbd7 rubocop fix for redundant self assignment 2017-03-02 22:21:15 +13:00
Brenda Wallace
0ecc65bbe0 rubocop fix for redundant self 2017-03-02 22:21:15 +13:00
Brenda Wallace
076da040b5 Revert "Intentionally making rubocop fail"
This reverts commit 17858cc17c.
2017-03-02 21:53:20 +13:00
Brenda Wallace
17858cc17c Intentionally making rubocop fail 2017-03-02 21:50:48 +13:00
Brenda Wallace
66fec1f4a3 Adding yaml linter 2017-03-02 21:32:53 +13:00
Brenda Wallace
69848f11ca Docs on using overcommit 2017-03-02 21:22:22 +13:00
Brenda Wallace
affbe2a460 renamed ruby files to .rb
so rubocop cop catches these in her net
2017-03-02 21:13:35 +13:00
Brenda Wallace
cc40bb35fb bundle exec on the contributor check 2017-03-02 21:04:21 +13:00
Shiny
542cc1f546 Merge branch 'dev' into bw/unneeded-percent-q 2017-03-02 21:02:28 +13:00
Brenda Wallace
0d2fb25881 Removed gemfile check. overcommit can do this 2017-03-02 20:59:45 +13:00
Brenda Wallace
29f050d19f Removed check_conflicts. overcommit does this 2017-03-02 20:48:21 +13:00
Brenda Wallace
2238374080 Moved overcommit call into check_static 2017-03-02 20:47:18 +13:00
Brenda Wallace
cad8ecad8f Added bundle-audit 2017-03-02 20:40:25 +13:00
Brenda Wallace
d161053328 Always create db - so we can check rails schema is up to date 2017-03-02 20:19:22 +13:00
Brenda Wallace
dbb74c5675 Moved phantom verion output to script 2017-03-02 20:10:47 +13:00
Brenda Wallace
6422070f04 Moved linter installs to own script 2017-03-02 20:06:47 +13:00
Brenda Wallace
b6512ce8e4 RailsSchemaUpToDate and BundleAudit added to overcommit 2017-03-02 20:00:46 +13:00
Brenda Wallace
a3e0bc0798 Rubocop fix for Gemfile 2017-03-02 19:59:59 +13:00
Brenda Wallace
5ec70d1438 Moved merge conflict checking to overcommit 2017-03-02 19:54:18 +13:00
Brenda Wallace
e848e18574 Removed commented out overcommit linters 2017-03-02 19:49:49 +13:00
Brenda Wallace
cfff970812 Revert "Intentionally making rubocop unhappy"
This reverts commit 6e3f5f9d77fb4b3b81265665adea1e1b416469fe.
2017-03-01 20:48:15 +00:00
Brenda Wallace
0db8c2feb2 Intentionally making rubocop unhappy
to test travis
2017-03-01 20:48:15 +00:00
Brenda Wallace
7e06bf4fd0 Wrap shell script variables in "" 2017-03-01 20:48:15 +00:00
Brenda Wallace
dd710860de Run the linters etc from overcommit 2017-03-01 20:48:15 +00:00
pozorvlak
4718a9edab Merge pull request #1256 from Br3nda/numeric
Rubocop fix for some numerics
2017-03-01 13:31:10 +00:00
Brenda Wallace
8c5db9229a fixed forced octal 2017-03-01 17:49:42 +13:00
Brenda Wallace
e229438997 rubocop fox for numeric literals 2017-03-01 17:46:12 +13:00
Brenda Wallace
85a4490740 Rubocop fix for unneeded %Q 2017-03-01 17:35:06 +13:00
Brenda Wallace
9684e84420 Moved metrics to bottom of rubocop.yml
Waiting to be completed
2017-03-01 11:38:16 +13:00
Brenda Wallace
4364c028a2 Removed offense counts 2017-03-01 11:36:40 +13:00
Brenda Wallace
4e44e26c6c Removed rubocop todos that are done 2017-03-01 11:24:26 +13:00
Daniel O'Connor
b07c033863 Merge pull request #1249 from Growstuff/bundle-update-2017-02-28-091217
Bundle Update on 2017-02-28
2017-02-28 11:59:57 +10:30
deppbot
f167f5cbd4 Bundle Update on 2017-02-28 2017-02-28 09:12:18 +08:00
pozorvlak
7a1b192392 Merge pull request #1238 from CloCkWeRX/bundle-update-2017-02-23-1
Upgrade rails, other gems
2017-02-27 15:18:43 +00:00
pozorvlak
642f371416 Merge branch 'dev' into bundle-update-2017-02-23-1 2017-02-27 15:01:14 +00:00
pozorvlak
f4e2b6e115 Merge pull request #1244 from Br3nda/photos-controller
DRY the photos controller
2017-02-27 11:26:14 +00:00
Daniel O'Connor
1873d28b50 Merge branch 'dev' into bundle-update-2017-02-23-1 2017-02-27 16:08:50 +10:30
Brenda Wallace
ce03b4efde DRY the photos controller 2017-02-26 17:03:29 +13:00
Shiny
102c113b0c Merge branch 'master' into dev 2017-02-25 22:56:23 +13:00
Shiny
245cd2e44c Merge branch 'dev' into bundle-update-2017-02-23-1 2017-02-25 22:56:01 +13:00
Cesy
f28456875b Merge pull request #1242 from Br3nda/schema-update
Schema is out of sync -- fixing
2017-02-24 21:15:12 +00:00
Brenda Wallace
9604eed2f3 Schema is out of sync -- fixing 2017-02-24 20:19:01 +13:00
Brenda Wallace
4eda3a506b Fix up csv importer, should make duplicates
Now matches the old functionality.
2017-02-24 20:08:01 +13:00
Daniel O'Connor
14f3dc7526 Add explaining notes 2017-02-23 14:34:38 +10:30
Daniel O'Connor
f2d3c88c85 Revert "Upgrade to the 4.x series of d3-rails"
This reverts commit 5bd7d9aa43.
2017-02-23 14:33:33 +10:30
Daniel O'Connor
f4e0efc8da Update autoprefixer-rails 2017-02-23 14:32:47 +10:30
Daniel O'Connor
13bfdeaa1a Pin Kaminari for the moment, until https://github.com/kaminari/kaminari/blob/master/CHANGELOG.md#100 assessed 2017-02-23 14:31:47 +10:30
Daniel O'Connor
e2fb7c940f Upgrade js-routes 2017-02-23 14:30:10 +10:30
Daniel O'Connor
5bd7d9aa43 Upgrade to the 4.x series of d3-rails 2017-02-23 14:28:19 +10:30
Daniel O'Connor
117c717391 Upgrade capybara, codeclimate-test-reporter 2017-02-23 14:25:51 +10:30
Daniel O'Connor
72603a2db0 Pin to specific omniauth versions for the moment, to avoid login test regression 2017-02-23 14:24:29 +10:30
Daniel O'Connor
9f8cfa8de3 Update sexp_processor, ruby-units 2017-02-23 14:23:01 +10:30
Daniel O'Connor
221dd45681 Upgrade to d3 3.5 “Mount Sharp” 2017-02-23 14:19:33 +10:30
Daniel O'Connor
fb2a600433 Pin d3-rails for the moment 2017-02-23 14:18:31 +10:30
Daniel O'Connor
296f8dddfa Update selenium-webdriver, haml_lint, jasmine 2017-02-23 14:15:27 +10:30
Daniel O'Connor
da16a38d1f Upgrade rails 2017-02-23 14:12:27 +10:30
Brenda Wallace
5abc1fb80e duplicate alt name spec (and adding to crop) 2017-02-23 15:35:29 +13:00
Brenda Wallace
86d5f5febd sciname/altnames adding code is very similar 2017-02-23 15:35:29 +13:00
Brenda Wallace
0a840abc58 Added specs for duplicate sci names 2017-02-23 15:35:29 +13:00
Brenda Wallace
968e9bd3ad Rubocop fix up in spec 2017-02-23 15:35:29 +13:00
Brenda Wallace
ddd0e0c285 Fixed typo in string causing spec to fail 2017-02-23 15:35:29 +13:00
Brenda Wallace
00952d5ef6 Updating more specs for new csv importer interface 2017-02-23 15:35:29 +13:00
Brenda Wallace
a0e1d8b11d Update scientific name model spec 2017-02-23 15:35:29 +13:00
Brenda Wallace
3d7f2ec20c Updating specs to match new csv importer 2017-02-23 15:35:29 +13:00
Brenda Wallace
abbd2cf0a4 fix bug: look up parent crop by name in csv import 2017-02-23 15:35:29 +13:00
Brenda Wallace
2f9961651f Call new csv importer from specs 2017-02-23 15:35:29 +13:00
Brenda Wallace
3089c28233 Adding validations to sci names and alt names 2017-02-23 15:35:29 +13:00
Brenda Wallace
4e722dd123 Move crop csv import to own file 2017-02-23 15:35:29 +13:00
Brenda Wallace
5698a78d9b DRY the accounts controller 2017-02-23 09:45:57 +13:00
Daniel O'Connor
71804a0b41 Merge pull request #1235 from Br3nda/accounttypes-controller-DRY
DRY the account types controller
2017-02-22 11:03:00 +10:30
Brenda Wallace
d500c9093d DRY the account types controller 2017-02-22 13:21:59 +13:00
72 changed files with 847 additions and 873 deletions

View File

@@ -20,8 +20,8 @@ engines:
- ruby
- javascript
exclude_fingerprints:
- 16dbcb58d6caa7ccfe241417831ecfa6
- 7d7dca4f27f50e3084f203280073cc74
- 16dbcb58d6caa7ccfe241417831ecfa6
- 7d7dca4f27f50e3084f203280073cc74
fixme:
enabled: true
exclude_fingerprints: # rubocop_todo filename

1
.gitignore vendored
View File

@@ -16,3 +16,4 @@ zeus.json
.bundle
.idea/**
public/**
node_modules

View File

@@ -1,4 +1,3 @@
linters:
LineLength:
max: 120

104
.overcommit.yml Normal file
View File

@@ -0,0 +1,104 @@
---
# Use this file to configure the Overcommit hooks you wish to use. This will
# extend the default configuration defined in:
# https://github.com/brigade/overcommit/blob/master/config/default.yml
#
# At the topmost level of this YAML file is a key representing type of hook
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
# customize each hook, such as whether to only run it on certain files (via
# `include`), whether to only display output if it fails (via `quiet`), etc.
#
# For a complete list of hooks, see:
# https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
#
# For a complete list of options that you can use to customize hooks, see:
# https://github.com/brigade/overcommit#configuration
#
# Uncomment the following lines to make the configuration take effect.
PreCommit:
ALL:
quiet: false
problem_on_unmodified_line: warn
RuboCop:
enabled: true
command: ['bundle', 'exec', 'rubocop', '-D', '--rails']
TrailingWhitespace:
enabled: true
exclude:
- '**/db/structure.sql' # Ignore trailing whitespace in generated files
CoffeeLint:
enabled: true
on_fail: warn
command: ['npm', 'run', 'coffeelint']
HardTabs:
enabled: true
AuthorEmail:
enabled: false
AuthorName:
enabled: false
CssLint:
enabled: true
exclude:
- '**/bootstrap.min.css'
command: ['npm', 'run', 'csslint']
HamlLint:
enabled: true
requires_files: true
on_warn: fail
command: ['bundle', 'exec', 'haml-lint', 'app/views']
JsonSyntax:
enabled: true
BundleOutdated:
enabled: true
on_warn: warn
BundleAudit:
enabled: true
on_warn: warn
JsHint:
enabled: true
exclude:
- 'app/assets/**'
- 'spec/javascripts/support/vendor/**'
- '**/bootstrap*'
command: ['npm', 'run', 'jshint']
ScssLint:
enabled: true
RailsSchemaUpToDate:
enabled: true
MergeConflicts:
enabled: true
YamlLint:
enabled: true
PostCommit:
GitGuilt:
enabled: true
command: ['npm', 'run', 'git-guilt']
PostCheckout:
ALL:
quiet: false
BundleInstall:
enabled: true
RailsSchemaUpToDate:
enabled: true
PostMerge:
BundleInstall:
enabled: true
RailsSchemaUpToDate:
enabled: true
# PrePush:
# ALL:
# on_warn: fail # Treat all warnings as failures
# quiet: false
# # Brakeman:
# # enabled: true
# RSpec:
# enabled: true
# command: ['bundle', 'exec', 'rspec', '--fail-fast']
#
# IndexTags:
# enabled: true # Generate a tags file with `ctags` each time HEAD changes

View File

@@ -27,38 +27,9 @@ Style/MultilineMethodCallIndentation:
Style/AlignParameters:
EnforcedStyle: with_fixed_indentation
Metrics/MethodLength:
Description: 'Avoid methods longer than 30 lines of code.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
# Set to 30 once all methods are fixed.
# Max: 30
Max: 34
# Remove the following once the code style matches
# Offense count: 59
Metrics/AbcSize:
Max: 32
# Offense count: 5
# Configuration parameters: CountComments.
Metrics/BlockLength:
Max: 62
# Offense count: 6
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 269
# Offense count: 6
Metrics/CyclomaticComplexity:
Max: 11
Metrics/LineLength:
Max: 120
# Offense count: 8
Metrics/PerceivedComplexity:
Max: 9
# See https://github.com/bbatsov/rubocop/issues/3629
Rails/HttpPositionalArguments:
@@ -76,3 +47,21 @@ Rails/Output:
Exclude:
- 'config/unicorn.rb'
- 'db/seeds.rb'
Metrics/BlockLength:
Exclude:
- 'spec/**/*'
- '**/*.rake'
- 'config/**/*.rb'
# Remove the following once the code style matches
Metrics/MethodLength:
Max: 34
Metrics/AbcSize:
Max: 32
Metrics/ClassLength:
Max: 207
Metrics/CyclomaticComplexity:
Max: 11
Metrics/PerceivedComplexity:
Max: 9

View File

@@ -1,12 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 500`
# on 2017-01-21 15:58:02 +1030 using RuboCop version 0.47.1.
# `rubocop --auto-gen-config --no-offense-counts`
# on 2017-03-01 11:18:11 +1300 using RuboCop version 0.47.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 22
Lint/AmbiguousRegexpLiteral:
Exclude:
- 'spec/controllers/admin/orders_controller_spec.rb'
@@ -19,12 +18,10 @@ Lint/AmbiguousRegexpLiteral:
- 'spec/views/members/show.rss.haml_spec.rb'
- 'spec/views/posts/show.html.haml_spec.rb'
# Offense count: 1
Lint/HandleExceptions:
Exclude:
- 'lib/tasks/testing.rake'
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
@@ -34,7 +31,6 @@ Lint/UnusedBlockArgument:
- 'config/unicorn.rb'
- 'lib/haml/filters/growstuff_markdown.rb'
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
Lint/UnusedMethodArgument:
@@ -45,47 +41,36 @@ Lint/UnusedMethodArgument:
- 'app/validators/approved_validator.rb'
- 'spec/views/plantings/show.html.haml_spec.rb'
# Offense count: 5
Lint/Void:
Exclude:
- 'spec/models/crop_spec.rb'
- 'spec/models/garden_spec.rb'
- 'spec/models/post_spec.rb'
# Offense count: 55
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Exclude:
- '**/*'
# Offense count: 2
# Cop supports --auto-correct.
Performance/StringReplacement:
Exclude:
- 'app/models/planting.rb'
- 'spec/rails_helper.rb'
# Offense count: 4
Rails/FilePath:
Exclude:
- 'spec/rails_helper.rb'
# Offense count: 3
Rails/OutputSafety:
Exclude:
- 'app/helpers/application_helper.rb'
- 'app/helpers/auto_suggest_helper.rb'
- 'app/helpers/gardens_helper.rb'
# Offense count: 4
# Configuration parameters: Blacklist.
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
# Blacklist: decrement!, decrement_counter, increment!, increment_counter
# toggle!, touch, update_all, update_attribute, update_column, update_columns,
# update_counters
Rails/SkipsModelValidations:
Exclude:
- 'app/controllers/plantings_controller.rb'
- 'db/seeds.rb'
# Offense count: 7
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: strict, flexible
Rails/TimeZone:
@@ -96,7 +81,6 @@ Rails/TimeZone:
- 'spec/models/post_spec.rb'
- 'spec/views/plantings/index.html.haml_spec.rb'
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: always, conditionals
@@ -105,12 +89,10 @@ Style/AndOr:
- 'config/unicorn.rb'
- 'lib/tasks/growstuff.rake'
# Offense count: 1
Style/AsciiComments:
Exclude:
- 'config/initializers/comfortable_mexican_sofa.rb'
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: percent_q, bare_percent
@@ -119,7 +101,6 @@ Style/BarePercentLiterals:
- 'app/helpers/auto_suggest_helper.rb'
- 'spec/support/feature_helpers.rb'
# Offense count: 26
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining
@@ -129,8 +110,6 @@ Style/BarePercentLiterals:
Style/BlockDelimiters:
Exclude:
- 'app/controllers/members_controller.rb'
- 'app/controllers/posts_controller.rb'
- 'app/controllers/scientific_names_controller.rb'
- 'spec/controllers/order_items_controller_spec.rb'
- 'spec/features/notifications_spec.rb'
- 'spec/models/ability_spec.rb'
@@ -141,17 +120,14 @@ Style/BlockDelimiters:
- 'spec/models/post_spec.rb'
- 'spec/views/crops/edit.html.haml_spec.rb'
# Offense count: 8
# Cop supports --auto-correct.
Style/BlockEndNewline:
Exclude:
- 'app/controllers/members_controller.rb'
- 'app/controllers/posts_controller.rb'
- 'spec/models/ability_spec.rb'
- 'spec/models/member_spec.rb'
- 'spec/models/planting_spec.rb'
# Offense count: 4
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
@@ -161,20 +137,17 @@ Style/ClassAndModuleChildren:
- 'lib/haml/filters/escaped_markdown.rb'
- 'lib/haml/filters/growstuff_markdown.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/ClassMethods:
Exclude:
- 'app/models/planting.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/ColonMethodCall:
Exclude:
- 'spec/lib/haml/filters/escaped_markdown_spec.rb'
- 'spec/lib/haml/filters/growstuff_markdown_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Keywords.
# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW
@@ -182,22 +155,18 @@ Style/CommentAnnotation:
Exclude:
- 'app/controllers/crops_controller.rb'
# Offense count: 10
# Cop supports --auto-correct.
Style/EachForSimpleLoop:
Exclude:
- 'spec/models/crop_spec.rb'
- 'spec/views/home/_crops.html.haml_spec.rb'
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: compact, expanded
Style/EmptyMethod:
Exclude:
- 'app/controllers/account_types_controller.rb'
- 'app/controllers/accounts_controller.rb'
- 'app/controllers/gardens_controller.rb'
- 'app/controllers/photos_controller.rb'
- 'app/controllers/plant_parts_controller.rb'
- 'app/controllers/posts_controller.rb'
@@ -206,7 +175,6 @@ Style/EmptyMethod:
- 'app/controllers/scientific_names_controller.rb'
- 'app/controllers/seeds_controller.rb'
# Offense count: 5
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: format, sprintf, percent
Style/FormatString:
@@ -215,12 +183,10 @@ Style/FormatString:
- 'spec/helpers/application_helper_spec.rb'
- 'spec/views/shop/index_spec.rb'
# Offense count: 2
Style/IdenticalConditionalBranches:
Exclude:
- 'app/controllers/follows_controller.rb'
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: MaxLineLength.
Style/IfUnlessModifier:
@@ -231,7 +197,6 @@ Style/IfUnlessModifier:
- 'config/initializers/geocoder.rb'
- 'lib/tasks/growstuff.rake'
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: line_count_dependent, lambda, literal
@@ -240,44 +205,36 @@ Style/Lambda:
- 'spec/controllers/member_controller_spec.rb'
- 'spec/models/photo_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/MultilineIfModifier:
Exclude:
- 'spec/rails_helper.rb'
# Offense count: 5
# Cop supports --auto-correct.
Style/MultilineIfThen:
Exclude:
- 'script/check_contributors_md'
- 'script/gemfile_check'
# Offense count: 2
Style/MultilineTernaryOperator:
Exclude:
- 'app/controllers/notifications_controller.rb'
- 'app/controllers/order_items_controller.rb'
# Offense count: 3
# Cop supports --auto-correct.
Style/MutableConstant:
Exclude:
- 'app/controllers/members_controller.rb'
- 'app/models/planting.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/NegatedIf:
Exclude:
- 'app/helpers/crops_helper.rb'
# Offense count: 2
Style/NestedTernaryOperator:
Exclude:
- 'app/controllers/plantings_controller.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
# SupportedStyles: skip_modifier_ifs, always
@@ -285,26 +242,11 @@ Style/Next:
Exclude:
- 'lib/tasks/growstuff.rake'
# Offense count: 2
# Cop supports --auto-correct.
Style/NilComparison:
Exclude:
- 'lib/tasks/growstuff.rake'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedOctalStyle, SupportedOctalStyles.
# SupportedOctalStyles: zero_with_o, zero_only
Style/NumericLiteralPrefix:
Exclude:
- 'spec/views/plantings/_form.html.haml_spec.rb'
# Offense count: 3
# Cop supports --auto-correct.
Style/NumericLiterals:
MinDigits: 9
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
# SupportedStyles: predicate, comparison
@@ -316,14 +258,11 @@ Style/NumericPredicate:
- 'lib/tasks/growstuff.rake'
- 'script/check_contributors_md'
# Offense count: 3
# Cop supports --auto-correct.
Style/ParallelAssignment:
Exclude:
- 'app/mailers/notifier.rb'
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
@@ -333,25 +272,11 @@ Style/PercentLiteralDelimiters:
- 'spec/features/signin_spec.rb'
- 'spec/features/signout_spec.rb'
# Offense count: 3
# Cop supports --auto-correct.
Style/PerlBackrefs:
Exclude:
- 'lib/haml/filters/growstuff_markdown.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantParentheses:
Exclude:
- 'app/helpers/plantings_helper.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantSelf:
Exclude:
- 'lib/geocodable.rb'
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
@@ -364,20 +289,12 @@ Style/RegexpLiteral:
- 'spec/views/posts/index.html.haml_spec.rb'
- 'spec/views/posts/show.html.haml_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/SelfAssignment:
Exclude:
- 'app/helpers/crops_helper.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles.
# SupportedStyles: use_perl_names, use_english_names
Style/SpecialGlobalVars:
EnforcedStyle: use_perl_names
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
# IgnoredMethods: respond_to, define_method
@@ -386,27 +303,11 @@ Style/SymbolProc:
- 'app/controllers/crops_controller.rb'
- 'lib/tasks/growstuff.rake'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowSafeAssignment.
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
Style/TernaryParentheses:
Exclude:
- 'app/helpers/plantings_helper.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/UnlessElse:
Exclude:
- 'app/controllers/omniauth_callbacks_controller.rb'
# Offense count: 3
# Cop supports --auto-correct.
Style/UnneededPercentQ:
Exclude:
- 'spec/support/feature_helpers.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, WordRegex.
# SupportedStyles: percent, brackets

View File

@@ -1 +1 @@
2.3.3
2.3.4

View File

@@ -7,41 +7,40 @@ cache:
- tmp/cache/assets/test/sprockets
env:
matrix:
- GROWSTUFF_ELASTICSEARCH='true' RSPEC_TAG=elasticsearch
- GROWSTUFF_ELASTICSEARCH='false' RSPEC_TAG=~elasticsearch
- STATIC_CHECKS='true'
- GROWSTUFF_ELASTICSEARCH='true' RSPEC_TAG=elasticsearch STATIC_CHECKS=false
- GROWSTUFF_ELASTICSEARCH='false' RSPEC_TAG=~elasticsearch STATIC_CHECKS=false
- STATIC_CHECKS=true
global:
- GROWSTUFF_SITE_NAME="Growstuff (travis)"
- RAILS_SECRET_TOKEN='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
- secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4="
rvm:
- 2.3.3
- 2.3.4
before_install:
- ./script/install_phantomjs;
- export PATH=$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH
- >
if [ $(phantomjs --version) != '2.1.1' ]; then
PHANTOM_URL=https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2;
rm -rf $PWD/travis_phantomjs;
mkdir -p $PWD/travis_phantomjs;
wget $PHANTOM_URL -O $PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2;
tar -xvf $PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs;
fi
- phantomjs --version
before_script:
- bundle exec rake db:create db:migrate db:test:prepare
- set -e
- >
if [ "$STATIC_CHECKS" != 'true' ]; then
bundle exec rake db:create db:migrate db:test:prepare
bundle exec rake assets:precompile
fi
script:
- >
if [ "$STATIC_CHECKS" = 'true' ]; then
bundle exec script/check_static
if [ "${STATIC_CHECKS}" = "true" ]; then
./script/install_linters;
else
bundle exec rake db:migrate --trace
bundle exec rspec --tag $RSPEC_TAG spec/
bundle exec rake jasmine:ci
bundle exec rake assets:precompile;
fi
- set +e
script:
- set -e
- >
if [ "${STATIC_CHECKS}" = "true" ]; then
./script/check_static.rb
else
bundle exec rake db:migrate --trace;
bundle exec rspec --tag $RSPEC_TAG spec/;
bundle exec rake jasmine:ci;
fi;
- set +e
services:
- elasticsearch
before_deploy:
@@ -49,7 +48,7 @@ before_deploy:
deploy:
provider: heroku
api_key:
secure: WrQxf0fEKkCdXrjcejurobOnNNz3he4dDwjBbToXbQTQNDObPp7NetJrLsfM8FiUFEeOuvhIHHiDQtMvY720zGGAGxDptvgFS+0QHCUqoTRZA/yFfUmHlG2jROXTzk5uVK0AE4k6Ion5kX8+mM0EnMT/7u+MTFiukrJctSiEXfg=
secure: "WrQxf0fEKkCdXrjcejurobOnNNz3he4dDwjBbToXbQTQNDObPp7NetJrLsfM8FiUFEeOuvhIHHiDQtMvY720zGGAGxDptvgFS+0QHCUqoTRZA/yFfUmHlG2jROXTzk5uVK0AE4k6Ion5kX8+mM0EnMT/7u+MTFiukrJctSiEXfg="
on:
repo: Growstuff/growstuff
app:

View File

@@ -10,7 +10,6 @@ When you create a pull request, please include the following:
All pull requests should pass our automatic continuous integration and style
checks before being merged. You can run tests locally as follows:
- `rake` to run all tests and static checks
- `rake spec` to run all Ruby tests
- `rake spec:models` to run Ruby model tests (or `rake spec:views` for view tests, etc)
- `rake static` to run all static checks (code style, unfixed Git conflicts, etc)
@@ -24,6 +23,12 @@ checks before being merged. You can run tests locally as follows:
failing tests so you can easily re-run particular ones.
- `rspec --only-failures` to re-run all Ruby tests that failed last time.
Growstuff runs several linters and checkers before a change is merged. These
run from overcommit. To automatically run the same linters yourself you can
install overcommit too.
- `./script/install_linters`
You can run `rake -T` to see a list of available Rake tasks. If you can't get
some tests to pass, please submit a pull request anyway - we'll be happy to
help you debug the failures.

View File

@@ -76,3 +76,11 @@ submit the change with your pull request.
- Brenda Wallace / [br3nda](https://github.com/br3nda)
- Jim Stallings / [jestallin](https://github.com/jestallin)
- Alyssa Ransbury / [alran](https://github.com/alran)
- Thomas Countz / [thomascountz](https://github.com/thomascountz)
- Megan Talbot / [meganft](https://github.com/meganft)
- Arun Kumar / [arun1595](https://github.com/arun1595)
- Harry Brodsky / [hbrodsk1](https://github.com/hbrodsk1)
## Bots
- Security and Dependency Updates / [deppbot](https://github.com/deppbot)

25
Gemfile
View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
source 'https://rubygems.org'
ruby '2.3.3'
ruby '2.3.4'
gem 'rails', '~> 4.2.7'
@@ -35,10 +35,10 @@ gem 'unicorn' # http server
gem 'comfortable_mexican_sofa', '~> 1.12.0' # content management system
gem 'bootstrap-kaminari-views' # bootstrap views for kaminari
gem 'kaminari' # pagination
gem 'kaminari', '~> 0.17.0' # pagination
gem 'active_utils'
gem 'activemerchant'
gem 'active_utils'
gem 'sidekiq'
# Markdown formatting for updates etc
@@ -63,13 +63,13 @@ gem 'geocoder'
gem 'bootstrap-datepicker-rails'
# For connecting to other services (eg Twitter)
gem 'omniauth'
gem 'omniauth', '~> 1.3'
gem 'omniauth-facebook'
gem 'omniauth-flickr', '>= 0.0.15'
gem 'omniauth-twitter'
gem 'omniauth-twitter', '~> 1.2'
# For charting data
gem 'd3-rails'
gem 'd3-rails', '~> 3.5' # 4.* produces Error: <spyOn> : could not find an object to spy upon for linear() - see https://travis-ci.org/Growstuff/growstuff/jobs/204461482
# client for Elasticsearch. Elasticsearch is a flexible
# and powerful, distributed, real-time search and analytics engine.
@@ -80,8 +80,8 @@ gem 'd3-rails'
# See https://github.com/elastic/elasticsearch-ruby#compatibility
gem "elasticsearch-api", "~> 2.0.0"
gem "elasticsearch-model"
gem "hashie", ">= 3.5.3"
gem "elasticsearch-rails"
gem "hashie", ">= 3.5.3"
gem 'rake', '>= 10.0.0'
@@ -112,6 +112,7 @@ end
group :development, :test do
gem "active_merchant-paypal-bogus-gateway"
gem 'bullet' # performance tuning by finding unnecesary queries
gem 'byebug' # debugging
gem 'capybara' # integration tests
gem 'capybara-email' # integration tests for email
@@ -120,17 +121,17 @@ group :development, :test do
gem 'database_cleaner', '~> 1.5.0'
gem 'factory_girl_rails' # for creating test data
gem 'haml-i18n-extractor'
gem 'haml_lint' # Checks haml files for goodness
gem 'haml-rails' # HTML templating language
gem 'haml_lint', '~> 0.20.0' # Checks haml files for goodness
gem 'i18n-tasks' # adds tests for finding missing and unused translations
gem 'jasmine' # javascript unit testing
gem 'poltergeist' # for headless JS testing
gem 'rspec-activemodel-mocks'
gem 'rspec-rails' # unit testing framework
gem 'rubocop', require: false
gem 'rainbow', '< 2.2.0' # See https://github.com/sickill/rainbow/issues/44
gem 'rspec-activemodel-mocks'
gem 'rspec-rails' # unit testing framework
gem 'rubocop', '<= 0.47.1', require: false # Pin to rubocop (0.47.1) as 0.48.0 is buggy
gem 'selenium-webdriver'
gem 'webrat' # provides HTML matchers for view tests
gem 'webrat' # provides HTML matchers for view tests
end
group :test do

View File

@@ -1,58 +1,58 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.7.1)
actionpack (= 4.2.7.1)
actionview (= 4.2.7.1)
activejob (= 4.2.7.1)
actionmailer (4.2.8)
actionpack (= 4.2.8)
actionview (= 4.2.8)
activejob (= 4.2.8)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.7.1)
actionview (= 4.2.7.1)
activesupport (= 4.2.7.1)
actionpack (4.2.8)
actionview (= 4.2.8)
activesupport (= 4.2.8)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.7.1)
activesupport (= 4.2.7.1)
actionview (4.2.8)
activesupport (= 4.2.8)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
active_link_to (1.0.3)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_link_to (1.0.4)
actionpack
addressable
active_merchant-paypal-bogus-gateway (0.1.0)
activemerchant
active_utils (3.2.3)
activesupport (>= 3.2, < 5.1.0)
active_utils (3.3.1)
activesupport (>= 3.2, < 5.2.0)
i18n
activejob (4.2.7.1)
activesupport (= 4.2.7.1)
activejob (4.2.8)
activesupport (= 4.2.8)
globalid (>= 0.3.0)
activemerchant (1.63.0)
activemerchant (1.64.0)
activesupport (>= 3.2.14, < 5.1)
builder (>= 2.1.2, < 4.0.0)
i18n (>= 0.6.9)
nokogiri (~> 1.4)
activemodel (4.2.7.1)
activesupport (= 4.2.7.1)
activemodel (4.2.8)
activesupport (= 4.2.8)
builder (~> 3.1)
activerecord (4.2.7.1)
activemodel (= 4.2.7.1)
activesupport (= 4.2.7.1)
activerecord (4.2.8)
activemodel (= 4.2.8)
activesupport (= 4.2.8)
arel (~> 6.0)
activesupport (4.2.7.1)
activesupport (4.2.8)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.0)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
arel (6.0.4)
ast (2.3.0)
autoprefixer-rails (6.6.1)
autoprefixer-rails (6.7.7.1)
execjs
bcrypt (3.1.11)
better_errors (2.1.1)
@@ -62,7 +62,9 @@ GEM
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bluecloth (2.2.0)
bonsai-elasticsearch-rails (0.0.4)
bonsai-elasticsearch-rails (0.2.0)
elasticsearch-model (~> 0)
elasticsearch-rails (~> 0)
bootstrap-datepicker-rails (1.6.4.1)
railties (>= 3.0)
bootstrap-kaminari-views (0.0.5)
@@ -73,9 +75,12 @@ GEM
sass (>= 3.3.4)
bootstrap_form (2.6.0)
builder (3.2.3)
bullet (5.5.1)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.10.0)
byebug (9.0.6)
cancancan (1.16.0)
capybara (2.12.0)
capybara (2.13.0)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
@@ -88,14 +93,14 @@ GEM
capybara-screenshot (1.0.14)
capybara (>= 1.0, < 3)
launchy
childprocess (0.6.1)
childprocess (0.6.3)
ffi (~> 1.0, >= 1.0.11)
climate_control (0.1.0)
cliver (0.3.2)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
codeclimate-test-reporter (1.0.3)
simplecov
codeclimate-test-reporter (1.0.8)
simplecov (<= 0.13)
codemirror-rails (5.16.0)
railties (>= 3.0, < 6.0)
coderay (1.1.1)
@@ -121,7 +126,7 @@ GEM
rails (>= 4.0.0, < 5.1)
rails-i18n (>= 4.0.0)
sass-rails (>= 4.0.3)
concurrent-ruby (1.0.4)
concurrent-ruby (1.0.5)
connection_pool (2.2.1)
coveralls (0.8.19)
json (>= 1.8, < 3)
@@ -131,12 +136,12 @@ GEM
tins (~> 1.6)
csv_shaper (1.3.0)
activesupport (>= 3.0.0)
d3-rails (3.4.13)
d3-rails (3.5.17)
railties (>= 3.1)
dalli (2.7.6)
database_cleaner (1.5.3)
debug_inspector (0.0.2)
devise (4.2.0)
devise (4.2.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.1)
@@ -162,16 +167,16 @@ GEM
faraday
multi_json
erubis (2.7.0)
excon (0.54.0)
excon (0.55.0)
execjs (2.7.0)
factory_girl (4.8.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
railties (>= 3.0.0)
faraday (0.9.2)
faraday (0.11.0)
multipart-post (>= 1.2, < 3)
ffi (1.9.17)
ffi (1.9.18)
figaro (1.1.1)
thor (~> 0.14)
flickraw (0.9.9)
@@ -222,19 +227,19 @@ GEM
rake (>= 10, < 13)
rubocop (>= 0.47.0)
sysexits (~> 1.1)
hashie (3.5.3)
hashie (3.5.5)
heroku-api (0.4.2)
excon (~> 0.45)
multi_json (~> 1.8)
highline (1.7.8)
html2haml (2.0.0)
html2haml (2.1.0)
erubis (~> 2.7.0)
haml (~> 4.0.0)
nokogiri (~> 1.6.0)
haml (~> 4.0)
nokogiri (>= 1.6.0)
ruby_parser (~> 3.5)
httparty (0.14.0)
multi_xml (>= 0.5.2)
i18n (0.8.0)
i18n (0.8.1)
i18n-tasks (0.9.12)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
@@ -245,22 +250,22 @@ GEM
parser (>= 2.2.3.0)
term-ansicolor (>= 1.3.2)
terminal-table (>= 1.5.1)
jasmine (2.5.1)
jasmine (2.5.2)
jasmine-core (>= 2.5.1, < 3.0.0)
phantomjs
rack (>= 1.2.1)
rake
jasmine-core (2.5.2)
jquery-rails (4.2.2)
jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5)
railties (>= 3.2.16)
js-routes (1.3.0)
js-routes (1.3.3)
railties (>= 3.2)
sprockets-rails
json (1.8.6)
json (2.0.3)
jwt (1.5.6)
kaminari (0.17.0)
actionpack (>= 3.0.0)
@@ -295,22 +300,22 @@ GEM
multi_xml (0.6.0)
multipart-post (2.0.0)
nenv (0.3.0)
newrelic_rpm (3.18.1.330)
nokogiri (1.6.8.1)
newrelic_rpm (4.0.0.332)
nokogiri (1.7.1)
mini_portile2 (~> 2.1.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
oauth (0.5.1)
oauth2 (1.2.0)
faraday (>= 0.8, < 0.10)
oauth2 (1.3.1)
faraday (>= 0.8, < 0.12)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.3.2)
hashie (>= 1.2, < 4)
rack (>= 1.0, < 3)
omniauth (1.6.1)
hashie (>= 3.4.6, < 3.6.0)
rack (>= 1.6.2, < 3)
omniauth-facebook (4.0.0)
omniauth-oauth2 (~> 1.2)
omniauth-flickr (0.0.19)
@@ -322,9 +327,9 @@ GEM
omniauth-oauth2 (1.4.0)
oauth2 (~> 1.0)
omniauth (~> 1.2)
omniauth-twitter (1.2.1)
json (~> 1.3)
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
rack
orm_adapter (0.5.0)
paperclip (5.1.0)
activemodel (>= 4.2.0)
@@ -334,11 +339,11 @@ GEM
mimemagic (~> 0.3.0)
parser (2.4.0.0)
ast (~> 2.2)
pg (0.19.0)
pg (0.20.0)
phantomjs (2.1.1.0)
plupload-rails (1.2.1)
rails (>= 3.1)
poltergeist (1.13.0)
poltergeist (1.14.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
@@ -355,16 +360,16 @@ GEM
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.7.1)
actionmailer (= 4.2.7.1)
actionpack (= 4.2.7.1)
actionview (= 4.2.7.1)
activejob (= 4.2.7.1)
activemodel (= 4.2.7.1)
activerecord (= 4.2.7.1)
activesupport (= 4.2.7.1)
rails (4.2.8)
actionmailer (= 4.2.8)
actionpack (= 4.2.8)
actionview (= 4.2.8)
activejob (= 4.2.8)
activemodel (= 4.2.8)
activerecord (= 4.2.8)
activesupport (= 4.2.8)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.7.1)
railties (= 4.2.8)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
@@ -382,13 +387,13 @@ GEM
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (4.2.7.1)
actionpack (= 4.2.7.1)
activesupport (= 4.2.7.1)
railties (4.2.8)
actionpack (= 4.2.8)
activesupport (= 4.2.8)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.1.0)
raindrops (0.17.0)
raindrops (0.18.0)
rake (12.0.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
@@ -428,7 +433,7 @@ GEM
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
ruby-units (2.0.1)
ruby-units (2.1.0)
ruby_dep (1.5.0)
ruby_parser (3.8.4)
sexp_processor (~> 4.1)
@@ -440,13 +445,13 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.0.8)
selenium-webdriver (3.3.0)
childprocess (~> 0.5)
rubyzip (~> 1.0)
websocket (~> 1.0)
sexp_processor (4.7.0)
sexp_processor (4.8.0)
shellany (0.0.1)
sidekiq (4.2.9)
sidekiq (4.2.10)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0)
@@ -467,17 +472,17 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sysexits (1.2.0)
term-ansicolor (1.4.0)
term-ansicolor (1.5.0)
tins (~> 1.0)
terminal-table (1.7.3)
unicode-display_width (~> 1.1.1)
thor (0.19.4)
thread (0.2.2)
thread_safe (0.3.5)
tilt (2.0.6)
thread_safe (0.3.6)
tilt (2.0.7)
tins (1.13.2)
trollop (1.16.2)
tzinfo (1.2.2)
tzinfo (1.2.3)
thread_safe (~> 0.1)
uglifier (2.7.2)
execjs (>= 0.3.0)
@@ -486,6 +491,7 @@ GEM
unicorn (5.2.0)
kgio (~> 2.6)
raindrops (~> 0.7)
uniform_notifier (1.10.0)
warden (1.2.7)
rack (>= 1.0)
webrat (0.7.3)
@@ -514,6 +520,7 @@ DEPENDENCIES
bootstrap-datepicker-rails
bootstrap-kaminari-views
bootstrap-sass (~> 3.3.6)
bullet
bundler (>= 1.1.5)
byebug
cancancan (~> 1.9)
@@ -525,7 +532,7 @@ DEPENDENCIES
comfortable_mexican_sofa (~> 1.12.0)
coveralls
csv_shaper
d3-rails
d3-rails (~> 3.5)
dalli
database_cleaner (~> 1.5.0)
devise (>= 4.0.0)
@@ -545,7 +552,7 @@ DEPENDENCIES
haml
haml-i18n-extractor
haml-rails
haml_lint
haml_lint (~> 0.20.0)
hashie (>= 3.5.3)
heroku-api
i18n-tasks
@@ -553,16 +560,16 @@ DEPENDENCIES
jquery-rails
jquery-ui-rails (~> 5.0.2)
js-routes
kaminari
kaminari (~> 0.17.0)
leaflet-markercluster-rails
leaflet-rails (~> 0.7.7)
letter_opener
memcachier
newrelic_rpm
omniauth
omniauth (~> 1.3)
omniauth-facebook
omniauth-flickr (>= 0.0.15)
omniauth-twitter
omniauth-twitter (~> 1.2)
pg
poltergeist
pry
@@ -573,7 +580,7 @@ DEPENDENCIES
rake (>= 10.0.0)
rspec-activemodel-mocks
rspec-rails
rubocop
rubocop (<= 0.47.1)
ruby-units
sass-rails (~> 5.0.4)
selenium-webdriver
@@ -585,7 +592,7 @@ DEPENDENCIES
will_paginate (~> 3.0)
RUBY VERSION
ruby 2.3.3p222
ruby 2.3.4p301
BUNDLED WITH
1.13.7
1.14.6

View File

@@ -1,6 +1,6 @@
# Growstuff
[![Build Status](https://travis-ci.org/Growstuff/growstuff.png)](https://travis-ci.org/Growstuff/growstuff)
[![Build Status](https://travis-ci.org/Growstuff/growstuff.svg?branch=dev)](https://travis-ci.org/Growstuff/growstuff)
[![Coverage Status](https://coveralls.io/repos/Growstuff/growstuff/badge.png)](https://coveralls.io/r/Growstuff/growstuff)
[![Code Climate](https://codeclimate.com/github/Growstuff/growstuff/badges/gpa.svg)](https://codeclimate.com/github/Growstuff/growstuff)
@@ -19,7 +19,6 @@ encourage participation from people of all backgrounds and skill levels.
* [Issues](http://github.com/Growstuff/growstuff/issues) (features we're
working on, known bugs, etc)
* [Discussion forums](http://talk.growstuff.org/) (design ideas, planning releases)
* [IRC](https://webchat.freenode.net/) growstuff channel (general chat, brainstorming and troubleshooting) or [Gitter](https://gitter.im/Growstuff/growstuff)
* [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc. Help by migrating from the [old wiki](https://web.archive.org/web/*/wiki.growstuff.org))
@@ -30,8 +29,7 @@ frontend features. We welcome contributions -- see
[CONTRIBUTING](CONTRIBUTING.md) for details.
* To set up your development environment, see [Getting started](https://github.com/Growstuff/growstuff/wiki/New-contributor-guide).
* We encourage [pair programming](http://wiki.growstuff.org/index.php/Pairing), especially for newer developers. [Find a pair programming partner.](http://talk.growstuff.org/t/find-a-pair-programming-partner/13)
* Drop in to our [discussion forums](http://talk.growstuff.org/), IRC or Gitter to chat to other developers, get help, etc.
* We encourage [pair programming](http://wiki.growstuff.org/index.php/Pairing), especially for newer developers.
* You may also be interested in our [API](https://github.com/Growstuff/growstuff/wiki/API).
## For designers, writers, researchers, data wranglers, and other contributors
@@ -41,23 +39,23 @@ your skills and interests.
You might like to check out:
* The [Get Involved](http://wiki.growstuff.org/index.php/Get_involved)
* The [New Contributor Guide](https://github.com/Growstuff/growstuff/wiki/New-contributor-guide)
page on our wiki, which has lots of detail for different areas
* [Growstuff Talk](http://talk.growstuff.org/) especially the [Idea category](http://talk.growstuff.org/c/idea)
Here on Github, you might find these useful:
* [Waffle](http://waffle.io/Growstuff/growstuff) has stories in "ready" that can be worked on.
* [needs: design](https://github.com/Growstuff/growstuff/labels/needs:%20design) - tasks requiring high-level design
* [needs: visual design](https://github.com/Growstuff/growstuff/labels/needs:%20visual design) - tasks requiring visual/graphical design
* [needs: documentation](https://github.com/Growstuff/growstuff/labels/needs:%20documentation)
* [needs: data](https://github.com/Growstuff/growstuff/labels/needs:%20data) - tasks requiring data entry, data design, data import, or similar
* [curated:beginner](https://github.com/Growstuff/growstuff/labels/curated:%20beginner) - tasks that are ideal for beginner programmers or people new to the project
Feel free to comment on any of the issues you find there, or open up a broader conversation on [Growstuff Talk](http://talk.growstuff.org).
Feel free to comment on any of the issues on [Github](https://github.com/Growstuff/growstuff/issues).
## Contact
For more information about this project, contact [info@growstuff.org](mailto:info@growstuff.org).
You can also contact us on [Twitter](http://twitter.com/growstufforg/) or
[Facebook](https://www.facebook.com/pages/Growstuff/1531133417099494).
[Facebook](https://www.facebook.com/pages/Growstuff/1531133417099494) or [Github](https://github.com/Growstuff/growstuff/issues)..

View File

@@ -31,10 +31,10 @@ This file draws the labels to the left of each bar.
var barLabelTopEdge = 17;
return i * barHeight * (barLabelSpread) + barLabelTopEdge;
})
.text(function(d){return d});
.text(function(d){return d;});
};
growstuff.BarLabelGroup = BarLabelGroup;
}())
}());

View File

@@ -26,7 +26,7 @@ to the display size of the svg
WidthScale.prototype.getMaxValue = function(){
return d3.max(this._data.bars.map(function(bar) { return bar.value; }));
}
};
growstuff.WidthScale = WidthScale;

View File

@@ -21,10 +21,10 @@ $ ->
$('#remove-sci_name-row').click ->
if (sci_index > 2)
sci_index = sci_index - 1
tmp = 'sci_template[' + sci_index + ']'
element = document.getElementById(tmp)
element.remove()
sci_index = sci_index - 1
tmp = 'sci_template[' + sci_index + ']'
element = document.getElementById(tmp)
element.remove()
alt_template = "<div id='alt_template[INDEX]' class='template col-md-12'><div class='col-md-2'><label>Alternate name INDEX:</label></div><div class='col-md-8'><input name='alt_name[INDEX]' class='form-control', id='alt_name[INDEX]')'></input><span class='help-block'>Alternate name of crop.</span></div><div class='col-md-2'></div></div>"

View File

@@ -1,67 +1,48 @@
class AccountTypesController < ApplicationController
before_action :authenticate_member!
load_and_authorize_resource
respond_to :html
# GET /account_types
def index
@account_types = AccountType.all
respond_to do |format|
format.html # index.html.erb
end
respond_with(@account_types)
end
# GET /account_types/1
def show
respond_to do |format|
format.html # show.html.erb
end
respond_with(@account_types)
end
# GET /account_types/new
def new
@account_type = AccountType.new
respond_to do |format|
format.html # new.html.erb
end
respond_with(@account_type)
end
# GET /account_types/1/edit
def edit
respond_with(@account_type)
end
# POST /account_types
def create
@account_type = AccountType.new(account_type_params)
respond_to do |format|
if @account_type.save
format.html { redirect_to @account_type, notice: I18n.t('account_types.created') }
else
format.html { render action: "new" }
end
end
flash[:notice] = I18n.t('account_types.created') if @account_type.save
respond_with(@account_type)
end
# PUT /account_types/1
def update
respond_to do |format|
if @account_type.update(account_type_params)
format.html { redirect_to @account_type, notice: I18n.t('account_types.updated') }
else
format.html { render action: "edit" }
end
end
flash[:notice] = I18n.t('account_types.updated') if @account_type.update(account_type_params)
respond_with(@account_type)
end
# DELETE /account_types/1
def destroy
@account_type.destroy
respond_to do |format|
format.html { redirect_to account_types_url, notice: I18n.t('account_types.deleted') }
end
flash[:notice] = I18n.t('account_types.deleted')
respond_with(@account_type)
end
private

View File

@@ -1,21 +1,17 @@
class AccountsController < ApplicationController
before_action :authenticate_member!
load_and_authorize_resource
respond_to :html
# GET /accounts
def index
@accounts = Account.all
respond_to do |format|
format.html # index.html.erb
end
respond_with(@accounts)
end
# GET /accounts/1
def show
respond_to do |format|
format.html # show.html.erb
end
respond_with(@account)
end
# GET /accounts/1/edit
@@ -24,13 +20,8 @@ class AccountsController < ApplicationController
# PUT /accounts/1
def update
respond_to do |format|
if @account.update(params[:account])
format.html { redirect_to @account, notice: I18n.t('account.update') }
else
format.html { render action: "edit" }
end
end
flash[:notice] = I18n.t('account.update') if @account.update(params[:account])
respond_with(@account)
end
private

View File

@@ -63,7 +63,6 @@ class GardensController < ApplicationController
def gardens
g = @owner ? @owner.gardens : Garden.all
g = g.active unless @show_all
g = g.includes(:owner).order(:name)
g.paginate(page: params[:page])
g.includes(:owner).order(:updated_at).paginate(page: params[:page])
end
end

View File

@@ -9,6 +9,8 @@ class HarvestsController < ApplicationController
def index
@owner = Member.find_by(slug: params[:owner])
@crop = Crop.find_by(slug: params[:crop])
@planting = Planting.find_by(slug: params['planting_id'])
@harvests = harvests
@filename = csv_filename
respond_with(@harvests)
@@ -79,6 +81,8 @@ class HarvestsController < ApplicationController
@owner.harvests
elsif @crop
@crop.harvests
elsif @planting_id
@planting.harvests
else
Harvest
end.includes(:owner, :crop).paginate(page: params[:page])

View File

@@ -1,42 +1,25 @@
class PhotosController < ApplicationController
before_action :authenticate_member!, except: [:index, :show]
after_action :expire_homepage, only: [:create, :delete]
load_and_authorize_resource
respond_to :html, :json
# GET /photos
# GET /photos.json
def index
@photos = Photo.paginate(page: params[:page])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @photos }
end
respond_with(@photos)
end
# GET /photos/new
# GET /photos/new.json
def new
@photo = Photo.new
@type = params[:type]
@id = params[:id]
page = params[:page] || 1
@flickr_auth = current_member.auth('flickr')
@current_set = params[:set]
if @flickr_auth
@sets = current_member.flickr_sets
photos, total = current_member.flickr_photos(page, @current_set)
@photos = WillPaginate::Collection.create(page, 30, total) do |pager|
pager.replace photos
end
end
respond_to do |format|
format.html # new.html.erb
format.json { render json: @photo }
end
@photo = Photo.new
retrieve_from_flickr
respond_with(@photo)
end
# GET /photos/1/edit
@@ -48,30 +31,15 @@ class PhotosController < ApplicationController
def create
find_or_create_photo_from_flickr_photo
add_photo_to_collection
respond_to do |format|
if @photo.present? && @photo.save
format.html { redirect_to photo_path(@photo), notice: 'Photo was successfully added.' }
format.json { render json: @photo, status: :created, location: @photo }
else
format.html { render action: "new" }
format.json { render json: @photo.errors, status: :unprocessable_entity }
end
end
flash[:notice] = 'Photo was successfully added.' if @photo.present? && @photo.save
respond_with(@photo)
end
# PUT /photos/1
# PUT /photos/1.json
def update
respond_to do |format|
if @photo.update(photo_params)
format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @photo.errors, status: :unprocessable_entity }
end
end
flash[:notice] = 'Photo was successfully updated.' if @photo.update(photo_params)
respond_with(@photo)
end
# DELETE /photos/1
@@ -79,11 +47,7 @@ class PhotosController < ApplicationController
def destroy
@photo.destroy
flash[:alert] = "Photo successfully deleted."
respond_to do |format|
format.html { redirect_to photos_url }
format.json { head :no_content }
end
respond_with(@photo)
end
private
@@ -97,7 +61,7 @@ class PhotosController < ApplicationController
end
def photo_params
params.require(:photo).permit(:flickr_photo_id, :owner_id, :title, :license_name,
params.require(:photo).permit(:flickr_photo_id, :title, :license_name,
:license_url, :thumbnail_url, :fullsize_url, :link_url)
end
@@ -122,4 +86,19 @@ class PhotosController < ApplicationController
rescue => e
flash[:alert] = e.message
end
def retrieve_from_flickr
@flickr_auth = current_member.auth('flickr')
@current_set = params[:set]
return unless @flickr_auth
page = params[:page] || 1
@sets = current_member.flickr_sets
photos, total = current_member.flickr_photos(page, @current_set)
@photos = WillPaginate::Collection.create(page, 30, total) do |pager|
pager.replace photos
end
end
end

View File

@@ -39,8 +39,8 @@ class PlantingsController < ApplicationController
@planting = Planting.new('planted_at' => Time.zone.today)
# using find_by_id here because it returns nil, unlike find
@crop = Crop.find_by(id: params[:crop_id]) || Crop.new
@garden = Garden.find_by(id: params[:garden_id]) || Garden.new
@crop = Crop.approved.find_by(id: params[:crop_id]) || Crop.new
@garden = Garden.find_by(owner: current_member, id: params[:garden_id]) || Garden.new
respond_to do |format|
format.html # new.html.erb

View File

@@ -93,11 +93,13 @@ module ApplicationHelper
end
end
def title(type, owner, crop)
def title(type, owner, crop, planting)
if owner
t(".title.owner_#{type}", owner: owner.login_name)
elsif crop
t(".title.crop_#{type}", crop: crop.name)
elsif planting
t(".title.planting_#{type}", planting: planting.to_s)
else
t(".title.default")
end

View File

@@ -5,7 +5,7 @@ module CropsHelper
seeds = member.seeds.select { |seed| seed.crop.name == crop.name }
seeds.each do |seed|
total_quantity = total_quantity + seed.quantity if seed.quantity
total_quantity += seed.quantity if seed.quantity
end
if !seeds.any?

View File

@@ -89,8 +89,8 @@ class Ability
can :destroy, Garden, owner_id: member.id
can :create, Planting
can :update, Planting, garden: { owner_id: member.id }
can :destroy, Planting, garden: { owner_id: member.id }
can :update, Planting, garden: { owner_id: member.id }, crop: { approval_status: 'approved' }
can :destroy, Planting, garden: { owner_id: member.id }, crop: { approval_status: 'approved' }
can :create, Harvest
can :update, Harvest, owner_id: member.id

View File

@@ -2,4 +2,6 @@ class AlternateName < ActiveRecord::Base
after_commit { |an| an.crop.__elasticsearch__.index_document if an.crop && ENV['GROWSTUFF_ELASTICSEARCH'] == "true" }
belongs_to :crop
belongs_to :creator, class_name: 'Member'
validates :name, presence: true
validates :crop, presence: true
end

View File

@@ -21,24 +21,27 @@ class Crop < ActiveRecord::Base
has_and_belongs_to_many :posts # rubocop:disable Rails/HasAndBelongsToMany
before_destroy { |crop| crop.posts.clear }
default_scope { order("lower(name) asc") }
default_scope { order("lower(crops.name) asc") }
scope :recent, lambda {
where(approval_status: "approved").reorder("created_at desc")
approved.reorder("created_at desc")
}
scope :toplevel, lambda {
where(approval_status: "approved", parent_id: nil)
approved.where(parent_id: nil)
}
scope :popular, lambda {
where(approval_status: "approved").reorder("plantings_count desc, lower(name) asc")
approved.reorder("plantings_count desc, lower(name) asc")
}
scope :randomized, lambda {
# ok on sqlite and psql, but not on mysql
where(approval_status: "approved").reorder('random()')
approved.reorder('random()')
}
scope :pending_approval, -> { where(approval_status: "pending") }
scope :approved, -> { where(approval_status: "approved") }
scope :rejected, -> { where(approval_status: "rejected") }
scope :interesting, -> { approved.has_photos }
scope :has_photos, -> { includes(:photos).where.not(photos: { id: nil }) }
## Wikipedia urls are only necessary when approving a crop
validates :en_wikipedia_url,
format: {
@@ -198,81 +201,6 @@ class Crop < ActiveRecord::Base
["already in database", "not edible", "not enough information", "other"]
end
# Crop.interesting
# returns a list of interesting crops, for use on the homepage etc
def self.interesting
howmany = 12 # max number to find
interesting_crops = []
Crop.includes(:photos).randomized.each do |c|
break if interesting_crops.size == howmany
next unless c.interesting?
interesting_crops.push(c)
end
interesting_crops
end
# Crop.create_from_csv(row)
# used by db/seeds.rb and rake growstuff:import_crops
# CSV fields:
# - name (required)
# - en_wikipedia_url (required)
# - parent (name, optional)
# - scientific name (optional, can be picked up from parent if it has one)
def self.create_from_csv(row)
name, en_wikipedia_url, parent, scientific_names, alternate_names = row
cropbot = Member.find_by(login_name: 'cropbot')
raise "cropbot account not found: run rake db:seed" unless cropbot
crop = Crop.find_or_create_by(name: name)
crop.update_attributes(
en_wikipedia_url: en_wikipedia_url,
creator_id: cropbot.id
)
if parent
parent = Crop.find_by(name: parent)
if parent
crop.update_attributes(parent_id: parent.id)
else
logger.warn("Warning: parent crop #{parent} not found")
end
end
crop.add_scientific_names_from_csv(scientific_names)
crop.add_alternate_names_from_csv(alternate_names)
end
def add_scientific_names_from_csv(scientific_names)
names_to_add = []
if !scientific_names.blank? # i.e. we actually passed something in, which isn't a given
names_to_add = scientific_names.split(/,\s*/)
elsif parent && !parent.scientific_names.empty? # pick up from parent
names_to_add = parent.scientific_names.map(&:name)
else
logger.warn("Warning: no scientific name (not even on parent crop) for #{self}")
end
cropbot = Member.find_by(login_name: 'cropbot')
return if names_to_add.empty?
raise "cropbot account not found: run rake db:seed" unless cropbot
add_names_to_list(names_to_add, 'scientific')
end
def add_alternate_names_from_csv(alternate_names)
# i.e. we actually passed something in, which isn't a given
return if alternate_names.blank?
cropbot = Member.find_by!(login_name: 'cropbot')
names_to_add = alternate_names.split(/,\s*/)
add_names_to_list(names_to_add, 'alternate')
rescue
raise "cropbot account not found: run rake db:seed" unless cropbot
end
def rejection_explanation
return rejection_notes if reason_for_rejection == "other"
reason_for_rejection
@@ -320,34 +248,11 @@ class Crop < ActiveRecord::Base
end
def self.case_insensitive_name(name)
where(["lower(name) = :value", { value: name.downcase }])
where(["lower(crops.name) = :value", { value: name.downcase }])
end
private
def add_names_to_list(names_to_add, list_name)
names_to_add.each do |n|
if name_already_exists(list_name, n)
logger.warn("Warning: skipping duplicate #{list_name} name #{n} for #{self}")
else
create_crop_in_list(list_name, n)
end
end
end
def create_crop_in_list(list_name, name)
cropbot = Member.find_by(login_name: 'cropbot')
create_hash = {
creator_id: cropbot.id.to_s,
name: name
}
send("#{list_name}_names").create(create_hash)
end
def name_already_exists(list_name, name)
send("#{list_name}_names").exists?(name: name)
end
def count_uses_of_property(col_name)
plantings.unscoped
.where(crop_id: id)
@@ -357,7 +262,6 @@ class Crop < ActiveRecord::Base
end
# Custom validations
def approval_status_cannot_be_changed_again
previous = previous_changes.include?(:approval_status) ? previous_changes.approval_status : {}
return unless previous.include?(:rejected) || previous.include?(:approved)

View File

@@ -0,0 +1,70 @@
class CsvImporter
# used by db/seeds.rb and rake growstuff:import_crops
# CSV fields:
# - name (required)
# - en_wikipedia_url (required)
# - parent (name, optional)
# - scientific name (optional, can be picked up from parent if it has one)
def import_crop(row)
name, en_wikipedia_url, parent_name, scientific_names, alternate_names = row
@crop = Crop.find_or_create_by(name: name)
@crop.update_attributes(
en_wikipedia_url: en_wikipedia_url,
creator_id: cropbot.id
)
add_parent(parent_name) if parent_name
add_scientific_names(scientific_names)
add_alternate_names(alternate_names)
@crop.save!
@crop
end
private
def add_parent(parent_name)
parent = Crop.find_by(name: parent_name)
if parent
@crop.update_attributes(parent_id: parent.id)
else
@crop.logger.warn("Warning: parent crop #{parent_name} not found")
end
end
def add_scientific_names(scientific_names)
names_to_add = []
if !scientific_names.blank? # i.e. we actually passed something in, which isn't a given
names_to_add = scientific_names.split(/,\s*/)
elsif @crop.parent && !@crop.parent.scientific_names.empty? # pick up from parent
names_to_add = @crop.parent.scientific_names.map(&:name)
else
@crop.logger.warn("Warning: no scientific name (not even on parent crop) for #{self}")
end
return if names_to_add.empty?
names_to_add.each do |name|
sciname = ScientificName.find_by(name: name, crop: @crop)
sciname = ScientificName.create!(name: name, crop: @crop, creator: cropbot) unless sciname
@crop.scientific_names << sciname
end
end
def add_alternate_names(alternate_names)
# i.e. we actually passed something in, which isn't a given
return if alternate_names.blank?
alternate_names.split(/,\s*/).each do |name|
altname = AlternateName.find_by(name: name, crop: @crop)
altname = AlternateName.create! name: name, crop: @crop, creator: cropbot unless altname
@crop.alternate_names << altname
end
end
def cropbot
@cropbot = Member.find_by!(login_name: 'cropbot') unless @cropbot
@cropbot
rescue
raise "cropbot account not found: run rake db:seed"
end
end

View File

@@ -36,6 +36,15 @@ class Member < ActiveRecord::Base
scope :recently_joined, -> { reorder("confirmed_at desc") }
scope :wants_newsletter, -> { where(newsletter: true) }
scope :interesting, lambda {
confirmed
.located
.recently_signed_in
.has_plantings
}
scope :has_plantings, -> { joins(:plantings).where("plantings.id IS NOT NULL") }
has_many :follows, class_name: "Follow", foreign_key: "follower_id"
has_many :followed, through: :follows
@@ -183,14 +192,6 @@ class Member < ActiveRecord::Base
sets
end
def interesting?
# we assume we're being passed something from
# Member.confirmed.located as those are required for
# interestingness, as well.
return true if plantings.present?
false
end
def self.login_name_or_email(login)
where(["lower(login_name) = :value OR lower(email) = :value", { value: login.downcase }])
end
@@ -199,16 +200,6 @@ class Member < ActiveRecord::Base
where(["lower(login_name) = :value", { value: login.downcase }])
end
def self.interesting
howmany = 12 # max number to find
interesting_members = []
Member.confirmed.located.recently_signed_in.each do |m|
break if interesting_members.size == howmany
interesting_members.push(m) if m.interesting?
end
interesting_members
end
def self.nearest_to(place)
nearby_members = []
if place

View File

@@ -8,10 +8,18 @@ class Planting < ActiveRecord::Base
belongs_to :crop, counter_cache: true
has_many :harvests, -> { order(harvested_at: :desc) }, dependent: :destroy
default_scope { order("created_at desc") }
default_scope { order("plantings.created_at desc") }
scope :finished, -> { where(finished: true) }
scope :current, -> { where(finished: false) }
scope :interesting, -> { has_photos.one_per_owner }
scope :one_per_owner, lambda {
joins("JOIN members m ON (m.id=plantings.owner_id)
LEFT OUTER JOIN plantings p2
ON (m.id=p2.owner_id AND plantings.id < p2.id)").where("p2 IS NULL")
}
scope :has_photos, -> { includes(:photos).where.not(photos: { id: nil }) }
delegate :name,
:en_wikipedia_url,
:default_scientific_name,
@@ -19,8 +27,6 @@ class Planting < ActiveRecord::Base
to: :crop,
prefix: true
default_scope { order("created_at desc") }
validates :crop, approved: true
validates :crop, presence: { message: "must be present and exist in our database" }
@@ -86,10 +92,6 @@ class Planting < ActiveRecord::Base
photos.first
end
def interesting?
photos.present?
end
def calculate_days_before_maturity(planting, crop)
p_crop = Planting.where(crop_id: crop).where.not(id: planting)
differences = p_crop.collect do |p|
@@ -135,24 +137,4 @@ class Planting < ActiveRecord::Base
percent
end
# return a list of interesting plantings, for the homepage etc.
# we can't do this via a scope (as far as we know) so sadly we have to
# do it this way.
def Planting.interesting(howmany = 12, require_photo = true)
interesting_plantings = []
seen_owners = Hash.new(false) # keep track of which owners we've seen already
Planting.includes(:photos).each do |p|
break if interesting_plantings.size == howmany # got enough yet?
if require_photo
next unless p.photos.present? # skip those without photos, if required
end
next if seen_owners[p.owner] # skip if we already have one from this owner
seen_owners[p.owner] = true # we've seen this owner
interesting_plantings.push(p)
end
interesting_plantings
end
end

View File

@@ -39,9 +39,7 @@ class Post < ActiveRecord::Base
default_scope { order("created_at desc") }
validates :subject,
format: {
with: /\S/
},
presence: true,
length: { maximum: 255 }
def author_date_subject

View File

@@ -2,4 +2,6 @@ class ScientificName < ActiveRecord::Base
after_commit { |sn| sn.crop.__elasticsearch__.index_document if sn.crop && ENV['GROWSTUFF_ELASTICSEARCH'] == "true" }
belongs_to :crop
belongs_to :creator, class_name: 'Member'
validates :name, presence: true
validates :crop, presence: true
end

View File

@@ -90,8 +90,7 @@
- unless can? :wrangle, @crop
%p
When you submit this form, your suggestion will be sent to our team of
= link_to 'volunteer crop wranglers', 'http://talk.growstuff.org/c/crop-wrangling'
for review. We'll let you know the outcome as soon as we can.
volunteer crop wranglers for review. We'll let you know the outcome as soon as we can.
-# Now, for crop wranglers, let's have approval/rejection at the bottom of the page
- if can?(:wrangle, @crop) && @crop.requester

View File

@@ -111,5 +111,5 @@
- else
= link_to othergarden, garden_path(othergarden)
- if can? :create, @garden
- if @garden.owner == current_member
= link_to 'Add New Garden', new_garden_path, class: 'btn btn-default btn-xs'

View File

@@ -0,0 +1,15 @@
%p
- if can? :create, Harvest
- if @planting && @planting.owner == current_member
= link_to 'Add harvest', new_planting_harvest_path(planting: @planting), class: 'btn btn-primary'
- elsif @owner
%p
- if @owner == current_member
= link_to 'Add harvest', new_harvest_path, class: 'btn btn-primary'
= link_to "View everyone's harvests", harvests_path, class: 'btn btn-default'
- else # everyone's harvests
= link_to 'Add harvest', new_harvest_path, class: 'btn btn-primary'
- if current_member
= link_to 'View your harvests', harvests_by_owner_path(owner: current_member.slug), class: 'btn btn-default'
- else
= render partial: 'shared/signin_signup', locals: { to: 'track your harvests' }

View File

@@ -1,4 +1,4 @@
- content_for :title, title('harvests', @owner, @crop)
- content_for :title, title('harvests', @owner, @crop, @planting)
- if @owner
= link_to "View #{@owner}'s profile >>", member_path(@owner)
@@ -7,20 +7,7 @@
#{ENV['GROWSTUFF_SITE_NAME']} helps you track what you're
harvesting from your home garden and see how productive it is.
%p
- if can? :create, Harvest
- if @owner
%p
- if @owner == current_member
= link_to 'Add harvest', new_harvest_path, class: 'btn btn-primary'
= link_to "View everyone's harvests", harvests_path, class: 'btn btn-default'
- else # everyone's harvests
= link_to 'Add harvest', new_harvest_path, class: 'btn btn-primary'
- if current_member
= link_to 'View your harvests', harvests_by_owner_path(owner: current_member.slug), class: 'btn btn-default'
- else
= render partial: 'shared/signin_signup', locals: { to: 'track your harvests' }
= render "nav"
.pagination
= page_entries_info @harvests
= will_paginate @harvests

View File

@@ -3,18 +3,18 @@
- cache cache_key_for(Crop, 'interesting'), expires_in: 1.day do
%h2= t('.our_crops')
.hidden-xs
- Crop.interesting.first(8).each do |c|
- Crop.interesting.includes(:scientific_names, :photos).first(8).each do |c|
.col-md-3
= render partial: 'crops/thumbnail', locals: { crop: c }
.visible-xs
- Crop.interesting.first(3).each do |c|
- Crop.interesting.includes(:scientific_names, :photos).first(3).each do |c|
.col-md-3
= render partial: 'crops/thumbnail', locals: { crop: c }
.col-md-4.hidden-xs
- cache cache_key_for(Planting) do
%h2= t('.recently_planted')
= render partial: 'plantings/list', locals: { plantings: Planting.interesting.first(6) }
= render partial: 'plantings/list', locals: { plantings: Planting.includes(:owner, :photos).interesting.first(6) }
.row
.col-md-12

View File

@@ -18,10 +18,6 @@
= link_to "approve or reject this request", edit_crop_url(@request)
\.
%p
Or, discuss this and other crop wrangling issues in our
= link_to "crop wrangling forum", "http://talk.growstuff.org/c/crop-wrangling"
%p
Thanks for your help!

View File

@@ -1,9 +1,8 @@
Harvests:
- if planting.harvests
Harvests:
%ul
- planting.harvests.each do |harvest|
%li
= harvest.harvested_at ? harvest.harvested_at : "undated"
= link_to harvest, harvest_path(harvest)
- else
none
= link_to "more harvests from this planting", planting_harvests_path(planting)

View File

@@ -1,4 +1,4 @@
- content_for :title, title('plantings', @owner, @crop)
- content_for :title, title('plantings', @owner, @crop, @planting)
= render 'nav', owner: @owner, show_all: @show_all

View File

@@ -1,4 +1,4 @@
- content_for :title, title('seeds', @owner, @crop)
- content_for :title, title('seeds', @owner, @crop, @planting)
- if @owner
= link_to "View #{@owner}'s profile >>", member_path(@owner)

View File

@@ -77,4 +77,10 @@ Growstuff::Application.configure do
config.action_controller.action_on_unpermitted_parameters = :raise
config.active_job.queue_adapter = :sidekiq
config.after_initialize do
Bullet.enable = true
Bullet.rails_logger = true
Bullet.add_footer = true
end
end

View File

@@ -23,4 +23,8 @@ ActiveSupport::Inflector.inflections do |inflect|
inflect.plural 'achiote', 'achiote'
inflect.plural 'alfalfa', 'alfalfa'
inflect.plural 'allspice', 'allspice'
inflect.plural 'spinach', 'spinach'
inflect.plural 'garlic', 'garlic'
inflect.plural 'licorice', 'licorice'
inflect.plural 'lillipilli', 'lillipillies'
end

View File

@@ -33,19 +33,26 @@ en:
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
updated: 'Your password was changed successfully. You are now signed in.'
updated_not_active: 'Your password was changed successfully.'
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
send_paranoid_instructions: >
If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes.
no_token: >
You can't access this page without coming from a password reset email. If you do come from a password reset email,
please make sure you used the full URL provided.
confirmations:
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
send_paranoid_instructions: 'If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
send_paranoid_instructions: >
If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.
confirmed: 'Your account was successfully confirmed.'
registrations:
signed_up: 'Welcome! You have signed up successfully.'
signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
signed_up_but_unconfirmed: >
A message with a confirmation link has been sent to your email address. Please open the link to activate your account.
signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
updated: 'You updated your account successfully.'
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
update_needs_confirmation: >
You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm
link to finalize confirming your new email address.
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
unlocks:
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'

View File

@@ -63,13 +63,17 @@ en:
index:
title:
crop_harvests: Everyone's %{crop} harvests
planting_harvests: Harvests from %{planting}
default: Everyone's harvests
owner_harvests: "%{owner} harvests"
updated: Harvest was successfully updated.
home:
blurb:
already_html: Or %{sign_in} if you already have an account
intro: "%{site_name} is a community of food gardeners. We're building an open source platform to help you learn about growing food, track what you plant and harvest, and swap seeds and produce with other gardeners near you."
intro: >
%{site_name} is a community of food gardeners. We're building an open source
platform to help you learn about growing food, track what you plant and harvest,
and swap seeds and produce with other gardeners near you.
perks: Join now for your free garden journal, seed sharing, forums, and more.
sign_in_linktext: sign in
sign_up: Sign up
@@ -97,12 +101,21 @@ en:
api_docs_linktext: API documentation
buy_account_linktext: buying a paid account
creative_commons_linktext: Creative Commons license
get_involved_body_html: We believe in collaboration, and work closely with our members and the wider food-growing community. Our team includes volunteers from all walks of life and all skill levels. To get involved, visit %{talk_link} or find more information on the %{wiki_link}.
get_involved_body_html: >
We believe in collaboration, and work closely with our members and the wider food-growing community.
Our team includes volunteers from all walks of life and all skill levels. To get involved,
visit %{talk_link} or find more information on the %{wiki_link}.
get_involved_title: Get Involved
github_linktext: Github
open_data_body_html: We're building a database of crops, planting advice, seed sources, and other information that anyone can use for free, under a %{creative_commons_link}. You can use this data for research, to build apps, or for any purpose at all. Read more about our %{wiki_link} and %{api_docs_link}.
open_data_body_html: >
We're building a database of crops, planting advice, seed sources, and other information that anyone
can use for free, under a %{creative_commons_link}. You can use this data for research, to build apps,
or for any purpose at all. Read more about our %{wiki_link} and %{api_docs_link}.
open_data_title: Open Data and APIs
open_source_body_html: "%{site_name} is open source software, which means that we share this website's code for free with our community and the world. We believe that openness, sustainability, and social good go hand in hand. You can read more about %{why} or check out our code on %{github}."
open_source_body_html: >
%{site_name} is open source software, which means that we share this website's code for free with our
community and the world. We believe that openness, sustainability, and social good go hand in hand.
You can read more about %{why} or check out our code on %{github}.
open_source_title: Open Source
support_body_html: Growstuff is independent, %{ad_free} and we have no outside investment. You can support our work by %{buy_account}.
support_title: Support Growstuff
@@ -174,7 +187,9 @@ en:
title: "%{site_name} Community Map"
plantings:
form:
finish_helper: A planting is finished when you've harvested all of the crop, or it dies, or it's otherwise no longer growing in your garden.
finish_helper: >
A planting is finished when you've harvested all of the crop, or it dies, or it's otherwise
no longer growing in your garden.
index:
title:
crop_plantings: Everyone's %{crop} plantings
@@ -188,7 +203,10 @@ en:
default: Everyone's posts
seeds:
form:
trade_help: Are you interested in trading or swapping seeds with other %{site_name} members? If you list your seeds as available for trade, other members can contact you to request seeds. You can list any conditions or other information in the description, above.
trade_help: >
Are you interested in trading or swapping seeds with other %{site_name} members? If you list
your seeds as available for trade, other members can contact you to request seeds. You can
list any conditions or other information in the description, above.
index:
title:
crop_seeds: Everyone's %{crop} seeds

View File

@@ -4,7 +4,7 @@ class CreateCms < ActiveRecord::Migration
when 'PostgreSQL'
{}
else
{ limit: 16777215 }
{ limit: 16_777_215 }
end
# -- Sites --------------------------------------------------------------

View File

@@ -17,7 +17,7 @@ ActiveRecord::Schema.define(version: 20170104035248) do
enable_extension "plpgsql"
create_table "account_types", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
t.boolean "is_paid"
t.boolean "is_permanent_paid"
t.datetime "created_at"
@@ -33,31 +33,31 @@ ActiveRecord::Schema.define(version: 20170104035248) do
end
create_table "alternate_names", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.integer "crop_id", null: false
t.integer "creator_id", null: false
t.string "name", null: false
t.integer "crop_id", null: false
t.integer "creator_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "authentications", force: :cascade do |t|
t.integer "member_id", null: false
t.string "provider", limit: 255, null: false
t.string "uid", limit: 255
t.string "token", limit: 255
t.string "secret", limit: 255
t.integer "member_id", null: false
t.string "provider", null: false
t.string "uid"
t.string "token"
t.string "secret"
t.datetime "created_at"
t.datetime "updated_at"
t.string "name", limit: 255
t.string "name"
end
add_index "authentications", ["member_id"], name: "index_authentications_on_member_id", using: :btree
create_table "comfy_cms_blocks", force: :cascade do |t|
t.string "identifier", limit: 255, null: false
t.string "identifier", null: false
t.text "content"
t.integer "blockable_id"
t.string "blockable_type", limit: 255
t.string "blockable_type"
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -66,17 +66,17 @@ ActiveRecord::Schema.define(version: 20170104035248) do
add_index "comfy_cms_blocks", ["identifier"], name: "index_comfy_cms_blocks_on_identifier", using: :btree
create_table "comfy_cms_categories", force: :cascade do |t|
t.integer "site_id", null: false
t.string "label", limit: 255, null: false
t.string "categorized_type", limit: 255, null: false
t.integer "site_id", null: false
t.string "label", null: false
t.string "categorized_type", null: false
end
add_index "comfy_cms_categories", ["site_id", "categorized_type", "label"], name: "index_cms_categories_on_site_id_and_cat_type_and_label", unique: true, using: :btree
create_table "comfy_cms_categorizations", force: :cascade do |t|
t.integer "category_id", null: false
t.string "categorized_type", limit: 255, null: false
t.integer "categorized_id", null: false
t.integer "category_id", null: false
t.string "categorized_type", null: false
t.integer "categorized_id", null: false
end
add_index "comfy_cms_categorizations", ["category_id", "categorized_type", "categorized_id"], name: "index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id", unique: true, using: :btree
@@ -84,9 +84,9 @@ ActiveRecord::Schema.define(version: 20170104035248) do
create_table "comfy_cms_files", force: :cascade do |t|
t.integer "site_id", null: false
t.integer "block_id"
t.string "label", limit: 255, null: false
t.string "file_file_name", limit: 255, null: false
t.string "file_content_type", limit: 255, null: false
t.string "label", null: false
t.string "file_file_name", null: false
t.string "file_content_type", null: false
t.integer "file_file_size", null: false
t.string "description", limit: 2048
t.integer "position", default: 0, null: false
@@ -100,16 +100,16 @@ ActiveRecord::Schema.define(version: 20170104035248) do
add_index "comfy_cms_files", ["site_id", "position"], name: "index_comfy_cms_files_on_site_id_and_position", using: :btree
create_table "comfy_cms_layouts", force: :cascade do |t|
t.integer "site_id", null: false
t.integer "site_id", null: false
t.integer "parent_id"
t.string "app_layout", limit: 255
t.string "label", limit: 255, null: false
t.string "identifier", limit: 255, null: false
t.string "app_layout"
t.string "label", null: false
t.string "identifier", null: false
t.text "content"
t.text "css"
t.text "js"
t.integer "position", default: 0, null: false
t.boolean "is_shared", default: false, null: false
t.integer "position", default: 0, null: false
t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -118,18 +118,18 @@ ActiveRecord::Schema.define(version: 20170104035248) do
add_index "comfy_cms_layouts", ["site_id", "identifier"], name: "index_comfy_cms_layouts_on_site_id_and_identifier", unique: true, using: :btree
create_table "comfy_cms_pages", force: :cascade do |t|
t.integer "site_id", null: false
t.integer "site_id", null: false
t.integer "layout_id"
t.integer "parent_id"
t.integer "target_page_id"
t.string "label", limit: 255, null: false
t.string "slug", limit: 255
t.string "full_path", limit: 255, null: false
t.string "label", null: false
t.string "slug"
t.string "full_path", null: false
t.text "content_cache"
t.integer "position", default: 0, null: false
t.integer "children_count", default: 0, null: false
t.boolean "is_published", default: true, null: false
t.boolean "is_shared", default: false, null: false
t.integer "position", default: 0, null: false
t.integer "children_count", default: 0, null: false
t.boolean "is_published", default: true, null: false
t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -138,8 +138,8 @@ ActiveRecord::Schema.define(version: 20170104035248) do
add_index "comfy_cms_pages", ["site_id", "full_path"], name: "index_comfy_cms_pages_on_site_id_and_full_path", using: :btree
create_table "comfy_cms_revisions", force: :cascade do |t|
t.string "record_type", limit: 255, null: false
t.integer "record_id", null: false
t.string "record_type", null: false
t.integer "record_id", null: false
t.text "data"
t.datetime "created_at"
end
@@ -147,24 +147,24 @@ ActiveRecord::Schema.define(version: 20170104035248) do
add_index "comfy_cms_revisions", ["record_type", "record_id", "created_at"], name: "index_cms_revisions_on_rtype_and_rid_and_created_at", using: :btree
create_table "comfy_cms_sites", force: :cascade do |t|
t.string "label", limit: 255, null: false
t.string "identifier", limit: 255, null: false
t.string "hostname", limit: 255, null: false
t.string "path", limit: 255
t.string "locale", limit: 255, default: "en", null: false
t.boolean "is_mirrored", default: false, null: false
t.string "label", null: false
t.string "identifier", null: false
t.string "hostname", null: false
t.string "path"
t.string "locale", default: "en", null: false
t.boolean "is_mirrored", default: false, null: false
end
add_index "comfy_cms_sites", ["hostname"], name: "index_comfy_cms_sites_on_hostname", using: :btree
add_index "comfy_cms_sites", ["is_mirrored"], name: "index_comfy_cms_sites_on_is_mirrored", using: :btree
create_table "comfy_cms_snippets", force: :cascade do |t|
t.integer "site_id", null: false
t.string "label", limit: 255, null: false
t.string "identifier", limit: 255, null: false
t.integer "site_id", null: false
t.string "label", null: false
t.string "identifier", null: false
t.text "content"
t.integer "position", default: 0, null: false
t.boolean "is_shared", default: false, null: false
t.integer "position", default: 0, null: false
t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -181,16 +181,16 @@ ActiveRecord::Schema.define(version: 20170104035248) do
end
create_table "crops", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "en_wikipedia_url", limit: 255
t.string "name", null: false
t.string "en_wikipedia_url"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "slug"
t.integer "parent_id"
t.integer "plantings_count", default: 0
t.integer "plantings_count", default: 0
t.integer "creator_id"
t.integer "requester_id"
t.string "approval_status", limit: 255, default: "approved"
t.string "approval_status", default: "approved"
t.text "reason_for_rejection"
t.text "request_notes"
t.text "rejection_notes"
@@ -216,29 +216,29 @@ ActiveRecord::Schema.define(version: 20170104035248) do
end
create_table "forums", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.text "description", null: false
t.integer "owner_id", null: false
t.string "name", null: false
t.text "description", null: false
t.integer "owner_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "slug"
end
add_index "forums", ["slug"], name: "index_forums_on_slug", unique: true, using: :btree
create_table "gardens", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
t.integer "owner_id"
t.string "slug", limit: 255, null: false
t.string "slug", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.text "description"
t.boolean "active", default: true
t.string "location", limit: 255
t.boolean "active", default: true
t.string "location"
t.float "latitude"
t.float "longitude"
t.decimal "area"
t.string "area_unit", limit: 255
t.string "area_unit"
end
add_index "gardens", ["owner_id"], name: "index_gardens_on_owner_id", using: :btree
@@ -252,17 +252,17 @@ ActiveRecord::Schema.define(version: 20170104035248) do
add_index "gardens_photos", ["garden_id", "photo_id"], name: "index_gardens_photos_on_garden_id_and_photo_id", using: :btree
create_table "harvests", force: :cascade do |t|
t.integer "crop_id", null: false
t.integer "owner_id", null: false
t.integer "crop_id", null: false
t.integer "owner_id", null: false
t.date "harvested_at"
t.decimal "quantity"
t.string "unit", limit: 255
t.string "unit"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "slug"
t.decimal "weight_quantity"
t.string "weight_unit", limit: 255
t.string "weight_unit"
t.integer "plant_part_id"
t.float "si_weight"
t.integer "planting_id"
@@ -291,38 +291,38 @@ ActiveRecord::Schema.define(version: 20170104035248) do
add_index "likes", ["member_id"], name: "index_likes_on_member_id", using: :btree
create_table "members", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false
t.string "encrypted_password", limit: 255, default: "", null: false
t.string "reset_password_token", limit: 255
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0
t.integer "sign_in_count", default: 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip", limit: 255
t.string "confirmation_token", limit: 255
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email", limit: 255
t.integer "failed_attempts", default: 0
t.string "unlock_token", limit: 255
t.string "unconfirmed_email"
t.integer "failed_attempts", default: 0
t.string "unlock_token"
t.datetime "locked_at"
t.datetime "created_at"
t.datetime "updated_at"
t.string "login_name", limit: 255
t.string "slug", limit: 255
t.string "login_name"
t.string "slug"
t.boolean "tos_agreement"
t.boolean "show_email"
t.string "location", limit: 255
t.string "location"
t.float "latitude"
t.float "longitude"
t.boolean "send_notification_email", default: true
t.boolean "send_notification_email", default: true
t.text "bio"
t.integer "plantings_count"
t.boolean "newsletter"
t.boolean "send_planting_reminder", default: true
t.string "preferred_avatar_uri", limit: 255
t.boolean "send_planting_reminder", default: true
t.string "preferred_avatar_uri"
end
add_index "members", ["confirmation_token"], name: "index_members_on_confirmation_token", unique: true, using: :btree
@@ -338,10 +338,10 @@ ActiveRecord::Schema.define(version: 20170104035248) do
create_table "notifications", force: :cascade do |t|
t.integer "sender_id"
t.integer "recipient_id", null: false
t.string "subject", limit: 255
t.integer "recipient_id", null: false
t.string "subject"
t.text "body"
t.boolean "read", default: false
t.boolean "read", default: false
t.integer "post_id"
t.datetime "created_at"
t.datetime "updated_at"
@@ -361,9 +361,9 @@ ActiveRecord::Schema.define(version: 20170104035248) do
t.datetime "updated_at"
t.datetime "completed_at"
t.integer "member_id"
t.string "paypal_express_token", limit: 255
t.string "paypal_express_payer_id", limit: 255
t.string "referral_code", limit: 255
t.string "paypal_express_token"
t.string "paypal_express_payer_id"
t.string "referral_code"
end
create_table "orders_products", id: false, force: :cascade do |t|
@@ -372,16 +372,16 @@ ActiveRecord::Schema.define(version: 20170104035248) do
end
create_table "photos", force: :cascade do |t|
t.integer "owner_id", null: false
t.string "thumbnail_url", limit: 255, null: false
t.string "fullsize_url", limit: 255, null: false
t.integer "owner_id", null: false
t.string "thumbnail_url", null: false
t.string "fullsize_url", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "title", limit: 255, null: false
t.string "license_name", limit: 255, null: false
t.string "license_url", limit: 255
t.string "link_url", limit: 255, null: false
t.string "flickr_photo_id", limit: 255
t.string "title", null: false
t.string "license_name", null: false
t.string "license_url"
t.string "link_url", null: false
t.string "flickr_photo_id"
end
create_table "photos_plantings", id: false, force: :cascade do |t|
@@ -397,25 +397,25 @@ ActiveRecord::Schema.define(version: 20170104035248) do
add_index "photos_seeds", ["seed_id", "photo_id"], name: "index_photos_seeds_on_seed_id_and_photo_id", using: :btree
create_table "plant_parts", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "slug"
end
create_table "plantings", force: :cascade do |t|
t.integer "garden_id", null: false
t.integer "crop_id", null: false
t.integer "garden_id", null: false
t.integer "crop_id", null: false
t.date "planted_at"
t.integer "quantity"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "sunniness", limit: 255
t.string "planted_from", limit: 255
t.string "slug"
t.string "sunniness"
t.string "planted_from"
t.integer "owner_id"
t.boolean "finished", default: false
t.boolean "finished", default: false
t.date "finished_at"
t.integer "days_before_maturity"
end
@@ -423,12 +423,12 @@ ActiveRecord::Schema.define(version: 20170104035248) do
add_index "plantings", ["slug"], name: "index_plantings_on_slug", unique: true, using: :btree
create_table "posts", force: :cascade do |t|
t.integer "author_id", null: false
t.string "subject", limit: 255, null: false
t.text "body", null: false
t.integer "author_id", null: false
t.string "subject", null: false
t.text "body", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "slug"
t.integer "forum_id"
end
@@ -436,9 +436,9 @@ ActiveRecord::Schema.define(version: 20170104035248) do
add_index "posts", ["slug"], name: "index_posts_on_slug", unique: true, using: :btree
create_table "products", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.text "description", null: false
t.integer "min_price", null: false
t.string "name", null: false
t.text "description", null: false
t.integer "min_price", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "account_type_id"
@@ -447,38 +447,38 @@ ActiveRecord::Schema.define(version: 20170104035248) do
end
create_table "roles", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "slug"
end
add_index "roles", ["slug"], name: "index_roles_on_slug", unique: true, using: :btree
create_table "scientific_names", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.integer "crop_id", null: false
t.string "name", null: false
t.integer "crop_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "creator_id"
end
create_table "seeds", force: :cascade do |t|
t.integer "owner_id", null: false
t.integer "crop_id", null: false
t.integer "owner_id", null: false
t.integer "crop_id", null: false
t.text "description"
t.integer "quantity"
t.date "plant_before"
t.datetime "created_at"
t.datetime "updated_at"
t.string "tradable_to", limit: 255, default: "nowhere"
t.string "slug", limit: 255
t.string "tradable_to", default: "nowhere"
t.string "slug"
t.integer "days_until_maturity_min"
t.integer "days_until_maturity_max"
t.text "organic", default: "unknown"
t.text "gmo", default: "unknown"
t.text "heirloom", default: "unknown"
t.text "organic", default: "unknown"
t.text "gmo", default: "unknown"
t.text "heirloom", default: "unknown"
end
add_index "seeds", ["slug"], name: "index_seeds_on_slug", unique: true, using: :btree

View File

@@ -31,7 +31,7 @@ def load_crops
Dir.glob("#{source_path}/crops*.csv").each do |crop_file|
puts "Loading crops from #{crop_file}..."
CSV.foreach(crop_file) do |row|
Crop.create_from_csv(row)
CsvImporter.new.import_crop(row)
end
end
puts "Finished loading crops"
@@ -171,7 +171,7 @@ def load_products
Product.create!(
name: "Seed account",
description: "Paid account, in perpetuity",
min_price: 15000,
min_price: 15_000,
account_type_id: @seed_account.id
)
end

View File

@@ -6,7 +6,7 @@ module Geocodable
private
def empty_unwanted_geocodes
return unless self.location.blank?
return unless location.blank?
self.latitude = nil
self.longitude = nil
end

View File

@@ -33,7 +33,7 @@ namespace :growstuff do
puts "Loading crops from #{@file}..."
CSV.foreach(@file) do |row|
Crop.create_from_csv(row)
CsvImporter.new.import_crop(row)
end
Rails.cache.delete('full_crop_hierarchy')
puts "Finished loading crops"
@@ -134,7 +134,7 @@ namespace :growstuff do
"early days. It gives you all the features of "\
"a paid account, in perpetuity. This account "\
"type never expires.",
min_price: 15000,
min_price: 15_000,
account_type_id: @seed_account.id
)

24
package.json Normal file
View File

@@ -0,0 +1,24 @@
{
"name": "growstuff",
"version": "1.0.0",
"description": "Growstuff Linters",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"coffeelint": "^1.16.0",
"csslint": "^1.0.5",
"eslint": "^3.17.1",
"git-guilt": "^0.1.1",
"jshint": "^2.9.4"
},
"repository": {
"type": "git",
"url": "git+https://github.com/growstuff/growstuff.git"
},
"author": "",
"license": "AGPL-1.0",
"bugs": {
"url": "https://github.com/growstuff/growstuff/issues"
},
"homepage": "https://github.com/growstuff/growstuff#readme"
}

View File

@@ -1,4 +1,12 @@
<!DOCTYPE html>
<nav id="header" class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header" style="float:none; text-align:center;">
<a class="navbar-brand" id="brand" href="/" style="text-align:center; position:absolute">GrowStuff</a>
</div>
</div>
</nav>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>

View File

@@ -1,4 +1,12 @@
<!DOCTYPE html>
<nav id="header" class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header" style="float:none; text-align:center;">
<a class="navbar-brand" id="brand" href="/" style="text-align:center; position:absolute">GrowStuff</a>
</div>
</div>
</nav>
<html>
<head>
<title>The change you wanted was rejected (422)</title>

View File

@@ -1,4 +1,12 @@
<!DOCTYPE html>
<nav id="header" class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header" style="float:none; text-align:center;">
<a class="navbar-brand" id="brand" href="/" style="text-align:center; position:absolute">GrowStuff</a>
</div>
</div>
</nav>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>

View File

@@ -1,18 +0,0 @@
#!/usr/bin/env ruby
require 'open3'
# We don't want to include the literal conflict marker here, or we'll match the
# script itself!
conflict_marker = '<' * 5
# Search for checked-in files containing conflict markers
# -l List only matching files
# -I Ignore binary files
_, stdout, _, wait_thr = Open3.popen3("git", "grep", "-Il", conflict_marker)
exit_code = wait_thr.value.exitstatus
if exit_code.zero?
puts "The following files appear to contain merge conflicts:"
puts stdout.gets(nil)
end

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
puts "Checking to see if you're in CONTRIBUTORS.md..."
if ENV['TRAVIS'] then
if ENV['TRAVIS_PULL_REQUEST'] then
if ENV['TRAVIS']
if ENV['TRAVIS_PULL_REQUEST']
require 'httparty'
repo = ENV['TRAVIS_REPO_SLUG']
pr = ENV['TRAVIS_PULL_REQUEST']
@@ -18,20 +18,20 @@ if ENV['TRAVIS'] then
end
else
author = `git config github.user`.chomp
if $?.exitstatus > 0 then
abort %{
if $?.exitstatus.positive?
abort %(
Couldn't determine your GitHub username, and not in a Travis PR build
Please set it using
git config --add github.user [username]
}
)
end
end
unless system('grep', '-i', author, 'CONTRIBUTORS.md') then
abort %{
unless system('grep', '-i', author, 'CONTRIBUTORS.md')
abort %(
Thanks for your contribution, #{author}!
Please add your name and GitHub handle to the file CONTRIBUTORS.md,
commit it, and update your PR.
}
)
end

View File

@@ -1,9 +0,0 @@
#!/usr/bin/env ruby
require 'set'
changed_file_list = `git diff --name-only --diff-filter=ACMRTUXB origin/dev...`
files = Set.new changed_file_list.split
if (files.include? "Gemfile") && !(files.include? "Gemfile.lock")
abort "Looks like you committed changes to Gemfile but not Gemfile.lock\n\n"
end

View File

@@ -1,11 +1,8 @@
#!/usr/bin/env ruby
checks = [
'script/check_gemfile',
'script/check_contributors_md',
'script/check_conflicts',
'rubocop --display-cop-names --rails',
"haml-lint app/views"
'overcommit -r',
'bundle exec script/check_contributors_md.rb'
]
return_values = checks.collect { |t| system(t) }

12
script/install_linters Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
set -euv
gem install overcommit rubocop haml-lint bundler-audit
npm install
pip install yamllint --user
overcommit --install
overcommit --sign
overcommit --sign pre-commit
bundle-audit update

10
script/install_phantomjs Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
if [ "$(phantomjs --version)" != '2.1.1' ]; then
PHANTOM_URL="https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2"
rm -rf "$PWD/travis_phantomjs"
mkdir -p "$PWD/travis_phantomjs"
wget "$PHANTOM_URL" -O "$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2"
tar -xvf "$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs"
fi
phantomjs --version

View File

@@ -62,13 +62,33 @@ describe PlantingsController do
assigns(:crop).should be_a_new(Crop)
end
it "picks up garden from params" do
member = FactoryGirl.create(:member)
it "picks up member's garden from params" do
garden = FactoryGirl.create(:garden, owner: member)
get :new, garden_id: garden.id
assigns(:garden).should eq(garden)
end
it "Doesn't display another member's garden on planting form" do
member = FactoryGirl.create(:member) # over-riding member from login_member()
garden = FactoryGirl.create(:garden, owner: member)
get :new, garden_id: garden.id
assigns(:garden).should_not eq(garden)
end
it "Doesn't display un-approved crops on planting form" do
crop = FactoryGirl.create(:crop, approval_status: 'pending')
FactoryGirl.create(:garden, owner: member)
get :new, crop_id: crop.id
assigns(:crop).should_not eq(crop)
end
it "Doesn't display rejected crops on planting form" do
crop = FactoryGirl.create(:crop, approval_status: 'rejected', reason_for_rejection: 'nope')
FactoryGirl.create(:garden, owner: member)
get :new, crop_id: crop.id
assigns(:crop).should_not eq(crop)
end
it "doesn't die if no garden specified" do
get :new, {}
assigns(:garden).should be_a_new(Garden)

View File

@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
feature "irregular crop inflections" do
# We're just testing a couple of representative crops to
@@ -7,5 +7,15 @@ feature "irregular crop inflections" do
scenario "crops which are mass nouns" do
expect("kale".pluralize).to eq "kale"
expect("broccoli".pluralize).to eq "broccoli"
expect("square foot".pluralize).to eq "square feet"
expect("squash".pluralize).to eq "squash"
expect("bok choy".pluralize).to eq "bok choy"
expect("achiote".pluralize).to eq "achiote"
expect("alfalfa".pluralize).to eq "alfalfa"
expect("allspice".pluralize).to eq "allspice"
expect("spinach".pluralize).to eq "spinach"
expect("garlic".pluralize).to eq "garlic"
expect("licorice".pluralize).to eq "licorice"
expect("lillipilli".pluralize).to eq "lillipillies"
end
end

View File

@@ -31,7 +31,7 @@
});
it('draws a group', function(){
expect($('g.bar')).toExist()
expect($('g.bar')).toExist();
});
it('draws 2 bars', function() {

View File

@@ -20,22 +20,22 @@
};
subject = new BarLabelGroup(data);
subject.render(d3.select('#jasmine_content').append('svg'));
})
});
it('draws a group for labels', function(){
expect($('g.bar-label')).toExist()
expect($('g.bar-label')).toExist();
});
it('draws 2 bar labels', function(){
expect($('g.bar-label text')).toHaveLength(2);
})
});
it ('has text for 2 bar labels', function(){
//jquery jasmine appends text from all text elements
// into one string
expect($('g.bar-label text')).toHaveText('ShadeHalf Shade');
})
});
});

View File

@@ -121,4 +121,3 @@ boot_files:
#
# rack_options:
# server: 'thin'

View File

@@ -11,14 +11,13 @@ describe Crop do
it 'should be fetchable from the database' do
crop.save
@crop2 = Crop.find_by(name: 'tomato')
@crop2.en_wikipedia_url.should == "http://en.wikipedia.org/wiki/Tomato"
@crop2.slug.should == "tomato"
@crop2.en_wikipedia_url.should eq("http://en.wikipedia.org/wiki/Tomato")
@crop2.slug.should eq("tomato")
end
it 'should stringify as the system name' do
crop.save
crop.to_s.should == 'tomato'
crop.to_s.should == 'tomato'
crop.to_s.should eq('tomato')
end
it 'has a creator' do
@@ -419,164 +418,135 @@ describe Crop do
context "scientific names" do
it "adds a scientific name to a crop that has none" do
tomato = FactoryGirl.create(:tomato)
expect(tomato.scientific_names.size).to eq 0
tomato.add_scientific_names_from_csv("Foo bar")
row = ["parent", "http://en.wikipedia.org/wiki/Parent", "", "Foo bar"]
tomato = CsvImporter.new.import_crop(row)
expect(tomato.scientific_names.size).to eq 1
expect(tomato.default_scientific_name).to eq "Foo bar"
end
it "picks up scientific name from parent crop if available" do
parent = FactoryGirl.create(:crop, name: 'parent crop')
parent.add_scientific_names_from_csv("Parentis cropis")
parent.save
parent.reload
parent = CsvImporter.new.import_crop(
["parent", "http://en.wikipedia.org/wiki/Parent", "", "Parentis cropis"]
)
tomato = CsvImporter.new.import_crop(
["Tomato", "http://en.wikipedia.org/wiki/Parent", "parent"]
)
tomato = FactoryGirl.create(:tomato, parent: parent)
expect(tomato.parent).to eq parent
expect(tomato.parent.default_scientific_name).to eq "Parentis cropis"
tomato.add_scientific_names_from_csv('')
expect(tomato.default_scientific_name).to eq "Parentis cropis"
end
it "doesn't add a duplicate scientific name" do
tomato = FactoryGirl.create(:tomato)
expect(tomato.scientific_names.size).to eq 0
tomato.add_scientific_names_from_csv("Foo bar")
row = ["parent", "http://en.wikipedia.org/wiki/Parent", "", "Foo bar, Foo bar"]
tomato = CsvImporter.new.import_crop(row)
expect(tomato.scientific_names.size).to eq 1
tomato.add_scientific_names_from_csv("Foo bar")
expect(tomato.scientific_names.size).to eq 1 # shouldn't increase
tomato.add_scientific_names_from_csv("Baz quux")
expect(tomato.scientific_names.size).to eq 2
end
it "doesn't add a duplicate scientific name from parent" do
parent = FactoryGirl.create(:crop, name: 'parent')
parent.add_scientific_names_from_csv("Parentis cropis")
parent.save
parent.reload
tomato = FactoryGirl.create(:tomato, parent: parent)
expect(tomato.scientific_names.size).to eq 0
tomato.add_scientific_names_from_csv('')
expect(tomato.scientific_names.size).to eq 1 # picks up parent SN
tomato.add_scientific_names_from_csv('')
expect(tomato.scientific_names.size).to eq 1 # shouldn't increase now
CsvImporter.new.import_crop(
["parent", "http://en.wikipedia.org/wiki/Parent", "", "Parentis cropis"]
)
tomato = CsvImporter.new.import_crop(
["Tomato", "http://en.wikipedia.org/wiki/Parent", "parent", "Parentis cropis"]
)
expect(tomato.scientific_names.size).to eq 1
end
it "loads a crop with multiple scientific names" do
tomato = FactoryGirl.create(:tomato)
expect(tomato.scientific_names.size).to eq 0
tomato.add_scientific_names_from_csv("Foo, Bar")
expect(tomato.scientific_names.size).to eq 2
row = ["parent", "http://en.wikipedia.org/wiki/Parent", "", "Foo,Bar"]
tomato = CsvImporter.new.import_crop(row)
expect(tomato.scientific_names[0].name).to eq "Foo"
expect(tomato.scientific_names[1].name).to eq "Bar"
end
it "loads multiple scientific names with variant spacing" do
tomato = FactoryGirl.create(:tomato)
expect(tomato.scientific_names.size).to eq 0
tomato.add_scientific_names_from_csv("Foo,Bar") # no space
row = ["parent", "http://en.wikipedia.org/wiki/Parent", "", "Baz, Quux"]
tomato = CsvImporter.new.import_crop(row)
expect(tomato.scientific_names.size).to eq 2
tomato.add_scientific_names_from_csv("Baz, Quux") # multiple spaces
expect(tomato.scientific_names.size).to eq 4
expect(tomato.scientific_names[0].name).to eq "Baz"
expect(tomato.scientific_names[1].name).to eq "Quux"
end
end # scientific names
context "alternate names" do
it "loads an alternate name" do
tomato = FactoryGirl.create(:tomato)
expect(tomato.alternate_names.size).to eq 0
tomato.add_alternate_names_from_csv("Foo")
row = ["tomato", "http://en.wikipedia.org/wiki/Parent", "", "", "Foo"]
tomato = CsvImporter.new.import_crop(row)
expect(tomato.alternate_names.size).to eq 1
expect(tomato.alternate_names.last.name).to eq "Foo"
end
it "doesn't load duplicate alternate names" do
tomato = FactoryGirl.create(:tomato)
expect(tomato.alternate_names.size).to eq 0
tomato.add_alternate_names_from_csv("Foo")
expect(tomato.alternate_names.size).to eq 1
tomato.add_alternate_names_from_csv("Foo")
expect(tomato.alternate_names.size).to eq 1 # still 1, doesn't add another
end
it "adds multiple alternate names" do
tomato = FactoryGirl.create(:tomato)
expect(tomato.alternate_names.size).to eq 0
tomato.add_alternate_names_from_csv("Foo, Bar")
row = ["tomato", "http://en.wikipedia.org/wiki/Parent", "", "", "Foo, Bar"]
tomato = CsvImporter.new.import_crop(row)
expect(tomato.alternate_names.size).to eq 2
expect(tomato.alternate_names[0].name).to eq "Foo"
expect(tomato.alternate_names[1].name).to eq "Bar"
end
it "adds multiple alt names with variant spacing" do
tomato = FactoryGirl.create(:tomato)
expect(tomato.alternate_names.size).to eq 0
tomato.add_alternate_names_from_csv("Foo,Bar") # no space
expect(tomato.alternate_names.size).to eq 2
tomato.add_alternate_names_from_csv("Baz, Quux") # mutliple spaces
row = ["tomato", "http://en.wikipedia.org/wiki/Parent", "", "", "Foo,Bar,Baz, Quux"]
tomato = CsvImporter.new.import_crop(row)
expect(tomato.alternate_names.size).to eq 4
expect(tomato.alternate_names[0].name).to eq "Foo"
expect(tomato.alternate_names[1].name).to eq "Bar"
expect(tomato.alternate_names[2].name).to eq "Baz"
expect(tomato.alternate_names[3].name).to eq "Quux"
end
it "Adds a duplicate alternate name for second crop" do
row = ["tomato", "http://en.wikipedia.org/wiki/tomato", "", "", "Foo"]
tomato = CsvImporter.new.import_crop(row)
row = ["tomoto", "http://en.wikipedia.org/wiki/tomoto", "", "", "Foo"]
tomoto = CsvImporter.new.import_crop(row)
expect(tomato.alternate_names.size).to eq 1
expect(tomoto.alternate_names.size).to eq 1
end
end # alternate names
it "loads the simplest possible crop" do
tomato_row = "tomato,http://en.wikipedia.org/wiki/Tomato"
tomato_row = ["tomato", "http://en.wikipedia.org/wiki/Tomato"]
tomato = CsvImporter.new.import_crop(tomato_row)
CSV.parse(tomato_row) do |row|
Crop.create_from_csv(row)
end
loaded = Crop.last
expect(loaded.name).to eq "tomato"
expect(loaded.en_wikipedia_url).to eq 'http://en.wikipedia.org/wiki/Tomato'
expect(loaded.creator).to eq @cropbot
expect(tomato.name).to eq "tomato"
expect(tomato.en_wikipedia_url).to eq 'http://en.wikipedia.org/wiki/Tomato'
expect(tomato.creator).to eq @cropbot
end
it "loads a crop with a scientific name" do
tomato_row = "tomato,http://en.wikipedia.org/wiki/Tomato,,Solanum lycopersicum"
tomato_row = ["tomato", "http://en.wikipedia.org/wiki/Tomato", "", "Solanum lycopersicum"]
tomato = CsvImporter.new.import_crop(tomato_row)
CSV.parse(tomato_row) do |row|
Crop.create_from_csv(row)
end
loaded = Crop.last
expect(loaded.name).to eq "tomato"
expect(loaded.scientific_names.size).to eq 1
expect(loaded.scientific_names.last.name).to eq "Solanum lycopersicum"
expect(tomato.name).to eq "tomato"
expect(tomato.scientific_names.size).to eq 1
expect(tomato.scientific_names.last.name).to eq "Solanum lycopersicum"
end
it "loads a crop with an alternate name" do
tomato_row = "tomato,http://en.wikipedia.org/wiki/Tomato,,,Foo"
crop = CsvImporter.new.import_crop(
["tomato", "http://en.wikipedia.org/wiki/Tomato", nil, nil, "Foo"]
)
CSV.parse(tomato_row) do |row|
Crop.create_from_csv(row)
end
loaded = Crop.last
expect(loaded.name).to eq "tomato"
expect(loaded.alternate_names.size).to eq 1
expect(loaded.alternate_names.last.name).to eq "Foo"
expect(crop.name).to eq "tomato"
expect(crop.alternate_names.size).to eq 1
expect(crop.alternate_names.last.name).to eq "Foo"
end
it "loads a crop with a parent" do
parent = FactoryGirl.create(:crop, name: 'parent')
tomato_row = "tomato,http://en.wikipedia.org/wiki/Tomato,parent"
CSV.parse(tomato_row) do |row|
Crop.create_from_csv(row)
end
loaded = Crop.last
expect(loaded.parent).to eq parent
crop = CsvImporter.new.import_crop(
["tomato", "http://en.wikipedia.org/wiki/Tomato", "parent"]
)
expect(crop.parent).to eq parent
end
it "loads a crop with a missing parent" do
tomato_row = "tomato,http://en.wikipedia.org/wiki/Tomato,parent"
CSV.parse(tomato_row) do |row|
Crop.create_from_csv(row)
CsvImporter.new.import_crop(row)
end
loaded = Crop.last
@@ -587,7 +557,7 @@ describe Crop do
tomato_row = "tomato,http://en.wikipedia.org/wiki/Tomato,,Solanum lycopersicum"
CSV.parse(tomato_row) do |row|
Crop.create_from_csv(row)
CsvImporter.new.import_crop(row)
end
loaded = Crop.last

View File

@@ -100,10 +100,10 @@ describe Garden do
garden = FactoryGirl.create(:garden, owner: owner)
@planting1 = FactoryGirl.create(:planting, garden: garden)
@planting2 = FactoryGirl.create(:planting, garden: garden)
garden.plantings.size.should == 2
garden.plantings.size.should eq(2)
all = Planting.count
garden.destroy
Planting.count.should == all - 2
Planting.count.should eq(all - 2)
end
context 'area' do

View File

@@ -262,26 +262,13 @@ describe Planting do
end
end
context "with require_photo = false" do
it "returns plantings without photos" do
# first, a planting with a photo
@planting = FactoryGirl.create(:planting)
@planting.photos << FactoryGirl.create(:photo)
@planting.save
# this one doesn't have a photo
@no_photo_planting = FactoryGirl.create(:planting)
interesting = Planting.interesting(10, false)
interesting.should include @planting
interesting.should include @no_photo_planting
end
end
context "with howmany argument" do
it "only returns the number asked for" do
@plantings = FactoryGirl.create_list(:planting, 10)
Planting.interesting(3, false).size.should eq 3
@plantings.each do |p|
p.photos << FactoryGirl.create(:photo, owner: planting.owner)
end
Planting.interesting.limit(3).count.should eq 3
end
end
end # interesting plantings

View File

@@ -23,8 +23,8 @@ describe Post do
datestr = time.strftime("%Y%m%d")
# 2 digit day and month, full-length years
# Counting digits using Math.log is not precise enough!
datestr.size.should == 4 + time.year.to_s.size
post.slug.should == "#{member.login_name}-#{datestr}-a-post"
datestr.size.should eq(4 + time.year.to_s.size)
post.slug.should eq("#{member.login_name}-#{datestr}-a-post")
end
it "has many comments" do
@@ -45,10 +45,10 @@ describe Post do
post = FactoryGirl.create(:post, author: member)
FactoryGirl.create(:comment, post: post)
FactoryGirl.create(:comment, post: post)
post.comments.size.should == 2
post.comments.size.should eq(2)
all = Comment.count
post.destroy
Comment.count.should == all - 2
Comment.count.should eq(all - 2)
end
it "belongs to a forum" do

View File

@@ -23,7 +23,7 @@ describe ScientificName do
context 'invalid data' do
it 'should not save a scientific name without a name' do
sn = ScientificName.new
expect { sn.save }.to raise_error ActiveRecord::StatementInvalid
expect { sn.save! }.to raise_error ActiveRecord::RecordInvalid
end
end
end

View File

@@ -2,14 +2,14 @@ module FeatureHelpers
def fill_autocomplete(field, options = {})
fill_in field, with: options[:with]
page.execute_script %Q{ $('##{field}').trigger('focus'); }
page.execute_script %Q{ $('##{field}').trigger('keydown'); }
page.execute_script " $('##{field}').trigger('focus'); "
page.execute_script " $('##{field}').trigger('keydown'); "
end
def select_from_autocomplete(select)
page.should have_selector('ul.ui-autocomplete li.ui-menu-item a')
selector = %Q{ul.ui-autocomplete li.ui-menu-item a:contains("#{select}")}
page.execute_script %Q{ $('#{selector}').mouseenter().click() }
page.execute_script " $('#{selector}').mouseenter().click() "
end
end

View File

@@ -24,7 +24,7 @@ describe "plantings/_form" do
@planting = FactoryGirl.create(:planting,
garden: @garden,
crop: @crop,
planted_at: Date.new(2013, 03, 01))
planted_at: Date.new(2013, 3, 1))
render
end