Compare commits

...

147 Commits

Author SHA1 Message Date
Cesy
3325e1e388 Merge pull request #1020 from Growstuff/dev
Release 13
2016-07-19 10:45:28 +01:00
Daniel O'Connor
7947fd6e91 Clean up link_to as per #1013 2016-07-08 17:08:17 +09:30
Daniel O'Connor
70bf5499b2 Clean up logic a bit as per #1013 2016-07-08 17:07:14 +09:30
Daniel O'Connor
6b059cb4f4 Clean up a bit as per #1013 with TODO comments 2016-07-08 17:06:05 +09:30
Daniel O'Connor
efd112c4b8 And vs && - revised version of b50127c166 2016-07-08 17:01:59 +09:30
Mackenzie Morgan
5c7b760f34 Use array literal [] instead of Array.new 2016-07-08 16:58:34 +09:30
Mackenzie Morgan
81ae473972 space between comma-separated arguments 2016-07-08 16:58:29 +09:30
Mackenzie Morgan
a8171bb739 has_key? -> key? 2016-07-08 16:58:22 +09:30
Daniel O'Connor
c803ed4ee6 Merge pull request #976 from pozorvlak/remove_default_shows
Remove "show" methods that just do the default
2016-07-08 16:56:25 +09:30
Daniel O'Connor
9e41a65749 Tweak readme wiki links
Supercedes #1016
2016-07-08 15:33:16 +09:30
Cesy
a7539df5b5 Merge pull request #1018 from CloCkWeRX/minor_rails_bump
Minor gem upgrades for the month
2016-07-01 10:14:22 +01:00
Daniel O'Connor
3950619877 Update various minor gems even more 2016-07-01 17:42:58 +09:30
Daniel O'Connor
7373fd4aa9 Update various minor gems 2016-07-01 17:34:25 +09:30
Daniel O'Connor
c3d9885525 Merge pull request #987 from CloCkWeRX/upgradazzle_rails
Upgrade to rails 4.2.0+ (round 2)
2016-06-29 14:47:05 +09:30
Daniel O'Connor
4b5dee7bdb Merge pull request #1007 from ctlewitt/dev
issue #1006: change "Freenode" to "irc.freenode.net" in README.md
2016-06-29 12:51:05 +09:30
Charley Lewittes
55d846b9e0 Merge remote-tracking branch 'them/dev' into dev 2016-06-22 10:56:56 -04:00
Daniel O'Connor
f2d8349a88 #1012 Tweak script to avoid errors after merge 2016-06-22 10:46:26 +09:30
Daniel O'Connor
7c7dd7c609 Merge pull request #1012 from pozorvlak/check_contributors_md
Check PR author is in CONTRIBUTORS.md under Travis
2016-06-22 10:25:06 +09:30
Charley Lewittes
d8f2c580ee added myself to contributors list 2016-06-21 13:14:26 -04:00
Charley Lewittes
2a0602468d Added link and wording to access Freenode IRC growstuff channel easily
fixes #1006
2016-06-21 13:03:06 -04:00
Charley Lewittes
89a9c18188 fixes #1006: change "Freenode" to "irc.freenode.net" in README.md 2016-06-21 12:49:33 -04:00
Miles Gould
8b426da149 Check PR author is in CONTRIBUTORS.md under Travis
Results of testing this locally (the exit value of the last command is
in my prompt):

```
0 $ TRAVIS=true TRAVIS_REPO_SLUG=growstuff/growstuff
TRAVIS_PULL_REQUEST=1007 script/check_contributors_md
Checking to see if you're in CONTRIBUTORS.md...

Thanks for your contribution, ctlewitt!
Please add your name and GitHub handle to the file CONTRIBUTORS.md,
commit it, and update your PR.

1 $ TRAVIS=true TRAVIS_REPO_SLUG=growstuff/growstuff
TRAVIS_PULL_REQUEST=1008 script/check_contributors_md
Checking to see if you're in CONTRIBUTORS.md...
- Miles Gould / [pozorvlak](https://github.com/pozorvlak)
0 $ script/check_contributors_md
Checking to see if you're in CONTRIBUTORS.md...
- Miles Gould / [pozorvlak](https://github.com/pozorvlak)
0 $
```
2016-06-21 16:37:26 +01:00
pozorvlak
cab98f9750 Merge pull request #1011 from Growstuff/revert-1002-letsencrypt-pt2-1
Revert "challenge code"
2016-06-21 15:28:15 +01:00
pozorvlak
27b7a26fee Merge pull request #1010 from Growstuff/revert-999-letsencrypt
Revert "lets encrypt challenge page"
2016-06-21 15:27:38 +01:00
Cesy
7261fae9f2 Revert "challenge code" 2016-06-21 15:06:02 +01:00
Cesy
628ebd6841 Revert "lets encrypt challenge page" 2016-06-21 15:05:45 +01:00
Cesy
61bbf7c30d Merge pull request #1008 from pozorvlak/test_gemfile_commits
Check for "forgot to commit Gemfile.lock" in CI
2016-06-21 14:57:54 +01:00
Miles Gould
e33803343a Check for "forgot to commit Gemfile.lock" in CI
Quick-and-dirty script to catch an error we've missed a couple of times
in code review, but which is not (AFAICT) covered by any of our existing
checkers. Inspired by the following posts:

 - https://zachholman.com/posts/how-github-writes-blog-posts/
 - https://zachholman.com/talk/move-fast-break-nothing/
2016-06-21 13:32:11 +01:00
Mackenzie
b08a448fdc hotfix commit: letsencrypt try #2 2016-06-20 13:40:49 -04:00
Cesy
7210ebfb22 Merge pull request #1004 from maco/letsencrypt
Letsencrypt, will be backed out once SSL is up and running.
2016-06-20 16:57:24 +01:00
Mackenzie Morgan
039978357b letsencrypt verification for staging 2016-06-20 11:48:19 -04:00
Cesy
7ce2481cbc Merge pull request #1002 from Growstuff/letsencrypt-pt2-1
challenge code - will also get reverted once SSL is up.
2016-06-20 15:49:33 +01:00
Mackenzie
5bc6af87c5 challenge code 2016-06-20 10:46:40 -04:00
Cesy
a5eaf3566e Merge pull request #999 from Growstuff/letsencrypt
lets encrypt challenge page - temporary change for SSL tool, will be backed out after
2016-06-20 15:42:22 +01:00
Mackenzie
63d89be698 lets encrypt challenge page 2016-06-20 10:34:11 -04:00
pozorvlak
1b7be9f9b0 Merge pull request #936 from maco/add_bootstrap_flashes
Add support for Bootstrap alert types
2016-06-20 10:19:36 +01:00
Mackenzie Morgan
7a53e96d52 test the default case 2016-06-19 22:52:51 -04:00
Mackenzie Morgan
b28d146de7 use default of info
add tests
2016-06-19 22:42:20 -04:00
Mackenzie Morgan
55c8be8dc5 merge 2016-06-19 22:27:27 -04:00
Daniel O'Connor
38a273459a Merge pull request #996 from pozorvlak/block_unknown_urls_in_features
Block external URLs in feature tests
2016-06-18 20:21:32 +09:30
Miles Gould
1b07632c69 Block external URLs in features
https://github.com/teampoltergeist/poltergeist/issues/375#issuecomment-42620085
suggested that this might help with our intermittent "Request to
http://localhost:8081 failed to reach server, check DNS and/or server
status" errors in CI - the theory being that the error message is
misleading, and it's actually a daughter request to an external service
timing out. Seems worth a shot. It also ought to speed up testing, but
the effect is slight (20s out of 3.5 minutes) on my machine.

