Compare commits

..

1 Commits

Author SHA1 Message Date
ImgBotApp
c1b8d2211a [ImgBot] Optimize images
*Total -- 1,165.34kb -> 338.55kb (70.95%)

/app/assets/images/pearLogo.svg -- 1,013.66kb -> 220.91kb (78.21%)
/app/assets/images/facebook-login-splash.png -- 69.41kb -> 51.04kb (26.47%)
/app/assets/images/facebook-thumbnail.png -- 10.94kb -> 8.10kb (25.93%)
/app/assets/images/pear.png -- 71.33kb -> 58.50kb (17.98%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
2021-08-09 07:30:03 +00:00
204 changed files with 3049 additions and 3274 deletions

View File

@@ -5,7 +5,7 @@ updates:
schedule:
interval: daily
time: "07:00"
open-pull-requests-limit: 20
open-pull-requests-limit: 10
versioning-strategy: lockfile-only
ignore:
- dependency-name: active_median

View File

@@ -5,6 +5,8 @@ name: Brakeman Scan
# This section configures the trigger for the workflow. Feel free to customize depending on your convention
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
@@ -15,15 +17,17 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2.3.4
# Customize the ruby version depending on your needs
- name: Setup Ruby
uses: ruby/setup-ruby@v1
uses: actions/setup-ruby@v1.1.3
with:
ruby-version: '2.7'
- name: Setup Brakeman
env:
BRAKEMAN_VERSION: '5.1.1' # SARIF support is provided in Brakeman version 4.10+
BRAKEMAN_VERSION: '4.10' # SARIF support is provided in Brakeman version 4.10+
run: |
gem install brakeman --version $BRAKEMAN_VERSION
@@ -35,6 +39,6 @@ jobs:
# Upload the SARIF file generated in the previous step
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: output.sarif.json

View File

@@ -6,7 +6,7 @@ jobs:
contributors:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2.3.4
- name: Install ruby version specified in .ruby-version
uses: ruby/setup-ruby@v1
with:
@@ -53,7 +53,7 @@ jobs:
steps:
- name: Checkout this repo
uses: actions/checkout@v3
uses: actions/checkout@v2.3.4
- name: Configure sysctl limits
run: |
@@ -76,7 +76,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v3
uses: actions/cache@v2.1.5
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -89,7 +89,7 @@ jobs:
sudo apt-get -y install libpq-dev google-chrome-stable
- name: Install NodeJS
uses: actions/setup-node@v3
uses: actions/setup-node@v2.4.0
with:
node-version: '12'

View File

@@ -1,7 +1,5 @@
inherit_from: .rubocop_todo.yml
require:
- rubocop-rails
- rubocop-rspec
require: rubocop-rails
AllCops:
NewCops: enable
Exclude:
@@ -18,11 +16,6 @@ Naming/FileName:
- 'Gemfile'
- 'Gemfile.lock'
RSpec/DescribeClass:
Exclude:
- 'spec/views/**/*.rb'
- 'spec/features/**/*.rb'
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

View File

@@ -1,384 +1,21 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-11-07 13:39:24 UTC using RuboCop version 1.38.0.
# `rubocop --auto-gen-config --no-offense-counts`
# on 2019-12-16 21:01:58 +1300 using RuboCop version 0.77.0.
# 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: 5
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
Layout/EmptyLineBetweenDefs:
Lint/AmbiguousOperator:
Exclude:
- 'db/migrate/20171129041341_create_photographings.rb'
- 'db/migrate/20190130090437_add_crop_to_photographings.rb'
- 'spec/controllers/crops_controller_spec.rb'
# Offense count: 10
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: space, no_space
Layout/LineContinuationSpacing:
Exclude:
- 'app/mailers/notifier_mailer.rb'
- 'app/models/seed.rb'
- 'lib/tasks/growstuff.rake'
- 'spec/features/rss/plantings_spec.rb'
- 'spec/features/rss/posts_spec.rb'
- 'spec/features/rss/seeds_spec.rb'
- 'spec/models/seed_spec.rb'
# Offense count: 9
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: aligned, indented
Layout/LineEndStringConcatenationIndentation:
Exclude:
- 'app/mailers/notifier_mailer.rb'
- 'app/models/seed.rb'
- 'lib/tasks/growstuff.rake'
- 'spec/features/rss/plantings_spec.rb'
- 'spec/features/rss/posts_spec.rb'
- 'spec/features/rss/seeds_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 304
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperatorPrecedence:
Exclude:
- 'db/seeds.rb'
- 'spec/helpers/gardens_helper_spec.rb'
- 'spec/helpers/seeds_helper_spec.rb'
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: RequireParenthesesForMethodChains.
Lint/AmbiguousRange:
Exclude:
- 'app/models/concerns/search_harvests.rb'
- 'app/models/concerns/search_plantings.rb'
# Offense count: 2
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
Lint/DuplicateBranch:
Exclude:
- 'app/models/harvest.rb'
- 'lib/actions/oauth_signup_action.rb'
# Offense count: 8
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'db/migrate/20171022032108_all_the_predictions.rb'
- 'spec/controllers/home_controller_spec.rb'
- 'spec/controllers/likes_controller_spec.rb'
- 'spec/controllers/plant_parts_controller_spec.rb'
- 'spec/factories/crop_companions.rb'
- 'spec/features/crops/crop_detail_page_spec.rb'
- 'spec/requests/authentications_spec.rb'
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/RedundantDirGlobSort:
Exclude:
- 'spec/rails_helper.rb'
# Offense count: 1
# Configuration parameters: AllowComments, AllowNil.
Lint/SuppressedException:
Exclude:
- 'lib/tasks/testing.rake'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: strict, consistent
Lint/SymbolConversion:
Exclude:
- 'app/controllers/likes_controller.rb'
# Offense count: 8
Lint/UselessAssignment:
Exclude:
- 'config.rb'
- 'config/compass.rb'
- 'lib/actions/oauth_signup_action.rb'
# Offense count: 44
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 151
# Offense count: 10
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 61
# Offense count: 6
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 171
# Offense count: 4
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 32
# Offense count: 59
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
Metrics/MethodLength:
Max: 59
# Offense count: 3
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 32
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: lowercase, uppercase
Naming/HeredocDelimiterCase:
Exclude:
- 'config/environments/production.rb'
# Offense count: 3
RSpec/AnyInstance:
Exclude:
- 'spec/controllers/harvests_controller_spec.rb'
- 'spec/controllers/photos_controller_spec.rb'
# Offense count: 15
RSpec/Capybara/SpecificMatcher:
Exclude:
- 'spec/features/crops/browse_crops_spec.rb'
- 'spec/features/footer_spec.rb'
- 'spec/features/gardens/adding_gardens_spec.rb'
- 'spec/features/harvests/harvesting_a_crop_spec.rb'
- 'spec/features/plantings/planting_a_crop_spec.rb'
- 'spec/features/seeds/adding_seeds_spec.rb'
# Offense count: 1
RSpec/Capybara/VisibilityMatcher:
Exclude:
- 'spec/features/shared_examples/crop_suggest.rb'
# Offense count: 292
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Enabled: false
# Offense count: 36
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SkipBlocks, EnforcedStyle.
# SupportedStyles: described_class, explicit
RSpec/DescribedClass:
Exclude:
- 'spec/models/like_spec.rb'
- 'spec/models/member_spec.rb'
- 'spec/services/timeline_service_spec.rb'
# Offense count: 13
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/EmptyExampleGroup:
Exclude:
- 'spec/controllers/authentications_controller_spec.rb'
- 'spec/controllers/forums_controller_spec.rb'
- 'spec/controllers/home_controller_spec.rb'
- 'spec/controllers/likes_controller_spec.rb'
- 'spec/controllers/plant_parts_controller_spec.rb'
- 'spec/controllers/seeds_controller_spec.rb'
- 'spec/features/crops/crop_detail_page_spec.rb'
- 'spec/features/plantings/planting_a_crop_spec.rb'
- 'spec/requests/authentications_spec.rb'
- 'spec/views/home/index_spec.rb'
- 'spec/views/photos/edit.html.haml_spec.rb'
- 'spec/views/posts/_single.html.haml_spec.rb'
# Offense count: 136
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 25
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
RSpec/ExcessiveDocstringSpacing:
Exclude:
- 'spec/controllers/crops_controller_spec.rb'
- 'spec/features/crops/crop_photos_spec.rb'
# Offense count: 30
RSpec/ExpectInHook:
Exclude:
- 'spec/controllers/garden_types_controller_spec.rb'
- 'spec/controllers/gardens_controller_spec.rb'
- 'spec/features/admin/forums_spec.rb'
- 'spec/features/crops/crop_photos_spec.rb'
- 'spec/features/members/list_spec.rb'
- 'spec/features/plantings/planting_a_crop_spec.rb'
- 'spec/features/shared_examples/append_date.rb'
# Offense count: 1135
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/FactoryBot/SyntaxMethods:
Enabled: false
# Offense count: 3
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/controllers/member_controller_spec.rb'
- 'spec/features/seeds/seed_photos.rb'
- 'spec/models/garden_type.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, each, example
RSpec/HookArgument:
Exclude:
- 'spec/requests/api/v1/plantings_request_spec.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
RSpec/HooksBeforeExamples:
Exclude:
- 'spec/features/crops/creating_a_crop_spec.rb'
# Offense count: 710
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Enabled: false
# Offense count: 40
RSpec/LetSetup:
Enabled: false
# Offense count: 2
RSpec/MessageChain:
Exclude:
- 'spec/models/member_spec.rb'
# Offense count: 23
# Configuration parameters: .
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
EnforcedStyle: receive
# Offense count: 1
RSpec/MultipleDescribes:
Exclude:
- 'spec/features/crops/crop_wranglers_spec.rb'
# Offense count: 149
RSpec/MultipleExpectations:
Max: 19
# Offense count: 137
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 14
# Offense count: 132
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Enabled: false
# Offense count: 111
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 6
# Offense count: 407
# Configuration parameters: AllowedPatterns.
# AllowedPatterns: ^expect_, ^assert_
RSpec/NoExpectationExample:
Enabled: false
# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/Rails/HaveHttpStatus:
Exclude:
- 'spec/controllers/api/v1/plantings_controller_spec.rb'
- 'spec/controllers/harvests_controller_spec.rb'
- 'spec/requests/harvests_spec.rb'
# Offense count: 16
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Inferences.
RSpec/Rails/InferredSpecType:
Enabled: false
# Offense count: 2
RSpec/RepeatedDescription:
Exclude:
- 'spec/models/like_spec.rb'
# Offense count: 6
RSpec/RepeatedExample:
Exclude:
- 'spec/controllers/photos_controller_spec.rb'
- 'spec/features/members/following_spec.rb'
- 'spec/models/like_spec.rb'
# Offense count: 4
RSpec/RepeatedExampleGroupBody:
Exclude:
- 'spec/controllers/crops_controller_spec.rb'
# Offense count: 6
RSpec/ScatteredSetup:
Exclude:
- 'spec/features/percy/percy_spec.rb'
- 'spec/features/plantings/prediction_spec.rb'
# Offense count: 3
RSpec/StubbedMock:
Exclude:
- 'spec/controllers/garden_types_controller_spec.rb'
- 'spec/controllers/gardens_controller_spec.rb'
- 'spec/models/member_spec.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: constant, string
RSpec/VerifiedDoubleReference:
Exclude:
- 'spec/models/member_spec.rb'
# Offense count: 3
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
RSpec/VerifiedDoubles:
Exclude:
- 'spec/controllers/garden_types_controller_spec.rb'
- 'spec/controllers/gardens_controller_spec.rb'
- 'spec/views/devise/shared/_links_spec.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Rails/ActionControllerFlashBeforeRender:
Exclude:
- 'app/controllers/authentications_controller.rb'
# Offense count: 26
# Configuration parameters: Database, Include.
# SupportedDatabases: mysql, postgresql
# Include: db/migrate/*.rb
Rails/BulkChangeTable:
Enabled: false
# Offense count: 11
# Configuration parameters: Include.
# Include: db/migrate/*.rb
Rails/CreateTableWithTimestamps:
@@ -393,14 +30,12 @@ Rails/CreateTableWithTimestamps:
- 'db/migrate/20161201154922_add_photos_seeds_table.rb'
- 'db/migrate/20171022032108_all_the_predictions.rb'
# Offense count: 1
# Configuration parameters: EnforcedStyle, AllowToTime.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: strict, flexible
Rails/Date:
Exclude:
- 'app/mailers/notifier_mailer.rb'
- 'app/mailers/notifier.rb'
# Offense count: 5
# Configuration parameters: EnforcedStyle.
# SupportedStyles: slashes, arguments
Rails/FilePath:
@@ -410,7 +45,6 @@ Rails/FilePath:
- 'config/environments/development.rb'
- 'db/seeds.rb'
# Offense count: 2
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasAndBelongsToMany:
@@ -418,39 +52,23 @@ Rails/HasAndBelongsToMany:
- 'app/models/member.rb'
- 'app/models/role.rb'
# Offense count: 5
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/member.rb'
# Offense count: 1
# Configuration parameters: Include.
# Include: spec/**/*.rb, test/**/*.rb
Rails/I18nLocaleAssignment:
# Include: app/models/**/*.rb
Rails/InverseOf:
Exclude:
- 'spec/features/locale_spec.rb'
- 'app/models/concerns/ownable.rb'
# Offense count: 33
Rails/I18nLocaleTexts:
Enabled: false
# Offense count: 2
# Configuration parameters: Include.
# Include: app/controllers/**/*.rb, app/mailers/**/*.rb
Rails/LexicallyScopedActionFilter:
Exclude:
- 'app/controllers/data_controller.rb'
# Offense count: 2
Rails/OutputSafety:
Exclude:
- 'app/helpers/auto_suggest_helper.rb'
- 'app/helpers/gardens_helper.rb'
# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Include.
# Include: **/Rakefile, **/*.rake
Rails/RakeEnvironment:
@@ -459,53 +77,27 @@ Rails/RakeEnvironment:
- 'lib/tasks/i18n.rake'
- 'lib/tasks/testing.rake'
# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
Rails/RedundantPresenceValidationOnBelongsTo:
Exclude:
- 'app/models/alternate_name.rb'
- 'app/models/like.rb'
- 'app/models/planting.rb'
- 'app/models/scientific_name.rb'
# Offense count: 9
# Configuration parameters: Include.
# Include: db/**/*.rb
# Include: db/migrate/*.rb
Rails/ReversibleMigration:
Exclude:
- 'db/migrate/20130326092227_change_planted_at_to_date.rb'
- 'db/migrate/20191119020643_upgrade_cms.rb'
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Rails/RootPathnameMethods:
# Configuration parameters: Blacklist, Whitelist.
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
Rails/SkipsModelValidations:
Exclude:
- 'app/controllers/crops_controller.rb'
- 'app/helpers/icons_helper.rb'
- 'db/migrate/20190317023129_finished_boolean.rb'
- 'db/seeds.rb'
- 'db/migrate/20190910022329_add_photo_source.rb'
# Offense count: 6
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/UniqueValidationWithoutIndex:
# Configuration parameters: AllowedChars.
Style/AsciiComments:
Exclude:
- 'app/models/follow.rb'
- 'app/models/garden.rb'
- 'app/models/like.rb'
- 'app/models/member.rb'
- 'app/models/plant_part.rb'
- 'app/models/role.rb'
- 'config/initializers/comfortable_mexican_sofa.rb'
# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
Rails/WhereEquals:
Exclude:
- 'app/models/crop.rb'
- 'app/models/harvest.rb'
- 'app/models/planting.rb'
# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
@@ -513,133 +105,23 @@ Style/ClassAndModuleChildren:
- 'lib/haml/filters/escaped_markdown.rb'
- 'lib/haml/filters/growstuff_markdown.rb'
# Offense count: 6
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/CommentedKeyword:
Exclude:
- 'db/migrate/20191119030244_cms_tags.rb'
- 'spec/models/crop_spec.rb'
- 'spec/models/photo_spec.rb'
- 'spec/models/planting_spec.rb'
# Offense count: 42
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedVars.
Style/FetchEnvVar:
Enabled: false
# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'config/initializers/new_framework_defaults_6_0.rb'
- 'db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb'
- 'db/migrate/20200815012538_remove_median_function.rb'
- 'spec/lib/haml/filters/growstuff_markdown_spec.rb'
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
Exclude:
- 'config/environments/production.rb'
- 'lib/tasks/openfarm.rake'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Exclude:
- 'bin/setup'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedMethods.
# AllowedMethods: nonzero?
Style/IfWithBooleanLiteralBranches:
Exclude:
- 'app/controllers/gardens_controller.rb'
# Offense count: 2
Style/MixinUsage:
Exclude:
- 'bin/setup'
- 'bin/update'
- 'spec/rails_helper.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/NegatedIfElseCondition:
Exclude:
- 'app/helpers/crops_helper.rb'
# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods.
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'app/helpers/harvests_helper.rb'
- 'app/helpers/plantings_helper.rb'
# Offense count: 6
Style/OpenStructUse:
Exclude:
- 'spec/helpers/event_helper_spec.rb'
# Offense count: 2
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'app/models/concerns/member_newsletter.rb'
# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: same_as_string_literals, single_quotes, double_quotes
Style/QuotedSymbols:
Exclude:
- 'app/models/seed.rb'
- 'spec/controllers/crops_controller_spec.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Methods.
Style/RedundantArgument:
Exclude:
- 'app/helpers/application_helper.rb'
# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SafeForConstants.
Style/RedundantFetchBlock:
Exclude:
- 'config/puma.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowModifier.
Style/SoleNestedConditional:
Exclude:
- 'app/controllers/application_controller.rb'
- 'app/controllers/messages_controller.rb'
- 'app/models/photo_association.rb'
# Offense count: 20
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'app/controllers/messages_controller.rb'
- 'app/helpers/buttons_helper.rb'
- 'config/initializers/rswag_api.rb'
- 'spec/helpers/gardens_helper_spec.rb'
- 'spec/helpers/seeds_helper_spec.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowComments.
# AllowedMethods: define_method, mail, respond_to
Style/SymbolProc:
Exclude:
- 'app/controllers/crops_controller.rb'

View File

@@ -1 +1 @@
3.1.2
2.7.2

View File

@@ -92,6 +92,7 @@ submit the change with your pull request.
- André Aubin / [lambda2](https://github.com/lambda2)
- Martina Simicic / [simicic](https://github.com/simicic)
- Rowan Crawford / [wombleton](https://github.com/wombleton)
- Le-jun - [lejun](https://github.com/le-jun)
## Bots

21
Gemfile
View File

@@ -5,13 +5,13 @@ source 'https://rubygems.org'
# Match ruby version in .ruby-version
ruby File.read('.ruby-version')
gem 'rails', '~> 7.0.4'
gem 'rails', '6.0.3.2'
# Keeping old sprockets
# https://github.com/rails/sprockets-rails/issues/444#issuecomment-637817050
gem "sprockets", "<4"
gem 'bundler', '>= 2.3.10'
gem 'bundler', '>=1.1.5'
gem 'coffee-rails'
gem 'haml'
@@ -24,7 +24,7 @@ gem 'rswag-api'
gem 'rswag-ui'
# CSS framework
gem "bootstrap", ">= 4.6.2"
gem "bootstrap", ">= 4.3.1"
gem 'material-sass', '4.1.1'
# Icons used by bootstrap/material-sass
@@ -52,14 +52,14 @@ gem 'csv_shaper' # CSV export
gem 'gibbon', '~>1.2.0' # for Mailchimp newsletter subscriptions
# Maps
gem 'leaflet-rails', '>= 1.9.2'
gem 'leaflet-rails'
gem 'rails-assets-leaflet.markercluster', source: 'https://rails-assets.org'
gem 'pg'
gem 'pg', '< 1.0.0' # Upstream bug, see https://github.com/Growstuff/growstuff/pull/1539
gem 'ruby-units' # for unit conversion
gem 'unicorn' # http server
gem "comfortable_mexican_sofa", git: "https://github.com/restarone/comfortable-mexican-sofa.git"
gem "comfortable_mexican_sofa", "~> 2.0.0"
gem 'active_utils'
gem 'sidekiq'
@@ -90,7 +90,7 @@ gem 'geocoder'
gem 'bootstrap-datepicker-rails'
# DRY-er easier bootstrap 4 forms
gem "bootstrap_form", ">= 4.5.0"
gem "bootstrap_form", ">= 4.2.0"
# For connecting to other services (eg Twitter)
gem 'omniauth', '~> 1.3'
@@ -119,11 +119,11 @@ gem 'xmlrpc' # fixes rake error - can be removed if not needed later
gem 'puma'
gem 'loofah', '>= 2.19.1'
gem 'loofah', '>= 2.2.1'
gem 'rack-protection', '>= 2.0.1'
# Member to member messaging system
gem 'mailboxer', '>= 0.15.1'
gem 'mailboxer'
gem 'faraday'
gem 'faraday_middleware'
@@ -175,6 +175,7 @@ end
group :test do
gem 'codeclimate-test-reporter', require: false
gem 'percy-capybara'
gem 'rails-controller-testing'
gem 'selenium-webdriver'
gem 'timecop'
@@ -184,5 +185,3 @@ end
group :travis do
gem 'platform-api'
end
gem "percy-capybara", "~> 5.0.0"

View File

@@ -1,72 +1,40 @@
GIT
remote: https://github.com/restarone/comfortable-mexican-sofa.git
revision: 456fb8507e9668128529c0302fa2e77e029c1f88
specs:
comfortable_mexican_sofa (2.0.19)
active_link_to (>= 1.0.0)
comfy_bootstrap_form (>= 4.0.0)
haml-rails (>= 1.0.0)
image_processing (>= 1.2)
jquery-rails (>= 4.3.1)
kramdown (>= 1.0.0)
mimemagic (>= 0.3.2)
mini_magick (>= 4.8.0)
rails (>= 5.2.0)
rails-i18n (>= 5.0.0)
sassc-rails (>= 2.0.0)
GEM
remote: https://rails-assets.org/
specs:
rails-assets-leaflet (1.5.1)
rails-assets-leaflet.markercluster (1.4.1)
rails-assets-leaflet (>= 1.3.1)
GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
specs:
abstract_type (0.0.7)
actioncable (7.0.4)
actionpack (= 7.0.4)
activesupport (= 7.0.4)
actioncable (6.0.3.2)
actionpack (= 6.0.3.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.4)
actionpack (= 7.0.4)
activejob (= 7.0.4)
activerecord (= 7.0.4)
activestorage (= 7.0.4)
activesupport (= 7.0.4)
actionmailbox (6.0.3.2)
actionpack (= 6.0.3.2)
activejob (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.4)
actionpack (= 7.0.4)
actionview (= 7.0.4)
activejob (= 7.0.4)
activesupport (= 7.0.4)
actionmailer (6.0.3.2)
actionpack (= 6.0.3.2)
actionview (= 6.0.3.2)
activejob (= 6.0.3.2)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.4)
actionview (= 7.0.4)
activesupport (= 7.0.4)
rack (~> 2.0, >= 2.2.0)
actionpack (6.0.3.2)
actionview (= 6.0.3.2)
activesupport (= 6.0.3.2)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.4)
actionpack (= 7.0.4)
activerecord (= 7.0.4)
activestorage (= 7.0.4)
activesupport (= 7.0.4)
globalid (>= 0.6.0)
actiontext (6.0.3.2)
actionpack (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
nokogiri (>= 1.8.5)
actionview (7.0.4)
activesupport (= 7.0.4)
actionview (6.0.3.2)
activesupport (= 6.0.3.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
@@ -78,60 +46,52 @@ GEM
activerecord (>= 4.2)
active_record_union (1.3.0)
activerecord (>= 4.0)
active_utils (3.3.19)
active_utils (3.3.17)
activesupport (>= 4.2)
i18n
activejob (7.0.4)
activesupport (= 7.0.4)
activejob (6.0.3.2)
activesupport (= 6.0.3.2)
globalid (>= 0.3.6)
activemodel (7.0.4)
activesupport (= 7.0.4)
activerecord (7.0.4)
activemodel (= 7.0.4)
activesupport (= 7.0.4)
activestorage (7.0.4)
actionpack (= 7.0.4)
activejob (= 7.0.4)
activerecord (= 7.0.4)
activesupport (= 7.0.4)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.4)
activemodel (6.0.3.2)
activesupport (= 6.0.3.2)
activerecord (6.0.3.2)
activemodel (= 6.0.3.2)
activesupport (= 6.0.3.2)
activestorage (6.0.3.2)
actionpack (= 6.0.3.2)
activejob (= 6.0.3.2)
activerecord (= 6.0.3.2)
marcel (~> 0.3.1)
activesupport (6.0.3.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
adamantium (0.2.0)
ice_nine (~> 0.11.0)
memoizable (~> 0.4.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
anima (0.3.2)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
anima (0.3.1)
abstract_type (~> 0.0.7)
adamantium (~> 0.2)
equalizer (~> 0.0.11)
ast (2.4.2)
autoprefixer-rails (10.4.7.0)
execjs (~> 2)
bcrypt (3.1.17)
autoprefixer-rails (10.2.4.0)
execjs
bcrypt (3.1.16)
better_errors (2.9.1)
coderay (>= 1.0.0)
erubi (>= 1.0.0)
rack (>= 0.9.0)
better_html (2.0.1)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bluecloth (2.2.0)
bonsai-elasticsearch-rails (7.0.1)
elasticsearch-model (< 8)
elasticsearch-rails (< 8)
bootstrap (4.6.2)
bootstrap (4.6.0)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 1.16.1, < 2)
popper_js (>= 1.14.3, < 2)
sassc-rails (>= 2.0.0)
bootstrap-datepicker-rails (1.9.0.1)
railties (>= 3.0)
@@ -139,14 +99,13 @@ GEM
actionpack (>= 5.2)
activemodel (>= 5.2)
builder (3.2.4)
bullet (7.0.4)
bullet (6.1.4)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
byebug (11.1.3)
cancancan (3.4.0)
capybara (3.38.0)
cancancan (3.2.1)
capybara (3.35.3)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
@@ -156,7 +115,7 @@ GEM
capybara-email (3.0.2)
capybara (>= 2.4, < 4.0)
mail
capybara-screenshot (1.0.26)
capybara-screenshot (1.0.25)
capybara (>= 1.0, < 4)
launchy
carrierwave (2.1.1)
@@ -167,7 +126,8 @@ GEM
mimemagic (>= 0.3.0)
mini_mime (>= 0.1.3)
ssrf_filter (~> 1.0)
chartkick (4.2.1)
chartkick (4.0.4)
childprocess (3.0.0)
codeclimate-test-reporter (1.0.9)
simplecov (<= 0.13)
coderay (1.1.3)
@@ -178,36 +138,47 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
comfortable_mexican_sofa (2.0.19)
active_link_to (>= 1.0.0)
comfy_bootstrap_form (>= 4.0.0)
haml-rails (>= 1.0.0)
jquery-rails (>= 4.3.1)
kramdown (>= 1.0.0)
mimemagic (>= 0.3.2)
mini_magick (>= 4.8.0)
rails (>= 5.2.0)
rails-i18n (>= 5.0.0)
sassc-rails (>= 2.0.0)
comfy_bootstrap_form (4.0.9)
rails (>= 5.0.0)
concord (0.1.6)
concord (0.1.5)
adamantium (~> 0.2.0)
equalizer (~> 0.0.9)
concurrent-ruby (1.1.10)
connection_pool (2.3.0)
concurrent-ruby (1.1.8)
connection_pool (2.2.3)
crass (1.0.6)
csv_shaper (1.3.2)
activesupport (>= 3.0.0)
dalli (3.2.3)
dalli (2.7.11)
database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0)
database_cleaner-active_record (2.0.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
devise (4.8.1)
devise (4.8.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
diff-lcs (1.5.0)
discard (1.2.1)
activerecord (>= 4.2, < 8)
diff-lcs (1.4.4)
discard (1.2.0)
activerecord (>= 4.2, < 7)
docile (1.1.5)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
dotenv (2.7.6)
dotenv-rails (2.7.6)
dotenv (= 2.7.6)
railties (>= 3.2)
elasticsearch (6.8.3)
elasticsearch-api (= 6.8.3)
@@ -223,58 +194,52 @@ GEM
faraday (~> 1)
multi_json
equalizer (0.0.11)
erubi (1.11.0)
erubi (1.10.0)
erubis (2.7.0)
excon (0.93.1)
execjs (2.8.1)
excon (0.78.1)
execjs (2.7.0)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
faker (3.0.0)
i18n (>= 1.8.11, < 2)
faraday (1.10.2)
faker (2.18.0)
i18n (>= 1.6, < 2)
faraday (1.5.1)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-httpclient (~> 1.0.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-net_http_persistent (1.1.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday_middleware (1.0.0)
faraday (~> 1.0)
ffi (1.15.5)
ffi (1.15.0)
flickraw (0.9.10)
font-awesome-sass (5.15.1)
sassc (>= 1.11)
friendly_id (5.5.0)
friendly_id (5.4.2)
activerecord (>= 4.0.0)
geocoder (1.8.1)
geocoder (1.6.7)
gibbon (1.2.1)
httparty
multi_json (>= 1.9.0)
globalid (1.0.0)
activesupport (>= 5.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
gravatar-ultimate (2.0.0)
activesupport (>= 2.3.14)
rack
haml (5.2.2)
haml (5.2.1)
temple (>= 0.8.0)
tilt
haml-i18n-extractor (0.5.9)
@@ -283,34 +248,38 @@ GEM
highline
tilt
trollop (= 1.16.2)
haml-rails (2.1.0)
haml-rails (2.0.1)
actionpack (>= 5.1)
activesupport (>= 5.1)
haml (>= 4.0.6)
haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1)
railties (>= 5.1)
haml_lint (0.43.0)
haml (>= 4.0, < 6.2)
haml_lint (0.37.1)
haml (>= 4.0, < 5.3)
parallel (~> 1.10)
rainbow
rubocop (>= 0.50.0)
sysexits (~> 1.1)
hashie (5.0.0)
heroics (0.1.2)
hashie (4.1.0)
heroics (0.1.1)
erubis (~> 2.0)
excon
moneta
multi_json (>= 1.9.2)
webrick
highline (2.0.3)
html2haml (2.2.0)
erubis (~> 2.7.0)
haml (>= 4.0, < 6)
nokogiri (>= 1.6.0)
ruby_parser (~> 3.5)
httparty (0.18.1)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
i18n (1.12.0)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
i18n-tasks (1.0.12)
i18n-tasks (0.9.34)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
better_html (>= 1.0, < 3.0)
erubi
highline (>= 2.0.0)
i18n
@@ -319,10 +288,10 @@ GEM
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
ice_nine (0.11.2)
image_processing (1.12.2)
image_processing (1.12.1)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
jquery-rails (4.5.1)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
@@ -330,28 +299,28 @@ GEM
railties (>= 3.2.16)
js-routes (1.4.14)
railties (>= 4)
json (2.6.3)
json-schema (3.0.0)
addressable (>= 2.8)
jsonapi-resources (0.10.7)
json (2.3.1)
json-schema (2.8.1)
addressable (>= 2.4)
jsonapi-resources (0.10.4)
activerecord (>= 4.1)
concurrent-ruby
railties (>= 4.1)
jsonapi-swagger (0.8.1)
jwt (2.3.0)
kgio (2.11.4)
kramdown (2.4.0)
jwt (2.2.2)
kgio (2.11.3)
kramdown (2.3.1)
rexml
launchy (2.5.0)
addressable (~> 2.7)
leaflet-rails (1.9.2)
leaflet-rails (1.7.0)
rails (>= 4.2.0)
letter_opener (1.8.1)
launchy (>= 2.2, < 3)
listen (3.7.1)
letter_opener (1.7.0)
launchy (~> 2.2)
listen (3.5.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.19.1)
loofah (2.9.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
@@ -359,13 +328,13 @@ GEM
mailboxer (0.15.1)
carrierwave (>= 0.5.8)
rails (>= 5.0.0)
marcel (1.0.2)
marcel (0.3.3)
mimemagic (~> 0.3.2)
material-sass (4.1.1)
autoprefixer-rails (>= 6.0.3)
sass (>= 3.5.2)
material_icons (4.0.0)
material_icons (2.2.1)
railties (>= 3.2)
matrix (0.4.2)
memcachier (0.0.2)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
@@ -373,43 +342,33 @@ GEM
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.0512)
mimemagic (0.4.3)
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mini_magick (4.11.0)
mini_mime (1.1.2)
mini_portile2 (2.8.0)
minitest (5.16.3)
mini_mime (1.0.2)
mini_portile2 (2.5.1)
minitest (5.14.4)
moneta (1.0.0)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.2.3)
net-imap (0.3.1)
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.1.3)
timeout
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.10-x86_64-linux)
multipart-post (2.1.1)
nio4r (2.5.7)
nokogiri (1.11.4)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
oauth (0.5.6)
oauth2 (1.4.9)
faraday (>= 0.17.3, < 3.0)
oauth2 (1.4.4)
faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
oj (3.13.23)
omniauth (1.9.2)
oj (3.12.1)
omniauth (1.9.1)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
omniauth-facebook (9.0.0)
omniauth-facebook (8.0.0)
omniauth-oauth2 (~> 1.2)
omniauth-flickr (0.0.20)
multi_json (~> 1.12)
@@ -417,50 +376,53 @@ GEM
omniauth-oauth (1.1.0)
oauth
omniauth (~> 1.0)
omniauth-oauth2 (1.7.2)
omniauth-oauth2 (1.7.0)
oauth2 (~> 1.4)
omniauth (>= 1.9, < 3)
omniauth (~> 1.9)
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
rack
orm_adapter (0.5.0)
parallel (1.22.1)
parser (3.1.3.0)
parallel (1.20.1)
parser (2.7.2.0)
ast (~> 2.4.1)
percy-capybara (5.0.0)
capybara (>= 3)
pg (1.4.5)
platform-api (3.5.0)
percy-capybara (4.3.3)
pg (0.21.0)
platform-api (3.3.0)
heroics (~> 0.1.1)
moneta (~> 1.0.0)
rate_throttle_client (~> 0.1.0)
popper_js (1.16.1)
public_suffix (5.0.0)
puma (6.0.0)
popper_js (1.16.0)
public_suffix (4.0.6)
puma (5.3.2)
nio4r (~> 2.0)
query_diet (0.7.1)
racc (1.6.1)
rack (2.2.4)
query_diet (0.7.0)
racc (1.5.2)
rack (2.2.3)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-protection (3.0.4)
rack-protection (2.1.0)
rack
rack-test (2.0.2)
rack (>= 1.3)
rails (7.0.4)
actioncable (= 7.0.4)
actionmailbox (= 7.0.4)
actionmailer (= 7.0.4)
actionpack (= 7.0.4)
actiontext (= 7.0.4)
actionview (= 7.0.4)
activejob (= 7.0.4)
activemodel (= 7.0.4)
activerecord (= 7.0.4)
activestorage (= 7.0.4)
activesupport (= 7.0.4)
bundler (>= 1.15.0)
railties (= 7.0.4)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.0.3.2)
actioncable (= 6.0.3.2)
actionmailbox (= 6.0.3.2)
actionmailer (= 6.0.3.2)
actionpack (= 6.0.3.2)
actiontext (= 6.0.3.2)
actionview (= 6.0.3.2)
activejob (= 6.0.3.2)
activemodel (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
bundler (>= 1.3.0)
railties (= 6.0.3.2)
sprockets-rails (>= 2.0.0)
rails-assets-leaflet (1.5.1)
rails-assets-leaflet.markercluster (1.4.1)
rails-assets-leaflet (>= 1.3.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
@@ -468,101 +430,100 @@ GEM
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.4)
loofah (~> 2.19, >= 2.19.1)
rails-i18n (7.0.5)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (>= 6.0.0, < 7)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (7.0.4)
actionpack (= 7.0.4)
activesupport (= 7.0.4)
railties (6.0.3.2)
actionpack (= 6.0.3.2)
activesupport (= 6.0.3.2)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
raindrops (0.20.0)
rake (13.0.6)
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
raindrops (0.19.1)
rake (13.0.3)
rate_throttle_client (0.1.2)
rb-fsevent (0.11.1)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis-client (0.11.2)
connection_pool
regexp_parser (2.6.1)
redis (4.2.5)
regexp_parser (2.1.1)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
rexml (3.2.5)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-activemodel-mocks (1.1.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
rspec-mocks (>= 2.99, < 4.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.1)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.2)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-rails (6.0.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.11)
rspec-expectations (~> 3.11)
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.11.1)
rspectre (0.0.4)
rspec-support (~> 3.10.0)
rspec-rails (5.0.1)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (>= 5.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.10.2)
rspectre (0.0.3)
anima (~> 0.3)
concord (~> 0.1)
parser (>= 2.6)
parser (~> 2.3)
rspec (~> 3.0)
rswag-api (2.8.0)
railties (>= 3.1, < 7.1)
rswag-specs (2.8.0)
activesupport (>= 3.1, < 7.1)
json-schema (>= 2.2, < 4.0)
railties (>= 3.1, < 7.1)
rspec-core (>= 2.14)
rswag-ui (2.8.0)
actionpack (>= 3.1, < 7.1)
railties (>= 3.1, < 7.1)
rubocop (1.40.0)
json (~> 2.3)
rswag-api (2.4.0)
railties (>= 3.1, < 7.0)
rswag-specs (2.4.0)
activesupport (>= 3.1, < 7.0)
json-schema (~> 2.2)
railties (>= 3.1, < 7.0)
rswag-ui (2.4.0)
actionpack (>= 3.1, < 7.0)
railties (>= 3.1, < 7.0)
rubocop (0.93.1)
parallel (~> 1.10)
parser (>= 3.1.2.1)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.23.0, < 2.0)
regexp_parser (>= 1.8)
rexml
rubocop-ast (>= 0.6.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.24.0)
parser (>= 3.1.1.0)
rubocop-rails (2.17.3)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-rails (2.9.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-rspec (2.16.0)
rubocop (~> 1.33)
rubocop (>= 0.90.0, < 2.0)
rubocop-rspec (1.44.1)
rubocop (~> 0.87)
rubocop-ast (>= 0.7.1)
ruby-progressbar (1.11.0)
ruby-units (3.0.0)
ruby-vips (2.1.4)
ffi (~> 1.12)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
ruby-units (2.3.2)
ruby-vips (2.0.17)
ffi (~> 1.9)
ruby2_keywords (0.0.4)
ruby_parser (3.14.2)
sexp_processor (~> 4.9)
rubyzip (2.3.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
@@ -578,84 +539,79 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
scout_apm (5.3.3)
scout_apm (4.0.4)
parser
searchkick (4.6.3)
searchkick (4.4.4)
activemodel (>= 5)
elasticsearch (>= 6, < 7.14)
elasticsearch (>= 6)
hashie
selenium-webdriver (4.7.1)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sidekiq (7.0.2)
concurrent-ruby (< 2)
connection_pool (>= 2.3.0)
rack (>= 2.2.4)
redis-client (>= 0.11.0)
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
sexp_processor (4.15.0)
sidekiq (6.2.1)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
simplecov (0.13.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
smart_properties (1.17.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
ssrf_filter (1.0.7)
sysexits (1.2.0)
temple (0.9.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.2.1)
temple (0.8.2)
terminal-table (3.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thor (1.1.0)
thread_safe (0.3.6)
tilt (2.0.11)
timecop (0.9.6)
timeout (0.3.0)
tilt (2.0.10)
timecop (0.9.4)
trollop (1.16.2)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
tzinfo (1.2.9)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.3.0)
unicorn (6.1.0)
unicode-display_width (1.7.0)
unicorn (6.0.0)
kgio (~> 2.6)
raindrops (~> 0.7)
uniform_notifier (1.16.0)
validate_url (1.0.15)
uniform_notifier (1.14.0)
validate_url (1.0.13)
activemodel (>= 3.0.0)
public_suffix
warden (1.2.9)
rack (>= 2.0.9)
webdrivers (5.2.0)
webdrivers (4.6.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0)
selenium-webdriver (>= 3.0, < 4.0)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
webrick (1.7.0)
websocket (1.2.9)
websocket-driver (0.7.5)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
will_paginate (3.3.1)
will_paginate (3.3.0)
will_paginate-bootstrap4 (0.2.2)
will_paginate (~> 3.0, >= 3.0.0)
xmlrpc (0.3.2)
webrick
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.6)
zeitwerk (2.4.2)
PLATFORMS
ruby
x86_64-linux
DEPENDENCIES
active_median (= 0.2.0)
@@ -664,11 +620,11 @@ DEPENDENCIES
better_errors
bluecloth
bonsai-elasticsearch-rails
bootstrap (>= 4.6.2)
bootstrap (>= 4.3.1)
bootstrap-datepicker-rails
bootstrap_form (>= 4.5.0)
bootstrap_form (>= 4.2.0)
bullet
bundler (>= 2.3.10)
bundler (>= 1.1.5)
byebug
cancancan
capybara
@@ -677,7 +633,7 @@ DEPENDENCIES
chartkick
codeclimate-test-reporter
coffee-rails
comfortable_mexican_sofa!
comfortable_mexican_sofa (~> 2.0.0)
csv_shaper
dalli
database_cleaner
@@ -706,11 +662,11 @@ DEPENDENCIES
js-routes
jsonapi-resources
jsonapi-swagger
leaflet-rails (>= 1.9.2)
leaflet-rails
letter_opener
listen
loofah (>= 2.19.1)
mailboxer (>= 0.15.1)
loofah (>= 2.2.1)
mailboxer
material-sass (= 4.1.1)
material_icons
memcachier
@@ -719,14 +675,14 @@ DEPENDENCIES
omniauth-facebook
omniauth-flickr (>= 0.0.15)
omniauth-twitter
percy-capybara (~> 5.0.0)
pg
percy-capybara
pg (< 1.0.0)
platform-api
puma
query_diet
rack-cors
rack-protection (>= 2.0.1)
rails (~> 7.0.4)
rails (= 6.0.3.2)
rails-assets-leaflet.markercluster!
rails-controller-testing
rails_12factor
@@ -759,7 +715,7 @@ DEPENDENCIES
xmlrpc
RUBY VERSION
ruby 3.1.2p20
ruby 2.7.2p137
BUNDLED WITH
2.3.11
1.17.3

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 221 KiB

View File

@@ -13,6 +13,12 @@ module Admin
@members = @members.order(:login_name).paginate(page: params[:page])
end
def destroy
@member = Member.find_by!(slug: params[:slug])
@member.discard
redirect_to admin_members_path
end
def edit
@member = Member.find_by!(slug: params[:slug])
end
@@ -24,12 +30,6 @@ module Admin
respond_with @member, location: admin_members_path
end
def destroy
@member = Member.find_by!(slug: params[:slug])
@member.discard
redirect_to admin_members_path
end
private
def search_term

View File

@@ -14,14 +14,14 @@ class AuthenticationsController < ApplicationController
@authentication = current_member.authentications
.create_with(
name:,
name: name,
token: auth['credentials']['token'],
secret: auth['credentials']['secret']
)
.find_or_create_by(
provider: auth['provider'],
uid: auth['uid'],
name:
name: name
)
flash[:notice] = "Authentication successful."

View File

@@ -71,7 +71,7 @@ class ConversationsController < ApplicationController
@conversation = Mailboxer::Conversation.find_by(id: params[:id])
return unless @conversation.nil? || !@conversation.is_participant?(current_member)
redirect_to conversations_path(box:)
redirect_to conversations_path(box: box)
nil
end
end

View File

@@ -57,7 +57,7 @@ class CropsController < ApplicationController
@crops = CropSearchService.search(@term,
page: params[:page],
per_page: Crop.per_page,
current_member:)
current_member: current_member)
respond_with @crops
end
@@ -191,7 +191,7 @@ class CropsController < ApplicationController
end
def filename
"Growstuff-Crops-#{Time.zone.now.to_fs(:number)}.csv"
"Growstuff-Crops-#{Time.zone.now.to_s(:number)}.csv"
end
def crop_json_fields

View File

@@ -5,10 +5,6 @@ class FollowsController < ApplicationController
load_and_authorize_resource
skip_load_resource only: :create
def index
@follows = @member.followed.paginate(page: params[:page])
end
def create
@follow = current_member.follows.build(followed: Member.find(params[:followed]))
@@ -29,6 +25,10 @@ class FollowsController < ApplicationController
redirect_to @unfollowed
end
def index
@follows = @member.followed.paginate(page: params[:page])
end
def followers
@followers = @member.followers.paginate(page: params[:page])
end

View File

@@ -20,7 +20,7 @@ class HarvestsController < DataController
where['planting_id'] = @planting.id
end
@harvests = Harvest.search('*', where:,
@harvests = Harvest.search('*', where: where,
limit: 100,
page: params[:page],
load: false,
@@ -92,7 +92,7 @@ class HarvestsController < DataController
elsif @crop
"#{@crop.to_param}-"
end
"Growstuff-#{specifics}Harvests-#{Time.zone.now.to_fs(:number)}.csv"
"Growstuff-#{specifics}Harvests-#{Time.zone.now.to_s(:number)}.csv"
end
def update_crop_medians

View File

@@ -39,7 +39,7 @@ class LikesController < ApplicationController
{
id: like.likeable.id,
like_count: like.likeable.likes.count,
liked_by_member:,
liked_by_member: liked_by_member,
description: ActionController::Base.helpers.pluralize(like.likeable.likes.count, "like")
}
end
@@ -50,7 +50,7 @@ class LikesController < ApplicationController
format.json do
render(json: render_json(
like,
liked_by_member:
liked_by_member: liked_by_member
), status: status_code)
end
end

View File

@@ -8,6 +8,11 @@ class PhotosController < ApplicationController
respond_to :html, :json
responders :flash
def show
@crops = Crop.distinct.joins(:photo_associations).where(photo_associations: { photo: @photo })
respond_with(@photo)
end
def index
@photos = Photo.search(
load: false,
@@ -19,11 +24,6 @@ class PhotosController < ApplicationController
respond_with(@photos)
end
def show
@crops = Crop.distinct.joins(:photo_associations).where(photo_associations: { photo: @photo })
respond_with(@photo)
end
def new
@photo = Photo.new
@item = item_to_link_to

View File

@@ -21,14 +21,14 @@ class PlantingsController < DataController
end
@plantings = Planting.search(
where:,
where: where,
page: params[:page],
limit: 30,
boost_by: [:created_at],
load: false
)
@filename = "Growstuff-#{specifics}Plantings-#{Time.zone.now.to_fs(:number)}.csv"
@filename = "Growstuff-#{specifics}Plantings-#{Time.zone.now.to_s(:number)}.csv"
respond_with(@plantings)
end

View File

@@ -24,7 +24,7 @@ class SeedsController < DataController
@filename = csv_filename
@seeds = Seed.search(
where:,
where: where,
page: params[:page],
limit: 30,
boost_by: [:created_at],
@@ -89,9 +89,9 @@ class SeedsController < DataController
def csv_filename
if @owner
"Growstuff-#{@owner.to_param}-Seeds-#{Time.zone.now.to_fs(:number)}.csv"
"Growstuff-#{@owner.to_param}-Seeds-#{Time.zone.now.to_s(:number)}.csv"
else
"Growstuff-Seeds-#{Time.zone.now.to_fs(:number)}.csv"
"Growstuff-Seeds-#{Time.zone.now.to_s(:number)}.csv"
end
end
end

View File

@@ -24,7 +24,7 @@ module ApplicationHelper
# Produces a cache key for uniquely identifying cached fragments.
def cache_key_for(klass, identifier = "all")
count = klass.count
max_updated_at = klass.maximum(:updated_at).try(:utc).try(:to_fs, :number)
max_updated_at = klass.maximum(:updated_at).try(:utc).try(:to_s, :number)
"#{klass.name.downcase.pluralize}/#{identifier}-#{count}-#{max_updated_at}"
end
@@ -55,7 +55,7 @@ module ApplicationHelper
return uri.to_s
end
Gravatar.new(member.email).image_url(size:,
Gravatar.new(member.email).image_url(size: size,
default: :identicon,
ssl: true)
end
@@ -70,11 +70,11 @@ module ApplicationHelper
all = show_all ? '' : 1
if owner.present?
public_send("member_#{type}_path", owner, all:)
public_send("member_#{type}_path", owner, all: all)
elsif crop.present?
public_send("crop_#{type}_path", crop, all:)
public_send("crop_#{type}_path", crop, all: all)
else
public_send("#{type}_path", all:)
public_send("#{type}_path", all: all)
end
end

View File

@@ -44,19 +44,19 @@ module ButtonsHelper
end
def seed_edit_button(seed, classes: "btn btn-raised btn-info")
edit_button(edit_seed_path(seed), classes:)
edit_button(edit_seed_path(seed), classes: classes)
end
def harvest_edit_button(harvest, classes: "btn btn-raised btn-info")
edit_button(edit_harvest_path(harvest), classes:)
edit_button(edit_harvest_path(harvest), classes: classes)
end
def garden_edit_button(garden, classes: "btn btn-raised btn-info")
edit_button(edit_garden_path(garden), classes:)
edit_button(edit_garden_path(garden), classes: classes)
end
def planting_edit_button(planting, classes: "btn btn-raised btn-info")
edit_button(edit_planting_path(planting), classes:)
edit_button(edit_planting_path(planting), classes: classes)
end
def planting_finish_button(planting, classes: 'btn btn-default btn-secondary')

View File

@@ -2,7 +2,7 @@
module CropsHelper
def display_seed_availability(member, crop)
seeds = member.seeds.where(crop:)
seeds = member.seeds.where(crop: crop)
total_quantity = seeds.where.not(quantity: nil).sum(:quantity)
return "You don't have any seeds of this crop." if seeds.none?

View File

@@ -2,7 +2,7 @@
module EditableFormHelper
def editable(field_type, model, field, display_field:, collection: [])
render 'shared/editable/form', field_type:,
model:, field:, display_field:, collection:
render 'shared/editable/form', field_type: field_type,
model: model, field: field, display_field: display_field, collection: collection
end
end

View File

@@ -2,11 +2,11 @@
module PostsHelper
def display_post_truncated(post, length: 300)
truncate(strip_tags(post.body), length:,
truncate(strip_tags(post.body), length: length,
separator: ' ', omission: '... ') { link_to "Read more", post_path(post) }
end
def post_stripped_tags(post, length: 300)
truncate(strip_tags(post.body), length:)
truncate(strip_tags(post.body), length: length)
end
end

View File

@@ -70,7 +70,7 @@ class Ability
can :create, Notification do |n|
n.recipient_id != member.id
end
# NOTE: we don't support update for notifications
# note we don't support update for notifications
# only crop wranglers can create/edit/destroy crops
if member.role? :crop_wrangler

View File

@@ -15,7 +15,7 @@ class Comment < ApplicationRecord
recipient_id: recipient,
sender_id: sender,
subject: "#{author} commented on #{post.subject}",
body:,
body: body,
post_id: post.id
)
end

View File

@@ -32,8 +32,8 @@ module MemberNewsletter
gibbon.lists.subscribe(
id: Rails.application.config.newsletter_list_id,
email: { email: },
merge_vars: { login_name: },
email: { email: email },
merge_vars: { login_name: login_name },
double_optin: false # they already confirmed their email with us
)
end
@@ -42,7 +42,7 @@ module MemberNewsletter
return true if Rails.env.test? && !testing
gibbon.lists.unsubscribe(id: Rails.application.config.newsletter_list_id,
email: { email: })
email: { email: email })
end
end
end

View File

@@ -33,7 +33,7 @@ module PredictHarvest
days_to_first_harvest = (first_harvest_date - planted_at).to_i
days_to_last_harvest = (last_harvest_date - planted_at).to_i if finished?
end
update(days_to_first_harvest:, days_to_last_harvest:)
update(days_to_first_harvest: days_to_first_harvest, days_to_last_harvest: days_to_last_harvest)
end
# status

View File

@@ -29,19 +29,19 @@ module SearchCrops
def search_data
{
name:,
description:,
slug:,
name: name,
description: description,
slug: slug,
alternate_names: alternate_names.pluck(:name),
scientific_names: scientific_names.pluck(:name),
photos_count: photo_associations_count,
# boost the crops that are planted the most
plantings_count:,
harvests_count:,
plantings_count: plantings_count,
harvests_count: harvests_count,
# boost this crop for these members
planters_ids: plantings.pluck(:owner_id),
has_photos: photos.size.positive?,
thumbnail_url:,
thumbnail_url: thumbnail_url,
scientific_name: default_scientific_name&.name,
created_at: created_at.to_i
}

View File

@@ -17,22 +17,22 @@ module SearchHarvests
def search_data
{
slug:,
quantity:,
slug: slug,
quantity: quantity,
# crop
crop_id:,
crop_name:,
crop_id: crop_id,
crop_name: crop_name,
crop_slug: crop.slug,
# owner
owner_id:,
owner_login_name:,
owner_slug:,
owner_id: owner_id,
owner_login_name: owner_login_name,
owner_slug: owner_slug,
plant_part_name: plant_part&.name,
# planting
planting_id:,
planting_id: planting_id,
planting_slug: planting&.slug,
# photo
@@ -43,7 +43,7 @@ module SearchHarvests
photos_count: photos.count,
# timestamps
harvested_at:,
harvested_at: harvested_at,
created_at: created_at.to_i
}
end
@@ -58,7 +58,7 @@ module SearchHarvests
}
one_record = search('*',
limit: 1,
where:,
where: where,
boost_by: [:created_at],
load: false).first
return records if one_record.nil?

View File

@@ -15,20 +15,20 @@ module SearchPhotos
def search_data
{
id:,
title:,
thumbnail_url:,
fullsize_url:,
id: id,
title: title,
thumbnail_url: thumbnail_url,
fullsize_url: fullsize_url,
# crops
crops: crops.pluck(:id),
# likes
liked_by_members_names:,
liked_by_members_names: liked_by_members_names,
# owner
owner_id:,
owner_login_name:,
owner_slug:,
owner_id: owner_id,
owner_login_name: owner_login_name,
owner_slug: owner_slug,
# counts
likes_count:,
likes_count: likes_count,
created_at: created_at.to_i
}

View File

@@ -18,39 +18,39 @@ module SearchPlantings
def search_data
{
slug:,
active:,
slug: slug,
active: active,
finished: finished?,
has_photos: photos.size.positive?,
location:,
location: location,
percentage_grown: percentage_grown.to_i,
planted_at:,
planted_from:,
planted_at: planted_at,
planted_from: planted_from,
planted_year: planted_at&.year,
quantity:,
sunniness:,
garden_id:,
quantity: quantity,
sunniness: sunniness,
garden_id: garden_id,
first_harvest_predicted_at:,
finish_predicted_at:,
first_harvest_predicted_at: first_harvest_predicted_at,
finish_predicted_at: finish_predicted_at,
# crops
crop_id:,
crop_name:,
crop_slug:,
crop_perennial:,
crop_id: crop_id,
crop_name: crop_name,
crop_slug: crop_slug,
crop_perennial: crop_perennial,
# owner
owner_id:,
owner_location:,
owner_login_name:,
owner_slug:,
owner_id: owner_id,
owner_location: owner_location,
owner_login_name: owner_login_name,
owner_slug: owner_slug,
# photos
thumbnail_url: default_photo&.thumbnail_url || crop.default_photo&.thumbnail_url,
# counts
photos_count: photos.size,
harvests_count:,
harvests_count: harvests_count,
# timestamps
created_at: created_at.to_i
@@ -67,7 +67,7 @@ module SearchPlantings
}
one_record = search('*',
limit: 1,
where:,
where: where,
boost_by: [:created_at],
load: false).first
return records if one_record.nil?

View File

@@ -18,31 +18,31 @@ module SearchSeeds
def search_data
{
slug:,
slug: slug,
finished: finished?,
gmo:,
active:,
heirloom:,
gmo: gmo,
active: active,
heirloom: heirloom,
location: owner.location,
organic:,
quantity:,
plant_before: plant_before&.to_fs(:ymd),
tradable_to:,
tradable:,
organic: organic,
quantity: quantity,
plant_before: plant_before&.to_s(:ymd),
tradable_to: tradable_to,
tradable: tradable,
# crop
crop_id:,
crop_id: crop_id,
crop_name: crop.name,
crop_slug: crop.slug,
# owner
owner_id:,
owner_location:,
owner_login_name:,
owner_slug:,
owner_id: owner_id,
owner_location: owner_location,
owner_login_name: owner_login_name,
owner_slug: owner_slug,
# planting
parent_planting:,
parent_planting: parent_planting,
# counts
photos_count: photos.size,
@@ -56,7 +56,7 @@ module SearchSeeds
end
def self.homepage_records(limit)
search('*', limit:,
search('*', limit: limit,
where: {
finished: false,
tradable: true

View File

@@ -10,9 +10,9 @@ class CsvImporter
def import_crop(row)
name, en_wikipedia_url, parent_name, scientific_names, alternate_names = row
@crop = Crop.find_or_create_by(name:)
@crop = Crop.find_or_create_by(name: name)
@crop.update(
en_wikipedia_url:,
en_wikipedia_url: en_wikipedia_url,
creator_id: cropbot.id
)
@@ -47,8 +47,8 @@ class CsvImporter
return if names_to_add.empty?
names_to_add.each do |name|
sciname = ScientificName.find_by(name:, crop: @crop)
sciname ||= ScientificName.create!(name:, crop: @crop, creator: cropbot)
sciname = ScientificName.find_by(name: name, crop: @crop)
sciname ||= ScientificName.create!(name: name, crop: @crop, creator: cropbot)
@crop.scientific_names << sciname
end
end
@@ -58,7 +58,7 @@ class CsvImporter
return if alternate_names.blank?
alternate_names.split(/,\s*/).each do |name|
altname = AlternateName.find_by(name:, crop: @crop)
altname = AlternateName.find_by(name: name, crop: @crop)
altname ||= AlternateName.create! name: name, crop: @crop, creator: cropbot
@crop.alternate_names << altname
end

View File

@@ -21,7 +21,7 @@ class Member < ApplicationRecord
has_many :harvests, foreign_key: 'owner_id', dependent: :destroy, inverse_of: :owner
has_and_belongs_to_many :roles
has_many :notifications, foreign_key: 'recipient_id', inverse_of: :recipient
has_many :sent_notifications, foreign_key: 'sender_id', inverse_of: :sender, class_name: "Notification"
has_many :sent_notifications, foreign_key: 'sender_id', inverse_of: :sender
has_many :authentications, dependent: :destroy
has_many :photos, inverse_of: :owner
has_many :likes, dependent: :destroy
@@ -127,7 +127,7 @@ class Member < ApplicationRecord
end
def auth(provider)
authentications.find_by(provider:)
authentications.find_by(provider: provider)
end
def unread_count

View File

@@ -27,7 +27,7 @@ class Photo < ApplicationRecord
source_type: type
end
scope :by_crop, ->(crop) { joins(:photo_associations).where(photo_associations: { crop: }) }
scope :by_crop, ->(crop) { joins(:photo_associations).where(photo_associations: { crop: crop }) }
scope :by_model, lambda { |model_name|
joins(:photo_associations).where(photo_associations: { photographable_type: model_name.to_s })
}

View File

@@ -33,8 +33,8 @@ class PhotoAssociation < ApplicationRecord
end
def crop_present
return unless %w(Planting Seed Harvest).include?(photographable_type)
errors.add(:crop_id, "failed to calculate crop") if crop_id.blank?
if %w(Planting Seed Harvest).include?(photographable_type)
errors.add(:crop_id, "failed to calculate crop") if crop_id.blank?
end
end
end

View File

@@ -89,7 +89,7 @@ class Planting < ApplicationRecord
# stringify as "beet in Skud's backyard" or similar
def to_s
I18n.t('plantings.string', crop: crop.name, garden: garden.name, owner:)
I18n.t('plantings.string', crop: crop.name, garden: garden.name, owner: owner)
end
def finished?
@@ -109,7 +109,7 @@ class Planting < ApplicationRecord
# latitude, longitude = Geocoder.coordinates(location, params: { limit: 1 })
Planting.joins(:garden)
.where(crop:)
.where(crop: crop)
.located
.where('gardens.latitude < ? AND gardens.latitude > ?',
latitude + 10, latitude - 10)

View File

@@ -90,10 +90,10 @@ class Post < ApplicationRecord
next unless recipient_id != sender
Notification.create(
recipient_id:,
recipient_id: recipient_id,
sender_id: sender,
subject: "#{author} mentioned you in their post #{subject}",
body:
body: body
)
end
end

View File

@@ -11,7 +11,7 @@ class Role < ApplicationRecord
%i(crop_wranglers admins).each do |method|
define_method method do
slug = method.to_s.singularize.dasherize
Role.where(slug:).try(:first).try(:members)
Role.where(slug: slug).try(:first).try(:members)
end
end
end

View File

@@ -69,6 +69,6 @@ class Seed < ApplicationRecord
end
def to_s
I18n.t('seeds.string', crop: crop.name, owner:)
I18n.t('seeds.string', crop: crop.name, owner: owner)
end
end

View File

@@ -5,10 +5,10 @@ module Api
class MemberResource < BaseResource
immutable
has_many :gardens, foreign_key: 'owner_id'
has_many :plantings, foreign_key: 'owner_id'
has_many :harvests, foreign_key: 'owner_id'
has_many :seeds, foreign_key: 'owner_id'
has_many :gardens
has_many :plantings
has_many :harvests
has_many :seeds
has_many :photos

View File

@@ -33,7 +33,6 @@ module Api
filter :planted_from
filter :garden
filter :owner
filter :owner_id
filter :finished
attribute :percentage_grown

View File

@@ -4,8 +4,8 @@ class CropSearchService
# Crop.search(string)
def self.search(query, page: 1, per_page: 12, current_member: nil)
search_params = {
page:,
per_page:,
page: page,
per_page: per_page,
fields: %i(name^5 alternate_names scientific_names),
match: :word_start,
boost_by: [:plantings_count],
@@ -16,28 +16,28 @@ class CropSearchService
# prioritise crops the member has planted
search_params[:boost_where] = { planters_ids: current_member.id } if current_member
Crop.search(query, **search_params)
Crop.search(query, search_params)
end
def self.random_with_photos(limit)
body = {
query: {
function_score: {
query: { query_string: { query: 'has_photos:true' } },
random_score: { seed: DateTime.now.to_i }
"query": {
"function_score": {
"query": { "query_string": { "query": 'has_photos:true' } },
"random_score": { "seed": DateTime.now.to_i }
}
}
}
Crop.search(
limit:,
limit: limit,
load: false,
body:
body: body
)
end
def self.recent(limit)
Crop.search(
limit:,
limit: limit,
load: false,
boost_by: { created_at: { factor: 100 } } # default factor is 1
)

View File

@@ -10,7 +10,7 @@ class OpenfarmService
def import!
Crop.all.order(updated_at: :desc).each do |crop|
Rails.logger.debug { "#{crop.id}, #{crop.name}" }
Rails.logger.debug("#{crop.id}, #{crop.name}")
update_crop(crop) if crop.valid?
end
end
@@ -64,9 +64,9 @@ class OpenfarmService
if photo.valid?
Photo.transaction do
photo.save
PhotoAssociation.find_or_create_by! photo:, photographable: crop
PhotoAssociation.find_or_create_by! photo: photo, photographable: crop
end
Rails.logger.debug { "\t saved photo #{photo.id} #{photo.source_id}" }
Rails.logger.debug "\t saved photo #{photo.id} #{photo.source_id}"
else
Rails.logger.warn "Photo not valid"
end

View File

@@ -2,6 +2,6 @@
class ApprovedValidator < ActiveModel::EachValidator
def validate_each(record, attribute, _value)
record.errors.add(attribute, options[:message] || 'must be approved') unless record.crop.try(:approved?)
record.errors[attribute] << (options[:message] || 'must be approved') unless record.crop.try(:approved?)
end
end

View File

@@ -16,6 +16,6 @@
:escaped_markdown
#{ strip_tags comment.body }
%pubdate= comment.created_at.to_fs(:rfc822)
%pubdate= comment.created_at.to_s(:rfc822)
%link= post_url(comment.post)
%guid= comment_url(comment)

View File

@@ -107,8 +107,8 @@ csv.headers *all_headers
csv.cell :added_by_member_id, c.creator.id
csv.cell :added_by_member_name, c.creator.to_s
csv.cell :date_added, c.created_at.to_fs(:db)
csv.cell :last_modified, c.updated_at.to_fs(:db)
csv.cell :date_added, c.created_at.to_s(:db)
csv.cell :last_modified, c.updated_at.to_s(:db)
csv.cell :license, "CC-BY-SA Growstuff http://growstuff.org/"

View File

@@ -6,6 +6,6 @@
- @crops.each do |crop|
%item
%title= crop.name
%pubdate= crop.created_at.to_fs(:rfc822)
%pubdate= crop.created_at.to_s(:rfc822)
%link= crop_url(crop)
%guid= crop_url(crop)

View File

@@ -31,7 +31,7 @@
= link_to "Request new crops.", new_crop_path
.col-md-4
= f.text_field :harvested_at, value: @harvest.harvested_at ? @harvest.harvested_at.to_fs(:ymd) : '',
= f.text_field :harvested_at, value: @harvest.harvested_at ? @harvest.harvested_at.to_s(:ymd) : '',
class: 'add-datepicker', label: 'When?'
.col-12
= f.form_group :plant_part_id, label: { text: "Harvested Plant Part" } do

View File

@@ -34,12 +34,12 @@ csv.headers :id,
csv.cells :quantity, :unit, :weight_quantity, :weight_unit, :si_weight
csv.cell :date_harvested, h.created_at.to_fs(:db)
csv.cell :date_harvested, h.created_at.to_s(:db)
csv.cell :description
csv.cell :date_added, h.created_at.to_fs(:db)
csv.cell :last_modified, h.updated_at.to_fs(:db)
csv.cell :date_added, h.created_at.to_s(:db)
csv.cell :last_modified, h.updated_at.to_s(:db)
csv.cell :license, "CC-BY-SA Growstuff http://growstuff.org/"

View File

@@ -30,6 +30,6 @@
= csrf_meta_tags
= stylesheet_link_tag "application", media: "all"
%link{ href: path_to_image("growstuff-apple-touch-icon-precomposed.png"), rel: "apple-touch-icon-precomposed" }
%link{ href: "/growstuff-apple-touch-icon-precomposed.png", rel: "apple-touch-icon-precomposed" }
%link{ href: "https://fonts.googleapis.com/css?family=Modak|Raleway&display=swap", rel: "stylesheet" }
= favicon_link_tag 'favicon.ico'

View File

@@ -3,13 +3,13 @@
- if signed_in?
%li.nav-item
= link_to timeline_index_path, method: :get, class: 'nav-link text-white' do
= image_tag 'icons/notification.svg', class: 'img img-icon'
= image_tag 'icons/notification.svg', alt: 'Timeline', class: 'img img-icon'
%li.nav-item
= link_to member_gardens_path(current_member), class: 'nav-link text-white' do
= image_icon 'gardens'
= image_icon 'gardens', alt: 'My gardens'
%li.nav-item.dropdown
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#", role: "button"}
= image_tag "icons/gardener.svg", class: 'img img-icon'
= image_tag "icons/gardener.svg", alt: 'New record', class: 'img img-icon'
= t('.record')
.dropdown-menu
= link_to new_planting_path, class: 'dropdown-item' do

View File

@@ -30,7 +30,7 @@
= truncate(@member.location, length: 25, separator: ' ', omission: '... ')
%p
%strong Member since
= @member.created_at.to_fs(:date)
= @member.created_at.to_s(:date)
%p
%strong Last Login
= @member.last_sign_in_at

View File

@@ -6,7 +6,7 @@
- @member.posts.each do |post|
%item
%title #{post.subject} by #{post.author.login_name}
%pubdate= post.created_at.to_fs(:rfc822)
%pubdate= post.created_at.to_s(:rfc822)
%link= post_url(post)
%guid= post_url(post)
%description

View File

@@ -34,7 +34,7 @@
= link_to "Add a garden.", new_garden_path
.col-md-4
= f.text_field :planted_at,
value: @planting.planted_at ? @planting.planted_at.to_fs(:ymd) : '',
value: @planting.planted_at ? @planting.planted_at.to_s(:ymd) : '',
class: 'add-datepicker', label: 'When?'
.row
@@ -52,7 +52,7 @@
%span.help-block= t('.finish_helper')
.col-md-6
= f.text_field :finished_at,
value: @planting.finished_at ? @planting.finished_at.to_fs(:ymd) : '',
value: @planting.finished_at ? @planting.finished_at.to_s(:ymd) : '',
class: 'add-datepicker',
label: 'Finished date',
placeholder: 'optional'

View File

@@ -34,15 +34,15 @@ csv.headers :id,
csv.cells :quantity, :planted_from, :sunniness
csv.cell :date_planted, p.planted_at ? p.planted_at.to_fs(:db) : ''
csv.cell :date_planted, p.planted_at ? p.planted_at.to_s(:db) : ''
csv.cell :finished
csv.cell :date_finished, p.finished_at ? p.finished_at.to_fs(:db) : ''
csv.cell :date_finished, p.finished_at ? p.finished_at.to_s(:db) : ''
csv.cell :description
csv.cell :date_added, p.created_at.to_fs(:db)
csv.cell :last_modified, p.updated_at.to_fs(:db)
csv.cell :date_added, p.created_at.to_s(:db)
csv.cell :last_modified, p.updated_at.to_s(:db)
csv.cell :license, "CC-BY-SA Growstuff http://growstuff.org/"

View File

@@ -7,7 +7,7 @@
- @plantings.each do |planting|
%item
%title #{planting['crop_name']} in #{planting['location']}
%pubdate= planting['created_at'].to_fs(:rfc822)
%pubdate= planting['created_at'].to_s(:rfc822)
%description
:escaped
<p>Quantity: #{planting['quantity'] ? planting['quantity'] : 'unknown' }</p>

View File

@@ -10,6 +10,6 @@
%description
:escaped_markdown
#{ strip_tags post.body }
%pubdate= post.created_at.to_fs(:rfc822)
%pubdate= post.created_at.to_s(:rfc822)
%link= post_url(post)
%guid= post_url(post)

View File

@@ -17,6 +17,6 @@
:escaped_markdown
#{ strip_tags comment.body }
%pubdate= comment.created_at.to_fs(:rfc822)
%pubdate= comment.created_at.to_s(:rfc822)
%link= post_url(@post)
%guid= comment_url(comment)

View File

@@ -30,18 +30,18 @@
.row
.col-12.col-md-4
= f.text_field :saved_at,
value: @seed.saved_at ? @seed.saved_at.to_fs(:ymd) : '',
value: @seed.saved_at ? @seed.saved_at.to_s(:ymd) : '',
class: 'add-datepicker', label: 'When were the seeds harvested/saved?'
.col-12.col-md-4= f.number_field :quantity, label: 'Quantity'
.col-12.col-md-4
= f.text_field :plant_before, class: 'add-datepicker',
value: @seed.plant_before ? @seed.plant_before.to_fs(:ymd) : ''
value: @seed.plant_before ? @seed.plant_before.to_s(:ymd) : ''
.row
.col-12.col-md-4
= f.check_box :finished, label: 'Mark as finished'
.col-12.col-md-4
= f.text_field :finished_at, class: 'add-datepicker', value: @seed.finished_at ? @seed.finished_at.to_fs(:ymd) : ''
= f.text_field :finished_at, class: 'add-datepicker', value: @seed.finished_at ? @seed.finished_at.to_s(:ymd) : ''
.col-12.col-md-4
%span.help-inline= t('.finish_helper')

View File

@@ -44,8 +44,8 @@ csv.headers :id,
csv.cell :gmo
csv.cell :heirloom
csv.cell :date_added, s.created_at.to_fs(:db)
csv.cell :last_modified, s.updated_at.to_fs(:db)
csv.cell :date_added, s.created_at.to_s(:db)
csv.cell :last_modified, s.updated_at.to_s(:db)
csv.cell :license, "CC-BY-SA Growstuff http://growstuff.org/"

View File

@@ -7,7 +7,7 @@
- @seeds.each do |seed|
%item
%title #{seed.owner_login_name}'s #{seed.crop_name} seeds
%pubdate= seed.created_at.to_fs(:rfc822)
%pubdate= seed.created_at.to_s(:rfc822)
%description
:escaped
<p>Quantity: #{seed.quantity ||= 'unknown' }</p>

View File

@@ -6,6 +6,6 @@
.hide{id: "date--#{model.id}-#{field.to_s}"}
= bootstrap_form_for(model) do |f|
= f.text_field field,
value: model.send(field) ? model.send(field).to_fs(:ymd) : '',
value: model.send(field) ? model.send(field).to_s(:ymd) : '',
class: 'add-datepicker', label: 'When?'
= f.submit :save

View File

@@ -13,6 +13,6 @@
= f.select field, collection
- elsif field_type == :date
= f.text_field field,
value: model.send(field) ? model.send(field).to_fs(:ymd) : '',
value: model.send(field) ? model.send(field).to_s(:ymd) : '',
class: 'add-datepicker', label: 'When?'
= f.submit :save

View File

@@ -12,12 +12,10 @@ Bundler.require(*Rails.groups)
module Growstuff
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
config.load_defaults 6.0
I18n.config.enforce_available_locales = true
config.active_record.legacy_connection_handling = false
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = 'UTC'

View File

@@ -92,10 +92,10 @@ Rails.application.configure do
config.action_mailer.default_url_options = { host: ENV['HOST'] }
config.action_mailer.smtp_settings = {
user_name: ENV['MAILGUN_SMTP_LOGIN'],
password: ENV['MAILGUN_SMTP_PASSWORD'],
user_name: ENV['SENDGRID_USERNAME'],
password: ENV['SENDGRID_PASSWORD'],
domain: ENV['GROWSTUFF_EMAIL_DOMAIN'],
address: ENV['MAILGUN_SMTP_SERVER'],
address: 'smtp.sendgrid.net',
port: 587,
authentication: :plain,
enable_starttls_auto: true

View File

@@ -86,7 +86,7 @@ Devise.setup do |config|
config.stretches = Rails.env.test? ? 1 : 10
# Setup a pepper to generate the encrypted password.
# config.pepper = "..."
# config.pepper = "dd24b97208cc11ebae765edd19bee764aacafa99b3711440f08fe92e8f790d0b4ab60ebb6bc3bcc2c526438eefa50326eddf4d3e429a2431f8a646d8a7d7bd1f"
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
@@ -235,6 +235,5 @@ Devise.setup do |config|
# config.omniauth_path_prefix = "/my_engine/users/auth"
# Later we may wish to ask for user_photos,user_location, however this means we need to be reviewed by facebook
config.omniauth :facebook, ENV['GROWSTUFF_FACEBOOK_KEY'], ENV['GROWSTUFF_FACEBOOK_SECRET'], scope: 'email,public_profile',
display: 'page', info_fields: 'email,name,first_name,last_name,id'
config.omniauth :facebook, ENV['GROWSTUFF_FACEBOOK_KEY'], ENV['GROWSTUFF_FACEBOOK_SECRET'], scope: 'email,public_profile', display: 'page', info_fields: 'email,name,first_name,last_name,id'
end

View File

@@ -3,7 +3,7 @@
if ENV['MY_RUBY_HOME']&.include?('rvm')
begin
require 'rvm'
RVM.use_from_path! File.dirname(__FILE__, 2)
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."

View File

@@ -1,7 +1,14 @@
# frozen_string_literal: true
class CreateCms < ActiveRecord::Migration[4.2]
def self.up # rubocop:disable Metrics/MethodLength
def self.up # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
text_limit = case ActiveRecord::Base.connection.adapter_name
when 'PostgreSQL'
{}
else
{ limit: 16_777_215 }
end
# -- Sites --------------------------------------------------------------
create_table :comfy_cms_sites do |t|
t.string :label, null: false
@@ -21,9 +28,9 @@ class CreateCms < ActiveRecord::Migration[4.2]
t.string :app_layout
t.string :label, null: false
t.string :identifier, null: false
t.text :content
t.text :css
t.text :js
t.text :content, text_limit
t.text :css, text_limit
t.text :js, text_limit
t.integer :position, null: false, default: 0
t.boolean :is_shared, null: false, default: false
t.timestamps null: true
@@ -39,8 +46,8 @@ class CreateCms < ActiveRecord::Migration[4.2]
t.integer :target_page_id
t.string :label, null: false
t.string :slug
t.string :full_path, null: false
t.text :content_cache
t.string :full_path, null: false
t.text :content_cache, text_limit
t.integer :position, null: false, default: 0
t.integer :children_count, null: false, default: 0
t.boolean :is_published, null: false, default: true
@@ -52,8 +59,8 @@ class CreateCms < ActiveRecord::Migration[4.2]
# -- Page Blocks --------------------------------------------------------
create_table :comfy_cms_blocks do |t|
t.string :identifier, null: false
t.text :content
t.string :identifier, null: false
t.text :content, text_limit
t.references :blockable, polymorphic: true
t.timestamps null: true
end
@@ -65,7 +72,7 @@ class CreateCms < ActiveRecord::Migration[4.2]
t.integer :site_id, null: false
t.string :label, null: false
t.string :identifier, null: false
t.text :content
t.text :content, text_limit
t.integer :position, null: false, default: 0
t.boolean :is_shared, null: false, default: false
t.timestamps null: true
@@ -94,7 +101,7 @@ class CreateCms < ActiveRecord::Migration[4.2]
create_table :comfy_cms_revisions, force: true do |t|
t.string :record_type, null: false
t.integer :record_id, null: false
t.text :data
t.text :data, text_limit
t.datetime :created_at
end
add_index :comfy_cms_revisions, %i(record_type record_id created_at),

View File

@@ -13,7 +13,7 @@ class CreateGardenTypes < ActiveRecord::Migration[5.2]
'wicking bed', 'permaculture', 'hydroponic', 'aquaponic', 'orchard', 'food forest',
'biodynamic'].each do |name|
say "Creating #{name}"
GardenType.create! name:
GardenType.create! name: name
end
end
end

View File

@@ -75,8 +75,8 @@ def load_test_users
suburb, _country, _state, latitude, longitude = row[0]
# Using 'update_column' method instead of 'update' so that
# it avoids accessing Geocoding service for faster processing
@user.gardens.first.update_columns(location: suburb, latitude:, longitude:)
@user.update_columns(location: suburb, latitude:, longitude:)
@user.gardens.first.update_columns(location: suburb, latitude: latitude, longitude: longitude)
@user.update_columns(location: suburb, latitude: latitude, longitude: longitude)
end
# Create a planting by the member

View File

@@ -43,14 +43,14 @@ class Growstuff::OauthSignupAction
member.authentications
.create_with(
name:,
name: name,
token: auth['credentials']['token'],
secret: auth['credentials']['secret']
)
.find_or_create_by(
provider: auth['provider'],
uid: auth['uid'],
name:,
name: name,
member_id: member.id
)
end
@@ -60,13 +60,16 @@ class Growstuff::OauthSignupAction
end
def determine_name(auth)
name = ''
case auth['provider']
when 'twitter'
auth['info']['nickname']
name = auth['info']['nickname']
when 'flickr', 'facebook'
auth['info']['name']
name = auth['info']['name']
else
auth['info']['name']
name = auth['info']['name']
end
name
end
end

View File

@@ -15,10 +15,10 @@ module Haml::Filters
private
CROP_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(crop\)/
MEMBER_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(member\)/
MEMBER_AT_REGEX = /(?<!\\)(@\w+)/
MEMBER_ESCAPE_AT_REGEX = /(?<!\\)\\(?=@\w+)/
CROP_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(crop\)/.freeze
MEMBER_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(member\)/.freeze
MEMBER_AT_REGEX = /(?<!\\)(@\w+)/.freeze
MEMBER_ESCAPE_AT_REGEX = /(?<!\\)\\(?=@\w+)/.freeze
HOST = Rails.application.config.host
def expand_crops!

View File

@@ -20,7 +20,7 @@ namespace :growstuff do
raise "Usage: rake growstuff:[rolename] name=[username] "\
"\n (login name is case-sensitive)\n"
end
member = Member.find_by!(login_name:)
member = Member.find_by!(login_name: login_name)
role = Role.find_by!(name: role_name)
member.roles << role
end

View File

@@ -4,17 +4,17 @@
"description": "Growstuff Linters",
"main": "index.js",
"dependencies": {
"mdbootstrap": "^4.20.0"
"@percy/agent": "^0.3.1",
"mdbootstrap": "^4.12.0"
},
"engines": {
"node": ">=6.0.0",
"yarn": ">=0.25.2"
},
"devDependencies": {
"@coffeelint/cli": "^3.0.0",
"@percy/cli": "^1.0.0-beta.76",
"coffeelint": "^2.0.7",
"csslint": "^1.0.5",
"eslint": "^5.0.0",
"eslint": "^4.14.0",
"eslint-config-google": "^0.9.1",
"jshint": "^2.9.4"
},

View File

@@ -11,14 +11,12 @@ describe Admin::RolesController do
describe "GET index" do
before { get :index }
it { expect(assigns(:roles)).to be_nil }
it { expect(assigns(:roles)).to eq(nil) }
end
describe "GET new" do
before { get :new }
it { expect(assigns(:role)).to be_nil }
it { expect(assigns(:role)).to eq nil }
end
describe "create" do
@@ -29,13 +27,11 @@ describe Admin::RolesController do
describe "GET edit" do
before { get :edit, params: { id: role.to_param } }
it { expect(assigns(:role)).to be_nil }
it { expect(assigns(:role)).to eq(nil) }
end
describe "update" do
before { patch :update, params: { id: role.id, role: { name: 'updated role' } } }
it { expect(Role.first.name).to eq 'MyString' }
end
end
@@ -45,13 +41,11 @@ describe Admin::RolesController do
describe "GET index" do
before { get :index }
it { expect(assigns(:roles)).to eq([Role.find_by(name: 'admin'), role]) }
end
describe "GET new" do
before { get :new }
it { expect(assigns(:role)).to be_a(Role) }
end
@@ -65,13 +59,11 @@ describe Admin::RolesController do
describe "GET edit" do
before { get :edit, params: { id: role.to_param } }
it { expect(assigns(:role)).to eq(role) }
end
describe "update" do
before { patch :update, params: { id: role.id, role: { name: 'updated role' } } }
it { expect(Role.first.name).to eq 'updated role' }
end
end

View File

@@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Api::V1::PlantingsController, type: :controller do
subject { JSON.parse response.body }
let!(:member) { FactoryBot.create(:member) }
let!(:member) { FactoryBot.create :member }
describe '#index' do
let(:matching_planting) { subject['data'].select { |planting| planting['id'] == my_planting.id.to_s }.first }

View File

@@ -4,7 +4,7 @@ require 'rails_helper'
describe Charts::CropsController do
describe 'GET charts' do
let(:crop) { FactoryBot.create(:crop) }
let(:crop) { FactoryBot.create :crop }
describe 'sunniness' do
before { get :sunniness, params: { crop_slug: crop.to_param } }

View File

@@ -5,7 +5,7 @@ require 'rails_helper'
describe Charts::GardensController do
include Devise::Test::ControllerHelpers
let(:garden) { FactoryBot.create(:garden) }
let(:garden) { FactoryBot.create :garden }
context "when not signed in" do
describe 'GET timeline' do

View File

@@ -18,8 +18,8 @@ describe CommentsController do
end
describe "GET RSS feed" do
let!(:first_comment) { FactoryBot.create(:comment, created_at: 10.days.ago) }
let!(:last_comment) { FactoryBot.create(:comment, created_at: 4.minutes.ago) }
let!(:first_comment) { FactoryBot.create :comment, created_at: 10.days.ago }
let!(:last_comment) { FactoryBot.create :comment, created_at: 4.minutes.ago }
describe "returns an RSS feed" do
before { get :index, format: "rss" }
@@ -37,7 +37,7 @@ describe CommentsController do
describe "with valid params" do
before { get :new, params: { post_id: post.id } }
let(:old_comment) { FactoryBot.create(:comment, post:) }
let(:old_comment) { FactoryBot.create(:comment, post: post) }
it "picks up post from params" do
expect(assigns(:post)).to eq(post)
@@ -60,8 +60,8 @@ describe CommentsController do
before { get :edit, params: { id: comment.to_param } }
describe "my comment" do
let!(:comment) { FactoryBot.create(:comment, author: member, post:) }
let!(:old_comment) { FactoryBot.create(:comment, post:, created_at: Time.zone.yesterday) }
let!(:comment) { FactoryBot.create :comment, author: member, post: post }
let!(:old_comment) { FactoryBot.create(:comment, post: post, created_at: Time.zone.yesterday) }
it "assigns previous comments as @comments" do
expect(assigns(:comments)).to eq([comment, old_comment])
@@ -69,7 +69,7 @@ describe CommentsController do
end
describe "not my comment" do
let(:comment) { FactoryBot.create(:comment, post:) }
let(:comment) { FactoryBot.create :comment, post: post }
it { expect(response).not_to be_successful }
end
@@ -79,7 +79,7 @@ describe CommentsController do
before { put :update, params: { id: comment.to_param, comment: valid_attributes } }
describe "my comment" do
let(:comment) { FactoryBot.create(:comment, author: member) }
let(:comment) { FactoryBot.create :comment, author: member }
it "redirects to the comment's post" do
expect(response).to redirect_to(comment.post)
@@ -87,16 +87,16 @@ describe CommentsController do
end
describe "not my comment" do
let(:comment) { FactoryBot.create(:comment) }
let(:comment) { FactoryBot.create :comment }
it { expect(response).not_to be_successful }
end
describe "attempting to change post_id" do
let(:post) { FactoryBot.create(:post, subject: 'our post') }
let(:other_post) { FactoryBot.create(:post, subject: 'the other post') }
let(:valid_attributes) { { post_id: other_post.id, body: "kōrero" } }
let(:comment) { FactoryBot.create(:comment, author: member, post:) }
let(:post) { FactoryBot.create :post, subject: 'our post' }
let(:other_post) { FactoryBot.create :post, subject: 'the other post' }
let(:valid_attributes) { { post_id: other_post.id, body: "kōrero" } }
let(:comment) { FactoryBot.create :comment, author: member, post: post }
it "does not change post_id" do
comment.reload
@@ -109,7 +109,7 @@ describe CommentsController do
before { delete :destroy, params: { id: comment.to_param } }
describe "my comment" do
let(:comment) { FactoryBot.create(:comment, author: member) }
let(:comment) { FactoryBot.create :comment, author: member }
it "redirects to the post the comment was on" do
expect(response).to redirect_to(comment.post)
@@ -117,7 +117,7 @@ describe CommentsController do
end
describe "not my comment" do
let(:comment) { FactoryBot.create(:comment) }
let(:comment) { FactoryBot.create :comment }
it { expect(response).not_to be_successful }
end

View File

@@ -3,12 +3,12 @@
require 'rails_helper'
describe CropsController do
subject { response }
shared_context 'login as wrangler' do
login_member(:crop_wrangling_member)
end
subject { response }
describe "GET crop wrangler homepage" do
describe 'fetches the crop wrangler homepage' do
context 'anonymous' do
@@ -42,11 +42,9 @@ describe CropsController do
describe "GET crop search" do
describe 'fetches the crop search page' do
let!(:tomato) { FactoryBot.create(:tomato) }
let!(:maize) { FactoryBot.create(:maize) }
let!(:tomato) { FactoryBot.create :tomato }
let!(:maize) { FactoryBot.create :maize }
before { Crop.reindex }
describe 'search form page' do
before { get :search }
@@ -56,7 +54,6 @@ describe CropsController do
describe 'perform a search' do
before { get :search, params: { term: 'tom' } }
it { expect(assigns(:term)).to eq 'tom' }
it { expect(assigns(:crops).map(&:name)).to eq ['tomato'] }
end
@@ -74,8 +71,6 @@ describe CropsController do
end
describe 'CREATE' do
subject { put :create, params: crop_params }
let(:crop_params) do
{
crop: {
@@ -86,15 +81,13 @@ describe CropsController do
sci_name: { "1": "fancy sci name", "2": "" }
}
end
subject { put :create, params: crop_params }
context 'not logged in' do
it { expect { subject }.not_to change(Crop, :count) }
end
context 'logged in as member' do
it { expect { subject }.not_to change(Crop, :count) }
end
context 'wrangler' do
include_context 'login as wrangler'
it { expect { subject }.to change(Crop, :count).by(1) }
@@ -106,7 +99,7 @@ describe CropsController do
describe 'DELETE destroy' do
subject { delete :destroy, params: { slug: crop.to_param } }
let!(:crop) { FactoryBot.create(:crop) }
let!(:crop) { FactoryBot.create :crop }
context 'not logged in' do
it { expect { subject }.not_to change(Crop, :count) }

View File

@@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe GardenTypesController, type: :controller do
include Devise::Test::ControllerHelpers
let(:valid_params) { { name: 'My second GardenType' } }
let(:garden_type) { FactoryBot.create(:garden_type) }
let(:garden_type) { FactoryBot.create :garden_type }
context "when not signed in" do
describe 'GET new' do

View File

@@ -6,7 +6,7 @@ RSpec.describe GardensController, type: :controller do
include Devise::Test::ControllerHelpers
let(:valid_params) { { name: 'My second Garden' } }
let(:garden) { FactoryBot.create(:garden) }
let(:garden) { FactoryBot.create :garden }
context "when not signed in" do
describe 'GET new' do

View File

@@ -153,7 +153,7 @@ describe HarvestsController, :search do
let(:harvest) { Harvest.create! valid_attributes }
it "updates the requested harvest" do
new_crop = FactoryBot.create(:crop)
new_crop = FactoryBot.create :crop
expect do
put :update, params: { slug: harvest.to_param, harvest: { crop_id: new_crop.id } }
harvest.reload
@@ -201,7 +201,7 @@ describe HarvestsController, :search do
}
end
it { expect(harvest.planting_id).to be_nil }
it { expect(harvest.planting_id).to eq(nil) }
end
end
end

View File

@@ -3,7 +3,7 @@
require 'rails_helper'
describe LikesController do
let(:like) { FactoryBot.create(:like, member:) }
let(:like) { FactoryBot.create :like, member: member }
let(:member) { FactoryBot.create(:member) }
let(:blogpost) { FactoryBot.create(:post) }
@@ -37,7 +37,7 @@ describe LikesController do
end
describe "Deleting someone else's like" do
let(:like) { FactoryBot.create(:like) }
let(:like) { FactoryBot.create :like }
it { expect(response.code).to eq('403') }
it { JSON.parse(response.body)["error"] == "Unable to like" }

View File

@@ -17,8 +17,8 @@ describe PhotoAssociationsController do
before { photo.harvests << harvest }
describe "my harvest my photo" do
let(:harvest) { FactoryBot.create(:harvest, owner: member) }
let(:photo) { FactoryBot.create(:photo, owner: member) }
let(:harvest) { FactoryBot.create :harvest, owner: member }
let(:photo) { FactoryBot.create :photo, owner: member }
it "removes link" do
expect { delete :destroy, params: valid_params }.to change { photo.harvests.count }.by(-1)
@@ -26,8 +26,8 @@ describe PhotoAssociationsController do
end
describe "another member's harvest from another member's photo" do
let(:harvest) { FactoryBot.create(:harvest, owner: photo.owner) }
let(:photo) { FactoryBot.create(:photo) }
let(:harvest) { FactoryBot.create :harvest, owner: photo.owner }
let(:photo) { FactoryBot.create :photo }
it do
expect do

View File

@@ -7,7 +7,7 @@ describe PhotosController, :search do
describe 'GET index' do
describe 'all photos' do
let!(:photo) { FactoryBot.create(:photo, :reindex) }
let!(:photo) { FactoryBot.create :photo, :reindex }
before do
Photo.reindex
@@ -21,10 +21,10 @@ describe PhotosController, :search do
end
describe '#index crop photos' do
let!(:photo) { FactoryBot.create(:photo, :reindex, owner: member, title: 'no assocations photo') }
let!(:crop_photo) { FactoryBot.create(:photo, :reindex, owner: member, title: 'photos of planting') }
let!(:planting) { FactoryBot.create(:planting, :reindex, crop:, owner: member) }
let!(:crop) { FactoryBot.create(:crop, :reindex) }
let!(:photo) { FactoryBot.create :photo, :reindex, owner: member, title: 'no assocations photo' }
let!(:crop_photo) { FactoryBot.create :photo, :reindex, owner: member, title: 'photos of planting' }
let!(:planting) { FactoryBot.create :planting, :reindex, crop: crop, owner: member }
let!(:crop) { FactoryBot.create :crop, :reindex }
before do
planting.photos << crop_photo
@@ -36,7 +36,6 @@ describe PhotosController, :search do
it "has indexed the photos of this crop" do
expect(Photo.search).to include crop_photo
end
it "assigns crop" do
expect(assigns(:crop)).to eq crop
end
@@ -54,7 +53,7 @@ describe PhotosController, :search do
let(:garden) { FactoryBot.create(:garden, owner: member) }
let(:harvest) { FactoryBot.create(:harvest, owner: member) }
let(:member) { FactoryBot.create(:member) }
let!(:auth) { FactoryBot.create(:flickr_authentication, member:) }
let!(:auth) { FactoryBot.create(:flickr_authentication, member: member) }
before do
sign_in member
@@ -99,7 +98,7 @@ describe PhotosController, :search do
let(:member) { FactoryBot.create(:member) }
let(:garden) { FactoryBot.create(:garden, owner: member) }
let(:planting) { FactoryBot.create(:planting, garden:, owner: member) }
let(:planting) { FactoryBot.create(:planting, garden: garden, owner: member) }
let(:harvest) { FactoryBot.create(:harvest, owner: member) }
let(:photo) { FactoryBot.create(:photo, owner: member) }
@@ -113,7 +112,6 @@ describe PhotosController, :search do
type: "planting", id: planting.id
}
end
it { expect(flash[:alert]).not_to be_present }
it { expect(Photo.last.plantings.first).to eq planting }
end
@@ -147,7 +145,6 @@ describe PhotosController, :search do
photo: { source_id: photo.source_id, source: 'flickr' }, type: "harvest", id: harvest.id
}
end
it { expect(flash[:alert]).not_to be_present }
it { expect(Photo.last.harvests.size).to eq 1 }
end
@@ -163,7 +160,7 @@ describe PhotosController, :search do
end
describe "for the second time" do
let(:planting) { FactoryBot.create(:planting, owner: member) }
let(:planting) { FactoryBot.create :planting, owner: member }
let(:valid_params) { { photo: { source_id: 1 }, id: planting.id, type: 'planting' } }
it "does not add a photo twice" do
@@ -176,11 +173,9 @@ describe PhotosController, :search do
before { controller.stub(:current_member) { member } }
describe "creates the planting/photo link" do
let(:planting) { FactoryBot.create(:planting, garden:, owner: member) }
let(:planting) { FactoryBot.create(:planting, garden: garden, owner: member) }
let(:photo) { FactoryBot.create(:photo, owner: member) }
before { post :create, params: { photo: { source_id: photo.source_id, source: 'flickr' }, type: "planting", id: planting.id } }
it { expect(flash[:alert]).not_to be_present }
it { expect(Photo.last.plantings.first).to eq planting }
end

View File

@@ -17,9 +17,8 @@ describe PlantingsController, :search do
let!(:member2) { FactoryBot.create(:member) }
let!(:tomato) { FactoryBot.create(:tomato) }
let!(:maize) { FactoryBot.create(:maize) }
let!(:planting1) { FactoryBot.create(:planting, crop: tomato, owner: member1, created_at: 1.day.ago) }
let!(:planting2) { FactoryBot.create(:planting, crop: maize, owner: member2, created_at: 5.days.ago) }
let!(:planting1) { FactoryBot.create :planting, crop: tomato, owner: member1, created_at: 1.day.ago }
let!(:planting2) { FactoryBot.create :planting, crop: maize, owner: member2, created_at: 5.days.ago }
before do
Planting.reindex
end
@@ -111,7 +110,7 @@ describe PlantingsController, :search do
end
context 'with parent seed' do
let(:seed) { FactoryBot.create(:seed, owner: member) }
let(:seed) { FactoryBot.create :seed, owner: member }
before { get :new, params: { seed_id: seed.to_param } }
@@ -128,12 +127,10 @@ describe PlantingsController, :search do
end
describe 'GET :edit' do
let(:my_planting) { FactoryBot.create(:planting, owner: member) }
let(:not_my_planting) { FactoryBot.create(:planting) }
let(:my_planting) { FactoryBot.create :planting, owner: member }
let(:not_my_planting) { FactoryBot.create :planting }
context 'my planting' do
before { get :edit, params: { slug: my_planting } }
it { expect(assigns(:planting)).to eq my_planting }
end

View File

@@ -12,19 +12,15 @@ describe PostsController do
describe '#index' do
before do
FactoryBot.create_list(:post, 100)
FactoryBot.create_list(:post, 5, author: member)
FactoryBot.create_list :post, 100
FactoryBot.create_list :post, 5, author: member
end
describe "everyone's posts" do
before { get :index }
it { expect(assigns(:posts).size).to eq 12 }
end
describe "one member's posts" do
before { get :index, params: { member_slug: member.slug } }
it { expect(assigns(:posts).size).to eq 5 }
it { expect(assigns(:posts).first.author).to eq member }
end

View File

@@ -26,7 +26,7 @@ describe SeedsController, :search do
end
context 'with parent planting' do
let!(:planting) { FactoryBot.create(:planting, owner:) }
let!(:planting) { FactoryBot.create :planting, owner: owner }
before do
Seed.reindex

View File

@@ -55,7 +55,7 @@ FactoryBot.define do
factory :crop_with_photo do
name { 'marshmallow' }
photos { FactoryBot.create_list(:photo, 1) }
photos { FactoryBot.create_list :photo, 1 }
end
# This should have a name that is alphabetically earlier than :uppercase

View File

@@ -5,7 +5,7 @@
FactoryBot.define do
factory :harvest do
crop { planting.present? ? planting.crop : FactoryBot.create(:crop) }
plant_part { FactoryBot.create(:plant_part) }
plant_part { FactoryBot.create :plant_part }
planting { nil }
owner { planting.present? ? planting.owner : FactoryBot.create(:member) }
harvested_at { Time.zone.local(2015, 9, 17) }

View File

@@ -4,8 +4,8 @@
FactoryBot.define do
factory :notification, aliases: [:message] do
sender { FactoryBot.create(:member) }
recipient { FactoryBot.create(:member) }
sender { FactoryBot.create :member }
recipient { FactoryBot.create :member }
subject { "MyString" }
body { "MyText" }

View File

@@ -3,7 +3,7 @@
FactoryBot.define do
factory :planting do
owner
garden { FactoryBot.create(:garden, owner:) }
garden { FactoryBot.create :garden, owner: owner }
crop
planted_at { Time.zone.local(2014, 7, 30) }
quantity { 33 }
@@ -42,21 +42,21 @@ FactoryBot.define do
end
factory :annual_planting do
crop { FactoryBot.create(:annual_crop) }
crop { FactoryBot.create :annual_crop }
end
factory :perennial_planting do
crop { FactoryBot.create(:perennial_crop) }
crop { FactoryBot.create :perennial_crop }
end
factory :predicatable_planting do
crop do
crop = FactoryBot.create(:annual_crop)
FactoryBot.create(:planting, crop:, planted_at: 10.days.ago)
FactoryBot.create(:planting, crop:, planted_at: 100.days.ago, finished_at: 50.days.ago)
FactoryBot.create(:planting, crop:, planted_at: 100.days.ago, finished_at: 51.days.ago)
FactoryBot.create(:planting, crop:, planted_at: 2.years.ago, finished_at: 50.days.ago)
FactoryBot.create(:planting, crop:, planted_at: 150.days.ago, finished_at: 100.days.ago)
crop = FactoryBot.create :annual_crop
FactoryBot.create :planting, crop: crop, planted_at: 10.days.ago
FactoryBot.create :planting, crop: crop, planted_at: 100.days.ago, finished_at: 50.days.ago
FactoryBot.create :planting, crop: crop, planted_at: 100.days.ago, finished_at: 51.days.ago
FactoryBot.create :planting, crop: crop, planted_at: 2.years.ago, finished_at: 50.days.ago
FactoryBot.create :planting, crop: crop, planted_at: 150.days.ago, finished_at: 100.days.ago
crop.update_lifespan_medians
crop
end

View File

@@ -6,7 +6,7 @@ FactoryBot.define do
factory :role do
name { "Moderator" }
description { "These people moderate the forums" }
initialize_with { Role.find_or_create_by(name:) }
initialize_with { Role.find_or_create_by(name: name) }
factory :admin do
name { "admin" }

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