I've blacklisted only URLs I could find in app/views or by tcpdumping a
test run, because I couldn't get whitelisting to work.
2016-06-17 21:12:25 +01:00
pozorvlak
4a12523793 Merge pull request #991 from Growstuff/dev
Release 12
2016-06-17 11:37:29 +01:00
pozorvlak
6aa601b8ab Merge pull request #993 from Growstuff/revert-988-dev
Revert "Handled Issue #950 (Branded Error Pages)"
2016-06-16 13:30:50 +01:00
pozorvlak
a66a040207 Revert "Handled Issue #950 (Branded Error Pages)" 2016-06-16 12:58:22 +01:00
pozorvlak
547a408a99 Merge pull request #988 from Prashanth261993/dev
Add branding to error pages (#950)
2016-06-16 11:12:23 +01:00
pozorvlak
8cd224b7fa Merge pull request #990 from maco/sparkpost_#917
don't override our environment email settings with plain old sendmail
2016-06-15 20:03:35 +01:00
Mackenzie Morgan
8428e93b47 don't override our environment email settings with plain old sendmail 2016-06-15 13:27:51 -04:00
Prashanth
483143f2fe Merge branch 'growstuff-dev' into dev
Conflicts:
	CONTRIBUTORS.md
2016-06-14 17:09:06 +05:30
pozorvlak
1b3d106b6d Merge pull request #989 from maco/sparkpost_#917
update to SparkPost's mailserver
2016-06-13 18:04:43 +01:00
Mackenzie Morgan
e7be006fa7 update to SparkPost's mailserver 2016-06-13 12:12:00 -04:00
Prashanth
b9f40151d8 Handled Issue #950 (Branded Error Pages)
Moved error related views from public to errors (asset pipeline can be used).
Header and footer were included along with the error message.
2016-06-10 18:35:48 +05:30
Daniel O'Connor
fd467acc29 Clean up whitespace 2016-06-10 20:51:02 +09:30
pozorvlak
e1ad0c31c8 Merge pull request #986 from CloCkWeRX/update_various_gems_nokogiri
Update various gems - nokogiri, mime-types, parser, guard-rspec
2016-06-10 11:09:12 +01:00
Daniel O'Connor
ee604dc2b0 Upgrade activemerchant, fixing rails 5 deprecation warnings 2016-06-10 16:04:00 +09:30
Daniel O'Connor
0620646c6d Fix failing specs
- Updated assert_select behaviour given this is now based on nokogiri
 - Adjust some specs not to look for a specific asset name, but a behaviour
 - Adjust some specs for HTML5 style attributes instead of xhtml style
 - Fix tests that did not render before
2016-06-10 16:01:30 +09:30
Daniel O'Connor
df9cf3f5c4 Fix various rails deprecations 2016-06-10 15:58:39 +09:30
Daniel O'Connor
944349760a Fix DEPRECATION WARNING: #timestamps was called without specifying an option for null.
In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing
2016-06-10 15:57:48 +09:30
Daniel O'Connor
7fe75ee52a Fix DEPRECATION WARNING: #deliver is deprecated. 2016-06-10 15:45:01 +09:30
Daniel O'Connor
e3d7bf9a62 Upgrade to rails 4.2.* 2016-06-10 15:43:04 +09:30
Daniel O'Connor
deaf49c18f Update selenium-webdriver 2016-06-10 15:40:56 +09:30
Daniel O'Connor
53543fff4c Update terminal-table 2016-06-10 15:40:29 +09:30
Daniel O'Connor
ea5e710a70 Update codeclimate-test-reporter 2016-06-10 15:38:43 +09:30
Daniel O'Connor
ad5a52ae74 Update tilt 2016-06-10 15:36:07 +09:30
Daniel O'Connor
c0cc5ab085 Update geocoder 2016-06-10 15:35:29 +09:30
Daniel O'Connor
cf784cbedd Update parser to current 2016-06-10 15:20:31 +09:30
Daniel O'Connor
5c68830919 Update guard-rspec 2016-06-10 15:19:57 +09:30
Daniel O'Connor
370aab41c3 Update mime-types 2016-06-10 15:19:28 +09:30
Daniel O'Connor
081f4021bc Upgrade nokogiri 2016-06-10 15:19:03 +09:30
Daniel O'Connor
36f846fabf Merge pull request #982 from CloCkWeRX/update_gibbon
Upgrade gibbon
2016-06-10 15:13:18 +09:30
pozorvlak
f6d094f57c Merge pull request #985 from lucasnogueira/fix_simplecov_deprecation
Fix SimpleCov Deprecation Warning
2016-06-09 22:37:40 +01:00
Lucas Nogueira
9ce097b7d6 Fix SimpleCov Deprecation Warning 2016-06-09 17:42:11 -03:00
pozorvlak
b03ccce575 Merge pull request #980 from lucasnogueira/replace_pluralize
Replace pluralize calls
2016-06-09 16:39:34 +01:00
Lucas Nogueira
63b8788c80 Change hash syntax 2016-06-09 11:57:56 -03:00
Daniel O'Connor
faa3beddbc Upgrade gibbon 2016-06-10 00:17:28 +09:30
Lucas Nogueira
5dbd5bc1d2 Correct minor typos 2016-06-09 08:21:28 -03:00
Lucas Nogueira
b8b0d98e07 Update the contributors list 2016-06-08 22:06:26 -03:00
Lucas Nogueira
b911ebfd07 Replace pluralize calls 2016-06-08 22:03:40 -03:00
Lucas Nogueira
1ca515bd4e Add missing activerecord model to locales 2016-06-08 21:56:29 -03:00
Lucas Nogueira
905710b6e9 Helper for plural localization 2016-06-08 21:55:33 -03:00
Mackenzie
12e0f674bc Merge pull request #977 from pozorvlak/fix_devise_warnings
Replace deprecated Devise `for` method with `permit`
2016-06-08 13:14:05 -04:00
Mackenzie
18739c2a24 Merge pull request #974 from pozorvlak/remove_vendor_dir
Remove vendor directory
2016-06-08 11:12:14 -04:00
pozorvlak
f3dc2ff7e5 Replace deprecated Devise for method with permit
This should eliminate the screens-ful of deprecation warnings when
running the test suite.
2016-06-08 15:00:05 +00:00
pozorvlak
e6209a5906 Remove "show" methods that just do the default
We can just fall back to the default implementation for these.
2016-06-08 15:58:45 +01:00
Mackenzie
dbf64a4e90 Merge pull request #975 from Growstuff/revert-972-show_concern
Revert "Show concern"
2016-06-08 09:26:58 -04:00
pozorvlak
a8961c3466 Revert "Show concern" 2016-06-08 12:58:32 +01:00
pozorvlak
6931952688 Whitespace fixes 2016-06-07 17:43:36 +00:00
pozorvlak
936aa17ecc Remove references to vendor directory
This consisted of instructions to various code-quality tools to
ignore it.
2016-06-07 17:43:36 +00:00
pozorvlak
f3d7420b8a Remove vendor directory
We no longer need it, since we're now getting the functionality we
needed from upstream gems.
2016-06-07 17:43:35 +00:00
pozorvlak
e419acea6e Install BogusPayPalGateway gem
We were maintaining a vendor fork of active_merchant because they
refused to merge this feature in; it's now been released as a
separate gem.
2016-06-07 17:43:35 +00:00
pozorvlak
95ae15b780 Merge pull request #972 from maco/show_concern
Show concern
2016-06-07 16:22:17 +01:00
Mackenzie Morgan
ed468e79fc Merge branch 'dev' of gitmaco:Growstuff/growstuff into show_concern 2016-06-07 09:57:47 -04:00
Daniel O'Connor
130565af75 Merge pull request #969 from maco/code_climate_token
add Code Climate token to Travis config
2016-06-07 09:01:27 +09:30
Daniel O'Connor
ad8f360336 Merge pull request #970 from maco/codeclimate_exclude_vendor
exclude vendor gems from code climate
2016-06-07 09:01:05 +09:30
Daniel O'Connor
15775403fd Merge pull request #971 from maco/readme_email
info@ email exists again
2016-06-07 09:00:38 +09:30
Mackenzie Morgan
e1b83c32af info@ email exists again 2016-06-06 13:27:13 -04:00
Mackenzie Morgan
3fc7c65247 exclude vendor gems from code climate 2016-06-06 13:14:01 -04:00
Mackenzie Morgan
c8d1239b79 add Code Climate token to Travis config 2016-06-06 09:40:30 -04:00
Cesy
7885257fae Merge pull request #943 from CloCkWeRX/adjust_helper
Deal with .nil quantity of a seed in rendering helper
2016-06-04 12:41:03 +01:00
Daniel O'Connor
a8d22709e6 Add explict test coverage of the helper with nil seeds (page level tests already cover this rendering on crop detail in general) 2016-06-04 20:51:20 +09:30
pozorvlak
31b7b45ae3 Merge pull request #966 from cesy/readme
Updating readme with current wiki status and Gitter link
2016-06-03 14:34:35 +01:00
Cesy Avon
681798b582 Updating readme with current wiki status and Gitter link 2016-06-03 13:12:19 +00:00
Cesy
f05ea56179 Merge pull request #965 from dv2/dev
Add test coverage for GardensHelper
2016-06-03 14:03:07 +01:00
DV Dasari
ed4269ea4c fixing grammar in test descriptions 2016-06-03 07:54:24 -05:00
DV Dasari
085fcc958e Add test coverage for GardensHelper 2016-06-02 22:22:14 -05:00
pozorvlak
8f33fe3595 Merge pull request #960 from CloCkWeRX/update_various_gems
Update various gems
2016-06-02 18:18:12 +01:00
pozorvlak
980a7d79d3 Merge pull request #963 from CloCkWeRX/add_better_opengraph_squashed
Various bugfixes for facebook/opengraph
2016-06-02 17:58:05 +01:00
pozorvlak
9c5c07e087 Merge pull request #948 from cesy/issue875
Fix #875 edited date on comments on homepage
2016-06-02 17:41:59 +01:00
Daniel O'Connor
faaf07cad8 Render the full size image, as facebook doesn't like smaller thumbnails 2016-06-03 01:58:34 +09:30
Daniel O'Connor
0e83a230b9 Helps not to render excess info 2016-06-03 01:54:26 +09:30
Daniel O'Connor
c278b36858 Up the various opengraph images to 200x200 2016-06-03 01:45:43 +09:30
pozorvlak
0805f86b86 Merge pull request #961 from cesy/issue476
Issue 476 edited by date on comments and posts
2016-06-02 16:53:44 +01:00
pozorvlak
aad88f1da6 Merge pull request #962 from CloCkWeRX/add_better_opengraph_squashed
Add better opengraph behaviour, fix facebook share thumbnail size
2016-06-02 16:52:13 +01:00
Daniel O'Connor
7550bc860f #816 Add better opengraph behaviour, fix facebook share thumbnail size 2016-06-03 01:01:03 +09:30
Cesy Avon
fc38e1edea Issue #476 test update 2016-06-02 14:58:10 +00:00
Daniel O'Connor
88a66a705b Update devise to 4.1.X and unpin 2016-06-03 00:23:58 +09:30
Daniel O'Connor
f77fd00931 Remove version pin for rspec-rails 2016-06-03 00:19:49 +09:30
Daniel O'Connor
b5c030905a Upgrade to geocoder current (we shouldn't be affected by the deprecations in 1.2.X or 1.3.X) 2016-06-03 00:16:00 +09:30
Daniel O'Connor
2844e13298 Upgrade factory_girl_rails, factory_girl 2016-06-03 00:10:25 +09:30
Cesy Avon
3e4dc1f9e3 Issue #875 typo causing test error 2016-06-02 14:39:56 +00:00
Cesy Avon
259c1e1731 Fix #476 show edited and posted date on posts and comments 2016-06-02 14:37:33 +00:00
Daniel O'Connor
870aa674b0 Upgrade autoprefixer-rails to current 2016-06-03 00:07:28 +09:30
Daniel O'Connor
b1ab319bf7 Update mime-types-data to current 2016-06-03 00:05:46 +09:30
Daniel O'Connor
857422719a Upgrade byebug to current 2016-06-03 00:04:09 +09:30
Daniel O'Connor
235314bc13 Upgrade js-routes to current 2016-06-03 00:03:48 +09:30
Daniel O'Connor
ac1cd88ae1 Upgrade kaminari to current 2016-06-03 00:01:38 +09:30
Daniel O'Connor
f93ea3c0a1 Upgrade httparty to current 2016-06-03 00:00:08 +09:30
Cesy Avon
0075040aab Fix #875 edited date on comments on homepage 2016-06-02 13:56:03 +00:00
Cesy
f9d51e623c Merge pull request #959 from pozorvlak/remove_capfile
Remove the Capistrano configuration file
2016-06-02 14:13:46 +01:00
Miles Gould
dcd36dcd67 Remove the Capistrano configuration file
Finishes work started in 93e468876d.
2016-06-02 13:45:53 +01:00
Cesy
608a921fce Merge pull request #956 from CloCkWeRX/upgrade_devise4
Upgrade to devise 4.0.*
2016-06-02 10:18:29 +01:00
pozorvlak
4bedf1e6ac Merge pull request #955 from CloCkWeRX/upgrade_geocoder
Swap to geocoder 1.1.9
2016-06-02 09:49:04 +01:00
pozorvlak
ac14c310f6 Merge pull request #954 from CloCkWeRX/ruby_231
Bump to Ruby 2.3.1
2016-06-02 09:48:20 +01:00
Daniel O'Connor
f979da315a Explicitly swap from config.email_regexp = /\A[^@\s]+@([^@\s]+\.)+[^@\W]+\z/
to the new default
2016-06-02 13:50:25 +09:30
Daniel O'Connor
a74ef7de6b Upgrade to devise 4.0.3 2016-06-02 13:49:13 +09:30
Daniel O'Connor
10064121a6 #953 Swap to geocoder 1.1.9; which is the release just after what we had previously pinned 2016-06-02 13:30:42 +09:30
Daniel O'Connor
f8a1ef6066 #952 Try ruby 2.3.1 2016-06-02 13:14:10 +09:30
Daniel O'Connor
40d7b11d90 #952 Try ruby 2.3.1 2016-06-02 13:13:52 +09:30
Mackenzie Morgan
1600dd9e0b Merge branch 'dev' of gitmaco:Growstuff/growstuff into add_bootstrap_flashes 2016-06-01 23:37:25 -04:00
pozorvlak
fbf5164eca Merge pull request #937 from dv2/dev
Add test coverage for Seeds Helper
2016-06-01 16:33:38 +01:00
DV Dasari
21d86a8c2d improve the test descriptions to be more readable 2016-06-01 09:46:22 -05:00
DV Dasari
848c7e117b Add test coverage for Seeds Helper 2016-06-01 09:46:22 -05:00
Cesy
369868672b Merge pull request #942 from pozorvlak/fix_coverage_calculations
Fix coverage calculations
2016-06-01 15:41:42 +01:00
Daniel O'Connor
321f3517a7 #920 Deal with .nil quantity of a seed in rendering helper 2016-06-01 23:26:43 +09:30
Miles Gould
6dd7ec9f95 Fix coverage calculations
SimpleCov was reporting 0% coverage for any files loaded before
`SimpleCov.start` was called, even if they were fully tested. This patch
loads the application *after* starting SimpleCov, leading to more
accurate coverage figures.
2016-06-01 14:54:13 +01:00
Mackenzie Morgan
90f444dc1a Merge branch 'dev' of gitmaco:Growstuff/growstuff into add_bootstrap_flashes 2016-05-31 10:50:56 -04:00
Mackenzie Morgan
32b98a7e40 Add support for Bootstrap alert types
* All alerts are currently shoved into either red (error) or green (success)
* Add support for yellow (warning) and blue (info) alert types

Solution from this Stack Overflow: http://stackoverflow.com/questions/31094771/rails-bootstrap-haml-how-to-convert-this-code-to-display-flash-messages-to
2016-05-30 21:48:11 -04:00
Mackenzie Morgan
8648db5518 create SimpleShow concern for models where show's json call is simple 2016-05-25 13:37:01 -04:00
443 changed files with 911 additions and 52702 deletions

View File

@@ -8,7 +8,7 @@ engines:
eslint:
enabled: true
coffeelint:
enabled: true
enabled: true
brakeman:
enabled: true
bundler-audit:
@@ -25,7 +25,7 @@ ratings:
paths:
- "**.rb"
- "**.js"
- "**.coffee"
- "**.coffee"
- "**.sass"
- "**.haml"
- Gemfile.lock

View File

@@ -1 +1 @@
2.2.4
2.3.1

View File

@@ -8,10 +8,12 @@ env:
global:
secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4="
rvm:
- 2.2.4
- 2.3.1
before_script:
- psql -c 'create database growstuff_test;' -U postgres
script:
- script/gemfile_check
- bundle exec script/check_contributors_md
- bundle exec rake db:migrate --trace
- bundle exec rspec spec/
services:
@@ -34,4 +36,6 @@ deploy:
- restart
after_deploy:
- bundle exec script/heroku_maintenance.rb off
addons:
code_climate:
repo_token: 462e015bbdaabfb20910fc07f2fea253410ecb131444e00f97dbf32dc6789ca6

View File

@@ -68,3 +68,5 @@ submit the change with your pull request.
- Daniel O'Connor / [CloCkWeRX](https://github.com/CloCkWeRX)
- DV Dasari / [dv2](https://github.com/dv2)
- Eric Tillberg / [Thrillberg](https://github.com/Thrillberg)
- Lucas Nogueira / [lucasnogueira](https://github.com/lucasnogueira)
- Charley Lewittes / [ctlewitt](https://github.com/ctlewitt)

View File

@@ -1,4 +0,0 @@
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
# load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks

24
Gemfile
View File

@@ -1,8 +1,8 @@
source 'https://rubygems.org'
ruby '2.2.4'
ruby '2.3.1'
gem 'rails', '~> 4.1.11'
gem 'rails', '~> 4.2.0'
gem 'bundler', '>=1.1.5'
@@ -36,13 +36,8 @@ gem 'comfortable_mexican_sofa', '~> 1.12.0' # content management system
gem 'kaminari' # pagination
gem 'bootstrap-kaminari-views' # bootstrap views for kaminari
# vendored activemerchant for testing- needed for bogus paypal
# gateway monkeypatch
gem 'activemerchant', '1.33.0',
:path => 'vendor/gems/activemerchant-1.33.0',
:require => 'active_merchant'
gem 'active_utils', '1.0.5',
:path => 'vendor/gems/active_utils-1.0.5'
gem 'activemerchant'
gem 'active_utils'
# Markdown formatting for updates etc
gem 'bluecloth'
@@ -51,7 +46,7 @@ gem 'bluecloth'
gem 'will_paginate', '~> 3.0'
# user signup/login/etc
gem 'devise', '~> 3.5.0'
gem 'devise', '>= 4.0.0'
# nicely formatted URLs
gem 'friendly_id', '~> 5.0.4'
@@ -60,9 +55,7 @@ gem 'friendly_id', '~> 5.0.4'
gem 'gravatar-ultimate'
# For geolocation
gem 'geocoder',
:git => 'https://github.com/alexreisner/geocoder.git',
:ref => '104d46'
gem 'geocoder'
# For easy calendar selection
gem 'bootstrap-datepicker-rails'
@@ -103,12 +96,12 @@ end
group :development, :test do
gem 'haml-rails' # HTML templating language
gem 'rspec-rails', '~> 3.4.0' # unit testing framework
gem 'rspec-rails' # unit testing framework
gem 'rspec-activemodel-mocks'
gem 'byebug' # debugging
gem 'database_cleaner', '~> 1.5.0'
gem 'webrat' # provides HTML matchers for view tests
gem 'factory_girl_rails', '~> 4.5.0' # for creating test data
gem 'factory_girl_rails' # for creating test data
gem 'coveralls', require: false # coverage analysis
gem 'capybara' # integration tests
gem 'capybara-email' # integration tests for email
@@ -117,6 +110,7 @@ group :development, :test do
gem 'i18n-tasks' # adds tests for finding missing and unused translations
gem 'selenium-webdriver'
gem "codeclimate-test-reporter", group: :test, require: nil
gem "active_merchant-paypal-bogus-gateway"
end
group :travis do

View File

@@ -1,57 +1,57 @@
GIT
remote: https://github.com/alexreisner/geocoder.git
revision: 104d466ba7097b7dce5ba19f8e4091b7f69ccdf6
ref: 104d46
specs:
geocoder (1.1.8)
PATH
remote: vendor/gems/active_utils-1.0.5
specs:
active_utils (1.0.5)
activesupport (>= 2.3.11)
i18n
PATH
remote: vendor/gems/activemerchant-1.33.0
specs:
activemerchant (1.33.0)
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.15)
actionpack (= 4.1.15)
actionview (= 4.1.15)
actionmailer (4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
mail (~> 2.5, >= 2.5.4)
actionpack (4.1.15)
actionview (= 4.1.15)
activesupport (= 4.1.15)
rack (~> 1.5.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.6)
actionview (= 4.2.6)
activesupport (= 4.2.6)
rack (~> 1.6)
rack-test (~> 0.6.2)
actionview (4.1.15)
activesupport (= 4.1.15)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.6)
activesupport (= 4.2.6)
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)
actionpack
activemodel (4.1.15)
activesupport (= 4.1.15)
active_merchant-paypal-bogus-gateway (0.1.0)
activemerchant
active_utils (3.2.0)
activesupport (>= 3.2)
i18n
activejob (4.2.6)
activesupport (= 4.2.6)
globalid (>= 0.3.0)
activemerchant (1.59.0)
activesupport (>= 3.2.14, < 5.1)
builder (>= 2.1.2, < 4.0.0)
i18n (>= 0.6.9)
nokogiri (~> 1.4)
activemodel (4.2.6)
activesupport (= 4.2.6)
builder (~> 3.1)
activerecord (4.1.15)
activemodel (= 4.1.15)
activesupport (= 4.1.15)
arel (~> 5.0.0)
activesupport (4.1.15)
i18n (~> 0.6, >= 0.6.9)
activerecord (4.2.6)
activemodel (= 4.2.6)
activesupport (= 4.2.6)
arel (~> 6.0)
activesupport (4.2.6)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
arel (5.0.1.20140414130214)
ast (2.2.0)
autoprefixer-rails (6.3.6.1)
arel (6.0.3)
ast (2.3.0)
autoprefixer-rails (6.3.6.2)
execjs
bcrypt (3.1.11)
better_errors (2.1.1)
@@ -72,8 +72,8 @@ GEM
sass (>= 3.3.4)
bootstrap_form (2.3.0)
builder (3.2.2)
byebug (9.0.4)
cancancan (1.14.0)
byebug (9.0.5)
cancancan (1.15.0)
capybara (2.7.1)
addressable
mime-types (>= 1.16)
@@ -94,7 +94,7 @@ GEM
cliver (0.3.2)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
codeclimate-test-reporter (0.5.0)
codeclimate-test-reporter (0.6.0)
simplecov (>= 0.7.1, < 1.0.0)
codemirror-rails (5.11)
railties (>= 3.0, < 5)
@@ -133,12 +133,11 @@ GEM
dalli (2.7.6)
database_cleaner (1.5.3)
debug_inspector (0.0.2)
devise (3.5.10)
devise (4.1.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
railties (>= 4.1.0, < 5.1)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.5)
docile (1.1.5)
@@ -146,41 +145,44 @@ GEM
json
thread
thread_safe
elasticsearch (1.0.17)
elasticsearch-api (= 1.0.17)
elasticsearch-transport (= 1.0.17)
elasticsearch-api (1.0.17)
elasticsearch (1.0.18)
elasticsearch-api (= 1.0.18)
elasticsearch-transport (= 1.0.18)
elasticsearch-api (1.0.18)
multi_json
elasticsearch-model (0.1.9)
activesupport (> 3)
elasticsearch (> 0.4)
hashie
elasticsearch-rails (0.1.9)
elasticsearch-transport (1.0.17)
elasticsearch-transport (1.0.18)
faraday
multi_json
erubis (2.7.0)
excon (0.49.0)
excon (0.50.1)
execjs (2.7.0)
factory_girl (4.5.0)
factory_girl (4.7.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0)
factory_girl_rails (4.7.0)
factory_girl (~> 4.7.0)
railties (>= 3.0.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
ffi (1.9.10)
figaro (1.1.1)
thor (~> 0.14)
flickraw (0.9.8)
flickraw (0.9.9)
font-awesome-sass (4.6.2)
sass (>= 3.2)
formatador (0.2.5)
friendly_id (5.0.5)
activerecord (>= 4.0.0)
gibbon (1.2.0)
geocoder (1.3.7)
gibbon (1.2.1)
httparty
multi_json (>= 1.9.0)
globalid (0.3.6)
activesupport (>= 4.1.0)
gravatar-ultimate (2.0.0)
activesupport (>= 2.3.14)
rack
@@ -194,7 +196,7 @@ GEM
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-rspec (4.6.5)
guard-rspec (4.7.2)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
@@ -216,7 +218,7 @@ GEM
haml (~> 4.0.0)
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
httparty (0.13.3)
httparty (0.13.7)
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (0.7.0)
@@ -230,16 +232,17 @@ GEM
parser (>= 2.2.3.0)
term-ansicolor (>= 1.3.2)
terminal-table (>= 1.5.1)
jquery-rails (3.1.4)
railties (>= 3.0, < 5.0)
jquery-rails (4.1.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.2.5)
js-routes (1.2.6)
railties (>= 3.2)
sprockets-rails
json (1.8.3)
kaminari (0.16.3)
kaminari (0.17.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.10.0)
@@ -255,24 +258,27 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.0.3)
nokogiri (>= 1.5.9)
lumberjack (1.0.10)
mail (2.6.4)
mime-types (>= 1.16, < 4)
memcachier (0.0.2)
method_source (0.8.2)
mime-types (3.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0221)
mime-types-data (3.2016.0521)
mimemagic (0.3.0)
mini_portile2 (2.0.0)
mini_portile2 (2.1.0)
minitest (5.9.0)
multi_json (1.11.3)
multi_xml (0.5.5)
multipart-post (2.0.0)
nenv (0.3.0)
newrelic_rpm (3.15.2.317)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
newrelic_rpm (3.16.0.318)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
notiffany (0.1.0)
nenv (~> 0.1)
shellany (~> 0.0)
@@ -296,15 +302,15 @@ GEM
cocaine (~> 0.5.5)
mime-types
mimemagic (= 0.3.0)
parser (2.3.1.0)
parser (2.3.1.2)
ast (~> 2.2)
pg (0.18.4)
pkg-config (1.1.7)
plupload-rails (1.2.1)
rails (>= 3.1)
poltergeist (1.9.0)
poltergeist (1.10.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
pry (0.10.3)
coderay (~> 1.1.0)
@@ -312,19 +318,28 @@ GEM
slop (~> 3.4)
quiet_assets (1.1.0)
railties (>= 3.1, < 5.0)
rack (1.5.5)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.1.15)
actionmailer (= 4.1.15)
actionpack (= 4.1.15)
actionview (= 4.1.15)
activemodel (= 4.1.15)
activerecord (= 4.1.15)
activesupport (= 4.1.15)
rails (4.2.6)
actionmailer (= 4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
activemodel (= 4.2.6)
activerecord (= 4.2.6)
activesupport (= 4.2.6)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.15)
sprockets-rails (~> 2.0)
railties (= 4.2.6)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails-i18n (4.0.8)
i18n (~> 0.7)
railties (~> 4.0)
@@ -333,18 +348,18 @@ GEM
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (4.1.15)
actionpack (= 4.1.15)
activesupport (= 4.1.15)
railties (4.2.6)
actionpack (= 4.2.6)
activesupport (= 4.2.6)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.16.0)
rake (11.1.2)
rake (11.2.2)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
responders (1.1.2)
railties (>= 3.2, < 4.2)
responders (2.2.0)
railties (>= 4.2.0, < 5.1)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
@@ -376,13 +391,13 @@ GEM
sexp_processor (~> 4.1)
rubyzip (1.2.0)
sass (3.4.22)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass-rails (5.0.5)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (2.53.0)
selenium-webdriver (2.53.4)
childprocess (~> 0.5)
rubyzip (~> 1.0)
websocket (~> 1.0)
@@ -394,20 +409,20 @@ GEM
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slop (3.6.0)
sprockets (3.6.0)
sprockets (3.6.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sprockets-rails (3.1.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
term-ansicolor (1.3.2)
tins (~> 1.0)
terminal-table (1.5.2)
terminal-table (1.6.0)
thor (0.19.1)
thread (0.2.2)
thread_safe (0.3.5)
tilt (2.0.4)
tilt (2.0.5)
tins (1.6.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
@@ -435,8 +450,9 @@ PLATFORMS
ruby
DEPENDENCIES
active_utils (= 1.0.5)!
activemerchant (= 1.33.0)!
active_merchant-paypal-bogus-gateway
active_utils
activemerchant
better_errors
binding_of_caller
bluecloth
@@ -457,15 +473,15 @@ DEPENDENCIES
csv_shaper
dalli
database_cleaner (~> 1.5.0)
devise (~> 3.5.0)
devise (>= 4.0.0)
elasticsearch-model
elasticsearch-rails
factory_girl_rails (~> 4.5.0)
factory_girl_rails
figaro
flickraw
font-awesome-sass
friendly_id (~> 5.0.4)
geocoder!
geocoder
gibbon (~> 1.2.0)
gravatar-ultimate
guard
@@ -490,11 +506,11 @@ DEPENDENCIES
poltergeist (~> 1.6)
pry
quiet_assets
rails (~> 4.1.11)
rails (~> 4.2.0)
rails_12factor
rake (>= 10.0.0)
rspec-activemodel-mocks
rspec-rails (~> 3.4.0)
rspec-rails
ruby-units
sass-rails (~> 5.0.4)
selenium-webdriver
@@ -504,7 +520,7 @@ DEPENDENCIES
will_paginate (~> 3.0)
RUBY VERSION
ruby 2.1.8p440
ruby 2.3.1p112
BUNDLED WITH
1.12.4
1.12.5

View File

@@ -19,8 +19,9 @@ 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://wiki.growstuff.org/index.php/Discussion_forums) (mailing lists, IRC, etc)
* [Wiki](http://wiki.growstuff.org/) (general documentation)
* [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))
## For coders
@@ -28,19 +29,11 @@ Growstuff is built in Ruby on Rails and also uses JavaScript for
frontend features. We welcome contributions -- see
[CONTRIBUTING](CONTRIBUTING.md) for details.
* To set up your development environment, see [Getting started](http://wiki.growstuff.org/index.php/Development/Getting_Started).
* 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 one of our [discussion forums](http://wiki.growstuff.org/index.php/Discussion_forums) to chat to other developers, get help, etc.
* Drop in to our [discussion forums](http://talk.growstuff.org/), IRC or Gitter to chat to other developers, get help, etc.
* You may also be interested in our [API](http://wiki.growstuff.org/index.php/API).
The wiki is down right now, so here's what you need to do on Mac OS X to get set up.
```
gem install bundle
gem install pg -v '0.18.4' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
bundle install
```
## For designers, writers, researchers, data wranglers, and other contributors
There are heaps of ways to get involved and contribute no matter what
@@ -58,6 +51,7 @@ Here on Github, you might find these useful:
* [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).

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -13,17 +13,6 @@ class AlternateNamesController < ApplicationController
end
end
# GET /alternate_names/1
# GET /alternate_names/1.json
def show
@alternate_name = AlternateName.find(params[:id])
respond_to do |format|
format.html # show.html.haml
format.json { render json: @alternate_name }
end
end
# GET /alternate_names/new
# GET /alternate_names/new.json
def new

View File

@@ -52,7 +52,7 @@ class ApplicationController < ActionController::Base
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) do |member|
devise_parameter_sanitizer.permit(:sign_up) do |member|
member.permit(:login_name, :email, :password, :password_confirmation,
:remember_me, :login,
# terms of service
@@ -64,7 +64,7 @@ class ApplicationController < ActionController::Base
)
end
devise_parameter_sanitizer.for(:account_update) do |member|
devise_parameter_sanitizer.permit(:account_update) do |member|
member.permit(:login_name, :email, :password, :password_confirmation,
:remember_me, :login,
# terms of service

View File

@@ -14,17 +14,6 @@ class CommentsController < ApplicationController
end
end
# GET /comments/1
# GET /comments/1.json
def show
@comment = Comment.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @comment }
end
end
# GET /comments/new
# GET /comments/new.json
def new

View File

@@ -83,8 +83,16 @@ class CropsController < ApplicationController
respond_to do |format|
format.html # show.html.haml
format.json do
# TODO RABL or similar one day to avoid presentation logic here
owner_structure = {
owner: {
only: [:id, :login_name, :location, :latitude, :longitude]
}
}
render json: @crop.to_json(include: {
plantings: { include: { owner: { only: [:id, :login_name, :location, :latitude, :longitude] }}}
plantings: {
include: owner_structure
}
})
end
end
@@ -136,7 +144,7 @@ class CropsController < ApplicationController
end
unless current_member.has_role? :crop_wrangler
Role.crop_wranglers.each do |w|
Notifier.new_crop_request(w, @crop).deliver!
Notifier.new_crop_request(w, @crop).deliver_now!
end
end
@@ -180,8 +188,8 @@ class CropsController < ApplicationController
if previous_status == "pending"
requester = @crop.requester
new_status = @crop.approval_status
Notifier.crop_request_approved(requester, @crop).deliver! if new_status == "approved"
Notifier.crop_request_rejected(requester, @crop).deliver! if new_status == "rejected"
Notifier.crop_request_approved(requester, @crop).deliver_now! if new_status == "approved"
Notifier.crop_request_rejected(requester, @crop).deliver_now! if new_status == "rejected"
end
format.html { redirect_to @crop, notice: 'Crop was successfully updated.' }
format.json { head :no_content }

View File

@@ -27,17 +27,6 @@ class HarvestsController < ApplicationController
end
end
# GET /harvests/1
# GET /harvests/1.json
def show
@harvest = Harvest.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @harvest }
end
end
# GET /harvests/new
# GET /harvests/new.json
def new

View File

@@ -0,0 +1,6 @@
class PagesController < ApplicationController
def letsencrypt
# use your code here, not mine
render text: "y9KNck8wqkoQLnlr2RgA2TVwWtyYb4PeY_hzGNx0Tfs.dlIPqFhMDCLyQEccczY3roHZ1UWu6UqVeyb9mkRxheU"
end
end

View File

@@ -13,17 +13,6 @@ class PhotosController < ApplicationController
end
end
# GET /photos/1
# GET /photos/1.json
def show
@photo = Photo.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @photo }
end
end
# GET /photos/new
# GET /photos/new.json
def new

View File

@@ -19,10 +19,24 @@ module ApplicationHelper
pid = price_in_dollars(price)
currency = Growstuff::Application.config.currency
link = "http://www.wolframalpha.com/input/?i=#{pid}+#{currency}"
return link_to "(convert)",
link,
target: "_blank"
end
link_to "(convert)", link, target: "_blank"
end
def build_alert_classes(alert_type = :info)
classes = 'alert alert-dismissable '
case alert_type.to_sym
when :alert, :danger, :error, :validation_errors
classes += 'alert-danger'
when :warning, :todo
classes += 'alert-warning'
when :notice, :success
classes += 'alert-success'
when :info
classes += 'alert-info'
end
classes
end
# Produces a cache key for uniquely identifying cached fragments.
def cache_key_for(klass, identifier="all")
@@ -50,5 +64,13 @@ module ApplicationHelper
default: :identicon
})
end
# Returns a string with the quantity and the right pluralization for a
# given collection and model.
def localize_plural(collection, model)
size = collection.size
model_name = model.model_name.human(count: size)
"#{size} #{model_name}"
end
end

View File

@@ -1,17 +1,21 @@
module CropsHelper
def display_seed_availability(member, crop)
total_quantity = 0
member.seeds.each do |seed|
if seed.crop.name == crop.name
total_quantity = total_quantity + seed.quantity
end
seeds = member.seeds.select {|seed| seed.crop.name == crop.name }
seeds.each do |seed|
total_quantity = total_quantity + seed.quantity if seed.quantity
end
if !seeds.any?
return "You don't have any seeds of this crop."
end
if (total_quantity != 0)
"You have #{pluralize(total_quantity, "seed")} of this crop."
"You have #{total_quantity} #{Seed.model_name.human(count: total_quantity)} of this crop."
else
"You don't have any seeds of this crop."
"You have an unknown quantity of seeds of this crop."
end
end
end
end

View File

@@ -2,12 +2,10 @@ class Notifier < ActionMailer::Base
include NotificationsHelper
default from: "Growstuff <noreply@growstuff.org>"
def verifier()
if ENV['RAILS_SECRET_TOKEN']
return ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
else
raise "RAILS_SECRET_TOKEN environment variable not set - have you created config/application.yml?"
end
def verifier
raise "RAILS_SECRET_TOKEN environment variable not set - have you created config/application.yml?" unless ENV['RAILS_SECRET_TOKEN']
return ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
end
def notify(notification)

View File

@@ -206,7 +206,7 @@ class Crop < ActiveRecord::Base
# returns a list of interesting crops, for use on the homepage etc
def Crop.interesting
howmany = 12 # max number to find
interesting_crops = Array.new
interesting_crops = []
Crop.includes(:photos).randomized.each do |c|
break if interesting_crops.size == howmany
next unless c.interesting?

View File

@@ -130,7 +130,7 @@ class Member < ActiveRecord::Base
def is_paid?
if account.account_type.is_permanent_paid
return true
elsif account.account_type.is_paid and account.paid_until >= Time.zone.now
elsif account.account_type.is_paid && account.paid_until >= Time.zone.now
return true
else
return false
@@ -200,7 +200,7 @@ class Member < ActiveRecord::Base
def Member.interesting
howmany = 12 # max number to find
interesting_members = Array.new
interesting_members = []
Member.confirmed.located.recently_signed_in.each do |m|
break if interesting_members.size == howmany
if m.interesting?
@@ -222,7 +222,7 @@ class Member < ActiveRecord::Base
end
def update_newsletter_subscription
if confirmed_at_changed? and newsletter # just signed up
if confirmed_at_changed? && newsletter # just signed up
newsletter_subscribe
elsif confirmed_at # i.e. after member's confirmed their account
if newsletter_changed? # edited member settings

View File

@@ -23,7 +23,7 @@ class Notification < ActiveRecord::Base
def send_email
if self.recipient.send_notification_email
Notifier.notify(self).deliver
Notifier.notify(self).deliver_now
end
end

View File

@@ -68,7 +68,7 @@ class Planting < ActiveRecord::Base
# check that any finished_at date occurs after planted_at
def finished_must_be_after_planted
return unless planted_at and finished_at # only check if we have both
return unless planted_at && finished_at # only check if we have both
errors.add(:finished_at, "must be after the planting date") unless planted_at < finished_at
end
@@ -97,7 +97,7 @@ class Planting < ActiveRecord::Base
def calculate_days_before_maturity(planting, crop)
p_crop = Planting.where(crop_id: crop).where.not(id: planting)
differences = p_crop.collect do |p|
if p.finished and !p.finished_at.nil?
if p.finished && !p.finished_at.nil?
(p.finished_at - p.planted_at).to_i
end
end
@@ -133,7 +133,7 @@ class Planting < ActiveRecord::Base
# 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 = Array.new
interesting_plantings = []
seen_owners = Hash.new(false) # keep track of which owners we've seen already
Planting.includes(:photos).each do |p|

View File

@@ -11,17 +11,17 @@ class Post < ActiveRecord::Base
# from this direction, so we won't set up an association for now.
after_create do
recipients = Array.new
recipients = []
sender = self.author.id
self.body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_REGEX) do |m|
# find member case-insensitively and add to list of recipients
member = Member.where('lower(login_name) = ?', $1.downcase).first
recipients << member if member and not recipients.include?(member)
recipients << member if member && !recipients.include?(member)
end
self.body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_AT_REGEX) do |m|
# find member case-insensitively and add to list of recipients
member = Member.where('lower(login_name) = ?', $1[1..-1].downcase).first
recipients << member if member and not recipients.include?(member)
recipients << member if member && !recipients.include?(member)
end
# don't send notifications to yourself
recipients.map{ |r| r.id }.each do |recipient|
@@ -64,7 +64,7 @@ class Post < ActiveRecord::Base
# return posts sorted by recent activity
def Post.recently_active
Post.all.sort do |a,b|
Post.all.sort do |a, b|
b.recent_activity <=> a.recent_activity
end
end
@@ -77,7 +77,7 @@ class Post < ActiveRecord::Base
# find crop case-insensitively
crop = Crop.where('lower(name) = ?', $1.downcase).first
# create association
self.crops << crop if crop and not self.crops.include?(crop)
self.crops << crop if crop && !self.crops.include?(crop)
end
end
end

View File

@@ -79,7 +79,7 @@ class Seed < ActiveRecord::Base
# returns a list of interesting seeds, for use on the homepage etc
def Seed.interesting
howmany = 12 # max number to find
interesting_seeds = Array.new
interesting_seeds = []
Seed.tradable.each do |s|
break if interesting_seeds.size == howmany

View File

@@ -1,3 +1,10 @@
= content_for :title, @alternate_name.name
- content_for :opengraph do
= tag("meta", property: "og:title", content: @alternate_name.name)
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
%p#notice= notice
= render :partial => 'crops/approval_status_message', :locals => { :crop => @alternate_name.crop }

View File

@@ -5,10 +5,13 @@
= render :partial => "members/avatar", :locals => { :member => comment.author }
.col-md-11
.comment-meta
= (comment.created_at == comment.updated_at) ? 'Posted by' : 'Edited by'
Posted by
= link_to comment.author.login_name, member_path(comment.author)
on
= (comment.created_at == comment.updated_at) ? comment.created_at : comment.updated_at
= comment.created_at
- if comment.updated_at > comment.created_at
and edited at
= comment.updated_at
.comment-body
:growstuff_markdown

View File

@@ -1,4 +1,12 @@
= content_for :title, @comment.post.subject
- content_for :opengraph do
= tag("meta", property: "og:image", content: avatar_uri(@comment.post.author, 200))
= tag("meta", property: "og:image:user_generated", content: "true")
= tag("meta", property: "og:title", content: @comment.post.subject)
= tag("meta", property: "og:description", content: strip_tags(@comment.post.body).split(' ')[0..20].join(' '))
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
= render :partial => "posts/single", :locals => { :post => @comment.post }

View File

@@ -1,5 +1,12 @@
- content_for :title, @crop.name
- content_for :subtitle, @crop.default_scientific_name
- content_for :opengraph do
- @crop.photos.each do |photo|
= tag("meta", property: "og:image", content: photo.fullsize_url)
= tag("meta", property: "og:title", content: @crop.name)
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
= render :partial => 'approval_status_message', :locals => { :crop => @crop }

View File

@@ -7,7 +7,7 @@
- @forums.each do |forum|
%h2= forum
%p
= pluralize(forum.posts.size, "post")
= localize_plural(forum.posts, Post)
|
=link_to "Visit forum", forum
|

View File

@@ -1,4 +1,11 @@
- content_for :title, @forum.name
- content_for :opengraph do
- if @forum.description
= tag("meta", property: "og:description", content: strip_tags(@forum.description).split(' ')[0..20].join(' '))
= tag("meta", property: "og:title", content: @forum.name)
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
%p#notice= notice

View File

@@ -25,7 +25,7 @@
%dd= garden.active ? "Yes" : "No"
.col-md-12
%b
= "#{pluralize(garden.plantings.size, "Planting")} : "
= "#{localize_plural(garden.plantings, Planting)} : "
= display_garden_plantings(garden.plantings.current)
- if garden.plantings.size > 2
%br

View File

@@ -1,5 +1,13 @@
=content_for :title, "#{@garden.owner}'s #{@garden}"
- content_for :opengraph do
- @garden.photos.each do |photo|
= tag("meta", property: "og:image", content: photo.fullsize_url)
- if @garden.description
= tag("meta", property: "og:description", content: @garden.description)
= tag("meta", property: "og:title", content: "#{@garden.owner}'s #{@garden}")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
.row
.col-md-9
- if can? :edit, @garden or can? :delete, @garden
@@ -39,7 +47,7 @@
- if @garden.photos.size > 0 or (can? :edit, @garden and can? :create, Photo)
.row-fluid
%h3 Photos
%p= pluralize(@garden.photos.length, "photo")
%p= localize_plural(@garden.photos, Photo)
.row-fluid
%ul.thumbnails
- @garden.photos.each do |p|

View File

@@ -1,4 +1,12 @@
=content_for :title, "#{@harvest.crop} harvested by #{@harvest.owner}"
- content_for :opengraph do
- @harvest.photos.each do |photo|
= tag("meta", property: "og:image", content: photo.fullsize_url)
= tag("meta", property: "og:image:user_generated", content: "true")
= tag("meta", property: "og:title", content: "#{@harvest.crop} harvested by #{@harvest.owner}")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
.row
.col-md-6

View File

@@ -1,11 +1,14 @@
%head
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:image" content="#{image_url 'growstuff-apple-touch-icon-precomposed.png'}"/>
<meta property="og:title" content="#{content_for?(:title) ? yield(:title) + " - #{ ENV['GROWSTUFF_SITE_NAME']} " : ENV['GROWSTUFF_SITE_NAME']}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="#{root_url}" />
<meta property="og:site_name" content="#{ENV['GROWSTUFF_SITE_NAME']}" />
- if content_for?(:opengraph)
= yield(:opengraph)
- else
= tag("meta", property: "og:image", content: image_url('facebook-thumbnail.png'))
= tag("meta", property: "og:title", content: "#{content_for?(:title) ? yield(:title) + " - #{ ENV['GROWSTUFF_SITE_NAME']} " : ENV['GROWSTUFF_SITE_NAME']}")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: root_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- if (content_for?(:member_rss_login_name) && content_for(:member_rss_slug))
= auto_discovery_link_tag(:rss, { :controller => "/members", :action => 'show', :format => "rss", :id => yield(:member_rss_slug) }, { :title => "#{ ENV['GROWSTUFF_SITE_NAME'] }- #{yield(:member_rss_login_name)}'s posts" })

View File

@@ -17,12 +17,7 @@
%p
.btn-group
= yield(:buttonbar)
- if notice
.alert.alert-success
= notice
- if alert
.alert.alert-warning
= alert
= render :partial => "shared/flash_messages", flash: flash
= yield
%footer

View File

@@ -33,7 +33,7 @@
- if g.photos.size > 0 or (can? :edit, g and can? :create, Photo)
.row
%h3 Photos
%p= pluralize(g.photos.length, "photo")
%p= localize_plural(g.photos, Photo)
.row
%ul.thumbnails
- g.photos.each do |p|

View File

@@ -3,28 +3,28 @@
%ul.list-inline
%li
- if member.plantings.size > 0
= link_to pluralize(member.plantings.size, "planting"), plantings_by_owner_path(:owner => member)
= link_to localize_plural(member.plantings, Planting), plantings_by_owner_path(owner: member)
- else
0 plantings
%li
- if member.harvests.size > 0
= link_to pluralize(member.harvests.size, "harvest"), harvests_by_owner_path(:owner => member)
= link_to localize_plural(member.harvests, Harvest), harvests_by_owner_path(owner: member)
- else
0 harvests
%li
- if member.seeds.size > 0
= link_to pluralize(member.seeds.size, "seeds"), seeds_by_owner_path(:owner => member)
= link_to localize_plural(member.seeds, Seed), seeds_by_owner_path(owner: member)
- else
0 seeds
%li
- if member.posts.size > 0
= link_to pluralize(member.posts.size, "post"), posts_by_author_path(:author => member)
= link_to localize_plural(member.posts, Post), posts_by_author_path(author: member)
- else
0 posts
%li
- if member.followed.size > 0
= link_to pluralize(member.followed.size, "follow"), member_follows_path(member)
= link_to localize_plural(member.followed, Follow), member_follows_path(member)
- else
0 following

View File

@@ -21,4 +21,4 @@
ago.
%p
%small
= [pluralize(member.gardens.size, "garden"), pluralize(member.plantings.size, "planting"), pluralize(member.seeds.size, "seed")].join(", ")
= [localize_plural(member.gardens, Garden), localize_plural(member.plantings, Planting), localize_plural(member.seeds, Seed)].join(", ")

View File

@@ -1,5 +1,12 @@
- content_for :title, @member.login_name
- content_for :subtitle, @member.location
- content_for :opengraph do
= tag("meta", property: "og:image", content: avatar_uri(@member, 200))
= tag("meta", property: "og:image:user_generated", content: "true")
= tag("meta", property: "og:title", content: @member.login_name)
= tag("meta", property: "og:type", content: "profile")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :buttonbar do
- if can? :update, @member
= link_to 'Edit profile', edit_member_registration_path, :class => 'btn btn-default'

View File

@@ -1,4 +1,11 @@
-content_for :title, @photo.title
- content_for :title, @photo.title
- content_for :opengraph do
= tag("meta", property: "og:title", content: @photo.title)
= tag("meta", property: "og:image", content: @photo.fullsize_url)
= tag("meta", property: "og:image:user_generated", content: "true")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
.row
.col-md-6

View File

@@ -1,4 +1,9 @@
-content_for :title, "#{ENV['GROWSTUFF_SITE_NAME']} community near #{@place}"
- content_for :opengraph do
= tag("meta", property: "og:title", content: "#{ENV['GROWSTUFF_SITE_NAME']} community near #{@place}")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
= render partial: 'search_form'

View File

@@ -1,4 +1,9 @@
- content_for :title, @plant_part.name.titlecase
- content_for :opengraph do
= tag("meta", property: "og:title", content: @plant_part.name.titlecase)
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- if @plant_part.crops.empty?
%p No crops are harvested for this plant part (yet).

View File

@@ -1,4 +1,13 @@
=content_for :title, "#{@planting.crop} in #{@planting.location}"
- content_for :opengraph do
- @planting.crop.photos.each do |photo|
= tag("meta", property: "og:image", content: photo.fullsize_url)
= tag("meta", property: "og:title", content: "#{@planting.crop} in #{@planting.location}")
- if @planting.description
= tag("meta", property: "og:description", content: @planting.description)
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
.row.planting
.col-md-6

View File

@@ -1,7 +1,7 @@
%a{:name => "comments"}
- if post.comments
%h2
=pluralize(post.comments.size, "comment")
=localize_plural(post.comments, Comment)
- post.comments.post_order.each do |c|
= render :partial => "comments/single", :locals => { :comment => c }

View File

@@ -9,13 +9,16 @@
.post-meta
%p
= (post.created_at == post.updated_at) ? 'Posted by' : 'Edited by'
Posted by
= link_to post.author.login_name, member_path(post.author)
- if post.forum
in
= link_to post.forum, post.forum
on
= (post.created_at == post.updated_at) ? post.created_at : post.updated_at
= post.created_at
- if post.updated_at > post.created_at
and edited at
= post.updated_at
.post-body
:growstuff_markdown
@@ -24,7 +27,7 @@
- unless defined?(hide_comments)
.post-comments
%ul.list-inline
%li.first= link_to pluralize(post.comments.size, "comment"),
%li.first= link_to localize_plural(post.comments, Comment),
post_path(post, :anchor => 'comments')
-if can? :create, Comment
%li= link_to "Reply", new_comment_path(:post_id => post.id)

View File

@@ -15,7 +15,10 @@
%td.hidden-xs
=link_to post.author, post.author
%td
= post.recent_activity.to_date.to_formatted_s(:short)
- if post.updated_at > post.recent_activity
= post.updated_at.to_date.to_formatted_s(:short)
- else
= post.recent_activity.to_date.to_formatted_s(:short)
// once the site gets more active, can change this to include time as well
// can't make it relative (distance_of_time_in_words) as it's cached
%td.hidden-xs

View File

@@ -1,4 +1,11 @@
= content_for :title, @post.subject
- content_for :opengraph do
= tag("meta", property: "og:image", content: avatar_uri(@post.author, 200))
= tag("meta", property: "og:description", content: "#{strip_tags(@post.body).split(' ')[0..20].join(' ')}...")
= tag("meta", property: "og:title", content: @post.subject)
= tag("meta", property: "og:type", content: "article")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- unless current_member
.alert.alert-info

View File

@@ -1,3 +1,12 @@
- content_for :opengraph do
- @scientific_name.crop.photos.each do |photo|
= tag("meta", property: "og:image", content: photo.fullsize_url)
= tag("meta", property: "og:title", content: @scientific_name.scientific_name)
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
%p#notice= notice
= render :partial => 'crops/approval_status_message', :locals => { :crop => @scientific_name.crop }

View File

@@ -1,4 +1,13 @@
- content_for :title, "#{@seed.owner}'s #{@seed.crop} seeds"
- content_for :opengraph do
- @seed.crop.photos.each do |photo|
= tag("meta", property: "og:image", content: photo.fullsize_url)
- if @seed.description
= tag("meta", property: "og:description", content: @seed.description)
= tag("meta", property: "og:image", content: "#{@seed.owner}'s #{@seed.crop} seeds")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
.row
.col-md-6

View File

@@ -0,0 +1,6 @@
- flash.each do |type, content|
%div{ class: build_alert_classes(type), role: "alert" }
%button.close{ type: "button", "data-dismiss" => "alert" }
%span{ "aria-hidden" => true } &times;
%span.sr-only Close
= content

View File

@@ -82,12 +82,6 @@ module Growstuff
g.javascripts false
end
config.action_mailer.delivery_method = :sendmail
config.action_mailer.sendmail_settings = {
location: '/usr/sbin/sendmail',
arguments: '-i -t',
openssl_verify_mode: 'none'
}
# Growstuff-specific configuration variables
config.currency = 'AUD'
@@ -112,5 +106,6 @@ module Growstuff
# didn't work for us.
config.cloudmade_key = '29a2d9e3cb3d429490a8f338b2388b1d'
config.active_record.raise_in_transactional_callbacks = true
end
end
end

View File

@@ -15,7 +15,7 @@ Growstuff::Application.configure do
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
config.serve_static_files = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
@@ -69,15 +69,15 @@ Growstuff::Application.configure do
# Growstuff configuration
config.action_mailer.default_url_options = { host: 'growstuff.org' }
config.action_mailer.smtp_settings = {
port: '587',
address: 'smtp.mandrillapp.com',
user_name: ENV['GROWSTUFF_MANDRILL_USERNAME'],
password: ENV['GROWSTUFF_MANDRILL_APIKEY'],
domain: 'heroku.com',
authentication: :plain
ActionMailer::Base.smtp_settings = {
port: ENV['SPARKPOST_SMTP_PORT'],
address: ENV['SPARKPOST_SMTP_HOST'],
user_name: ENV['SPARKPOST_SMTP_USERNAME'],
password: ENV['SPARKPOST_SMTP_PASSWORD'],
authentication: :login,
enable_starttls_auto: true
}
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.delivery_method = :smtp
config.host = 'growstuff.org'
config.analytics_code = <<-eos

View File

@@ -17,7 +17,7 @@ Growstuff::Application.configure do
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
config.serve_static_files = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
@@ -71,15 +71,15 @@ Growstuff::Application.configure do
# Growstuff configuration
config.action_mailer.default_url_options = { host: 'staging.growstuff.org' }
config.action_mailer.smtp_settings = {
port: '587',
address: 'smtp.mandrillapp.com',
user_name: ENV['GROWSTUFF_MANDRILL_USERNAME'],
password: ENV['GROWSTUFF_MANDRILL_APIKEY'],
domain: 'heroku.com',
authentication: :plain
ActionMailer::Base.smtp_settings = {
port: ENV['SPARKPOST_SMTP_PORT'],
address: ENV['SPARKPOST_SMTP_HOST'],
user_name: ENV['SPARKPOST_SMTP_USERNAME'],
password: ENV['SPARKPOST_SMTP_PASSWORD'],
authentication: :login,
enable_starttls_auto: true
}
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.delivery_method = :smtp
config.host = 'staging.growstuff.org'
config.analytics_code = ''

View File

@@ -15,7 +15,7 @@ Growstuff::Application.configure do
config.cache_classes = false
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.serve_static_files = true
config.static_cache_control = "public, max-age=3600"
# Show full error reports and disable caching
@@ -49,6 +49,7 @@ Growstuff::Application.configure do
end
config.after_initialize do
require "active_merchant/ext/paypal_bogus_gateway"
ActiveMerchant::Billing::Base.mode = :test
::STANDARD_GATEWAY = ActiveMerchant::Billing::PaypalBogusGateway.new
::EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalBogusGateway.new

View File

@@ -121,7 +121,7 @@ Devise.setup do |config|
# Email regex used to validate email formats. It simply asserts that
# an one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
# config.email_regexp = /\A[^@]+@[^@]+\z/
config.email_regexp = /\A[^@]+@[^@]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this

View File

@@ -179,6 +179,9 @@ en:
crop:
one: "crop"
other: "crops"
follow:
one: "follow"
other: "follows"
garden:
one: "garden"
other: "gardens"

View File

@@ -83,6 +83,8 @@ Growstuff::Application.routes.draw do
get '/admin/newsletter' => 'admin#newsletter', :as => :admin_newsletter
get '/admin/:action' => 'admin#:action'
get '/.well-known/acme-challenge/:id' => 'pages#letsencrypt'
# CMS stuff -- must remain LAST
comfy_route :cms, path: '/', sitemap: false

View File

@@ -34,7 +34,7 @@ class DeviseCreateUsers < ActiveRecord::Migration
# t.string :authentication_token
t.timestamps
t.timestamps null: true
end
add_index :users, :email, unique: true

View File

@@ -3,7 +3,7 @@ class CreateCrops < ActiveRecord::Migration
create_table :crops do |t|
t.string :system_name
t.string :en_wikipedia_url
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -5,7 +5,7 @@ class CreateGardens < ActiveRecord::Migration
t.integer :user_id
t.string :slug, null: false
t.timestamps
t.timestamps null: true
end
add_index :gardens, :user_id

View File

@@ -4,7 +4,7 @@ class CreateScientificNames < ActiveRecord::Migration
t.string :scientific_name, null: false
t.integer :crop_id, null: false
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -5,7 +5,7 @@ class CreateUpdates < ActiveRecord::Migration
t.string :subject, null: false
t.text :body, null: false
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -7,7 +7,7 @@ class CreatePlantings < ActiveRecord::Migration
t.integer :quantity
t.text :description
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -5,7 +5,7 @@ class CreateComments < ActiveRecord::Migration
t.integer :author_id
t.text :body
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -8,7 +8,7 @@ class CreateNotifications < ActiveRecord::Migration
t.boolean :read
t.integer :post_id
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -5,7 +5,7 @@ class CreateForums < ActiveRecord::Migration
t.text :description, null: false
t.integer :owner_id, null: false
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -4,7 +4,7 @@ class CreateRoles < ActiveRecord::Migration
t.string :name, null: false
t.text :description
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -6,7 +6,7 @@ class CreateAuthentications < ActiveRecord::Migration
t.string :uid
t.string :token
t.string :secret
t.timestamps
t.timestamps null: true
end
add_index :authentications, :member_id
end

View File

@@ -5,7 +5,7 @@ class CreateProducts < ActiveRecord::Migration
t.string :description, null: false
t.decimal :min_price, null: false
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -3,7 +3,7 @@ class CreateOrders < ActiveRecord::Migration
create_table :orders do |t|
t.string :member_id, null: false
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -6,7 +6,7 @@ class CreatePhotos < ActiveRecord::Migration
t.string :thumbnail_url, null: false
t.string :fullsize_url, null: false
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -6,7 +6,7 @@ class CreateOrderItems < ActiveRecord::Migration
t.decimal :price
t.integer :quantity
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -5,7 +5,7 @@ class CreateAccountDetails < ActiveRecord::Migration
t.integer :account_type_id
t.datetime :paid_until
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -5,7 +5,7 @@ class CreateAccountTypes < ActiveRecord::Migration
t.boolean :is_paid
t.boolean :is_permanent_paid
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -7,7 +7,7 @@ class CreateSeeds < ActiveRecord::Migration
t.integer :quantity
t.date :use_by
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -8,7 +8,7 @@ class CreateHarvests < ActiveRecord::Migration
t.string :units
t.text :notes
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -3,7 +3,7 @@ class CreatePlantParts < ActiveRecord::Migration
create_table :plant_parts do |t|
t.string :name
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -5,7 +5,7 @@ class CreateAlternateNames < ActiveRecord::Migration
t.integer :crop_id, null: false
t.integer :creator_id, null: false
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -4,7 +4,7 @@ class CreateFollows < ActiveRecord::Migration
t.integer :member_id
t.integer :followed_id
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -33,7 +33,7 @@ class CreateCms < ActiveRecord::Migration
t.text :js, text_limit
t.integer :position, null: false, default: 0
t.boolean :is_shared, null: false, default: false
t.timestamps
t.timestamps null: true
end
add_index :comfy_cms_layouts, [:parent_id, :position]
add_index :comfy_cms_layouts, [:site_id, :identifier], unique: true
@@ -52,7 +52,7 @@ class CreateCms < ActiveRecord::Migration
t.integer :children_count, null: false, default: 0
t.boolean :is_published, null: false, default: true
t.boolean :is_shared, null: false, default: false
t.timestamps
t.timestamps null: true
end
add_index :comfy_cms_pages, [:site_id, :full_path]
add_index :comfy_cms_pages, [:parent_id, :position]
@@ -62,7 +62,7 @@ class CreateCms < ActiveRecord::Migration
t.string :identifier, null: false
t.text :content, text_limit
t.references :blockable, polymorphic: true
t.timestamps
t.timestamps null: true
end
add_index :comfy_cms_blocks, [:identifier]
add_index :comfy_cms_blocks, [:blockable_id, :blockable_type]
@@ -75,7 +75,7 @@ class CreateCms < ActiveRecord::Migration
t.text :content, text_limit
t.integer :position, null: false, default: 0
t.boolean :is_shared, null: false, default: false
t.timestamps
t.timestamps null: true
end
add_index :comfy_cms_snippets, [:site_id, :identifier], unique: true
add_index :comfy_cms_snippets, [:site_id, :position]
@@ -90,7 +90,7 @@ class CreateCms < ActiveRecord::Migration
t.integer :file_file_size, null: false
t.string :description, limit: 2048
t.integer :position, null: false, default: 0
t.timestamps
t.timestamps null: true
end
add_index :comfy_cms_files, [:site_id, :label]
add_index :comfy_cms_files, [:site_id, :file_file_name]

View File

@@ -49,7 +49,7 @@ namespace :growstuff do
if Date.today.cwday == send_on_day and Date.today.cweek % every_n_weeks == 0
Member.confirmed.find_each do |m|
Notifier.planting_reminder(m).deliver!
Notifier.planting_reminder(m).deliver_now!
end
end
end

38
script/check_contributors_md Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env ruby
puts "Checking to see if you're in CONTRIBUTORS.md..."
if ENV['TRAVIS'] then
if ENV['TRAVIS_PULL_REQUEST'] then
require 'httparty'
repo = ENV['TRAVIS_REPO_SLUG']
pr = ENV['TRAVIS_PULL_REQUEST']
url = "https://api.github.com/repos/#{repo}/pulls/#{pr}"
response = HTTParty.get(url).parsed_response
author = response['user']['login'] if response && response['user']
# Could not determine author
exit unless author
else
# We're in a Travis branch build; nothing to check
exit
end
else
author = `git config github.user`.chomp
if $?.exitstatus > 0 then
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
if !system("grep #{author} CONTRIBUTORS.md") then
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

9
script/gemfile_check Executable file
View File

@@ -0,0 +1,9 @@
#!/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") then
abort "Looks like you committed changes to Gemfile but not Gemfile.lock"
end

View File

@@ -6,7 +6,7 @@ require 'yaml'
heroku = Heroku::API.new(api_key: ENV['HEROKU_API_KEY'])
branch = ENV['TRAVIS_BRANCH']
travis_config = YAML.load_file('.travis.yml')
if travis_config['deploy']['app'].has_key? branch
if travis_config['deploy']['app'].key? branch
app = travis_config['deploy']['app'][branch]
else
abort "No Heroku app found for branch #{branch}"

View File

@@ -27,7 +27,7 @@ feature 'Commenting on a post' do
fill_in "comment_body", with: "Testing edit for comment"
click_button "Post comment"
expect(page).to have_content "Comment was successfully updated"
expect(page).to have_content "Edited by"
expect(page).to have_content "edited at"
end
end
end

View File

@@ -231,7 +231,7 @@ feature "Planting a crop", :js do
end
describe "Planting sunniness" do
it "should show the image sunniness_sun.png" do
it "should show the a sunny image" do
fill_autocomplete "crop", with: "mai"
select_from_autocomplete "maize"
within "form#new_planting" do
@@ -244,11 +244,10 @@ feature "Planting a crop", :js do
click_button "Save"
end
expect(page).to have_css("img[src*='sunniness_sun.png']")
expect(page).to have_css("img[alt=sun]")
expect(page).to have_css("img[alt='sun']")
end
it "should show the image 'not specified.png'" do
it "should show a sunniness not specified image" do
fill_autocomplete "crop", with: "mai"
select_from_autocomplete "maize"
within "form#new_planting" do
@@ -260,7 +259,6 @@ feature "Planting a crop", :js do
click_button "Save"
end
expect(page).to have_css("img[src*='sunniness_not specified.png']")
expect(page).to have_css("img[alt='not specified']")
end
end

View File

@@ -27,7 +27,7 @@ feature 'Post a post' do
fill_in "post_subject", with: "Testing Edit"
click_button "Post"
expect(page).to have_content "Post was successfully updated"
expect(page).to have_content "Edited by"
expect(page).to have_content "edited at"
end
end
end
end

View File

@@ -15,7 +15,7 @@ feature "unsubscribe" do
expect(member.send_notification_email).to eq(true)
# generate planting reminder email
Notifier.planting_reminder(member).deliver
Notifier.planting_reminder(member).deliver_now
open_email(member.email)
# clicking 'Unsubscribe' link will unsubscribe the member
@@ -33,7 +33,7 @@ feature "unsubscribe" do
# generate inbox notification email
notification.recipient = member
Notifier.notify(notification).deliver
Notifier.notify(notification).deliver_now
open_email(member.email)
# clicking 'Unsubscribe' link will unsubscribe the member

View File

@@ -43,4 +43,97 @@ describe ApplicationHelper do
end
end
end
describe '#localize_plural' do
let(:post) { create(:post) }
context 'with a populated collection' do
context 'with one element' do
before { create(:comment, post: post) }
it 'returns a string with the quantity and the plural of the model' do
expect(localize_plural(post.comments, Comment)).to eq '1 comment'
end
end
context 'with more than one element' do
before { create_list(:comment, 2, post: post) }
it 'returns a string with the quantity and the plural of the model' do
expect(localize_plural(post.comments, Comment)).to eq '2 comments'
end
end
end
context 'without a populated collection' do
it 'returns a string with the quantity and the plural of the model' do
expect(localize_plural(post.comments, Comment)).to eq '0 comments'
end
end
describe '#build_alert_classes' do
context 'danger' do
it 'works when :alert' do
expect(build_alert_classes(:alert)).to include 'alert-danger'
end
it 'works when :danger' do
expect(build_alert_classes(:danger)).to include 'alert-danger'
end
it 'works when :error' do
expect(build_alert_classes(:error)).to include 'alert-danger'
end
it 'works when :validation_errors' do
expect(build_alert_classes(:validation_errors)).to include 'alert-danger'
end
it 'includes base classes' do
expect(build_alert_classes(:danger)).to include 'alert alert-dismissable'
end
it 'does not include danger when info' do
expect(build_alert_classes(:info)).not_to include ' alert-danger'
end
end
context 'warning' do
it 'works when :warning' do
expect(build_alert_classes(:warning)).to include 'alert-warning'
end
it 'works when :todo' do
expect(build_alert_classes(:todo)).to include 'alert-warning'
end
it 'includes base classes' do
expect(build_alert_classes(:warning)).to include 'alert alert-dismissable'
end
it 'does not include warning when info' do
expect(build_alert_classes(:info)).not_to include ' alert-warning'
end
end
context 'success' do
it 'works when :notice' do
expect(build_alert_classes(:notice)).to include 'alert-success'
end
it 'works when :success' do
expect(build_alert_classes(:success)).to include 'alert-success'
end
it 'includes base classes' do
expect(build_alert_classes(:success)).to include 'alert alert-dismissable'
end
it 'does not include success when info' do
expect(build_alert_classes(:info)).not_to include ' alert-success'
end
end
context 'info' do
it 'works when :info' do
expect(build_alert_classes(:info)).to include 'alert-info'
end
it 'works when blank' do
expect(build_alert_classes()).to include 'alert-info'
end
it 'includes base classes' do
expect(build_alert_classes(:info)).to include 'alert alert-dismissable'
end
it 'does not include info when danger' do
expect(build_alert_classes(:danger)).not_to include ' alert-info'
end
end
end
end
end

View File

@@ -0,0 +1,41 @@
require 'rails_helper'
describe CropsHelper do
describe "display_seed_availability" do
before :each do
@member = create :member
@crop = create :tomato
end
context "with no seeds" do
it 'should render' do
expect(helper.display_seed_availability(@member, @crop)).to eq "You don't have any seeds of this crop."
end
end
context "with an unknown quantity of seeds" do
before do
create :seed, crop: @crop, quantity: nil, owner: @member
end
it 'should render' do
expect(helper.display_seed_availability(@member, @crop)).to eq "You have an unknown quantity of seeds of this crop."
end
end
context "with an quantity of seeds" do
before do
a_different_crop = create :apple
create :seed, crop: @crop, quantity: 20, owner: @member
create :seed, crop: @crop, quantity: 13, owner: @member
create :seed, crop: a_different_crop, quantity: 3, owner: @member
end
it 'should render' do
expect(helper.display_seed_availability(@member, @crop)).to eq "You have 33 seeds of this crop."
end
end
end
end

View File

@@ -0,0 +1,110 @@
require 'rails_helper'
describe GardensHelper do
describe "garden description" do
it "is missing" do
garden = FactoryGirl.create(:garden,
description: nil
)
result = helper.display_garden_description(garden)
expect(result).to eq "no description provided."
end
it "is less than 130 characters long" do
garden = FactoryGirl.create(:garden,
description: 'a' * 20
)
result = helper.display_garden_description(garden)
expect(result).to eq 'a' * 20
end
it "is 130 characters long" do
garden = FactoryGirl.create(:garden,
description: 'a' * 130
)
result = helper.display_garden_description(garden)
link = link_to("Read more", garden_path(garden))
expect(result).to eq 'a' * 130
end
it "is more than 130 characters long" do
garden = FactoryGirl.create(:garden,
description: 'a' * 140
)
result = helper.display_garden_description(garden)
expect(result).to eq 'a' * 126 + '...' + ' ' + link_to("Read more", garden_path(garden))
end
end
describe "garden plantings" do
it "is missing" do
garden = FactoryGirl.create(:garden)
plantings = nil
result = helper.display_garden_plantings(plantings)
expect(result).to eq "None"
end
it "has 1 planting" do
garden = FactoryGirl.create(:garden)
plantings = []
crop = FactoryGirl.create(:crop)
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop)
result = helper.display_garden_plantings(plantings)
output = "<li>"
output += "10 " + link_to(crop.name, crop)
output += ", planted on #{plantings.first.planted_at}"
output += "</li>"
expect(result).to eq output
end
it "has 2 plantings" do
garden = FactoryGirl.create(:garden)
plantings = []
crop1 = FactoryGirl.create(:crop)
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop1)
crop2 = FactoryGirl.create(:crop)
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop2)
result = helper.display_garden_plantings(plantings)
output = "<li>"
output += "10 " + link_to(crop1.name, crop1)
output += ", planted on #{plantings.first.planted_at}"
output += "</li>"
output += "<li>"
output += "10 " + link_to(crop2.name, crop2)
output += ", planted on #{plantings.first.planted_at}"
output += "</li>"
expect(result).to eq output
end
it "has 3 plantings" do
garden = FactoryGirl.create(:garden)
plantings = []
crop1 = FactoryGirl.create(:crop)
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop1)
crop2 = FactoryGirl.create(:crop)
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop2)
crop3 = FactoryGirl.create(:crop)
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop3)
result = helper.display_garden_plantings(plantings)
output = "<li>"
output += "10 " + link_to(crop1.name, crop1)
output += ", planted on #{plantings.first.planted_at}"
output += "</li>"
output += "<li>"
output += "10 " + link_to(crop2.name, crop2)
output += ", planted on #{plantings.first.planted_at}"
output += "</li>"
expect(result).to eq output
end
end
end

View File

@@ -0,0 +1,38 @@
require 'rails_helper'
describe SeedsHelper do
describe "seed description" do
it "is missing" do
seed = FactoryGirl.create(:seed,
description: nil
)
result = helper.display_seed_description(seed)
expect(result).to eq "no description provided."
end
it "is less than 130 characters long" do
seed = FactoryGirl.create(:seed,
description: 'a' * 20
)
result = helper.display_seed_description(seed)
expect(result).to eq 'a' * 20
end
it "is 130 characters long" do
seed = FactoryGirl.create(:seed,
description: 'a' * 130
)
result = helper.display_seed_description(seed)
link = link_to("Read more", seed_path(seed))
expect(result).to eq 'a' * 130
end
it "is more than 130 characters long" do
seed = FactoryGirl.create(:seed,
description: 'a' * 140
)
result = helper.display_seed_description(seed)
expect(result).to eq 'a' * 126 + '...' + ' ' + link_to("Read more", seed_path(seed))
end
end
end

View File

@@ -547,11 +547,11 @@ describe Crop do
end
it "should delete the association between post and the crop(tomato)" do
expect(Post.find(post).crops).to eq [maize]
expect(Post.find(post.id).crops).to eq [maize]
end
it "should not delete the posts" do
expect(Post.find(post)).to_not eq nil
expect(Post.find(post.id)).to_not eq nil
end
end
end

View File

@@ -158,13 +158,13 @@ describe Post do
end
it "should delete the association" do
expect(Crop.find(tomato).posts).to eq []
expect(Crop.find(maize).posts).to eq []
expect(Crop.find(tomato.id).posts).to eq []
expect(Crop.find(maize.id).posts).to eq []
end
it "should not delete the crops" do
expect(Crop.find(tomato)).to_not eq nil
expect(Crop.find(maize)).to_not eq nil
expect(Crop.find(tomato.id)).to_not eq nil
expect(Crop.find(maize.id)).to_not eq nil
end
end
end

View File

@@ -1,26 +1,27 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
require 'simplecov'
require 'coveralls'
# output coverage locally AND send it to coveralls
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
])
# fail if there's a significant test coverage drop
SimpleCov.maximum_coverage_drop 1
SimpleCov.start :rails do
add_filter 'spec/'
add_filter 'vendor/'
end
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
Rails.application.eager_load!
require 'capybara'
require 'capybara/poltergeist'
require 'capybara/rspec'
@@ -100,4 +101,14 @@ RSpec.configure do |config|
# Allow just create(:factory) instead of needing to specify FactoryGirl.create(:factory)
config.include FactoryGirl::Syntax::Methods
# Prevent Poltergeist from fetching external URLs during feature tests
config.before(:each, js: true) do
page.driver.browser.url_blacklist = [
'gravatar.com',
'mapbox.com',
'okfn.org',
'googlecode.com',
]
end
end

View File

@@ -30,7 +30,7 @@ describe "crops/new" do
end
it "shows a link to crop wrangling guidelines" do
assert_select "a[href^=http://wiki.growstuff.org]", "crop wrangling guide"
assert_select "a[href^='http://wiki.growstuff.org']", "crop wrangling guide"
end
end

View File

@@ -35,7 +35,7 @@ describe "forums/show" do
it 'links to new post with the forum id' do
render
assert_select "a[href=#{new_post_path(forum_id: @forum.id)}]"
assert_select "a[href='#{new_post_path(forum_id: @forum.id)}']"
end
it 'has no posts' do

View File

@@ -66,7 +66,7 @@ describe "gardens/show" do
end
it "links to the right crop in the planting link" do
assert_select("a[href=#{new_planting_path}?garden_id=#{@garden.id}]")
assert_select("a[href='#{new_planting_path}?garden_id=#{@garden.id}']")
end
end

View File

@@ -32,7 +32,7 @@ describe 'home/_crops.html.haml', type: "view" do
it 'shows crops section' do
assert_select 'h2', text: 'Some of our crops'
assert_select "a[href=#{crop_path(@crop)}]"
assert_select "a[href='#{crop_path(@crop)}']"
end
it 'shows plantings section' do
@@ -45,6 +45,6 @@ describe 'home/_crops.html.haml', type: "view" do
end
it 'includes a link to all crops' do
assert_select "a[href=#{crops_path}]", text: /View all crops/
assert_select "a[href='#{crops_path}']", text: /View all crops/
end
end

Some files were not shown because too many files have changed in this diff Show More