Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1b8d2211a |
47
.codeclimate.yml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
plugins:
|
||||||
|
brakeman:
|
||||||
|
enabled: false # codeclimate's brakeman is stuck in rails 5 rules
|
||||||
|
bundler-audit:
|
||||||
|
enabled: true
|
||||||
|
coffeelint:
|
||||||
|
enabled: true
|
||||||
|
duplication:
|
||||||
|
enabled: true
|
||||||
|
config:
|
||||||
|
languages:
|
||||||
|
- ruby
|
||||||
|
- javascript
|
||||||
|
editorconfig:
|
||||||
|
enabled: true
|
||||||
|
eslint:
|
||||||
|
enabled: true
|
||||||
|
fixme:
|
||||||
|
enabled: true
|
||||||
|
haml-lint:
|
||||||
|
enabled: true
|
||||||
|
nodesecurity:
|
||||||
|
enabled: true
|
||||||
|
rubocop:
|
||||||
|
enabled: true
|
||||||
|
channel: "rubocop-1-11"
|
||||||
|
scss-lint:
|
||||||
|
enabled: true
|
||||||
|
shellcheck:
|
||||||
|
enabled: true
|
||||||
|
ratings:
|
||||||
|
paths:
|
||||||
|
- "**.rb"
|
||||||
|
- "**.ru"
|
||||||
|
- "**.js"
|
||||||
|
- "**.coffee"
|
||||||
|
- "**.scss"
|
||||||
|
- "**.haml"
|
||||||
|
- Gemfile.lock
|
||||||
|
exclude_paths:
|
||||||
|
- config/
|
||||||
|
- db/
|
||||||
|
- spec/
|
||||||
|
- public/
|
||||||
|
- app/assets/stylesheets/bootstrap-accessibility.css
|
||||||
|
- app/assets/javascripts/bootstrap*
|
||||||
|
- app/assets/stylesheets/leaflet_overrides.scss
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# Ruby version
|
|
||||||
VARIANT=3.3.4
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
FROM mcr.microsoft.com/devcontainers/ruby:3.4-trixie
|
|
||||||
|
|
||||||
# Install Rails
|
|
||||||
RUN gem install rails:7.0.8
|
|
||||||
|
|
||||||
# Default value to allow debug server to serve content over GitHub Codespace's port forwarding service
|
|
||||||
# The value is a comma-separated list of allowed domains
|
|
||||||
ENV RAILS_DEVELOPMENT_HOSTS=".githubpreview.dev,.preview.app.github.dev,.app.github.dev"
|
|
||||||
|
|
||||||
#RUN bundle
|
|
||||||
#RUN bundle exec rake db:create
|
|
||||||
#RUN bundle exec rake db:migrate
|
|
||||||
|
|
||||||
# [Optional] Uncomment this section to install additional OS packages.
|
|
||||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|
||||||
&& apt-get -y install --no-install-recommends bash-completion
|
|
||||||
|
|
||||||
# Chrome for testing packages. https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-doesnt-launch-on-linux
|
|
||||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|
||||||
&& apt-get -y install --no-install-recommends ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
|
|
||||||
|
|
||||||
# [Optional] Uncomment this line to install additional gems.
|
|
||||||
# RUN gem install <your-gem-names-here>
|
|
||||||
|
|
||||||
# [Optional] Uncomment this line to install global node packages.
|
|
||||||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
|
||||||
|
|
||||||
# We run as the vscode user.
|
|
||||||
# Make sure this is writable as https://github.com/rubygems/rubygems/issues/6272 was removed
|
|
||||||
RUN su root -c "mkdir -p /usr/local/rvm/gems/default/cache/bundler/"
|
|
||||||
RUN su root -c "mkdir -p /usr/local/rvm/gems/default/bundler/gems/"
|
|
||||||
RUN su root -c "chown -R vscode:rvm /usr/local/rvm/gems/"
|
|
||||||
RUN su root -c "chmod -R 0755 /usr/local/rvm/gems/"
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
CREATE USER vscode CREATEDB;
|
|
||||||
CREATE DATABASE vscode WITH OWNER vscode;
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
||||||
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby-rails-postgres
|
|
||||||
{
|
|
||||||
"name": "Growstuff",
|
|
||||||
"dockerComposeFile": "docker-compose.yml",
|
|
||||||
"service": "app",
|
|
||||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
|
||||||
|
|
||||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
||||||
// Need something to get javascript working
|
|
||||||
"features": {
|
|
||||||
"ghcr.io/devcontainers/features/node:1": {}
|
|
||||||
},
|
|
||||||
|
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
||||||
// This can be used to network with other containers or the host.
|
|
||||||
"forwardPorts": [3000, 5432, 9200, 8081],
|
|
||||||
|
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
|
||||||
// these don't actually work as postCreateCommands, you need to run them manually
|
|
||||||
// for some unknown reason, Github codespaces use rbenv and rvm simultaneously
|
|
||||||
// and you need both to be correct for it to work
|
|
||||||
"postCreateCommand": "nice -n 19 bundle install && nice -n 19 bundle exec rake db:create && nice -n 19 bundle exec rake db:migrate && nice -n19 bundle exec rake db:seed",
|
|
||||||
|
|
||||||
// Configure tool-specific properties.
|
|
||||||
"customizations": {
|
|
||||||
"vscode": {
|
|
||||||
"extensions": [
|
|
||||||
"karunamurti.haml",
|
|
||||||
"redhat.vscode-yaml",
|
|
||||||
"CraigMaslowski.erb"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
|
||||||
// "remoteUser": "root"
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
build:
|
|
||||||
context: ..
|
|
||||||
dockerfile: .devcontainer/Dockerfile
|
|
||||||
depends_on:
|
|
||||||
db:
|
|
||||||
condition: service_healthy
|
|
||||||
elasticsearch:
|
|
||||||
condition: service_healthy
|
|
||||||
environment:
|
|
||||||
ELASTICSEARCH_URL: http://elasticsearch:9200/
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (local)"
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
volumes:
|
|
||||||
- ../..:/workspaces:cached
|
|
||||||
|
|
||||||
# Overrides default command so things don't shut down after the process ends.
|
|
||||||
command: sleep infinity
|
|
||||||
|
|
||||||
db:
|
|
||||||
image: postgres:17
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
|
||||||
- postgres-data:/var/lib/postgresql/data
|
|
||||||
- ./create-db-user.sql:/docker-entrypoint-initdb.d/create-db-user.sql
|
|
||||||
environment:
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_DB: growstuff_dev
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
ports:
|
|
||||||
- "5432:5432"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
elasticsearch:
|
|
||||||
image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0
|
|
||||||
container_name: elasticsearch
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
- xpack.security.enabled=false
|
|
||||||
- discovery.type=single-node
|
|
||||||
ulimits:
|
|
||||||
memlock:
|
|
||||||
soft: -1
|
|
||||||
hard: -1
|
|
||||||
nofile:
|
|
||||||
soft: 65536
|
|
||||||
hard: 65536
|
|
||||||
cap_add:
|
|
||||||
- IPC_LOCK
|
|
||||||
healthcheck:
|
|
||||||
test:
|
|
||||||
[
|
|
||||||
"CMD-SHELL",
|
|
||||||
"curl http://localhost:9200 | grep tagline",
|
|
||||||
]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 120
|
|
||||||
volumes:
|
|
||||||
- esdata01:/usr/share/elasticsearch/data
|
|
||||||
ports:
|
|
||||||
- 9200:9200
|
|
||||||
- 9300:9300
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
postgres-data:
|
|
||||||
certs:
|
|
||||||
driver: local
|
|
||||||
esdata01:
|
|
||||||
driver: local
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
.git
|
|
||||||
.github
|
|
||||||
.devcontainer
|
|
||||||
log/*
|
|
||||||
tmp/*
|
|
||||||
!tmp/keep
|
|
||||||
node_modules
|
|
||||||
public/assets
|
|
||||||
.env
|
|
||||||
.ruby-gemset
|
|
||||||
.editorconfig
|
|
||||||
.esignore
|
|
||||||
.eslintrc.json
|
|
||||||
.haml-lint.yml
|
|
||||||
.overcommit.yml
|
|
||||||
.rspec
|
|
||||||
.rubocop.yml
|
|
||||||
.rubocop_todo.yml
|
|
||||||
.scss-lint.yml
|
|
||||||
.travis.yml
|
|
||||||
.yamllint
|
|
||||||
CODE_OF_CONDUCT.md
|
|
||||||
CONTRIBUTING.md
|
|
||||||
CONTRIBUTORS.md
|
|
||||||
LICENSE.txt
|
|
||||||
README.md
|
|
||||||
TECH.md
|
|
||||||
docker-compose.yml
|
|
||||||
Dockerfile
|
|
||||||
.dockerignore
|
|
||||||
1
.github/FUNDING.yml
vendored
@@ -1 +0,0 @@
|
|||||||
ko_fi: jennyscottthompson
|
|
||||||
47
.github/dependabot.yml
vendored
@@ -5,12 +5,55 @@ updates:
|
|||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: daily
|
||||||
time: "07:00"
|
time: "07:00"
|
||||||
open-pull-requests-limit: 20
|
open-pull-requests-limit: 10
|
||||||
versioning-strategy: lockfile-only
|
versioning-strategy: lockfile-only
|
||||||
|
ignore:
|
||||||
|
- dependency-name: active_median
|
||||||
|
versions:
|
||||||
|
- "< 0.2.2, >= 0.2.1.a"
|
||||||
|
- dependency-name: rubocop
|
||||||
|
versions:
|
||||||
|
- "< 0.63, >= 0.62.a"
|
||||||
|
- dependency-name: rubocop
|
||||||
|
versions:
|
||||||
|
- "< 0.64, >= 0.63.a"
|
||||||
|
- dependency-name: sidekiq
|
||||||
|
versions:
|
||||||
|
- 5.2.4
|
||||||
|
- dependency-name: oj
|
||||||
|
versions:
|
||||||
|
- 3.11.4
|
||||||
|
- dependency-name: listen
|
||||||
|
versions:
|
||||||
|
- 3.5.0
|
||||||
|
- dependency-name: rspec-rails
|
||||||
|
versions:
|
||||||
|
- 4.1.0
|
||||||
|
- 5.0.0
|
||||||
|
- dependency-name: searchkick
|
||||||
|
versions:
|
||||||
|
- 4.4.3
|
||||||
|
- dependency-name: rswag-api
|
||||||
|
versions:
|
||||||
|
- 2.3.3
|
||||||
|
- dependency-name: rswag-specs
|
||||||
|
versions:
|
||||||
|
- 2.3.3
|
||||||
|
- dependency-name: rswag-ui
|
||||||
|
versions:
|
||||||
|
- 2.3.3
|
||||||
|
- dependency-name: timecop
|
||||||
|
versions:
|
||||||
|
- 0.9.3
|
||||||
|
- dependency-name: puma
|
||||||
|
versions:
|
||||||
|
- 5.2.0
|
||||||
|
- dependency-name: capybara
|
||||||
|
versions:
|
||||||
|
- 3.35.1
|
||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: daily
|
||||||
time: "07:00"
|
time: "07:00"
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
|
|
||||||
|
|||||||
44
.github/workflows/brakeman-analysis.yml
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# This workflow integrates Brakeman with GitHub's Code Scanning feature
|
||||||
|
# Brakeman is a static analysis security vulnerability scanner for Ruby on Rails applications
|
||||||
|
|
||||||
|
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 ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
brakeman-scan:
|
||||||
|
name: Brakeman Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Checkout the repository to the GitHub Actions runner
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2.3.4
|
||||||
|
|
||||||
|
# Customize the ruby version depending on your needs
|
||||||
|
- name: Setup Ruby
|
||||||
|
uses: actions/setup-ruby@v1.1.3
|
||||||
|
with:
|
||||||
|
ruby-version: '2.7'
|
||||||
|
|
||||||
|
- name: Setup Brakeman
|
||||||
|
env:
|
||||||
|
BRAKEMAN_VERSION: '4.10' # SARIF support is provided in Brakeman version 4.10+
|
||||||
|
run: |
|
||||||
|
gem install brakeman --version $BRAKEMAN_VERSION
|
||||||
|
|
||||||
|
# Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
|
||||||
|
- name: Scan
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
brakeman -f sarif -o output.sarif.json .
|
||||||
|
|
||||||
|
# Upload the SARIF file generated in the previous step
|
||||||
|
- name: Upload SARIF
|
||||||
|
uses: github/codeql-action/upload-sarif@v1
|
||||||
|
with:
|
||||||
|
sarif_file: output.sarif.json
|
||||||
109
.github/workflows/ci-features-admin.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Admin
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (admin/)
|
|
||||||
run: bundle exec rspec spec/features/admin/ -fd -t ~@flaky
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-comments.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Comments
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (comments/)
|
|
||||||
run: bundle exec rspec spec/features/comments/ -fd -t ~@flaky
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-conversations.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Conversations
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (conversations/)
|
|
||||||
run: bundle exec rspec spec/features/conversations/ -fd -t ~@flaky
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-crops.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Crops
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (crops/)
|
|
||||||
run: bundle exec rspec spec/features/crops/ -fd -t ~@flaky
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-gardens.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Gardens
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (gardens/)
|
|
||||||
run: bundle exec rspec spec/features/gardens/ -fd -t ~@flaky
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-harvests.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Harvests
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (harvests/)
|
|
||||||
run: bundle exec rspec spec/features/harvests/ -fd -t ~@flaky
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-home.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Home
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (home/)
|
|
||||||
run: bundle exec rspec spec/features/home/ -fd -t ~@flaky
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-members.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Members
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (members/)
|
|
||||||
run: bundle exec rspec spec/features/members/ -fd -t ~@flaky
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-places.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Admin
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (places/)
|
|
||||||
run: bundle exec rspec spec/features/places/ -fd
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-plantings.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Plantings
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (plantings/)
|
|
||||||
run: bundle exec rspec spec/features/plantings/ -fd
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-posts.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Posts
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (posts/)
|
|
||||||
run: bundle exec rspec spec/features/posts/ -fd
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-seeds.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Seeds
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (seeds/)
|
|
||||||
run: bundle exec rspec spec/features/seeds/ -fd -t ~@flaky
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
109
.github/workflows/ci-features-timeline.yml
vendored
@@ -1,109 +0,0 @@
|
|||||||
name: CI Features - Timeline
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (timeline/)
|
|
||||||
run: bundle exec rspec spec/features/timeline/ -fd -t ~@flaky
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
118
.github/workflows/ci-features.yml
vendored
@@ -1,118 +0,0 @@
|
|||||||
name: CI Features
|
|
||||||
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
rspec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
##
|
|
||||||
# The Postgres service fails its docker health check unless you
|
|
||||||
# specify these environment variables
|
|
||||||
#
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: growstuff_test
|
|
||||||
ports: ['5432:5432']
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
APP_DOMAIN_NAME: localhost:3000
|
|
||||||
APP_PROTOCOL: http
|
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
|
||||||
DEVISE_SECRET_KEY: secret
|
|
||||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
|
||||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
|
||||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
|
||||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
|
||||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
|
||||||
RAILS_ENV: test
|
|
||||||
RAILS_SECRET_TOKEN: supersecret
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout this repo
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
|
||||||
run: |
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo sysctl -w vm.swappiness=1
|
|
||||||
sudo sysctl -w fs.file-max=262144
|
|
||||||
sudo sysctl -w vm.max_map_count=262144
|
|
||||||
|
|
||||||
- name: Start Elasticsearch
|
|
||||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
||||||
with:
|
|
||||||
stack-version: 7.5.1
|
|
||||||
|
|
||||||
##
|
|
||||||
# Cache Yarn modules
|
|
||||||
#
|
|
||||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
|
||||||
#
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Setup yarn cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
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 }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Install required OS packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
|
||||||
|
|
||||||
- name: Install NodeJS
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '24'
|
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
bundler-cache: true
|
|
||||||
|
|
||||||
- name: Install required JS packages
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: install chrome
|
|
||||||
run: sudo apt-get install google-chrome-stable
|
|
||||||
|
|
||||||
- name: Prepare database for testing
|
|
||||||
run: bundle exec rails db:prepare
|
|
||||||
|
|
||||||
- name: precompile assets
|
|
||||||
run: bundle exec rails assets:precompile
|
|
||||||
|
|
||||||
- name: index into elastic search
|
|
||||||
run: bundle exec rails search:reindex
|
|
||||||
|
|
||||||
- name: Run rspec (*_spec)
|
|
||||||
run: bundle exec rspec spec/features/*_spec.rb -fd
|
|
||||||
|
|
||||||
- name: Run rspec (percy/)
|
|
||||||
run: bundle exec rspec spec/features/percy/ -fd
|
|
||||||
|
|
||||||
- name: Run rspec (photos/)
|
|
||||||
run: bundle exec rspec spec/features/photos/ -fd
|
|
||||||
|
|
||||||
- name: Run rspec (rss/)
|
|
||||||
run: bundle exec rspec spec/features/rss/ -fd
|
|
||||||
|
|
||||||
- name: Upload screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: screenshots
|
|
||||||
path: tmp/screenshots
|
|
||||||
42
.github/workflows/ci.yml
vendored
@@ -6,7 +6,7 @@ jobs:
|
|||||||
contributors:
|
contributors:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v2.3.4
|
||||||
- name: Install ruby version specified in .ruby-version
|
- name: Install ruby version specified in .ruby-version
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
@@ -53,7 +53,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout this repo
|
- name: Checkout this repo
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2.3.4
|
||||||
|
|
||||||
- name: Configure sysctl limits
|
- name: Configure sysctl limits
|
||||||
run: |
|
run: |
|
||||||
@@ -76,7 +76,7 @@ jobs:
|
|||||||
id: yarn-cache-dir-path
|
id: yarn-cache-dir-path
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
- name: Setup yarn cache
|
- name: Setup yarn cache
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v2.1.5
|
||||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
@@ -89,9 +89,9 @@ jobs:
|
|||||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
sudo apt-get -y install libpq-dev google-chrome-stable
|
||||||
|
|
||||||
- name: Install NodeJS
|
- name: Install NodeJS
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v2.4.0
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '12'
|
||||||
|
|
||||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
- name: Install Ruby (version given by .ruby-version) and Bundler
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
@@ -106,25 +106,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Prepare database for testing
|
- name: Prepare database for testing
|
||||||
run: bundle exec rails db:prepare
|
run: bundle exec rails db:prepare
|
||||||
|
|
||||||
|
- name: precompile assets
|
||||||
|
run: bundle exec rails assets:precompile
|
||||||
|
|
||||||
|
- name: index into elastic search
|
||||||
|
run: bundle exec rails search:reindex
|
||||||
|
|
||||||
|
- name: Run rspec (report results to Percy.io and CodeClimate)
|
||||||
|
run: bundle exec rspec spec -fd
|
||||||
|
|
||||||
- name: Run rspec (lib)
|
- name: Report to code climate
|
||||||
run: bundle exec rspec spec/lib/ -fd --fail-fast
|
run: |
|
||||||
|
gem install codeclimate-test-reporter
|
||||||
- name: Run rspec (services)
|
codeclimate-test-reporter
|
||||||
run: bundle exec rspec spec/services/ -fd --fail-fast
|
|
||||||
|
|
||||||
- name: Run rspec (models)
|
|
||||||
run: bundle exec rspec spec/models/ -fd --fail-fast
|
|
||||||
|
|
||||||
- name: Run rspec (controllers)
|
|
||||||
run: bundle exec rspec spec/controllers/ -fd --fail-fast
|
|
||||||
|
|
||||||
- name: Run rspec (views)
|
|
||||||
run: bundle exec rspec spec/views/ -fd --fail-fast
|
|
||||||
|
|
||||||
- name: Run rspec (routing)
|
|
||||||
run: bundle exec rspec spec/routing/ -fd --fail-fast
|
|
||||||
|
|
||||||
- name: Run rspec (request)
|
|
||||||
run: bundle exec rspec spec/requests/ -fd --fail-fast
|
|
||||||
|
|||||||
43
.github/workflows/docker-build-push.yml
vendored
@@ -1,43 +0,0 @@
|
|||||||
name: Docker Build and Push
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- mainline
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v4
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v6
|
|
||||||
with:
|
|
||||||
images: ghcr.io/${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
19
.rubocop.yml
@@ -1,17 +1,11 @@
|
|||||||
inherit_from: .rubocop_todo.yml
|
inherit_from: .rubocop_todo.yml
|
||||||
plugins:
|
require: rubocop-rails
|
||||||
- rubocop-factory_bot
|
|
||||||
- rubocop-capybara
|
|
||||||
- rubocop-rails
|
|
||||||
- rubocop-rspec
|
|
||||||
- rubocop-rspec_rails
|
|
||||||
- rubocop-rake
|
|
||||||
AllCops:
|
AllCops:
|
||||||
NewCops: enable
|
NewCops: enable
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'db/schema.rb'
|
- 'db/schema.rb'
|
||||||
- 'vendor/**/*'
|
- 'vendor/**/*'
|
||||||
TargetRailsVersion: 7.1
|
TargetRailsVersion: 6.0
|
||||||
|
|
||||||
Rails:
|
Rails:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@@ -22,12 +16,6 @@ Naming/FileName:
|
|||||||
- 'Gemfile'
|
- 'Gemfile'
|
||||||
- 'Gemfile.lock'
|
- 'Gemfile.lock'
|
||||||
|
|
||||||
RSpec/DescribeClass:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/tasks/import_spec.rb'
|
|
||||||
- 'spec/views/**/*.rb'
|
|
||||||
- 'spec/features/**/*.rb'
|
|
||||||
|
|
||||||
Layout/MultilineMethodCallIndentation:
|
Layout/MultilineMethodCallIndentation:
|
||||||
EnforcedStyle: indented
|
EnforcedStyle: indented
|
||||||
|
|
||||||
@@ -72,7 +60,4 @@ Layout/LineLength:
|
|||||||
Rails/SkipsModelValidations:
|
Rails/SkipsModelValidations:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'db/migrate/20190317023129_finished_boolean.rb'
|
- 'db/migrate/20190317023129_finished_boolean.rb'
|
||||||
- 'db/migrate/20251128200506_add_description_to_crops.rb'
|
|
||||||
- 'db/migrate/20240810160538_set_default_language_for_existing_alternate_names.rb'
|
|
||||||
- 'db/migrate/20240101010102_populate_crop_fields_from_openfarm_data.rb'
|
|
||||||
- 'db/seeds.rb'
|
- 'db/seeds.rb'
|
||||||
|
|||||||
@@ -1,877 +1,127 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `rubocop --auto-gen-config --no-offense-counts`
|
||||||
# on 2026-05-02 06:53:56 UTC using RuboCop version 1.86.1.
|
# 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
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
# Offense count: 407
|
Lint/AmbiguousOperator:
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Capybara/RSpec/HaveContent:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 21
|
|
||||||
Capybara/RSpec/NegationMatcherAfterVisit:
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/features/admin/reverting_crops_spec.rb'
|
- 'spec/controllers/crops_controller_spec.rb'
|
||||||
- 'spec/features/crops/crop_detail_page_spec.rb'
|
|
||||||
- 'spec/features/crops/crop_wranglers_spec.rb'
|
|
||||||
- 'spec/features/gardens/gardens_spec.rb'
|
|
||||||
- 'spec/features/members/blocking_spec.rb'
|
|
||||||
- 'spec/features/members/deletion_spec.rb'
|
|
||||||
- 'spec/features/members/following_spec.rb'
|
|
||||||
- 'spec/features/members/profile_spec.rb'
|
|
||||||
- 'spec/features/plantings/planting_a_crop_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 14
|
# Configuration parameters: EnforcedStyle.
|
||||||
Capybara/RSpec/SpecificMatcher:
|
# SupportedStyles: lowercase, uppercase
|
||||||
Exclude:
|
Naming/HeredocDelimiterCase:
|
||||||
- '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
|
|
||||||
Capybara/RSpec/VisibilityMatcher:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/features/shared_examples/crop_suggest.rb'
|
|
||||||
|
|
||||||
# Offense count: 8
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: EnforcedStyle, NonImplicitAssociationMethodNames.
|
|
||||||
# SupportedStyles: explicit, implicit
|
|
||||||
FactoryBot/AssociationStyle:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/factories/alternate_names.rb'
|
|
||||||
- 'spec/factories/comments.rb'
|
|
||||||
- 'spec/factories/crop.rb'
|
|
||||||
- 'spec/factories/like.rb'
|
|
||||||
- 'spec/factories/notifications.rb'
|
|
||||||
- 'spec/factories/scientific_name.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: EnforcedStyle, ExplicitOnly.
|
|
||||||
# SupportedStyles: create_list, n_times
|
|
||||||
FactoryBot/CreateList:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/views/comments/index.rss.haml_spec.rb'
|
|
||||||
- 'spec/views/photos/index.html.haml_spec.rb'
|
|
||||||
- 'spec/views/posts/index.html.haml_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# Configuration parameters: MaxAmount.
|
|
||||||
FactoryBot/ExcessiveCreateList:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/posts_controller_spec.rb'
|
|
||||||
- 'spec/features/crops/show_spec.rb'
|
|
||||||
- 'spec/features/percy/percy_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Layout/EmptyLines:
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'config/environments/production.rb'
|
- 'config/environments/production.rb'
|
||||||
|
|
||||||
# Offense count: 311
|
# Configuration parameters: Include.
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# Include: db/migrate/*.rb
|
||||||
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
||||||
# SupportedHashRocketStyles: key, separator, table
|
|
||||||
# SupportedColonStyles: key, separator, table
|
|
||||||
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
||||||
Layout/HashAlignment:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/application_helper.rb'
|
|
||||||
- 'app/helpers/crops_helper.rb'
|
|
||||||
- 'app/models/concerns/search_harvests.rb'
|
|
||||||
- 'app/models/concerns/search_plantings.rb'
|
|
||||||
- 'app/models/crop.rb'
|
|
||||||
- 'config/sitemap.rb'
|
|
||||||
- 'lib/tasks/import.rake'
|
|
||||||
- 'spec/requests/api/v1/activities_request_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/members_request_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 8
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
||||||
# URISchemes: http, https
|
|
||||||
Layout/LineLength:
|
|
||||||
Exclude:
|
|
||||||
- 'Gemfile'
|
|
||||||
- 'app/controllers/admin/versions_controller.rb'
|
|
||||||
- 'app/controllers/crops_controller.rb'
|
|
||||||
- 'app/models/concerns/predict_planting.rb'
|
|
||||||
- 'app/models/crop.rb'
|
|
||||||
- 'db/seeds.rb'
|
|
||||||
- 'lib/tasks/members.rake'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
||||||
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
|
||||||
Layout/MultilineMethodCallIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/activity.rb'
|
|
||||||
- 'app/models/concerns/predict_harvest.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Lint/AmbiguousOperatorPrecedence:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/activities_controller.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# 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'
|
|
||||||
- 'db/seeds.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: AllowedMethods.
|
|
||||||
# AllowedMethods: enums
|
|
||||||
Lint/ConstantDefinitionInBlock:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/import.rake'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
||||||
Lint/DuplicateBranch:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/harvest.rb'
|
|
||||||
- 'lib/actions/oauth_signup_action.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
Lint/DuplicateMethods:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/planting.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Lint/RedundantCopDisableDirective:
|
|
||||||
Exclude:
|
|
||||||
- 'db/migrate/20230313015323_create_active_storage_tables.active_storage.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
|
|
||||||
Lint/UselessConstantScoping:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/members_controller.rb'
|
|
||||||
|
|
||||||
# Offense count: 65
|
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
||||||
Metrics/AbcSize:
|
|
||||||
Max: 295
|
|
||||||
|
|
||||||
# Offense count: 14
|
|
||||||
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
|
||||||
# AllowedMethods: refine
|
|
||||||
Metrics/BlockLength:
|
|
||||||
Max: 294
|
|
||||||
|
|
||||||
# Offense count: 10
|
|
||||||
# Configuration parameters: CountComments, CountAsOne.
|
|
||||||
Metrics/ClassLength:
|
|
||||||
Max: 298
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: LengthThreshold.
|
|
||||||
Metrics/CollectionLiteralLength:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/import.rake'
|
|
||||||
|
|
||||||
# Offense count: 11
|
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
||||||
Metrics/CyclomaticComplexity:
|
|
||||||
Max: 32
|
|
||||||
|
|
||||||
# Offense count: 83
|
|
||||||
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
||||||
Metrics/MethodLength:
|
|
||||||
Max: 296
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Configuration parameters: CountComments, CountAsOne.
|
|
||||||
Metrics/ModuleLength:
|
|
||||||
Max: 144
|
|
||||||
|
|
||||||
# Offense count: 10
|
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
||||||
Metrics/PerceivedComplexity:
|
|
||||||
Max: 32
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
|
|
||||||
# AllowedMethods: call
|
|
||||||
# WaywardPredicates: infinite?, nonzero?
|
|
||||||
Naming/PredicateMethod:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/concerns/finishable.rb'
|
|
||||||
- 'app/models/seed.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
|
|
||||||
# NamePrefix: is_, has_, have_, does_
|
|
||||||
# ForbiddenPrefixes: is_, has_, have_, does_
|
|
||||||
# AllowedMethods: is_a?
|
|
||||||
# MethodDefinitionMacros: define_method, define_singleton_method
|
|
||||||
Naming/PredicatePrefix:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/member.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
RSpec/AnyInstance:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/harvests_controller_spec.rb'
|
|
||||||
- 'spec/controllers/photos_controller_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
RSpec/BeEq:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/requests/api/v1/activities_request_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
RSpec/BeforeAfterAll:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/tasks/import_spec.rb'
|
|
||||||
- 'spec/tasks/members_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 311
|
|
||||||
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
||||||
# Prefixes: when, with, without
|
|
||||||
RSpec/ContextWording:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Configuration parameters: IgnoredMetadata.
|
|
||||||
RSpec/DescribeClass:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/models/harvest_prediction_spec.rb'
|
|
||||||
- 'spec/tasks/members_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 37
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
|
|
||||||
# SupportedStyles: described_class, explicit
|
|
||||||
RSpec/DescribedClass:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/mailers/harvest_reminder_mailer_spec.rb'
|
|
||||||
- 'spec/models/like_spec.rb'
|
|
||||||
- 'spec/models/member_spec.rb'
|
|
||||||
- 'spec/services/timeline_service_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowConsecutiveOneLiners.
|
|
||||||
RSpec/EmptyLineAfterExample:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/crops_controller_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
RSpec/EmptyLineAfterFinalLet:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/crops_controller_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 161
|
|
||||||
# Configuration parameters: CountAsOne.
|
|
||||||
RSpec/ExampleLength:
|
|
||||||
Max: 27
|
|
||||||
|
|
||||||
# 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: 53
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
RSpec/IncludeExamples:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/features/conversations/index_spec.rb'
|
|
||||||
- 'spec/features/crops/alternate_name_spec.rb'
|
|
||||||
- 'spec/features/crops/browse_crops_spec.rb'
|
|
||||||
- 'spec/features/crops/creating_a_crop_spec.rb'
|
|
||||||
- 'spec/features/crops/crop_photos_spec.rb'
|
|
||||||
- 'spec/features/crops/delete_crop_spec.rb'
|
|
||||||
- 'spec/features/gardens/actions_spec.rb'
|
|
||||||
- 'spec/features/gardens/adding_gardens_spec.rb'
|
|
||||||
- 'spec/features/gardens/index_spec.rb'
|
|
||||||
- 'spec/features/likeable_spec.rb'
|
|
||||||
- 'spec/features/signout_spec.rb'
|
|
||||||
- 'spec/models/crop_spec.rb'
|
|
||||||
- 'spec/support/feature_helpers.rb'
|
|
||||||
- 'spec/views/photos/show.html.haml_spec.rb'
|
|
||||||
- 'spec/views/seeds/index.rss.haml_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
|
|
||||||
RSpec/IndexedLet:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/models/activity_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 711
|
|
||||||
# Configuration parameters: AssignmentOnly.
|
|
||||||
RSpec/InstanceVariable:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 43
|
|
||||||
RSpec/LetSetup:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
RSpec/MatchArray:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/models/post_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
RSpec/MessageChain:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/models/member_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 65
|
|
||||||
# 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: 235
|
|
||||||
RSpec/MultipleExpectations:
|
|
||||||
Max: 19
|
|
||||||
|
|
||||||
# Offense count: 171
|
|
||||||
# Configuration parameters: AllowSubject.
|
|
||||||
RSpec/MultipleMemoizedHelpers:
|
|
||||||
Max: 16
|
|
||||||
|
|
||||||
# Offense count: 183
|
|
||||||
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
|
||||||
# SupportedStyles: always, named_only
|
|
||||||
RSpec/NamedSubject:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 112
|
|
||||||
# Configuration parameters: AllowedGroups.
|
|
||||||
RSpec/NestedGroups:
|
|
||||||
Max: 6
|
|
||||||
|
|
||||||
# Offense count: 366
|
|
||||||
# Configuration parameters: AllowedPatterns.
|
|
||||||
# AllowedPatterns: ^expect_, ^assert_
|
|
||||||
RSpec/NoExpectationExample:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
RSpec/PendingWithoutReason:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/features/members/blocking_spec.rb'
|
|
||||||
- 'spec/features/plantings/planting_a_crop_spec.rb'
|
|
||||||
- 'spec/features/seeds/misc_seeds_spec.rb'
|
|
||||||
- 'spec/features/unsubscribing_spec.rb'
|
|
||||||
- 'spec/models/ability_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/gardens_request_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 5
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
|
|
||||||
# SupportedStyles: inflected, explicit
|
|
||||||
RSpec/PredicateMatcher:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/tasks/members_spec.rb'
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
RSpec/ScatteredSetup:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/features/percy/percy_spec.rb'
|
|
||||||
- 'spec/features/plantings/prediction_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
|
|
||||||
# SupportedInflectors: default, active_support
|
|
||||||
RSpec/SpecFilePathFormat:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/member_controller_spec.rb'
|
|
||||||
- 'spec/mailers/harvest_reminder_mailer_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
RSpec/StubbedMock:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/photos_controller_spec.rb'
|
|
||||||
- 'spec/models/member_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
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).
|
|
||||||
# Configuration parameters: Inferences.
|
|
||||||
RSpecRails/InferredSpecType:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/mailers/harvest_reminder_mailer_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 30
|
|
||||||
# Configuration parameters: Database.
|
|
||||||
# SupportedDatabases: mysql, postgresql
|
|
||||||
Rails/BulkChangeTable:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
Rails/CreateTableWithTimestamps:
|
Rails/CreateTableWithTimestamps:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- 'db/migrate/20130214034838_add_members_roles_table.rb'
|
||||||
|
- 'db/migrate/20130507113915_add_orders_products_table.rb'
|
||||||
|
- 'db/migrate/20130531110729_add_photos_plantings_table.rb'
|
||||||
|
- 'db/migrate/20140905001730_add_harvests_photos_table.rb'
|
||||||
|
- 'db/migrate/20140928044231_add_crops_posts_table.rb'
|
||||||
|
- 'db/migrate/20150127043022_add_gardens_photos_table.rb'
|
||||||
- 'db/migrate/20150201052245_create_cms.rb'
|
- 'db/migrate/20150201052245_create_cms.rb'
|
||||||
|
- 'db/migrate/20161201154922_add_photos_seeds_table.rb'
|
||||||
- 'db/migrate/20171022032108_all_the_predictions.rb'
|
- 'db/migrate/20171022032108_all_the_predictions.rb'
|
||||||
|
|
||||||
# Offense count: 8
|
# Configuration parameters: EnforcedStyle.
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: EnforcedStyle, AllowToTime.
|
|
||||||
# SupportedStyles: strict, flexible
|
# SupportedStyles: strict, flexible
|
||||||
Rails/Date:
|
Rails/Date:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/activities_controller.rb'
|
- 'app/mailers/notifier.rb'
|
||||||
- 'app/mailers/notifier_mailer.rb'
|
|
||||||
- 'app/models/concerns/search_seeds.rb'
|
|
||||||
- 'spec/features/activities/creating_a_recurring_activity_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: slashes, arguments
|
# SupportedStyles: slashes, arguments
|
||||||
Rails/FilePath:
|
Rails/FilePath:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/tasks/import.rake'
|
- 'app/controllers/crops_controller.rb'
|
||||||
|
- 'config/application.rb'
|
||||||
|
- 'config/environments/development.rb'
|
||||||
|
- 'db/seeds.rb'
|
||||||
|
|
||||||
# Offense count: 12
|
# Configuration parameters: Include.
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# Include: app/models/**/*.rb
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
||||||
# AllowedMethods: order, limit, select, lock
|
|
||||||
Rails/FindEach:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/conversations_controller.rb'
|
|
||||||
- 'db/migrate/20171105011017_set_prediction_data.rb'
|
|
||||||
- 'db/migrate/20171129041341_create_photographings.rb'
|
|
||||||
- 'db/migrate/20190130090437_add_crop_to_photographings.rb'
|
|
||||||
- 'db/migrate/20191119030244_cms_tags.rb'
|
|
||||||
- 'lib/tasks/wikidata.rake'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
Rails/HasAndBelongsToMany:
|
Rails/HasAndBelongsToMany:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/member.rb'
|
- 'app/models/member.rb'
|
||||||
- 'app/models/role.rb'
|
- 'app/models/role.rb'
|
||||||
|
|
||||||
# Offense count: 6
|
# Configuration parameters: Include.
|
||||||
|
# Include: app/models/**/*.rb
|
||||||
Rails/HasManyOrHasOneDependent:
|
Rails/HasManyOrHasOneDependent:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/crop.rb'
|
|
||||||
- 'app/models/member.rb'
|
- 'app/models/member.rb'
|
||||||
|
|
||||||
# Offense count: 7
|
# Configuration parameters: Include.
|
||||||
Rails/HelperInstanceVariable:
|
# Include: app/models/**/*.rb
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/crops_helper.rb'
|
|
||||||
- 'app/helpers/plantings_helper.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
Rails/I18nLocaleAssignment:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/features/locale_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 5
|
|
||||||
Rails/I18nLocaleTexts:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/blocks_controller.rb'
|
|
||||||
- 'app/controllers/comments_controller.rb'
|
|
||||||
- 'app/controllers/messages_controller.rb'
|
|
||||||
- 'config/initializers/comfortable_mexican_sofa.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: IgnoreScopes.
|
|
||||||
Rails/InverseOf:
|
Rails/InverseOf:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/member.rb'
|
- 'app/models/concerns/ownable.rb'
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
Rails/LexicallyScopedActionFilter:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/api/v1/base_controller.rb'
|
|
||||||
- 'app/controllers/data_controller.rb'
|
|
||||||
- 'app/controllers/registrations_controller.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Rails/OrderArguments:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/activity.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
Rails/OutputSafety:
|
Rails/OutputSafety:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/helpers/auto_suggest_helper.rb'
|
- 'app/helpers/auto_suggest_helper.rb'
|
||||||
- 'app/helpers/gardens_helper.rb'
|
- 'app/helpers/gardens_helper.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Configuration parameters: Include.
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# Include: **/Rakefile, **/*.rake
|
||||||
Rails/PluralizationGrammar:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/requests/plantings_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Rails/Presence:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/photos_controller.rb'
|
|
||||||
- 'app/controllers/plantings_controller.rb'
|
|
||||||
- 'app/models/concerns/open_farm_data.rb'
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Rails/RakeEnvironment:
|
Rails/RakeEnvironment:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/tasks/hooks.rake'
|
- 'lib/tasks/hooks.rake'
|
||||||
- 'lib/tasks/i18n.rake'
|
- 'lib/tasks/i18n.rake'
|
||||||
- 'lib/tasks/testing.rake'
|
- 'lib/tasks/testing.rake'
|
||||||
|
|
||||||
# Offense count: 8
|
# Configuration parameters: Include.
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# Include: db/migrate/*.rb
|
||||||
# Configuration parameters: AllowedReceivers.
|
|
||||||
# AllowedReceivers: ActionMailer::Preview, ActiveSupport::TimeZone
|
|
||||||
Rails/RedundantActiveRecordAllMethod:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/roles_controller.rb'
|
|
||||||
- 'app/controllers/alternate_names_controller.rb'
|
|
||||||
- 'app/controllers/forums_controller.rb'
|
|
||||||
- 'app/controllers/plant_parts_controller.rb'
|
|
||||||
- 'app/controllers/scientific_names_controller.rb'
|
|
||||||
- 'spec/features/members/deletion_spec.rb'
|
|
||||||
- 'spec/features/percy/percy_spec.rb'
|
|
||||||
|
|
||||||
# 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: 16
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Rails/ResponseParsedBody:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/api/v1/plantings_controller_spec.rb'
|
|
||||||
- 'spec/controllers/likes_controller_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/activities_request_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/crop_request_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/gardens_request_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/harvests_request_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/members_request_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/photos_request_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/plantings_request_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/seeds_request_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
Rails/ReversibleMigration:
|
Rails/ReversibleMigration:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'db/migrate/20130326092227_change_planted_at_to_date.rb'
|
|
||||||
- 'db/migrate/20191119020643_upgrade_cms.rb'
|
- 'db/migrate/20191119020643_upgrade_cms.rb'
|
||||||
|
|
||||||
# Offense count: 6
|
# Configuration parameters: Blacklist, Whitelist.
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
||||||
Rails/RootPathnameMethods:
|
Rails/SkipsModelValidations:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/crops_controller.rb'
|
- 'db/migrate/20190317023129_finished_boolean.rb'
|
||||||
- 'app/helpers/icons_helper.rb'
|
- 'db/seeds.rb'
|
||||||
- 'config/application.rb'
|
- 'db/migrate/20190910022329_add_photo_source.rb'
|
||||||
- 'lib/tasks/import.rake'
|
|
||||||
- 'spec/rails_helper.rb'
|
|
||||||
|
|
||||||
# Offense count: 21
|
# Configuration parameters: AllowedChars.
|
||||||
Rails/ThreeStateBooleanColumn:
|
Style/AsciiComments:
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: strict, flexible
|
|
||||||
Rails/TimeZone:
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/activities_controller.rb'
|
- 'config/initializers/comfortable_mexican_sofa.rb'
|
||||||
- 'spec/features/harvests/harvesting_a_crop_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 6
|
# Cop supports --auto-correct.
|
||||||
Rails/UniqueValidationWithoutIndex:
|
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
||||||
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'
|
|
||||||
|
|
||||||
# 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).
|
|
||||||
Rails/WhereRange:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/concerns/predict_planting.rb'
|
|
||||||
- 'app/models/garden.rb'
|
|
||||||
- 'app/models/seed.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
Rake/MethodDefinitionInTask:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/growstuff.rake'
|
|
||||||
|
|
||||||
# Offense count: 5
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForClasses, EnforcedStyleForModules.
|
|
||||||
# SupportedStyles: nested, compact
|
# SupportedStyles: nested, compact
|
||||||
# SupportedStylesForClasses: ~, nested, compact
|
|
||||||
# SupportedStylesForModules: ~, nested, compact
|
|
||||||
Style/ClassAndModuleChildren:
|
Style/ClassAndModuleChildren:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/admin/crops_controller.rb'
|
|
||||||
- 'config/initializers/rack_attack.rb'
|
|
||||||
- 'lib/actions/oauth_signup_action.rb'
|
- 'lib/actions/oauth_signup_action.rb'
|
||||||
- 'lib/haml/filters/escaped_markdown.rb'
|
- 'lib/haml/filters/escaped_markdown.rb'
|
||||||
- 'lib/haml/filters/growstuff_markdown.rb'
|
- 'lib/haml/filters/growstuff_markdown.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Style/CollectionQuerying:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/member.rb'
|
|
||||||
|
|
||||||
# Offense count: 6
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Style/CommentedKeyword:
|
Style/CommentedKeyword:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'db/migrate/20191119030244_cms_tags.rb'
|
|
||||||
- 'spec/models/crop_spec.rb'
|
- 'spec/models/crop_spec.rb'
|
||||||
- 'spec/models/photo_spec.rb'
|
- 'spec/models/photo_spec.rb'
|
||||||
- 'spec/models/planting_spec.rb'
|
- 'spec/models/planting_spec.rb'
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowedVars, DefaultToNil.
|
|
||||||
Style/FetchEnvVar:
|
|
||||||
Exclude:
|
|
||||||
- 'config/sitemap.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
Style/FileOpen:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/application_helper.rb'
|
|
||||||
- 'db/seeds.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: left_coerce, right_coerce, single_coerce, fdiv
|
|
||||||
Style/FloatDivision:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/concerns/predict_planting.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: always, always_true, never
|
|
||||||
Style/FrozenStringLiteralComment:
|
|
||||||
Exclude:
|
|
||||||
- 'db/migrate/20260429132911_add_send_harvest_reminder_to_members.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/gbif.rake'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Style/IdenticalConditionalBranches:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/actions/oauth_signup_action.rb'
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Style/IfUnlessModifier:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/crops_helper.rb'
|
|
||||||
- 'app/models/concerns/predict_planting.rb'
|
|
||||||
- 'config/initializers/rack_attack.rb'
|
|
||||||
- 'lib/tasks/growstuff.rake'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Style/MinMaxComparison:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/concerns/predict_planting.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
Style/MixinUsage:
|
Style/MixinUsage:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- 'bin/setup'
|
||||||
- 'bin/update'
|
- 'bin/update'
|
||||||
- 'spec/rails_helper.rb'
|
- 'spec/rails_helper.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Cop supports --auto-correct.
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: literals, strict
|
|
||||||
Style/MutableConstant:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/activity.rb'
|
|
||||||
|
|
||||||
# Offense count: 6
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
|
||||||
# SupportedStyles: predicate, comparison
|
# SupportedStyles: predicate, comparison
|
||||||
Style/NumericPredicate:
|
Style/NumericPredicate:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/activities_controller.rb'
|
- 'spec/**/*'
|
||||||
- 'app/helpers/crops_helper.rb'
|
|
||||||
- 'app/helpers/harvests_helper.rb'
|
- 'app/helpers/harvests_helper.rb'
|
||||||
- 'app/helpers/plantings_helper.rb'
|
- 'app/helpers/plantings_helper.rb'
|
||||||
- 'app/models/concerns/predict_planting.rb'
|
|
||||||
|
|
||||||
# Offense count: 6
|
|
||||||
Style/OpenStructUse:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/helpers/event_helper_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Configuration parameters: AllowedMethods.
|
|
||||||
# AllowedMethods: respond_to_missing?
|
|
||||||
Style/OptionalBooleanParameter:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/application_helper.rb'
|
|
||||||
- 'app/models/concerns/member_newsletter.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: Methods.
|
|
||||||
Style/RedundantArgument:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/application_helper.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Style/RedundantBegin:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/concerns/predict_harvest.rb'
|
|
||||||
- 'app/models/harvest.rb'
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: SafeForConstants.
|
|
||||||
Style/RedundantFetchBlock:
|
|
||||||
Exclude:
|
|
||||||
- 'config/puma.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Style/RedundantInterpolation:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/buttons_helper.rb'
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# Configuration parameters: Max.
|
|
||||||
Style/SafeNavigationChainLength:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/ability.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowModifier.
|
|
||||||
Style/SoleNestedConditional:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/activities_controller.rb'
|
|
||||||
- 'app/controllers/application_controller.rb'
|
|
||||||
- 'app/controllers/messages_controller.rb'
|
|
||||||
|
|
||||||
# Offense count: 27
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: Mode.
|
|
||||||
Style/StringConcatenation:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/messages_controller.rb'
|
|
||||||
- 'app/controllers/registrations_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, AllowComments.
|
|
||||||
# AllowedMethods: define_method, mail, respond_to
|
|
||||||
Style/SymbolProc:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/crops_controller.rb'
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.4.9
|
2.7.2
|
||||||
|
|||||||
@@ -248,3 +248,6 @@ linters:
|
|||||||
|
|
||||||
ZeroUnit:
|
ZeroUnit:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
Compass::*:
|
||||||
|
enabled: false
|
||||||
|
|||||||
31
.travis.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
sudo: required
|
||||||
|
language: ruby
|
||||||
|
dist: bionic
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- mainline
|
||||||
|
- dev
|
||||||
|
cache:
|
||||||
|
bundler: true
|
||||||
|
yarn: true
|
||||||
|
directories:
|
||||||
|
- tmp/cache/assets/test/sprockets
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4="
|
||||||
|
before_deploy:
|
||||||
|
- bundle exec script/heroku_maintenance.rb on
|
||||||
|
deploy:
|
||||||
|
provider: heroku
|
||||||
|
api_key:
|
||||||
|
secure: "WrQxf0fEKkCdXrjcejurobOnNNz3he4dDwjBbToXbQTQNDObPp7NetJrLsfM8FiUFEeOuvhIHHiDQtMvY720zGGAGxDptvgFS+0QHCUqoTRZA/yFfUmHlG2jROXTzk5uVK0AE4k6Ion5kX8+mM0EnMT/7u+MTFiukrJctSiEXfg="
|
||||||
|
on:
|
||||||
|
repo: Growstuff/growstuff
|
||||||
|
app:
|
||||||
|
dev: growstuff-staging
|
||||||
|
mainline: growstuff-prod
|
||||||
|
run:
|
||||||
|
- "script/deploy-tasks.sh"
|
||||||
|
- restart
|
||||||
|
after_deploy:
|
||||||
|
- bundle exec script/heroku_maintenance.rb off
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
# Contributor Covenant Code of Conduct
|
|
||||||
|
|
||||||
## Our Pledge
|
|
||||||
|
|
||||||
We as members, contributors, and leaders pledge to make participation in our
|
|
||||||
community a harassment-free experience for everyone, regardless of age, body
|
|
||||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
||||||
identity and expression, level of experience, education, socio-economic status,
|
|
||||||
nationality, personal appearance, race, religion, or sexual identity
|
|
||||||
and orientation.
|
|
||||||
|
|
||||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
||||||
diverse, inclusive, and healthy community.
|
|
||||||
|
|
||||||
## Our Standards
|
|
||||||
|
|
||||||
Examples of behavior that contributes to a positive environment for our
|
|
||||||
community include:
|
|
||||||
|
|
||||||
* Demonstrating empathy and kindness toward other people
|
|
||||||
* Being respectful of differing opinions, viewpoints, and experiences
|
|
||||||
* Giving and gracefully accepting constructive feedback
|
|
||||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
||||||
and learning from the experience
|
|
||||||
* Focusing on what is best not just for us as individuals, but for the
|
|
||||||
overall community
|
|
||||||
|
|
||||||
Examples of unacceptable behavior include:
|
|
||||||
|
|
||||||
* The use of sexualized language or imagery, and sexual attention or
|
|
||||||
advances of any kind
|
|
||||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
||||||
* Public or private harassment
|
|
||||||
* Publishing others' private information, such as a physical or email
|
|
||||||
address, without their explicit permission
|
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
|
||||||
professional setting
|
|
||||||
|
|
||||||
## Enforcement Responsibilities
|
|
||||||
|
|
||||||
Community leaders are responsible for clarifying and enforcing our standards of
|
|
||||||
acceptable behavior and will take appropriate and fair corrective action in
|
|
||||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
||||||
or harmful.
|
|
||||||
|
|
||||||
Community leaders have the right and responsibility to remove, edit, or reject
|
|
||||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
||||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
||||||
decisions when appropriate.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
This Code of Conduct applies within all community spaces, and also applies when
|
|
||||||
an individual is officially representing the community in public spaces.
|
|
||||||
Examples of representing our community include using an official e-mail address,
|
|
||||||
posting via an official social media account, or acting as an appointed
|
|
||||||
representative at an online or offline event.
|
|
||||||
|
|
||||||
## Enforcement
|
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
||||||
reported to the community leaders responsible for enforcement at
|
|
||||||
info@growstuff.org. Any issues with a particular moderator can be reported to
|
|
||||||
any one of the other moderators.
|
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
|
||||||
reporter of any incident.
|
|
||||||
|
|
||||||
## Enforcement Guidelines
|
|
||||||
|
|
||||||
Community leaders will follow these Community Impact Guidelines in determining
|
|
||||||
the consequences for any action they deem in violation of this Code of Conduct:
|
|
||||||
|
|
||||||
### 1. Correction
|
|
||||||
|
|
||||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
||||||
unprofessional or unwelcome in the community.
|
|
||||||
|
|
||||||
**Consequence**: A private, written warning from community leaders, providing
|
|
||||||
clarity around the nature of the violation and an explanation of why the
|
|
||||||
behavior was inappropriate. A public apology may be requested.
|
|
||||||
|
|
||||||
### 2. Warning
|
|
||||||
|
|
||||||
**Community Impact**: A violation through a single incident or series
|
|
||||||
of actions.
|
|
||||||
|
|
||||||
**Consequence**: A warning with consequences for continued behavior. No
|
|
||||||
interaction with the people involved, including unsolicited interaction with
|
|
||||||
those enforcing the Code of Conduct, for a specified period of time. This
|
|
||||||
includes avoiding interactions in community spaces as well as external channels
|
|
||||||
like social media. Violating these terms may lead to a temporary or
|
|
||||||
permanent ban.
|
|
||||||
|
|
||||||
### 3. Temporary Ban
|
|
||||||
|
|
||||||
**Community Impact**: A serious violation of community standards, including
|
|
||||||
sustained inappropriate behavior.
|
|
||||||
|
|
||||||
**Consequence**: A temporary ban from any sort of interaction or public
|
|
||||||
communication with the community for a specified period of time. No public or
|
|
||||||
private interaction with the people involved, including unsolicited interaction
|
|
||||||
with those enforcing the Code of Conduct, is allowed during this period.
|
|
||||||
Violating these terms may lead to a permanent ban.
|
|
||||||
|
|
||||||
### 4. Permanent Ban
|
|
||||||
|
|
||||||
**Community Impact**: Demonstrating a pattern of violation of community
|
|
||||||
standards, including sustained inappropriate behavior, harassment of an
|
|
||||||
individual, or aggression toward or disparagement of classes of individuals.
|
|
||||||
|
|
||||||
**Consequence**: A permanent ban from any sort of public interaction within
|
|
||||||
the community.
|
|
||||||
|
|
||||||
## Attribution
|
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
||||||
version 2.0, available at
|
|
||||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
||||||
|
|
||||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
||||||
enforcement ladder](https://github.com/mozilla/diversity).
|
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see the FAQ at
|
|
||||||
https://www.contributor-covenant.org/faq. Translations are available at
|
|
||||||
https://www.contributor-covenant.org/translations.
|
|
||||||
@@ -12,7 +12,6 @@ submit the change with your pull request.
|
|||||||
- Miles Gould / [pozorvlak](https://github.com/pozorvlak)
|
- Miles Gould / [pozorvlak](https://github.com/pozorvlak)
|
||||||
- Mackenzie Morgan / [maco](https://github.com/maco)
|
- Mackenzie Morgan / [maco](https://github.com/maco)
|
||||||
- Brenda Wallace / [br3nda](https://github.com/br3nda)
|
- Brenda Wallace / [br3nda](https://github.com/br3nda)
|
||||||
- Daniel O'Connor / [CloCkWeRX](https://github.com/CloCkWeRX)
|
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
@@ -69,6 +68,7 @@ submit the change with your pull request.
|
|||||||
- Jym Paul Carandang / [jacarandang](https://github.com/jacarandang)
|
- Jym Paul Carandang / [jacarandang](https://github.com/jacarandang)
|
||||||
- Anthony Atkinson / [sha1sum](https://github.com/sha1sum)
|
- Anthony Atkinson / [sha1sum](https://github.com/sha1sum)
|
||||||
- Terence Conquest / [twconquest](https://github.com/twconquest)
|
- Terence Conquest / [twconquest](https://github.com/twconquest)
|
||||||
|
- Daniel O'Connor / [CloCkWeRX](https://github.com/CloCkWeRX)
|
||||||
- DV Dasari / [dv2](https://github.com/dv2)
|
- DV Dasari / [dv2](https://github.com/dv2)
|
||||||
- Eric Tillberg / [Thrillberg](https://github.com/Thrillberg)
|
- Eric Tillberg / [Thrillberg](https://github.com/Thrillberg)
|
||||||
- Lucas Nogueira / [lucasnogueira](https://github.com/lucasnogueira)
|
- Lucas Nogueira / [lucasnogueira](https://github.com/lucasnogueira)
|
||||||
@@ -92,14 +92,10 @@ submit the change with your pull request.
|
|||||||
- André Aubin / [lambda2](https://github.com/lambda2)
|
- André Aubin / [lambda2](https://github.com/lambda2)
|
||||||
- Martina Simicic / [simicic](https://github.com/simicic)
|
- Martina Simicic / [simicic](https://github.com/simicic)
|
||||||
- Rowan Crawford / [wombleton](https://github.com/wombleton)
|
- Rowan Crawford / [wombleton](https://github.com/wombleton)
|
||||||
- Ítalo Pires / [italopires](https://github.com/italopires)
|
- Le-jun - [lejun](https://github.com/le-jun)
|
||||||
- Bennett Zink / [bennett-zink](https://github.com/bennett-zink)
|
|
||||||
- Dominick Thornton / [domthor](https://github.com/domthor)
|
|
||||||
|
|
||||||
## Bots
|
## Bots
|
||||||
|
|
||||||
### Security and Dependency Updates
|
### Security and Dependency Updates
|
||||||
- `codefactor-io[bot]`
|
|
||||||
- DeppBot / [deppbot](https://github.com/deppbot)
|
- DeppBot / [deppbot](https://github.com/deppbot)
|
||||||
- `dependabot[bot]` [dependabot](https://github.com/dependabot-bot) / [dependabot-preview](https://github.com/apps/dependabot-preview)
|
- `dependabot[bot]` [dependabot](https://github.com/dependabot-bot) / [dependabot-preview](https://github.com/apps/dependabot-preview)
|
||||||
- [google-labs-jules[bot]](https://github.com/apps/google-labs-jules)
|
|
||||||
|
|||||||
52
Dockerfile
@@ -1,52 +0,0 @@
|
|||||||
FROM ruby:3.4.9-trixie
|
|
||||||
|
|
||||||
# Install system dependencies
|
|
||||||
RUN apt-get update -qq && \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
build-essential \
|
|
||||||
libpq-dev \
|
|
||||||
git \
|
|
||||||
curl \
|
|
||||||
gnupg2 \
|
|
||||||
shared-mime-info \
|
|
||||||
libvips \
|
|
||||||
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
|
||||||
&& apt-get install -y --no-install-recommends nodejs \
|
|
||||||
&& npm install -g yarn \
|
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Set production environment
|
|
||||||
ENV RAILS_ENV=production \
|
|
||||||
BUNDLE_WITHOUT="development test" \
|
|
||||||
RAILS_SERVE_STATIC_FILES=true \
|
|
||||||
RAILS_LOG_TO_STDOUT=true
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install gems
|
|
||||||
COPY Gemfile Gemfile.lock ./
|
|
||||||
RUN bundle config set --local deployment 'true' && \
|
|
||||||
bundle config set --local without 'development test' && \
|
|
||||||
bundle install --jobs 4 --retry 3
|
|
||||||
|
|
||||||
# Install JavaScript dependencies
|
|
||||||
COPY package.json yarn.lock ./
|
|
||||||
RUN yarn install --check-files
|
|
||||||
|
|
||||||
# Copy the application code
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Precompile assets
|
|
||||||
# Secret key base is needed for asset compilation but doesn't need to be the real one
|
|
||||||
RUN RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1 bundle exec rake assets:precompile
|
|
||||||
|
|
||||||
# Add a script to be executed every time the container starts.
|
|
||||||
COPY entrypoint.sh /usr/bin/
|
|
||||||
RUN chmod +x /usr/bin/entrypoint.sh
|
|
||||||
ENTRYPOINT ["entrypoint.sh"]
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
# Start the main process.
|
|
||||||
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
|
|
||||||
77
Gemfile
@@ -5,17 +5,17 @@ source 'https://rubygems.org'
|
|||||||
# Match ruby version in .ruby-version
|
# Match ruby version in .ruby-version
|
||||||
ruby File.read('.ruby-version')
|
ruby File.read('.ruby-version')
|
||||||
|
|
||||||
gem 'rails', '~> 7.2.0'
|
gem 'rails', '6.0.3.2'
|
||||||
|
|
||||||
# Keeping old sprockets
|
# Keeping old sprockets
|
||||||
# https://github.com/rails/sprockets-rails/issues/444#issuecomment-637817050
|
# https://github.com/rails/sprockets-rails/issues/444#issuecomment-637817050
|
||||||
gem "sprockets", "<4"
|
gem "sprockets", "<4"
|
||||||
|
|
||||||
gem 'bundler', '>= 2.4.22'
|
gem 'bundler', '>=1.1.5'
|
||||||
|
|
||||||
gem 'coffee-rails'
|
gem 'coffee-rails'
|
||||||
gem 'haml'
|
gem 'haml'
|
||||||
gem 'sassc-rails'
|
gem 'sass-rails'
|
||||||
|
|
||||||
# API data
|
# API data
|
||||||
gem 'jsonapi-resources'
|
gem 'jsonapi-resources'
|
||||||
@@ -24,7 +24,7 @@ gem 'rswag-api'
|
|||||||
gem 'rswag-ui'
|
gem 'rswag-ui'
|
||||||
|
|
||||||
# CSS framework
|
# CSS framework
|
||||||
gem "bootstrap", ">= 5.0.0"
|
gem "bootstrap", ">= 4.3.1"
|
||||||
gem 'material-sass', '4.1.1'
|
gem 'material-sass', '4.1.1'
|
||||||
|
|
||||||
# Icons used by bootstrap/material-sass
|
# Icons used by bootstrap/material-sass
|
||||||
@@ -33,32 +33,33 @@ gem 'material_icons'
|
|||||||
# icons
|
# icons
|
||||||
gem 'font-awesome-sass'
|
gem 'font-awesome-sass'
|
||||||
|
|
||||||
gem 'terser'
|
gem 'uglifier' # JavaScript compressor
|
||||||
|
|
||||||
gem 'oj' # Speeds up json
|
gem 'oj' # Speeds up json
|
||||||
|
|
||||||
# planting and harvest predictions
|
# planting and harvest predictions
|
||||||
# based on median values for the crop
|
# based on median values for the crop
|
||||||
gem 'active_median'
|
gem 'active_median', '0.2.0'
|
||||||
gem 'active_record_union'
|
gem 'active_record_union'
|
||||||
|
|
||||||
gem 'flickraw'
|
gem 'flickraw'
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
gem 'jquery-ui-rails', github: 'jquery-ui-rails/jquery-ui-rails', tag: 'v7.0.0' # See https://github.com/jquery-ui-rails/jquery-ui-rails/issues/146
|
gem 'jquery-ui-rails'
|
||||||
|
gem 'js-routes' # provides access to Rails routes in Javascript
|
||||||
|
|
||||||
gem 'cancancan' # for checking member privileges
|
gem 'cancancan' # for checking member privileges
|
||||||
gem 'csv_shaper' # CSV export
|
gem 'csv_shaper' # CSV export
|
||||||
gem 'gibbon', '~>1.2.0' # for Mailchimp newsletter subscriptions
|
gem 'gibbon', '~>1.2.0' # for Mailchimp newsletter subscriptions
|
||||||
|
|
||||||
# Maps
|
# Maps
|
||||||
gem 'leaflet-rails', '>= 1.9.2'
|
gem 'leaflet-rails'
|
||||||
gem 'rails-assets-leaflet.markercluster', source: 'https://rails-assets.org'
|
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 'ruby-units' # for unit conversion
|
||||||
gem 'unicorn' # http server
|
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 'active_utils'
|
||||||
gem 'sidekiq'
|
gem 'sidekiq'
|
||||||
@@ -68,7 +69,7 @@ gem 'bluecloth'
|
|||||||
|
|
||||||
# Pagination
|
# Pagination
|
||||||
gem 'will_paginate'
|
gem 'will_paginate'
|
||||||
gem 'will_paginate-bootstrap-style'
|
gem 'will_paginate-bootstrap4'
|
||||||
|
|
||||||
# user signup/login/etc
|
# user signup/login/etc
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
@@ -89,17 +90,19 @@ gem 'geocoder'
|
|||||||
gem 'bootstrap-datepicker-rails'
|
gem 'bootstrap-datepicker-rails'
|
||||||
|
|
||||||
# DRY-er easier bootstrap 4 forms
|
# DRY-er easier bootstrap 4 forms
|
||||||
gem "bootstrap_form", ">= 4.5.0"
|
gem "bootstrap_form", ">= 4.2.0"
|
||||||
|
|
||||||
# For connecting to other services (eg Flickr)
|
# For connecting to other services (eg Twitter)
|
||||||
gem 'omniauth', '~> 1.3'
|
gem 'omniauth', '~> 1.3'
|
||||||
|
gem 'omniauth-facebook'
|
||||||
gem 'omniauth-flickr', '>= 0.0.15'
|
gem 'omniauth-flickr', '>= 0.0.15'
|
||||||
|
gem 'omniauth-twitter'
|
||||||
|
|
||||||
# Pretty charts
|
# Pretty charts
|
||||||
gem "chartkick"
|
gem "chartkick"
|
||||||
|
|
||||||
# clever elastic search
|
# clever elastic search
|
||||||
gem 'elasticsearch', '~> 7.0.0'
|
gem 'elasticsearch', '< 7.0.0'
|
||||||
gem 'searchkick'
|
gem 'searchkick'
|
||||||
|
|
||||||
gem "hashie", ">= 3.5.3"
|
gem "hashie", ">= 3.5.3"
|
||||||
@@ -116,33 +119,17 @@ gem 'xmlrpc' # fixes rake error - can be removed if not needed later
|
|||||||
|
|
||||||
gem 'puma'
|
gem 'puma'
|
||||||
|
|
||||||
gem 'rack-attack'
|
gem 'loofah', '>= 2.2.1'
|
||||||
|
|
||||||
gem 'loofah', '>= 2.19.1'
|
|
||||||
gem 'rack-protection', '>= 2.0.1'
|
gem 'rack-protection', '>= 2.0.1'
|
||||||
|
|
||||||
# Member to member messaging system
|
# Member to member messaging system
|
||||||
gem 'mailboxer', '>= 0.15.1'
|
gem 'mailboxer'
|
||||||
|
|
||||||
gem 'faraday'
|
gem 'faraday'
|
||||||
|
gem 'faraday_middleware'
|
||||||
|
|
||||||
gem 'rack-cors'
|
gem 'rack-cors'
|
||||||
|
|
||||||
gem 'icalendar'
|
|
||||||
|
|
||||||
# for signups as requested by email service
|
|
||||||
gem 'recaptcha'
|
|
||||||
|
|
||||||
# External APIs for data
|
|
||||||
gem "gbifrb"
|
|
||||||
|
|
||||||
gem "msgpack"
|
|
||||||
|
|
||||||
# Pinned due to RAILS_ENV=production bundle exec rake assets:precompile failing with ArgumentError: wrong number of arguments (given 1, expected 0) (ArgumentError)
|
|
||||||
# /tmp/build_8301a541/vendor/bundle/ruby/3.3.0/gems/connection_pool-3.0.2/lib/connection_pool.rb:48:in `initialize'
|
|
||||||
# /tmp/build_8301a541/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.3/lib/active_support/cache/mem_cache_store.rb:63:in `new'
|
|
||||||
gem "connection_pool", "< 3"
|
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
gem 'bonsai-elasticsearch-rails' # Integration with Bonsa-Elasticsearch on heroku
|
gem 'bonsai-elasticsearch-rails' # Integration with Bonsa-Elasticsearch on heroku
|
||||||
gem 'dalli'
|
gem 'dalli'
|
||||||
@@ -168,23 +155,18 @@ group :development, :test do
|
|||||||
gem 'factory_bot_rails' # for creating test data
|
gem 'factory_bot_rails' # for creating test data
|
||||||
gem 'faker'
|
gem 'faker'
|
||||||
gem 'haml-rails' # HTML templating language
|
gem 'haml-rails' # HTML templating language
|
||||||
gem 'pry'
|
|
||||||
gem 'query_diet'
|
gem 'query_diet'
|
||||||
gem 'rspec-activemodel-mocks'
|
gem 'rspec-activemodel-mocks'
|
||||||
gem 'rspec-rails' # unit testing framework
|
gem 'rspec-rails' # unit testing framework
|
||||||
gem 'rswag-specs'
|
gem 'rswag-specs'
|
||||||
gem 'rubocop-capybara'
|
|
||||||
gem 'rubocop-factory_bot'
|
|
||||||
gem 'rubocop-rails'
|
gem 'rubocop-rails'
|
||||||
gem 'rubocop-rake'
|
|
||||||
gem 'rubocop-rspec'
|
gem 'rubocop-rspec'
|
||||||
gem 'rubocop-rspec_rails'
|
|
||||||
gem 'webrat' # provides HTML matchers for view tests
|
gem 'webrat' # provides HTML matchers for view tests
|
||||||
|
|
||||||
gem 'crowdin-cli' # for translations
|
|
||||||
gem 'dotenv-rails'
|
gem 'dotenv-rails'
|
||||||
|
|
||||||
# cli utils
|
# cli utils
|
||||||
|
gem 'haml-i18n-extractor', require: false
|
||||||
gem 'haml_lint', '>= 0.25.1', require: false # Checks haml files for goodness
|
gem 'haml_lint', '>= 0.25.1', require: false # Checks haml files for goodness
|
||||||
gem 'i18n-tasks', require: false # adds tests for finding missing and unused translations
|
gem 'i18n-tasks', require: false # adds tests for finding missing and unused translations
|
||||||
gem 'rspectre', require: false # finds unused code in specs
|
gem 'rspectre', require: false # finds unused code in specs
|
||||||
@@ -192,19 +174,14 @@ group :development, :test do
|
|||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'axe-core-capybara'
|
gem 'codeclimate-test-reporter', require: false
|
||||||
gem 'axe-core-rspec'
|
gem 'percy-capybara'
|
||||||
gem "percy-capybara", "~> 5.0.0"
|
|
||||||
gem 'rails-controller-testing'
|
gem 'rails-controller-testing'
|
||||||
gem "rspec-rebound"
|
|
||||||
gem 'selenium-webdriver'
|
gem 'selenium-webdriver'
|
||||||
gem 'timecop'
|
gem 'timecop'
|
||||||
gem 'vcr'
|
gem 'webdrivers'
|
||||||
end
|
end
|
||||||
|
|
||||||
gem "i18n_data", "~> 1.1"
|
group :travis do
|
||||||
|
gem 'platform-api'
|
||||||
gem "paper_trail", "~> 17.0"
|
end
|
||||||
|
|
||||||
gem 'aws-sdk-s3', '~> 1', '>= 1.114.0'
|
|
||||||
gem 'sitemap_generator'
|
|
||||||
|
|||||||
1073
Gemfile.lock
18
README.md
@@ -1,6 +1,7 @@
|
|||||||
# 🌱 Growstuff
|
# 🌱 Growstuff
|
||||||
|
|
||||||

|

|
||||||
|
[](https://codeclimate.com/github/Growstuff/growstuff)
|
||||||
|
|
||||||
Welcome to the Growstuff project.
|
Welcome to the Growstuff project.
|
||||||
|
|
||||||
@@ -14,18 +15,12 @@ Growstuff was founded in 2012 and has been built by dozens of
|
|||||||
[contributors](CONTRIBUTORS.md). We are an inclusive, welcoming project, and
|
[contributors](CONTRIBUTORS.md). We are an inclusive, welcoming project, and
|
||||||
encourage participation from people of all backgrounds and skill levels.
|
encourage participation from people of all backgrounds and skill levels.
|
||||||
|
|
||||||
## Want to contribute?
|
|
||||||
|
|
||||||
Don't ask to ask, the best way to get started is to fork the project, start a codespace and get hacking.
|
|
||||||
Dive on in and submit your PRs!
|
|
||||||
|
|
||||||
Vibe Coding is more than okay, just make sure you indicate if you have done so and ensure there are tests.
|
|
||||||
|
|
||||||
## Important links
|
## Important links
|
||||||
|
|
||||||
* [Issues](https://github.com/orgs/Growstuff/projects/1) (features we're
|
* [Issues](https://github.com/orgs/Growstuff/projects/1) (features we're
|
||||||
working on, known bugs, etc)
|
working on, known bugs, etc)
|
||||||
* [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc.)
|
* [](https://gitter.im/Growstuff/growstuff?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||||
|
* [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc. Help by migrating from the [old wiki](https://web.archive.org/web/*/wiki.growstuff.org))
|
||||||
|
|
||||||
## For coders
|
## For coders
|
||||||
|
|
||||||
@@ -34,12 +29,9 @@ frontend features. We welcome contributions -- see
|
|||||||
[CONTRIBUTING](CONTRIBUTING.md) for details.
|
[CONTRIBUTING](CONTRIBUTING.md) for details.
|
||||||
|
|
||||||
* To set up your development environment, see [Getting started](https://github.com/Growstuff/growstuff/wiki/New-contributor-guide).
|
* To set up your development environment, see [Getting started](https://github.com/Growstuff/growstuff/wiki/New-contributor-guide).
|
||||||
|
* We encourage [pair programming](http://wiki.growstuff.org/index.php/Pairing), especially for newer developers.
|
||||||
* You may also be interested in our [API](https://github.com/Growstuff/growstuff/wiki/API).
|
* You may also be interested in our [API](https://github.com/Growstuff/growstuff/wiki/API).
|
||||||
|
|
||||||
### For Home Automation enthusiasts
|
|
||||||
|
|
||||||
https://github.com/Growstuff/homeassistant-growstuff/
|
|
||||||
|
|
||||||
## For designers, writers, researchers, data wranglers, and other contributors
|
## For designers, writers, researchers, data wranglers, and other contributors
|
||||||
|
|
||||||
There are heaps of ways to get involved and contribute no matter what
|
There are heaps of ways to get involved and contribute no matter what
|
||||||
@@ -67,3 +59,5 @@ For more information about this project, contact [info@growstuff.org](mailto:inf
|
|||||||
|
|
||||||
Security Issues: If you find an authorization bypass or data breach, please contact our maintainers directly at [maintainers@growstuff.org](mailto:maintainers@growstuff.org).
|
Security Issues: If you find an authorization bypass or data breach, please contact our maintainers directly at [maintainers@growstuff.org](mailto:maintainers@growstuff.org).
|
||||||
|
|
||||||
|
You can also contact us on [Twitter](http://twitter.com/growstufforg/) or
|
||||||
|
[Facebook](https://www.facebook.com/pages/Growstuff/1531133417099494) or [Github](https://github.com/Growstuff/growstuff/issues)..
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 155 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 266 KiB |
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
||||||
<!-- MIT Licenced, https://www.svgrepo.com/svg/336823/plan -->
|
|
||||||
<svg width="800px" height="800px" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<rect width="48" height="48" fill="white" fill-opacity="0.01"/>
|
|
||||||
<path d="M5 19H43V41C43 42.1046 42.1046 43 41 43H7C5.89543 43 5 42.1046 5 41V19Z" fill="#2F88FF" stroke="#000000" stroke-width="4" stroke-linejoin="round"/>
|
|
||||||
<path d="M5 10C5 8.89543 5.89543 8 7 8H41C42.1046 8 43 8.89543 43 10V19H5V10Z" stroke="#000000" stroke-width="4" stroke-linejoin="round"/>
|
|
||||||
<path d="M16 31L22 37L34 25" stroke="white" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
<path d="M16 5V13" stroke="#000000" stroke-width="4" stroke-linecap="round"/>
|
|
||||||
<path d="M32 5V13" stroke="#000000" stroke-width="4" stroke-linecap="round"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 916 B |
BIN
app/assets/images/location-not-set.en.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 58 KiB |
1
app/assets/images/pearLogo.svg
Normal file
|
After Width: | Height: | Size: 221 KiB |
BIN
app/assets/images/twitter_32.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
@@ -12,23 +12,13 @@
|
|||||||
//
|
//
|
||||||
// = require leaflet
|
// = require leaflet
|
||||||
// = require leaflet.markercluster
|
// = require leaflet.markercluster
|
||||||
|
// = require js-routes
|
||||||
// = require popper
|
// = require popper
|
||||||
// = require jquery
|
// = require jquery
|
||||||
// = require jquery_ujs
|
// = require jquery_ujs
|
||||||
// = require jquery-ui/widgets/autocomplete
|
// = require jquery-ui/widgets/autocomplete
|
||||||
// = require bootstrap-sprockets
|
// = require bootstrap-sprockets
|
||||||
// = require bootstrap-datepicker
|
// = require bootstrap-datepicker
|
||||||
|
// = require bootstrap
|
||||||
// = require material
|
// = require material
|
||||||
// = require_tree .
|
// = require_tree .
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function(event) {
|
|
||||||
var popoverTrigger = Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
|
|
||||||
popoverTrigger.map(function(popoverTrigger2) {
|
|
||||||
return new bootstrap.Popover(popoverTrigger2);
|
|
||||||
});
|
|
||||||
|
|
||||||
var tooltipTrigger = Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
|
||||||
tooltipTrigger.map(function(tooltipTrigger2) {
|
|
||||||
return new bootstrap.Tooltip(tooltipTrigger2);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
4
app/assets/javascripts/bootstrap-accessibility.min.js
vendored
Normal file
4
app/assets/javascripts/bootstrap.js.coffee
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
jQuery ->
|
||||||
|
$("a[rel=popover]").popover()
|
||||||
|
$(".tooltip").tooltip()
|
||||||
|
$("a[rel=tooltip]").tooltip()
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
function showCropMap(cropmap) {
|
function showCropMap(cropmap) {
|
||||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
var mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>";
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
var mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>";
|
||||||
|
var mapbox_base_url = "https://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
|
||||||
|
|
||||||
|
L.tileLayer(mapbox_base_url, {
|
||||||
|
attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors under <a href="https://www.openstreetmap.org/copyright">ODbL</a> | Map imagery © <a href="https://mapbox.com">Mapbox</a>',
|
||||||
maxZoom: 18
|
maxZoom: 18
|
||||||
}).addTo(cropmap);
|
}).addTo(cropmap);
|
||||||
var markers = new L.MarkerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 20 });
|
var markers = new L.MarkerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 20 });
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ jQuery ->
|
|||||||
$(".remove-altname-row").css("display", "inline-block")
|
$(".remove-altname-row").css("display", "inline-block")
|
||||||
|
|
||||||
-$ ->
|
-$ ->
|
||||||
sci_template = "<div id='sci_template[INDEX]' class='template col-md-12'><div class='col-md-2'><label>Scientific name INDEX:</label></div><div class='col-md-8'><input name='sci_name[INDEX]' class='scientific-name-auto-suggest form-control' id='sci_name[INDEX]' data-source-url='/scientific_names/gbif_suggest')'></input><span class='help-block'>Scientific name of crop</span><input type='text' id='sci_gbif_key[INDEX]' class=''></div><div class='col-md-2'></div></div>"
|
sci_template = "<div id='sci_template[INDEX]' class='template col-md-12'><div class='col-md-2'><label>Scientific name INDEX:</label></div><div class='col-md-8'><input name='sci_name[INDEX]' class='form-control', id='sci_name[INDEX]')'></input><span class='help-block'>Scientific name of crop.</span></div><div class='col-md-2'></div></div>"
|
||||||
|
|
||||||
sci_index = $('#scientific_names .template').length + 1
|
sci_index = $('#scientific_names .template').length + 1
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ jQuery ->
|
|||||||
element = document.getElementById(tmp)
|
element = document.getElementById(tmp)
|
||||||
element.remove()
|
element.remove()
|
||||||
|
|
||||||
alt_template = "<div id='alt_template[INDEX]' class='template col-md-12'><div class='col-md-2'><label>Alternate name INDEX:</label></div><div class='col-md-8'><input name='alt_name[INDEX]' class='form-control' id='alt_name[INDEX]')'></input><span class='help-block'>Alternate name of crop.</span></div><div class='col-md-2'></div></div>"
|
alt_template = "<div id='alt_template[INDEX]' class='template col-md-12'><div class='col-md-2'><label>Alternate name INDEX:</label></div><div class='col-md-8'><input name='alt_name[INDEX]' class='form-control', id='alt_name[INDEX]')'></input><span class='help-block'>Alternate name of crop.</span></div><div class='col-md-2'></div></div>"
|
||||||
|
|
||||||
alt_index = $('#alternate_names .template').length + 1
|
alt_index = $('#alternate_names .template').length + 1
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,11 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.like-btn').show();
|
$('.like-btn').show();
|
||||||
|
|
||||||
/**
|
$('.post-like').on('ajax:success', function(event, data) {
|
||||||
* Handles the result of an ajax call and updates UI
|
var likeButton = $('#post-' + data.id + ' .post-like');
|
||||||
*
|
var likeBadge = $('#post-'+ data.id + ' .like-badge');
|
||||||
* @param {object} data JSON data from ajax response
|
|
||||||
* @param {string} type object type (ie: post, activity, etc)
|
|
||||||
*/
|
|
||||||
var likeableSuccess = function(data, type) {
|
|
||||||
var target = '.' + type + '-' + data.id;
|
|
||||||
var objectClass = type.charAt(0).toUpperCase() + type.slice(1);
|
|
||||||
var likeButton = $(target + ' .' + type + '-like');
|
|
||||||
var likeBadge = $(target + ' .like-badge');
|
|
||||||
|
|
||||||
$(target + ' .like-count').text(data.like_count);
|
$('#post-' + data.id + ' .like-count').text(data.like_count);
|
||||||
if (data.liked_by_member) {
|
if (data.liked_by_member) {
|
||||||
likeBadge.addClass('liked');
|
likeBadge.addClass('liked');
|
||||||
likeButton.data('method', 'delete');
|
likeButton.data('method', 'delete');
|
||||||
@@ -22,26 +14,11 @@ $(document).ready(function() {
|
|||||||
} else {
|
} else {
|
||||||
likeBadge.removeClass('liked');
|
likeBadge.removeClass('liked');
|
||||||
likeButton.data('method', 'post');
|
likeButton.data('method', 'post');
|
||||||
likeButton.attr('href', '/likes.json?type=' + objectClass + '&id=' + data.id);
|
likeButton.attr('href', '/likes.json?type=Post&id=' + data.id);
|
||||||
likeButton.text('Like');
|
likeButton.text('Like');
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
$('.post-like').on('ajax:success', function(event, data) {
|
|
||||||
likeableSuccess(data, 'post');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.activity-like').on('ajax:success', function(event, data) {
|
|
||||||
likeableSuccess(data, 'activity');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.planting-like').on('ajax:success', function(event, data) {
|
|
||||||
likeableSuccess(data, 'planting');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.harvest-like').on('ajax:success', function(event, data) {
|
|
||||||
likeableSuccess(data, 'harvest');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.photo-like').on('ajax:success', function(event, data) {
|
$('.photo-like').on('ajax:success', function(event, data) {
|
||||||
var likeBadge = $('#photo-'+ data.id + ' .like-badge');
|
var likeBadge = $('#photo-'+ data.id + ' .like-badge');
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
if (document.getElementById("membermap") !== null) {
|
if (document.getElementById("membermap") !== null) {
|
||||||
|
var mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>";
|
||||||
|
var mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>";
|
||||||
|
var mapbox_base_url = "https://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
|
||||||
|
|
||||||
|
L.Icon.Default.imagePath = '/assets'
|
||||||
|
|
||||||
L.Icon.Default.imagePath = '/assets';
|
L.Icon.Default.imagePath = '/assets';
|
||||||
|
|
||||||
var default_marker_icon = L.icon({
|
var default_marker_icon = L.icon({
|
||||||
@@ -12,8 +18,8 @@ if (document.getElementById("membermap") !== null) {
|
|||||||
if (member.latitude && member.longitude) {
|
if (member.latitude && member.longitude) {
|
||||||
var membermap = L.map('membermap').setView([member.latitude, member.longitude], 4);
|
var membermap = L.map('membermap').setView([member.latitude, member.longitude], 4);
|
||||||
|
|
||||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer(mapbox_base_url, {
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors under <a href="https://www.openstreetmap.org/copyright">ODbL</a> | Map imagery © <a href="https://mapbox.com">Mapbox</a>',
|
||||||
maxZoom: 18
|
maxZoom: 18
|
||||||
}).addTo(membermap);
|
}).addTo(membermap);
|
||||||
var marker = new L.Marker(new L.LatLng(member.latitude, member.longitude),
|
var marker = new L.Marker(new L.LatLng(member.latitude, member.longitude),
|
||||||
|
|||||||
1
app/assets/javascripts/nav.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
$('.dropdown-toggle').dropdown();
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
if (document.getElementById("placesmap") !== null) {
|
if (document.getElementById("placesmap") !== null) {
|
||||||
var places_base_path = "/places";
|
var places_base_path = "/places";
|
||||||
|
var mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>";
|
||||||
|
var mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>";
|
||||||
|
var mapbox_base_url = "https://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
|
||||||
var nominatim_base_url = 'https://nominatim.openstreetmap.org/search/';
|
var nominatim_base_url = 'https://nominatim.openstreetmap.org/search/';
|
||||||
var nominatim_user_agent_email = "<%= Rails.env == 'test' ? 0 : Rails.application.config.user_agent_email %>";
|
var nominatim_user_agent_email = "<%= Rails.env == 'test' ? 0 : Rails.application.config.user_agent_email %>";
|
||||||
|
|
||||||
@@ -28,8 +31,8 @@ if (document.getElementById("placesmap") !== null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showMap(placesmap) {
|
function showMap(placesmap) {
|
||||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer(mapbox_base_url, {
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors under <a href="https://www.openstreetmap.org/copyright">ODbL</a> | Map imagery © <a href="https://mapbox.com">Mapbox</a>',
|
||||||
maxZoom: 18
|
maxZoom: 18
|
||||||
}).addTo(placesmap);
|
}).addTo(placesmap);
|
||||||
|
|
||||||
@@ -58,7 +61,6 @@ function showMap(placesmap) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function fetchCropsForMap(url) {
|
function fetchCropsForMap(url) {
|
||||||
var n = 0;
|
|
||||||
$.getJSON(url, function(crop_data) {
|
$.getJSON(url, function(crop_data) {
|
||||||
$.each(crop_data['data'], function(i, p) {
|
$.each(crop_data['data'], function(i, p) {
|
||||||
if (p.attributes.latitude && p.attributes.longitude) {
|
if (p.attributes.latitude && p.attributes.longitude) {
|
||||||
@@ -79,8 +81,7 @@ function showMap(placesmap) {
|
|||||||
markers.addLayer(marker);
|
markers.addLayer(marker);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// We fetch pages of 10 at a time. Stop after 200 crops; so we are showing only 'active' plantings.
|
if (crop_data['links']['next']) {
|
||||||
if (crop_data['links']['next'] && n++ < 20) {
|
|
||||||
fetchCropsForMap(crop_data['links']['next'])
|
fetchCropsForMap(crop_data['links']['next'])
|
||||||
}
|
}
|
||||||
return crop_data;
|
return crop_data;
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
# TODO: This assumes one autocomplete per page.
|
|
||||||
# Needs to be a function so that when we append one of these, it gets uniquely associated with the hidden controls.
|
|
||||||
jQuery ->
|
|
||||||
|
|
||||||
if el = $( '.scientific-name-auto-suggest' )
|
|
||||||
|
|
||||||
id = $( '.scientific-name-auto-suggest-id' )
|
|
||||||
|
|
||||||
el.autocomplete
|
|
||||||
minLength: 3,
|
|
||||||
source: el.attr( 'data-source-url' ),
|
|
||||||
focus: ( event, ui ) ->
|
|
||||||
el.val( ui.item.canonicalName )
|
|
||||||
id.val( ui.item.nameKey )
|
|
||||||
false
|
|
||||||
select: ( event, ui ) ->
|
|
||||||
el.val( ui.item.canonicalName )
|
|
||||||
id.val( ui.item.nameKey )
|
|
||||||
false
|
|
||||||
response: ( event, ui ) ->
|
|
||||||
id.val( "" )
|
|
||||||
for item in ui.content
|
|
||||||
if item.name == el.val()
|
|
||||||
id.val( item.nameKey )
|
|
||||||
|
|
||||||
if el.data( 'uiAutocomplete' )
|
|
||||||
el.data( 'uiAutocomplete' )._renderItem = ( ul, item ) ->
|
|
||||||
$( '<li class="list-group-item"></li>' )
|
|
||||||
.data( 'item.autocomplete', item )
|
|
||||||
.append( "<a>#{item.canonicalName} (#{item.scientificName}) - #{item.rank}</a>" )
|
|
||||||
.appendTo( ul )
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
$(document).ready(function() {
|
|
||||||
var url = location.href.replace(/\/$/, '');
|
|
||||||
|
|
||||||
if (location.hash) {
|
|
||||||
var hash = url.split('#');
|
|
||||||
var triggerEl = document.querySelector('#myTab a[href="#' + hash[1] + '"]');
|
|
||||||
var tab = new bootstrap.Tab(triggerEl);
|
|
||||||
tab.show();
|
|
||||||
url = location.href.replace(/\/#/, '#');
|
|
||||||
history.replaceState(null, null, url);
|
|
||||||
setTimeout(function() {
|
|
||||||
$(window).scrollTop(0);
|
|
||||||
}, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
$('a[data-bs-toggle="tab"]').on('click', function() {
|
|
||||||
var newUrl;
|
|
||||||
var hash = $(this).attr('href');
|
|
||||||
newUrl = url.split('#')[0] + hash;
|
|
||||||
history.replaceState(null, null, newUrl);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
$(function() {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
.crop-icon {
|
.crop-icon {
|
||||||
height: 1em;
|
height: 1em;
|
||||||
}
|
}
|
||||||
.card-footer {
|
|
||||||
.btn-group-vertical {
|
|
||||||
.btn {
|
|
||||||
text-wrap: initial
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.crop-thumbnail {
|
.crop-thumbnail {
|
||||||
.text {
|
.text {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
@@ -25,7 +19,7 @@
|
|||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.crop-sci-name {
|
h5.crop-sci-name {
|
||||||
background-color: $beige;
|
background-color: $beige;
|
||||||
color: $black;
|
color: $black;
|
||||||
font-size: 0.7em;
|
font-size: 0.7em;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// stats shown on homepage. eg. "999 members..."
|
// stats shown on homepage. eg. "999 members..."
|
||||||
.stats {
|
.stats {
|
||||||
a {
|
font-weight: bold;
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.crops,
|
.crops,
|
||||||
@@ -16,27 +14,3 @@
|
|||||||
.homepage--list-item {
|
.homepage--list-item {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
.releases {
|
|
||||||
.card {
|
|
||||||
.card-header {
|
|
||||||
|
|
||||||
}
|
|
||||||
.card-body {
|
|
||||||
h2 {
|
|
||||||
background-color: transparent;
|
|
||||||
color: black;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
img {
|
|
||||||
border: 0.5em solid #111;
|
|
||||||
margin-left: 5%;
|
|
||||||
margin-right: 5%;
|
|
||||||
width: 90%;
|
|
||||||
}
|
|
||||||
ul {
|
|
||||||
margin-bottom: 1em;
|
|
||||||
margin-top: 1em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -33,22 +33,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.location-not-set {
|
||||||
.badge-location {
|
background-image: image-url("location-not-set.en.png");
|
||||||
background-color: darken($blue, 10%);
|
background-position: center;
|
||||||
border-radius: 5%;
|
background-repeat: no-repeat;
|
||||||
color: $white;
|
height: 250px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.fa-map-marker {
|
.badge-location {
|
||||||
padding-right: 0.5em;
|
background-color: darken($blue, 10%);
|
||||||
}
|
border-radius: 5%;
|
||||||
}
|
color: $white;
|
||||||
|
}
|
||||||
.badge {
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: normal;
|
|
||||||
align-items: end;
|
|
||||||
max-height: 1rlh;
|
|
||||||
-webkit-line-clamp: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -47,13 +47,4 @@
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-footer {
|
|
||||||
max-height: 2em;
|
|
||||||
-webkit-line-clamp: 1;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
margin-bottom: 0.5em;
|
|
||||||
padding-top: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.seed-card {
|
.seed-card {
|
||||||
.text {
|
.text {
|
||||||
opacity: 0.95;
|
opacity: 0.8;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
//$screen-md-min: 1028px
|
//$screen-md-min: 1028px
|
||||||
|
|
||||||
// Base colours
|
// Base colours
|
||||||
$beige: #f4f2ef;
|
$beige: #f3f1ee;
|
||||||
$brown: #413f3b;
|
$brown: #413f3b;
|
||||||
|
|
||||||
$green: #57803c;
|
$green: #5f8e43;
|
||||||
$blue: #2f4365;
|
$blue: #2f4365;
|
||||||
$red: #ff4d43;
|
$red: #ff4d43;
|
||||||
$orange: #ffa500;
|
$orange: #ffa500;
|
||||||
|
|||||||
@@ -30,7 +30,3 @@
|
|||||||
@import "predictions";
|
@import "predictions";
|
||||||
@import "homepage";
|
@import "homepage";
|
||||||
@import "maps";
|
@import "maps";
|
||||||
|
|
||||||
@view-transition {
|
|
||||||
navigation: auto;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -10,33 +10,9 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#navbarSupportedContent {
|
.navbar .nav > li {
|
||||||
ul {
|
|
||||||
flex-direction: column-reverse;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
|
|
||||||
li.nav-item {
|
|
||||||
display: block;
|
|
||||||
a {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 2em 1fr 2em;
|
|
||||||
}
|
|
||||||
a.dropdown-toggle::after {
|
|
||||||
width: 100%;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.crop-actions {
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
a {
|
|
||||||
margin: auto;
|
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.navbar .navbar-form {
|
.navbar .navbar-form {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
@@ -78,12 +54,6 @@
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-footer {
|
|
||||||
.d-flex {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
border-left: 0;
|
border-left: 0;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ body {
|
|||||||
font-family: $default-font;
|
font-family: $default-font;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar {
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
align-items: flex-start
|
|
||||||
}
|
|
||||||
.navbar-brand {
|
.navbar-brand {
|
||||||
.site-name {
|
.site-name {
|
||||||
font-family: "Modak", cursive;
|
font-family: "Modak", cursive;
|
||||||
@@ -20,7 +16,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
height: 100%;
|
height: 60px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,15 +101,13 @@ section {
|
|||||||
background: $white;
|
background: $white;
|
||||||
box-shadow: 1px 3px 3px 1px darken($beige, 20%);
|
box-shadow: 1px 3px 3px 1px darken($beige, 20%);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition:
|
transition: 0.3s transform cubic-bezier(0.155, 1.105, 0.295, 1.12), 0.3s box-shadow,
|
||||||
0.1s transform cubic-bezier(0.155, 1.105, 0.295, 1.12),
|
0.3s -webkit-transform cubic-bezier(0.155, 1.105, 0.295, 1.12);
|
||||||
0.1s box-shadow,
|
|
||||||
0.1s -webkit-transform cubic-bezier(0.155, 1.105, 0.295, 1.12);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.card:hover {
|
.card:hover {
|
||||||
box-shadow:
|
box-shadow: 0 10px 20px darken($beige, 30%), 0 4px 8px darken($beige, 40%);
|
||||||
1px 3px 3px 1px darken($beige, 30%);
|
transform: scale(1.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,8 +126,6 @@ section {
|
|||||||
border-radius: 5%;
|
border-radius: 5%;
|
||||||
margin: 0.5em 0.5em 0.5em 0;
|
margin: 0.5em 0.5em 0.5em 0;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
align-items: stretch;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.img-card {
|
.img-card {
|
||||||
border-top-left-radius: 5%;
|
border-top-left-radius: 5%;
|
||||||
@@ -152,6 +144,10 @@ section {
|
|||||||
color: $brown;
|
color: $brown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
background-color: $beige;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-cover,
|
.img-cover,
|
||||||
@@ -358,9 +354,7 @@ ul.thumbnail-buttons {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.text-muted {
|
|
||||||
color: $blue;
|
|
||||||
}
|
|
||||||
.jumbotron {
|
.jumbotron {
|
||||||
background-color: $beige;
|
background-color: $beige;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
@@ -373,17 +367,12 @@ ul.thumbnail-buttons {
|
|||||||
|
|
||||||
// signup widget on homepage
|
// signup widget on homepage
|
||||||
.signup {
|
.signup {
|
||||||
background-color: darken($green, 20%);
|
background-color: lighten($green, 40%);
|
||||||
border: 1px solid darken($green, 20%);
|
border: 1px solid lighten($green, 20%);
|
||||||
color: $white;
|
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
line-height: 200%;
|
line-height: 200%;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
.btn-info {
|
|
||||||
background-color: $blue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class ActivitiesController < DataController
|
|
||||||
def index
|
|
||||||
@show_all = params[:all] == '1'
|
|
||||||
|
|
||||||
@activities = Activity.includes(:owner).order(created_at: :desc)
|
|
||||||
@activities = @activities.active unless @show_all
|
|
||||||
|
|
||||||
if params[:member_slug].present?
|
|
||||||
@owner = Member.find_by!(slug: params[:member_slug])
|
|
||||||
@activities = @activities.where(owner_id: @owner.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
@activities = @activities.paginate(page: params[:page], per_page: 30)
|
|
||||||
|
|
||||||
@filename = "Growstuff-#{specifics}Activities-#{Time.zone.now.to_fs(:number)}.csv"
|
|
||||||
respond_with(@activities)
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
if @activity.finished? && @activity.owner == current_member && (@activity.updated_at + 2.weeks) > Time.now
|
|
||||||
@repeat_link = new_activity_path(
|
|
||||||
name: @activity.name,
|
|
||||||
garden_id: @activity.garden_id,
|
|
||||||
planting_id: @activity.planting_id,
|
|
||||||
category: @activity.category,
|
|
||||||
description: @activity.description,
|
|
||||||
due_date: 2.weeks.from_now.to_date
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_with @activity
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@activity = Activity.new(
|
|
||||||
owner: current_member,
|
|
||||||
due_date: Date.today
|
|
||||||
)
|
|
||||||
@activity.name = params[:name] if params[:name]
|
|
||||||
@activity.description = params[:description] if params[:description]
|
|
||||||
@activity.category = params[:category] if params[:category]
|
|
||||||
@activity.due_date = params[:due_date] if params[:due_date]
|
|
||||||
if params[:garden_id]
|
|
||||||
@activity.garden = Garden.find_by(
|
|
||||||
owner: current_member,
|
|
||||||
id: params[:garden_id]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:planting_id]
|
|
||||||
@activity.planting = Planting.find_by(
|
|
||||||
owner: current_member,
|
|
||||||
id: params[:planting_id]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_with @activity
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
|
||||||
# the following are needed to display the form but aren't used
|
|
||||||
@gardens = @activity.owner.gardens.active.order_by_name
|
|
||||||
@plantings = @activity.owner.plantings.active
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@activity = Activity.new(activity_params)
|
|
||||||
@activity.owner = current_member
|
|
||||||
@activity.due_date ||= Date.today
|
|
||||||
|
|
||||||
if @activity.save
|
|
||||||
if params[:repeat_times].to_i > 0
|
|
||||||
repeat_times = params[:repeat_times].to_i
|
|
||||||
repeat_weeks = params[:repeat_weeks].to_i
|
|
||||||
|
|
||||||
repeat_times.times do |i|
|
|
||||||
new_activity = @activity.dup
|
|
||||||
new_activity.due_date = @activity.due_date + (i + 1) * repeat_weeks.weeks
|
|
||||||
new_activity.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_with @activity
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
@activity.update(activity_params)
|
|
||||||
respond_with @activity
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
@activity.destroy
|
|
||||||
respond_with @activity, location: @activity.garden
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def activity_params
|
|
||||||
params.require(:activity).permit(
|
|
||||||
:name, :description, :category, :finished,
|
|
||||||
:garden_id, :planting_id, :due_date,
|
|
||||||
:repeat_times, :repeat_weeks
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
def specifics
|
|
||||||
return if @owner.blank?
|
|
||||||
|
|
||||||
"#{@owner.to_param}-"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Admin
|
|
||||||
class CropCompanionsController < AdminController
|
|
||||||
before_action :set_crop
|
|
||||||
|
|
||||||
def index
|
|
||||||
@crop_companions = @crop.crop_companions
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@crop_companion = @crop.crop_companions.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@crop_companion = @crop.crop_companions.new(crop_companion_params)
|
|
||||||
if @crop_companion.save
|
|
||||||
redirect_to admin_crop_crop_companions_path(@crop), notice: t('crop_companions.created')
|
|
||||||
else
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
@crop_companion = @crop.crop_companions.find(params[:id])
|
|
||||||
@crop_companion.destroy
|
|
||||||
redirect_to admin_crop_crop_companions_path(@crop), notice: t('crop_companions.deleted')
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_crop
|
|
||||||
@crop = Crop.find_by!(slug: params[:crop_slug])
|
|
||||||
end
|
|
||||||
|
|
||||||
def crop_companion_params
|
|
||||||
params.require(:crop_companion).permit(:crop_b_id, :source_url)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Admin::CropsController < ApplicationController
|
|
||||||
before_action :authenticate_member!
|
|
||||||
before_action :authorize_admin!
|
|
||||||
|
|
||||||
def index
|
|
||||||
@versions = PaperTrail::Version.where(item_type: 'Crop').order(created_at: :desc).limit(100)
|
|
||||||
member_ids = @versions.map(&:whodunnit).compact.map(&:to_i)
|
|
||||||
@members = Member.where(id: member_ids).index_by(&:id)
|
|
||||||
@crop_wranglers = Role.crop_wranglers
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def authorize_admin!
|
|
||||||
authorize! :wrangle, Crop
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -8,9 +8,15 @@ module Admin
|
|||||||
responders :flash
|
responders :flash
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@members = Member.order(:login_name)
|
@members = Member.all
|
||||||
@members = @members.where("login_name ILIKE ?", "%#{search_term}%") if search_term.present?
|
@members = @members.where("login_name ILIKE ?", "%#{search_term}%") unless search_term.nil?
|
||||||
@members = @members.paginate(page: params[:page])
|
@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
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@@ -24,12 +30,6 @@ module Admin
|
|||||||
respond_with @member, location: admin_members_path
|
respond_with @member, location: admin_members_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
|
||||||
@member = Member.find_by!(slug: params[:slug])
|
|
||||||
@member.discard
|
|
||||||
redirect_to admin_members_path
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def search_term
|
def search_term
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ module Admin
|
|||||||
responders :flash
|
responders :flash
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@roles = Role.all.order(:name).paginate(page: params[:page])
|
@roles = Role.all.order(:name)
|
||||||
respond_with @roles
|
respond_with @roles
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ module Admin
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@role.destroy
|
@role.destroy
|
||||||
respond_with @role, location: admin_roles_path, notice: "Role was successfully deleted"
|
respond_with @role, location: admin_roles_path
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Admin
|
|
||||||
class VersionsController < ApplicationController
|
|
||||||
before_action :authenticate_member!
|
|
||||||
before_action :authorize_admin!
|
|
||||||
|
|
||||||
def revert
|
|
||||||
@version = PaperTrail::Version.find(params[:id])
|
|
||||||
@object = @version.reify
|
|
||||||
if @object.save
|
|
||||||
redirect_to admin_crops_path, notice: t('messages.revert_success', date: @version.created_at.strftime('%B %d, %Y'))
|
|
||||||
else
|
|
||||||
redirect_to admin_crops_path, alert: t('messages.revert_error', date: @version.created_at.strftime('%B %d, %Y'), errors: @object.errors.full_messages.to_sentence)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def authorize_admin!
|
|
||||||
authorize! :wrangle, Crop
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -8,7 +8,7 @@ class AdminController < ApplicationController
|
|||||||
|
|
||||||
def newsletter
|
def newsletter
|
||||||
authorize! :manage, :all
|
authorize! :manage, :all
|
||||||
@members = Member.confirmed.wants_newsletter.all.paginate(page: params[:page], per_page: 100)
|
@members = Member.confirmed.wants_newsletter.all
|
||||||
respond_with @members
|
respond_with @members
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class AlternateNamesController < ApplicationController
|
|||||||
# GET /alternate_names
|
# GET /alternate_names
|
||||||
# GET /alternate_names.json
|
# GET /alternate_names.json
|
||||||
def index
|
def index
|
||||||
@alternate_names = AlternateName.all.order(:name).paginate(page: params[:page], per_page: 100)
|
@alternate_names = AlternateName.all.order(:name)
|
||||||
respond_with(@alternate_names)
|
respond_with(@alternate_names)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ class AlternateNamesController < ApplicationController
|
|||||||
@alternate_name = AlternateName.new(alternate_name_params)
|
@alternate_name = AlternateName.new(alternate_name_params)
|
||||||
|
|
||||||
if @alternate_name.save
|
if @alternate_name.save
|
||||||
redirect_to @alternate_name.crop, notice: t('alternate_names.created')
|
redirect_to @alternate_name.crop, notice: 'Alternate name was successfully created.'
|
||||||
else
|
else
|
||||||
render action: "new"
|
render action: "new"
|
||||||
end
|
end
|
||||||
@@ -40,7 +40,7 @@ class AlternateNamesController < ApplicationController
|
|||||||
# PUT /alternate_names/1.json
|
# PUT /alternate_names/1.json
|
||||||
def update
|
def update
|
||||||
if @alternate_name.update(alternate_name_params)
|
if @alternate_name.update(alternate_name_params)
|
||||||
redirect_to @alternate_name.crop, notice: t('alternate_names.updated')
|
redirect_to @alternate_name.crop, notice: 'Alternate name was successfully updated.'
|
||||||
else
|
else
|
||||||
render action: "edit"
|
render action: "edit"
|
||||||
end
|
end
|
||||||
@@ -51,12 +51,12 @@ class AlternateNamesController < ApplicationController
|
|||||||
def destroy
|
def destroy
|
||||||
@crop = @alternate_name.crop
|
@crop = @alternate_name.crop
|
||||||
@alternate_name.destroy
|
@alternate_name.destroy
|
||||||
redirect_to @crop, notice: t('alternate_names.deleted')
|
redirect_to @crop, notice: 'Alternate name was successfully deleted.'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def alternate_name_params
|
def alternate_name_params
|
||||||
params.require(:alternate_name).permit(:crop_id, :name, :creator_id, :language)
|
params.require(:alternate_name).permit(:crop_id, :name, :creator_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Api
|
|
||||||
module V1
|
|
||||||
class ActivitiesController < BaseController
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -4,40 +4,6 @@ module Api
|
|||||||
module V1
|
module V1
|
||||||
class BaseController < JSONAPI::ResourceController
|
class BaseController < JSONAPI::ResourceController
|
||||||
abstract
|
abstract
|
||||||
protect_from_forgery with: :null_session
|
|
||||||
before_action :authenticate_member_from_token!
|
|
||||||
before_action :enforce_member_for_write_operations!, only: %i(create update destroy)
|
|
||||||
rescue_from CanCan::AccessDenied do
|
|
||||||
head :forbidden
|
|
||||||
end
|
|
||||||
|
|
||||||
def context
|
|
||||||
{
|
|
||||||
current_user: current_user,
|
|
||||||
current_ability: current_ability,
|
|
||||||
controller: self,
|
|
||||||
action: params[:action]
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
attr_reader :current_user
|
|
||||||
|
|
||||||
def enforce_member_for_write_operations!
|
|
||||||
head :unauthorized unless current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
def authenticate_member_from_token!
|
|
||||||
authenticate_with_http_token do |token, _options|
|
|
||||||
auth = Authentication.find_by(token: token, provider: 'api')
|
|
||||||
if auth.present?
|
|
||||||
@current_user = auth.member
|
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,36 +3,6 @@
|
|||||||
module Api
|
module Api
|
||||||
module V1
|
module V1
|
||||||
class CropsController < BaseController
|
class CropsController < BaseController
|
||||||
def search
|
|
||||||
term = params[:term]
|
|
||||||
page = params.dig(:page, :number) || 1
|
|
||||||
per_page = params.dig(:page, :size) || Crop.per_page
|
|
||||||
|
|
||||||
search_results = CropSearchService.search(
|
|
||||||
term,
|
|
||||||
page: page,
|
|
||||||
per_page: per_page,
|
|
||||||
load: true
|
|
||||||
)
|
|
||||||
|
|
||||||
resources = search_results.map do |crop|
|
|
||||||
Api::V1::CropResource.new(crop, context)
|
|
||||||
end
|
|
||||||
|
|
||||||
serializer = JSONAPI::ResourceSerializer.new(Api::V1::CropResource)
|
|
||||||
|
|
||||||
data = resources.map do |resource|
|
|
||||||
serializer.object_hash(resource, {})
|
|
||||||
end
|
|
||||||
|
|
||||||
render json: {
|
|
||||||
data: data,
|
|
||||||
meta: {
|
|
||||||
record_count: search_results.total_count,
|
|
||||||
page_count: search_results.total_pages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery
|
protect_from_forgery
|
||||||
# Working from codespaces, we want to turn off validation
|
|
||||||
skip_before_action :verify_authenticity_token if Rails.env.development? && ENV['CODESPACE_NAME']
|
|
||||||
|
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
@@ -68,7 +66,7 @@ class ApplicationController < ActionController::Base
|
|||||||
# profile stuff
|
# profile stuff
|
||||||
:bio, :location, :latitude, :longitude,
|
:bio, :location, :latitude, :longitude,
|
||||||
# email settings
|
# email settings
|
||||||
:show_email, :newsletter, :send_notification_email, :send_planting_reminder, :send_harvest_reminder)
|
:show_email, :newsletter, :send_notification_email, :send_planting_reminder)
|
||||||
end
|
end
|
||||||
|
|
||||||
devise_parameter_sanitizer.permit(:account_update) do |member|
|
devise_parameter_sanitizer.permit(:account_update) do |member|
|
||||||
@@ -78,9 +76,8 @@ class ApplicationController < ActionController::Base
|
|||||||
:tos_agreement,
|
:tos_agreement,
|
||||||
# profile stuff
|
# profile stuff
|
||||||
:bio, :location, :latitude, :longitude,
|
:bio, :location, :latitude, :longitude,
|
||||||
:website_url, :instagram_handle, :facebook_handle, :bluesky_handle, :other_url,
|
|
||||||
# email settings
|
# email settings
|
||||||
:show_email, :newsletter, :send_notification_email, :send_planting_reminder, :send_harvest_reminder,
|
:show_email, :newsletter, :send_notification_email, :send_planting_reminder,
|
||||||
# update password
|
# update password
|
||||||
:current_password)
|
:current_password)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,19 +14,19 @@ class AuthenticationsController < ApplicationController
|
|||||||
|
|
||||||
@authentication = current_member.authentications
|
@authentication = current_member.authentications
|
||||||
.create_with(
|
.create_with(
|
||||||
name:,
|
name: name,
|
||||||
token: auth['credentials']['token'],
|
token: auth['credentials']['token'],
|
||||||
secret: auth['credentials']['secret']
|
secret: auth['credentials']['secret']
|
||||||
)
|
)
|
||||||
.find_or_create_by(
|
.find_or_create_by(
|
||||||
provider: auth['provider'],
|
provider: auth['provider'],
|
||||||
uid: auth['uid'],
|
uid: auth['uid'],
|
||||||
name:
|
name: name
|
||||||
)
|
)
|
||||||
|
|
||||||
flash[:notice] = t('messages.auth_success')
|
flash[:notice] = "Authentication successful."
|
||||||
else
|
else
|
||||||
flash[:notice] = t('messages.auth_failed')
|
flash[:notice] = "Authentication failed."
|
||||||
end
|
end
|
||||||
redirect_to request.env['omniauth.origin'] || edit_member_registration_path
|
redirect_to request.env['omniauth.origin'] || edit_member_registration_path
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class BlocksController < ApplicationController
|
|
||||||
load_and_authorize_resource
|
|
||||||
skip_load_resource only: :create
|
|
||||||
|
|
||||||
def create
|
|
||||||
@block = current_member.blocks.build(blocked: Member.find(params[:blocked]))
|
|
||||||
|
|
||||||
if @block.save
|
|
||||||
flash[:notice] = "Blocked #{@block.blocked.login_name}"
|
|
||||||
else
|
|
||||||
flash[:error] = "Already blocking or error while blocking."
|
|
||||||
end
|
|
||||||
redirect_back_or_to(root_path)
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
@block = current_member.blocks.find(params[:id])
|
|
||||||
@unblocked = @block.blocked
|
|
||||||
@block.destroy
|
|
||||||
|
|
||||||
flash[:notice] = "Unblocked #{@unblocked.login_name}"
|
|
||||||
redirect_to @unblocked
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def block_params
|
|
||||||
params.permit(:id, :blocked)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
module Charts
|
module Charts
|
||||||
class CropsController < ApplicationController
|
class CropsController < ApplicationController
|
||||||
respond_to :json
|
respond_to :json
|
||||||
before_action :set_crop
|
|
||||||
|
|
||||||
def sunniness
|
def sunniness
|
||||||
pie_chart_query 'sunniness'
|
pie_chart_query 'sunniness'
|
||||||
@@ -14,28 +13,20 @@ module Charts
|
|||||||
end
|
end
|
||||||
|
|
||||||
def harvested_for
|
def harvested_for
|
||||||
data = Rails.cache.fetch("#{@crop.cache_key_with_version}/harvested_for", expires_in: 1.day) do
|
@crop = Crop.find_by!(slug: params[:crop_slug])
|
||||||
Harvest.joins(:plant_part)
|
render json: Harvest.joins(:plant_part)
|
||||||
.where(crop: @crop)
|
.where(crop: @crop)
|
||||||
.group("plant_parts.name").count(:id)
|
.group("plant_parts.name").count(:id)
|
||||||
end
|
|
||||||
render json: data
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_crop
|
|
||||||
@crop = Crop.find_by!(slug: params[:crop_slug])
|
|
||||||
end
|
|
||||||
|
|
||||||
def pie_chart_query(field)
|
def pie_chart_query(field)
|
||||||
data = Rails.cache.fetch("#{@crop.cache_key_with_version}/#{field}", expires_in: 1.day) do
|
@crop = Crop.find_by!(slug: params[:crop_slug])
|
||||||
Planting.where(crop: @crop)
|
render json: Planting.where(crop: @crop)
|
||||||
.where.not(field.to_sym => nil)
|
.where.not(field.to_sym => nil)
|
||||||
.where.not(field.to_sym => '')
|
.where.not(field.to_sym => '')
|
||||||
.group(field.to_sym).count(:id)
|
.group(field.to_sym).count(:id)
|
||||||
end
|
|
||||||
render json: data
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,55 +13,43 @@ class CommentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@commentable = find_commentable
|
|
||||||
@comment = Comment.new
|
@comment = Comment.new
|
||||||
if @commentable
|
@post = Post.find_by(id: params[:post_id])
|
||||||
@comments = @commentable.comments
|
|
||||||
|
if @post
|
||||||
|
@comments = @post.comments
|
||||||
respond_with(@comments)
|
respond_with(@comments)
|
||||||
else
|
else
|
||||||
redirect_to(request.referer || root_url,
|
redirect_to(request.referer || root_url,
|
||||||
alert: "Can't post a comment on a non-existent commentable")
|
alert: "Can't post a comment on a non-existent post")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
# TODO: Why does this need a collection of comments?
|
@comments = @comment.post.comments
|
||||||
@comments = @comment.commentable.comments
|
|
||||||
@commentable = @comment.commentable
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@comment = Comment.new(comment_params)
|
@comment = Comment.new(comment_params)
|
||||||
@commentable = @comment.commentable
|
|
||||||
@comment.author = current_member
|
@comment.author = current_member
|
||||||
@comment.save
|
@comment.save
|
||||||
respond_with @comment, location: @commentable
|
respond_with @comment, location: @comment.post
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@comment.update(body: comment_params['body'])
|
@comment.update(body: comment_params['body'])
|
||||||
respond_with @comment, location: @comment.commentable
|
respond_with @comment, location: @comment.post
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@commentable = @comment.commentable
|
@post = @comment.post
|
||||||
@comment.destroy
|
@comment.destroy
|
||||||
respond_with(@commentable)
|
respond_with(@post)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_commentable
|
|
||||||
return unless params[:comment]
|
|
||||||
|
|
||||||
if params[:comment][:commentable_type] == 'Photo'
|
|
||||||
Photo.find(params[:comment][:commentable_id])
|
|
||||||
elsif params[:comment][:commentable_type] == 'Post'
|
|
||||||
Post.find(params[:comment][:commentable_id])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def comment_params
|
def comment_params
|
||||||
params.require(:comment).permit(:body, :commentable_id, :commentable_type)
|
params.require(:comment).permit(:body, :post_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class ConversationsController < ApplicationController
|
|||||||
@conversation = Mailboxer::Conversation.find_by(id: params[:id])
|
@conversation = Mailboxer::Conversation.find_by(id: params[:id])
|
||||||
return unless @conversation.nil? || !@conversation.is_participant?(current_member)
|
return unless @conversation.nil? || !@conversation.is_participant?(current_member)
|
||||||
|
|
||||||
redirect_to conversations_path(box:)
|
redirect_to conversations_path(box: box)
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,10 +10,11 @@ class CropsController < ApplicationController
|
|||||||
responders :flash
|
responders :flash
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@sort = params[:sort]
|
||||||
@crops = Crop.search('*', boost_by: %i(plantings_count harvests_count),
|
@crops = Crop.search('*', boost_by: %i(plantings_count harvests_count),
|
||||||
limit: 100,
|
limit: 100,
|
||||||
page: params[:page],
|
page: params[:page],
|
||||||
load: (request.format.csv? || request.format.rss? ? { include: %i(parent scientific_names seeds harvests creator plantings) } : false))
|
load: false)
|
||||||
@num_requested_crops = requested_crops.size if current_member
|
@num_requested_crops = requested_crops.size if current_member
|
||||||
@filename = filename
|
@filename = filename
|
||||||
respond_with @crops
|
respond_with @crops
|
||||||
@@ -39,9 +40,9 @@ class CropsController < ApplicationController
|
|||||||
respond_with @crops
|
respond_with @crops
|
||||||
end
|
end
|
||||||
|
|
||||||
def gbif
|
def openfarm
|
||||||
@crop = Crop.find(params[:crop_slug])
|
@crop = Crop.find(params[:crop_slug])
|
||||||
@crop.update_gbif_data!
|
@crop.update_openfarm_data!
|
||||||
respond_with @crop, location: @crop
|
respond_with @crop, location: @crop
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -56,16 +57,8 @@ class CropsController < ApplicationController
|
|||||||
@crops = CropSearchService.search(@term,
|
@crops = CropSearchService.search(@term,
|
||||||
page: params[:page],
|
page: params[:page],
|
||||||
per_page: Crop.per_page,
|
per_page: Crop.per_page,
|
||||||
current_member:)
|
current_member: current_member)
|
||||||
|
respond_with @crops
|
||||||
respond_to do |format|
|
|
||||||
format.html do
|
|
||||||
render
|
|
||||||
end
|
|
||||||
format.json do
|
|
||||||
render json: @crops.to_a
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@@ -73,11 +66,9 @@ class CropsController < ApplicationController
|
|||||||
format.html do
|
format.html do
|
||||||
@posts = @crop.posts.order(created_at: :desc).paginate(page: params[:page])
|
@posts = @crop.posts.order(created_at: :desc).paginate(page: params[:page])
|
||||||
@companions = @crop.companions.approved
|
@companions = @crop.companions.approved
|
||||||
member_ids = @crop.versions.map(&:whodunnit).compact.map(&:to_i)
|
|
||||||
@version_members = Member.where(id: member_ids).index_by(&:id)
|
|
||||||
end
|
end
|
||||||
format.svg do
|
format.svg do
|
||||||
icon_data = @crop.svg_icon.presence || File.read(Rails.root.join("app/assets/images/icons/sprout.svg"))
|
icon_data = @crop.svg_icon.presence || File.read(Rails.root.join('app', 'assets', 'images', 'icons', 'sprout.svg'))
|
||||||
send_data(icon_data, type: "image/svg+xml", disposition: "inline")
|
send_data(icon_data, type: "image/svg+xml", disposition: "inline")
|
||||||
end
|
end
|
||||||
format.json do
|
format.json do
|
||||||
@@ -109,12 +100,7 @@ class CropsController < ApplicationController
|
|||||||
@crop.approval_status = "pending"
|
@crop.approval_status = "pending"
|
||||||
end
|
end
|
||||||
|
|
||||||
if Crop.transaction { @crop.save && save_crop_names }
|
notify_wranglers if Crop.transaction { @crop.save && save_crop_names }
|
||||||
notify_wranglers
|
|
||||||
else
|
|
||||||
@crop.alternate_names.build
|
|
||||||
@crop.scientific_names.build
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_with @crop
|
respond_with @crop
|
||||||
end
|
end
|
||||||
@@ -133,7 +119,7 @@ class CropsController < ApplicationController
|
|||||||
|
|
||||||
if @crop.approval_status_changed?(from: "pending", to: "approved")
|
if @crop.approval_status_changed?(from: "pending", to: "approved")
|
||||||
notifier.deliver_now!
|
notifier.deliver_now!
|
||||||
@crop.update_gbif_data!
|
@crop.update_openfarm_data!
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@crop.approval_status = @crop.approval_status_was
|
@crop.approval_status = @crop.approval_status_was
|
||||||
@@ -149,34 +135,6 @@ class CropsController < ApplicationController
|
|||||||
respond_with @crop
|
respond_with @crop
|
||||||
end
|
end
|
||||||
|
|
||||||
def data_improvement
|
|
||||||
@active_tab = params[:tab] || 'photos'
|
|
||||||
|
|
||||||
@crops = case @active_tab
|
|
||||||
when 'photos'
|
|
||||||
Crop.approved.where(photo_associations_count: 0).order(plantings_count: :desc)
|
|
||||||
when 'descriptions'
|
|
||||||
Crop.approved.where(description: [nil, '']).order(plantings_count: :desc)
|
|
||||||
when 'youtube'
|
|
||||||
Crop.approved.where(en_youtube_url: [nil, '']).order(plantings_count: :desc)
|
|
||||||
when 'alternate_names'
|
|
||||||
Crop.approved.where.missing(:alternate_names).order(plantings_count: :desc)
|
|
||||||
when 'wikidata'
|
|
||||||
crops_with_wikidata = Crop.joins(:scientific_names).where.not(scientific_names: { wikidata_id: nil }).distinct
|
|
||||||
Crop.approved.where.not(id: crops_with_wikidata).order(plantings_count: :desc)
|
|
||||||
when 'row_spacing'
|
|
||||||
Crop.approved.where(row_spacing: nil).order(plantings_count: :desc)
|
|
||||||
when 'sun_requirements'
|
|
||||||
Crop.approved.where(sun_requirements: [nil, '']).order(plantings_count: :desc)
|
|
||||||
when 'height'
|
|
||||||
Crop.approved.where(height: nil).order(plantings_count: :desc)
|
|
||||||
when 'public_food_key'
|
|
||||||
Crop.approved.where(public_food_key: [nil, '']).order(plantings_count: :desc)
|
|
||||||
else
|
|
||||||
Crop.none
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def notifier
|
def notifier
|
||||||
@@ -189,7 +147,7 @@ class CropsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def save_crop_names
|
def save_crop_names
|
||||||
AlternateName.create!(names_params(:alt_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id, language: "EN" } })
|
AlternateName.create!(names_params(:alt_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id } })
|
||||||
ScientificName.create!(names_params(:sci_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id } })
|
ScientificName.create!(names_params(:sci_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id } })
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -204,28 +162,26 @@ class CropsController < ApplicationController
|
|||||||
def recreate_names(param_name, name_type)
|
def recreate_names(param_name, name_type)
|
||||||
return if params[param_name].blank?
|
return if params[param_name].blank?
|
||||||
|
|
||||||
@crop.send("#{name_type}_names").each(&:destroy)
|
destroy_names(name_type)
|
||||||
params[param_name].each_value do |value|
|
params[param_name].each do |_i, value|
|
||||||
next if value.empty?
|
create_name!(name_type, value) unless value.empty?
|
||||||
|
|
||||||
if name_type == 'alternate'
|
|
||||||
@crop.send("#{name_type}_names").create!(name: value, creator_id: current_member.id, language: "EN")
|
|
||||||
else
|
|
||||||
@crop.send("#{name_type}_names").create!(name: value, creator_id: current_member.id)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy_names(name_type)
|
||||||
|
@crop.send("#{name_type}_names").each(&:destroy)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_name!(name_type, value)
|
||||||
|
@crop.send("#{name_type}_names").create!(name: value, creator_id: current_member.id)
|
||||||
|
end
|
||||||
|
|
||||||
def crop_params
|
def crop_params
|
||||||
params.require(:crop).permit(
|
params.require(:crop).permit(
|
||||||
:name, :en_wikipedia_url, :en_youtube_url,
|
:name, :en_wikipedia_url,
|
||||||
:parent_id, :perennial,
|
:parent_id, :perennial,
|
||||||
:request_notes, :reason_for_rejection,
|
:request_notes, :reason_for_rejection,
|
||||||
:rejection_notes,
|
:rejection_notes,
|
||||||
:description,
|
|
||||||
:public_food_key,
|
|
||||||
:row_spacing, :spread, :height,
|
|
||||||
:sowing_method, :sun_requirements, :growing_degree_days,
|
|
||||||
scientific_names_attributes: %i(scientific_name _destroy id)
|
scientific_names_attributes: %i(scientific_name _destroy id)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@@ -235,18 +191,18 @@ class CropsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def filename
|
def filename
|
||||||
"Growstuff-Crops-#{Time.zone.now.to_fs(:number)}.csv"
|
"Growstuff-Crops-#{Time.zone.now.to_s(:number)}.csv"
|
||||||
end
|
end
|
||||||
|
|
||||||
def crop_json_fields
|
def crop_json_fields
|
||||||
{
|
{
|
||||||
include: {
|
include: {
|
||||||
plantings: {
|
plantings: {
|
||||||
include: {
|
include: {
|
||||||
owner: { only: %i(id login_name location latitude longitude) }
|
owner: { only: %i(id login_name location latitude longitude) }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scientific_names: { only: [:name] }, alternate_names: { only: %i(name language) }
|
scientific_names: { only: [:name] }, alternate_names: { only: [:name] }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,19 +5,15 @@ class FollowsController < ApplicationController
|
|||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
skip_load_resource only: :create
|
skip_load_resource only: :create
|
||||||
|
|
||||||
def index
|
|
||||||
@follows = @member.followed.paginate(page: params[:page])
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@follow = current_member.follows.build(followed: Member.find(params[:followed]))
|
@follow = current_member.follows.build(followed: Member.find(params[:followed]))
|
||||||
|
|
||||||
if @follow.save
|
if @follow.save
|
||||||
flash[:notice] = t('messages.followed', name: @follow.followed.login_name)
|
flash[:notice] = "Followed #{@follow.followed.login_name}"
|
||||||
else
|
else
|
||||||
flash[:error] = t('messages.follow_error')
|
flash[:error] = "Already following or error while following."
|
||||||
end
|
end
|
||||||
redirect_back_or_to(root_path)
|
redirect_back fallback_location: root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@@ -25,10 +21,14 @@ class FollowsController < ApplicationController
|
|||||||
@unfollowed = @follow.followed
|
@unfollowed = @follow.followed
|
||||||
@follow.destroy
|
@follow.destroy
|
||||||
|
|
||||||
flash[:notice] = t('messages.unfollowed', name: @unfollowed.login_name)
|
flash[:notice] = "Unfollowed #{@unfollowed.login_name}"
|
||||||
redirect_to @unfollowed
|
redirect_to @unfollowed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@follows = @member.followed.paginate(page: params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
def followers
|
def followers
|
||||||
@followers = @member.followers.paginate(page: params[:page])
|
@followers = @member.followers.paginate(page: params[:page])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ class ForumsController < ApplicationController
|
|||||||
# POST /forums.json
|
# POST /forums.json
|
||||||
def create
|
def create
|
||||||
@forum = Forum.new(forum_params)
|
@forum = Forum.new(forum_params)
|
||||||
flash[:notice] = t('forums.created') if @forum.save
|
flash[:notice] = 'Forum was successfully created.' if @forum.save
|
||||||
respond_with(@forum)
|
respond_with(@forum)
|
||||||
end
|
end
|
||||||
|
|
||||||
# PUT /forums/1
|
# PUT /forums/1
|
||||||
# PUT /forums/1.json
|
# PUT /forums/1.json
|
||||||
def update
|
def update
|
||||||
flash[:notice] = t('forums.updated') if @forum.update(forum_params)
|
flash[:notice] = 'Forum was successfully updated.' if @forum.update(forum_params)
|
||||||
respond_with(@forum)
|
respond_with(@forum)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ class ForumsController < ApplicationController
|
|||||||
# DELETE /forums/1.json
|
# DELETE /forums/1.json
|
||||||
def destroy
|
def destroy
|
||||||
@forum.destroy
|
@forum.destroy
|
||||||
flash[:notice] = t('forums.deleted')
|
flash[:notice] = 'Forum was successfully deleted'
|
||||||
redirect_to forums_url
|
redirect_to forums_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class GardenCollaboratorsController < ApplicationController
|
|
||||||
before_action :authenticate_member!, except: %i(index show)
|
|
||||||
before_action :load_garden
|
|
||||||
load_and_authorize_resource id_param: :slug
|
|
||||||
|
|
||||||
respond_to :html
|
|
||||||
responders :flash
|
|
||||||
|
|
||||||
def index
|
|
||||||
@garden_collaborators = @garden.garden_collaborators.paginate(page: params[:page])
|
|
||||||
respond_with(@garden_collaborators)
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
@garden_collaborator = GardenCollaborator.find(params[:garden_collaborator_id])
|
|
||||||
|
|
||||||
respond_with(@garden_collaborator)
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@garden_collaborator = GardenCollaborator.new(garden: @garden)
|
|
||||||
|
|
||||||
authorize! :create, @garden_collaborator
|
|
||||||
|
|
||||||
respond_with(@garden_collaborator)
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
|
||||||
@garden_collaborator = GardenCollaborator.find(params[:id])
|
|
||||||
|
|
||||||
authorize! :update, @garden_collaborator
|
|
||||||
|
|
||||||
respond_with(@garden_collaborator)
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@garden_collaborator = GardenCollaborator.new(garden: @garden)
|
|
||||||
authorize! :create, @garden_collaborator
|
|
||||||
|
|
||||||
@member = Member.find_by(slug: params[:garden_collaborator][:member_slug])
|
|
||||||
|
|
||||||
@garden_collaborator.member = @member
|
|
||||||
if @garden_collaborator.save
|
|
||||||
redirect_to garden_garden_collaborators_path(@garden)
|
|
||||||
else
|
|
||||||
respond_with(@garden_collaborator)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
@garden_collaborator = GardenCollaborator.find(params[:id])
|
|
||||||
authorize! :update, @garden_collaborator
|
|
||||||
|
|
||||||
@member = Member.find_by(slug: params[:garden_collaborator][:member_slug])
|
|
||||||
|
|
||||||
@garden_collaborator.member = @member
|
|
||||||
@garden_collaborator.save
|
|
||||||
|
|
||||||
respond_with(@garden_collaborator)
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
@garden_collaborator = GardenCollaborator.find(params[:id])
|
|
||||||
|
|
||||||
authorize! :destroy, @garden_collaborator
|
|
||||||
|
|
||||||
if @garden_collaborator.destroy
|
|
||||||
redirect_to garden_garden_collaborators_path(@garden)
|
|
||||||
else
|
|
||||||
respond_with(@garden_collaborator)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def load_garden
|
|
||||||
@garden = Garden.find_by(slug: params[:garden_slug])
|
|
||||||
end
|
|
||||||
|
|
||||||
def garden_collaborator_params
|
|
||||||
params.require(:garden_collaborator).permit(
|
|
||||||
:member_slug
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -2,25 +2,20 @@
|
|||||||
|
|
||||||
class GardensController < DataController
|
class GardensController < DataController
|
||||||
def index
|
def index
|
||||||
@owner = Member.find_by!(slug: params[:member_slug]) if params[:member_slug].present?
|
@owner = Member.find_by(slug: params[:member_slug])
|
||||||
@show_all = params[:all] == '1'
|
@show_all = params[:all] == '1'
|
||||||
@show_jump_to = params[:member_slug].present? || false
|
@show_jump_to = params[:member_slug].present? ? true : false
|
||||||
|
|
||||||
@gardens = @gardens.includes(:owner)
|
@gardens = @gardens.includes(:owner)
|
||||||
@gardens = @gardens.active unless @show_all
|
@gardens = @gardens.active unless @show_all
|
||||||
if @owner.present?
|
@gardens = @gardens.where(owner: @owner) if @owner.present?
|
||||||
@gardens = @gardens.left_joins(:garden_collaborators)
|
|
||||||
@gardens = @gardens.where(owner: @owner).or(@gardens.where(garden_collaborators: { member: @owner }))
|
|
||||||
end
|
|
||||||
@gardens = @gardens.where.not(members: { confirmed_at: nil })
|
@gardens = @gardens.where.not(members: { confirmed_at: nil })
|
||||||
.order(:name).paginate(page: params[:page])
|
.order(:name).paginate(page: params[:page])
|
||||||
respond_with(@gardens)
|
respond_with(@gardens)
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@current_plantings = @garden.plantings.current.where.not(failed: true).includes(:crop, :owner).order(planted_at: :desc)
|
@current_plantings = @garden.plantings.current.includes(:crop, :owner).order(planted_at: :desc)
|
||||||
@current_activities = @garden.activities.current.includes(:owner).order(created_at: :desc)
|
|
||||||
@finished_activities = @garden.activities.finished.includes(:owner).order(created_at: :desc)
|
|
||||||
@finished_plantings = @garden.plantings.finished.includes(:crop)
|
@finished_plantings = @garden.plantings.finished.includes(:crop)
|
||||||
@suggested_companions = Crop.approved.where(
|
@suggested_companions = Crop.approved.where(
|
||||||
id: CropCompanion.where(crop_a_id: @current_plantings.select(:crop_id)).select(:crop_b_id)
|
id: CropCompanion.where(crop_a_id: @current_plantings.select(:crop_id)).select(:crop_b_id)
|
||||||
@@ -39,10 +34,7 @@ class GardensController < DataController
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
@garden.owner_id = current_member.id
|
@garden.owner_id = current_member.id
|
||||||
if @garden.save
|
flash[:notice] = I18n.t('gardens.created') if @garden.save
|
||||||
link = new_activity_path(name: 'Weed the garden bed', garden_id: @garden.id, due_date: 2.weeks.from_now.to_date)
|
|
||||||
flash[:notice] = t('gardens.created_prompt_html', link: link).html_safe
|
|
||||||
end
|
|
||||||
respond_with(@garden)
|
respond_with(@garden)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -57,23 +49,12 @@ class GardensController < DataController
|
|||||||
redirect_to(member_gardens_path(@garden.owner))
|
redirect_to(member_gardens_path(@garden.owner))
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_wikidata
|
|
||||||
if @garden.populate_wikidata_info
|
|
||||||
@garden.save
|
|
||||||
flash[:notice] = "Wikidata information updated."
|
|
||||||
else
|
|
||||||
flash[:alert] = "Could not find Wikidata information for this location."
|
|
||||||
end
|
|
||||||
redirect_to @garden
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def garden_params
|
def garden_params
|
||||||
params.require(:garden).permit(
|
params.require(:garden).permit(
|
||||||
:name, :slug, :description, :active,
|
:name, :slug, :description, :active,
|
||||||
:location, :latitude, :longitude, :area, :area_unit, :garden_type_id,
|
:location, :latitude, :longitude, :area, :area_unit, :garden_type_id
|
||||||
:location_wikidata_id, :lowest_temp_c, :highest_temp_c
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ class HarvestsController < DataController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
where = {}
|
where = {}
|
||||||
if params[:member_slug].present?
|
if params[:member_slug]
|
||||||
@owner = Member.find_by!(slug: params[:member_slug])
|
@owner = Member.find_by(slug: params[:member_slug])
|
||||||
where['owner_id'] = @owner.id
|
where['owner_id'] = @owner.id
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -20,10 +20,10 @@ class HarvestsController < DataController
|
|||||||
where['planting_id'] = @planting.id
|
where['planting_id'] = @planting.id
|
||||||
end
|
end
|
||||||
|
|
||||||
@harvests = Harvest.search('*', where:,
|
@harvests = Harvest.search('*', where: where,
|
||||||
limit: 100,
|
limit: 100,
|
||||||
page: params[:page],
|
page: params[:page],
|
||||||
load: (request.format.csv? ? { include: %i(crop owner plant_part) } : false),
|
load: false,
|
||||||
boost_by: [:created_at])
|
boost_by: [:created_at])
|
||||||
|
|
||||||
@filename = csv_filename
|
@filename = csv_filename
|
||||||
@@ -38,9 +38,9 @@ class HarvestsController < DataController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@harvest = Harvest.new(new_harvest_params.merge(harvested_at: Time.zone.today))
|
@harvest = Harvest.new(harvested_at: Time.zone.today)
|
||||||
@planting = @harvest.planting
|
@planting = Planting.find_by(slug: params[:planting_slug]) if params[:planting_slug]
|
||||||
@crop = @harvest.crop
|
@crop = Crop.find_by(id: params[:crop_id])
|
||||||
respond_with(@harvest)
|
respond_with(@harvest)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ class HarvestsController < DataController
|
|||||||
def create
|
def create
|
||||||
@harvest.crop_id = @harvest.planting.crop_id if @harvest.planting_id
|
@harvest.crop_id = @harvest.planting.crop_id if @harvest.planting_id
|
||||||
@harvest.harvested_at = Time.zone.now if @harvest.harvested_at.blank?
|
@harvest.harvested_at = Time.zone.now if @harvest.harvested_at.blank?
|
||||||
update_planting_rating if @harvest.save
|
@harvest.save
|
||||||
if params[:return] == 'planting'
|
if params[:return] == 'planting'
|
||||||
respond_with(@harvest, location: @harvest.planting)
|
respond_with(@harvest, location: @harvest.planting)
|
||||||
else
|
else
|
||||||
@@ -61,7 +61,7 @@ class HarvestsController < DataController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
update_planting_rating if @harvest.update(harvest_params)
|
@harvest.update(harvest_params)
|
||||||
respond_with(@harvest)
|
respond_with(@harvest)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -76,17 +76,7 @@ class HarvestsController < DataController
|
|||||||
params.require(:harvest)
|
params.require(:harvest)
|
||||||
.permit(:planting_id, :crop_id, :harvested_at, :description,
|
.permit(:planting_id, :crop_id, :harvested_at, :description,
|
||||||
:quantity, :unit, :weight_quantity, :weight_unit,
|
:quantity, :unit, :weight_quantity, :weight_unit,
|
||||||
:plant_part_id, :slug, :si_weight, :overall_rating)
|
:plant_part_id, :slug, :si_weight)
|
||||||
.merge(owner_id: current_member.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def new_harvest_params
|
|
||||||
return {} unless params[:harvest]
|
|
||||||
|
|
||||||
params.require(:harvest)
|
|
||||||
.permit(:planting_id, :crop_id, :harvested_at, :description,
|
|
||||||
:quantity, :unit, :weight_quantity, :weight_unit,
|
|
||||||
:plant_part_id, :slug, :si_weight, :overall_rating)
|
|
||||||
.merge(owner_id: current_member.id)
|
.merge(owner_id: current_member.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -102,7 +92,7 @@ class HarvestsController < DataController
|
|||||||
elsif @crop
|
elsif @crop
|
||||||
"#{@crop.to_param}-"
|
"#{@crop.to_param}-"
|
||||||
end
|
end
|
||||||
"Growstuff-#{specifics}Harvests-#{Time.zone.now.to_fs(:number)}.csv"
|
"Growstuff-#{specifics}Harvests-#{Time.zone.now.to_s(:number)}.csv"
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_crop_medians
|
def update_crop_medians
|
||||||
@@ -113,10 +103,4 @@ class HarvestsController < DataController
|
|||||||
@harvest.planting.update_harvest_days!
|
@harvest.planting.update_harvest_days!
|
||||||
@harvest.crop.update_harvest_medians
|
@harvest.crop.update_harvest_medians
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_planting_rating
|
|
||||||
return if @harvest.planting.nil? || params[:harvest][:overall_rating].blank?
|
|
||||||
|
|
||||||
@harvest.planting.update(overall_rating: params[:harvest][:overall_rating])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,6 +10,4 @@ class HomeController < ApplicationController
|
|||||||
# the relevant class methods directly in the view, so that fragment
|
# the relevant class methods directly in the view, so that fragment
|
||||||
# caching will be effective.
|
# caching will be effective.
|
||||||
end
|
end
|
||||||
|
|
||||||
def community_gardens; end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class LikesController < ApplicationController
|
|||||||
@like.likeable.reindex(refresh: true)
|
@like.likeable.reindex(refresh: true)
|
||||||
success(@like, liked_by_member: true, status_code: :created)
|
success(@like, liked_by_member: true, status_code: :created)
|
||||||
else
|
else
|
||||||
failed(@like, message: t('messages.unable_to_like'))
|
failed(@like, message: 'Unable to like')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ class LikesController < ApplicationController
|
|||||||
@like.likeable.reindex(refresh: true)
|
@like.likeable.reindex(refresh: true)
|
||||||
success(@like, liked_by_member: false, status_code: :ok)
|
success(@like, liked_by_member: false, status_code: :ok)
|
||||||
else
|
else
|
||||||
failed(@like, message: t('messages.unable_to_unlike'))
|
failed(@like, message: 'Unable to unlike')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ class LikesController < ApplicationController
|
|||||||
{
|
{
|
||||||
id: like.likeable.id,
|
id: like.likeable.id,
|
||||||
like_count: like.likeable.likes.count,
|
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")
|
description: ActionController::Base.helpers.pluralize(like.likeable.likes.count, "like")
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -50,7 +50,7 @@ class LikesController < ApplicationController
|
|||||||
format.json do
|
format.json do
|
||||||
render(json: render_json(
|
render(json: render_json(
|
||||||
like,
|
like,
|
||||||
liked_by_member:
|
liked_by_member: liked_by_member
|
||||||
), status: status_code)
|
), status: status_code)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -58,7 +58,7 @@ class LikesController < ApplicationController
|
|||||||
|
|
||||||
def failed(like, message)
|
def failed(like, message)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json { render(json: { error: message }, status: :forbidden) }
|
format.json { render(json: { 'error': message }, status: :forbidden) }
|
||||||
format.html do
|
format.html do
|
||||||
flash[:error] = message
|
flash[:error] = message
|
||||||
if like&.likeable
|
if like&.likeable
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ class MembersController < ApplicationController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@member = Member.confirmed.kept.find_by!(slug: params[:slug])
|
@member = Member.confirmed.kept.find_by!(slug: params[:slug])
|
||||||
|
@twitter_auth = @member.auth('twitter')
|
||||||
@flickr_auth = @member.auth('flickr')
|
@flickr_auth = @member.auth('flickr')
|
||||||
|
@facebook_auth = @member.auth('facebook')
|
||||||
@posts = @member.posts
|
@posts = @member.posts
|
||||||
|
|
||||||
@activity = TimelineService.member_query(@member).limit(30)
|
@activity = TimelineService.member_query(@member).limit(30)
|
||||||
@@ -60,7 +62,7 @@ class MembersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def unsubscribe
|
def unsubscribe
|
||||||
verifier = ActiveSupport::MessageVerifier.new(ENV.fetch('RAILS_SECRET_TOKEN', nil))
|
verifier = ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
|
||||||
decrypted_message = verifier.verify(params[:message])
|
decrypted_message = verifier.verify(params[:message])
|
||||||
|
|
||||||
@member = Member.find(decrypted_message[:member_id])
|
@member = Member.find(decrypted_message[:member_id])
|
||||||
@@ -90,12 +92,11 @@ class MembersController < ApplicationController
|
|||||||
|
|
||||||
EMAIL_TYPE_STRING = {
|
EMAIL_TYPE_STRING = {
|
||||||
send_notification_email: "direct message notifications",
|
send_notification_email: "direct message notifications",
|
||||||
send_planting_reminder: "planting reminders",
|
send_planting_reminder: "planting reminders"
|
||||||
send_harvest_reminder: "harvest reminders"
|
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
def member_params
|
def member_params
|
||||||
params.require(:member).permit(:login_name, :tos_agreement, :email, :newsletter, :send_harvest_reminder)
|
params.require(:member).permit(:login_name, :tos_agreement, :email, :newsletter)
|
||||||
end
|
end
|
||||||
|
|
||||||
def member_json_fields
|
def member_json_fields
|
||||||
|
|||||||
@@ -21,27 +21,16 @@ class MessagesController < ApplicationController
|
|||||||
return if params[:recipient_id].blank?
|
return if params[:recipient_id].blank?
|
||||||
|
|
||||||
@recipient = Member.find_by(id: params[:recipient_id])
|
@recipient = Member.find_by(id: params[:recipient_id])
|
||||||
nil if @recipient.nil?
|
return if @recipient.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if params[:conversation_id].present?
|
if params[:conversation_id].present?
|
||||||
@conversation = Mailboxer::Conversation.find(params[:conversation_id])
|
@conversation = Mailboxer::Conversation.find(params[:conversation_id])
|
||||||
# Check if any of the recipients have blocked the sender
|
|
||||||
if @conversation.recipients.any? { |recipient| recipient.already_blocking?(current_member) }
|
|
||||||
flash[:error] = "You cannot reply to this conversation because one of the recipients has blocked you."
|
|
||||||
redirect_to conversation_path(@conversation)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
current_member.reply_to_conversation(@conversation, params[:body])
|
current_member.reply_to_conversation(@conversation, params[:body])
|
||||||
redirect_to conversation_path(@conversation)
|
redirect_to conversation_path(@conversation)
|
||||||
else
|
else
|
||||||
recipient = Member.find(params[:recipient_id])
|
recipient = Member.find(params[:recipient_id])
|
||||||
if recipient.already_blocking?(current_member)
|
|
||||||
flash[:error] = "You cannot send a message to a member who has blocked you."
|
|
||||||
redirect_back_or_to(root_path)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
body = params[:body]
|
body = params[:body]
|
||||||
subject = params[:subject]
|
subject = params[:subject]
|
||||||
@conversation = current_member.send_message(recipient, body, subject)
|
@conversation = current_member.send_message(recipient, body, subject)
|
||||||
|
|||||||
@@ -9,8 +9,12 @@ require './lib/actions/oauth_signup_action'
|
|||||||
# Heavily overlaps with Authentications controller
|
# Heavily overlaps with Authentications controller
|
||||||
#
|
#
|
||||||
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||||
|
def facebook
|
||||||
|
create
|
||||||
|
end
|
||||||
|
|
||||||
def failure
|
def failure
|
||||||
flash[:alert] = t('messages.auth_failed')
|
flash[:alert] = "Authentication failed."
|
||||||
redirect_to request.env['omniauth.origin'] || "/"
|
redirect_to request.env['omniauth.origin'] || "/"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -28,7 +32,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|||||||
@authentication = action.establish_authentication(auth, member)
|
@authentication = action.establish_authentication(auth, member)
|
||||||
|
|
||||||
if action.member_created?
|
if action.member_created?
|
||||||
raise "Invalid provider" unless %w(flickr).index(auth['provider'].to_s)
|
raise "Invalid provider" unless %w(facebook twitter flickr).index(auth['provider'].to_s)
|
||||||
|
|
||||||
session["devise.#{auth['provider']}_data"] = request.env["omniauth.auth"]
|
session["devise.#{auth['provider']}_data"] = request.env["omniauth.auth"]
|
||||||
sign_in member
|
sign_in member
|
||||||
@@ -41,7 +45,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|||||||
|
|
||||||
def after_sign_in_path_for(resource)
|
def after_sign_in_path_for(resource)
|
||||||
if resource.tos_agreement
|
if resource.tos_agreement
|
||||||
super
|
super resource
|
||||||
else
|
else
|
||||||
finish_signup_path(resource)
|
finish_signup_path(resource)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ class PhotosController < ApplicationController
|
|||||||
respond_to :html, :json
|
respond_to :html, :json
|
||||||
responders :flash
|
responders :flash
|
||||||
|
|
||||||
|
def show
|
||||||
|
@crops = Crop.distinct.joins(:photo_associations).where(photo_associations: { photo: @photo })
|
||||||
|
respond_with(@photo)
|
||||||
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@photos = Photo.search(
|
@photos = Photo.search(
|
||||||
load: false,
|
load: false,
|
||||||
@@ -19,12 +24,6 @@ class PhotosController < ApplicationController
|
|||||||
respond_with(@photos)
|
respond_with(@photos)
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
|
||||||
@crops = Crop.distinct.joins(:photo_associations).where(photo_associations: { photo: @photo })
|
|
||||||
@comment = Comment.new(commentable: @photo)
|
|
||||||
respond_with(@photo)
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@photo = Photo.new
|
@photo = Photo.new
|
||||||
@item = item_to_link_to
|
@item = item_to_link_to
|
||||||
@@ -64,7 +63,7 @@ class PhotosController < ApplicationController
|
|||||||
|
|
||||||
def photo_params
|
def photo_params
|
||||||
params.require(:photo).permit(:source_id, :source, :title, :license_name,
|
params.require(:photo).permit(:source_id, :source, :title, :license_name,
|
||||||
:license_url, :thumbnail_url, :fullsize_url, :link_url, :date_taken)
|
:license_url, :thumbnail_url, :fullsize_url, :link_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Item with photos attached
|
# Item with photos attached
|
||||||
@@ -102,12 +101,11 @@ class PhotosController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
@current_set = params[:set]
|
@current_set = params[:set]
|
||||||
@current_tag = params[:tag]
|
|
||||||
|
|
||||||
page = params[:page] || 1
|
page = params[:page] || 1
|
||||||
|
|
||||||
@sets = current_member.flickr_sets
|
@sets = current_member.flickr_sets
|
||||||
photos, total = current_member.flickr_photos(page, @current_set, @current_tag)
|
photos, total = current_member.flickr_photos(page, @current_set)
|
||||||
|
|
||||||
@photos = WillPaginate::Collection.create(page, 30, total) do |pager|
|
@photos = WillPaginate::Collection.create(page, 30, total) do |pager|
|
||||||
pager.replace photos
|
pager.replace photos
|
||||||
@@ -119,8 +117,6 @@ class PhotosController < ApplicationController
|
|||||||
{ crops: @crop.id }
|
{ crops: @crop.id }
|
||||||
elsif params[:planting_id]
|
elsif params[:planting_id]
|
||||||
{ planting_id: @planting.id }
|
{ planting_id: @planting.id }
|
||||||
elsif params[:planting_slug]
|
|
||||||
{ plantings: @planting.id }
|
|
||||||
else
|
else
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
@@ -129,6 +125,5 @@ class PhotosController < ApplicationController
|
|||||||
def set_crop_and_planting
|
def set_crop_and_planting
|
||||||
@crop = Crop.find params[:crop_slug] if params[:crop_slug]
|
@crop = Crop.find params[:crop_slug] if params[:crop_slug]
|
||||||
@planting = Planting.find params[:planting_id] if params[:planting_id]
|
@planting = Planting.find params[:planting_id] if params[:planting_id]
|
||||||
@planting ||= Planting.find params[:planting_slug] if params[:planting_slug]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class PlacesController < ApplicationController
|
|||||||
|
|
||||||
def search
|
def search
|
||||||
if params[:new_place].empty?
|
if params[:new_place].empty?
|
||||||
redirect_to places_path, alert: t('messages.invalid_location')
|
redirect_to places_path, alert: 'Please enter a valid location'
|
||||||
else
|
else
|
||||||
redirect_to place_path(params[:new_place])
|
redirect_to place_path(params[:new_place])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class PlantPartsController < ApplicationController
|
|||||||
responders :flash
|
responders :flash
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@plant_parts = PlantPart.all.order(:name).paginate(page: params[:page], per_page: 100)
|
@plant_parts = PlantPart.all.order(:name)
|
||||||
respond_with(@plant_parts)
|
respond_with(@plant_parts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
class PlantingsController < DataController
|
class PlantingsController < DataController
|
||||||
after_action :update_crop_medians, only: %i(create update destroy)
|
after_action :update_crop_medians, only: %i(create update destroy)
|
||||||
after_action :update_planting_medians, only: :update
|
after_action :update_planting_medians, only: :update
|
||||||
respond_to :ics, only: [:index] # TODO: This can be shifted up when all relevant controllers respond to ical
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@show_all = params[:all] == '1'
|
@show_all = params[:all] == '1'
|
||||||
@@ -11,8 +10,8 @@ class PlantingsController < DataController
|
|||||||
where = {}
|
where = {}
|
||||||
where['active'] = true unless @show_all
|
where['active'] = true unless @show_all
|
||||||
|
|
||||||
if params[:member_slug].present?
|
if params[:member_slug]
|
||||||
@owner = Member.find_by!(slug: params[:member_slug])
|
@owner = Member.find_by(slug: params[:member_slug])
|
||||||
where['owner_id'] = @owner.id
|
where['owner_id'] = @owner.id
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -22,22 +21,21 @@ class PlantingsController < DataController
|
|||||||
end
|
end
|
||||||
|
|
||||||
@plantings = Planting.search(
|
@plantings = Planting.search(
|
||||||
where:,
|
where: where,
|
||||||
page: params[:page],
|
page: params[:page],
|
||||||
limit: 30,
|
limit: 30,
|
||||||
boost_by: [:created_at],
|
boost_by: [:created_at],
|
||||||
load: false
|
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)
|
respond_with(@plantings)
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@photos = @planting.photos.includes(:owner).order(date_taken: :desc)
|
@photos = @planting.photos.includes(:owner).order(date_taken: :desc)
|
||||||
@harvests = Harvest.search(where: { planting_id: @planting.id })
|
@harvests = Harvest.search(where: { planting_id: @planting.id })
|
||||||
@current_activities = @planting.activities.current.includes(:owner).order(created_at: :desc)
|
|
||||||
@finished_activities = @planting.activities.finished.includes(:owner).order(created_at: :desc)
|
|
||||||
@matching_seeds = matching_seeds
|
@matching_seeds = matching_seeds
|
||||||
@crop = @planting.crop
|
@crop = @planting.crop
|
||||||
|
|
||||||
@@ -46,12 +44,6 @@ class PlantingsController < DataController
|
|||||||
.where.not(id: @planting.id)
|
.where.not(id: @planting.id)
|
||||||
.includes(:owner, :crop, :garden)
|
.includes(:owner, :crop, :garden)
|
||||||
.limit(6)
|
.limit(6)
|
||||||
|
|
||||||
if @planting.finished? && @planting.garden.plantings.current.none? && (@planting.updated_at + 2.weeks) > Time.zone.now
|
|
||||||
@cultivate_soil_link = new_activity_path(name: 'Cultivate soil', garden_id: @planting.garden_id, category: "Soil Cultivation",
|
|
||||||
description: "Recently finished #{@planting.crop.name} planting. Prepare for next planting.")
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_with @planting
|
respond_with @planting
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -98,32 +90,6 @@ class PlantingsController < DataController
|
|||||||
respond_with @planting, location: @planting.garden
|
respond_with @planting, location: @planting.garden
|
||||||
end
|
end
|
||||||
|
|
||||||
def transplant
|
|
||||||
# The `load_and_authorize_resource` in DataController will handle finding the
|
|
||||||
# planting and authorizing the action.
|
|
||||||
# We still need to authorize the new garden
|
|
||||||
new_garden = Garden.find(params[:garden_id])
|
|
||||||
authorize! :update, new_garden
|
|
||||||
|
|
||||||
# Mark original planting as finished
|
|
||||||
@planting.update(finished: true, finished_at: Time.zone.now)
|
|
||||||
|
|
||||||
# Create a new planting
|
|
||||||
new_planting = @planting.dup
|
|
||||||
new_planting.garden = new_garden
|
|
||||||
new_planting.slug = nil # let friendly_id generate a new slug
|
|
||||||
new_planting.finished = false
|
|
||||||
new_planting.finished_at = nil
|
|
||||||
|
|
||||||
if new_planting.save
|
|
||||||
redirect_to edit_planting_path(new_planting), notice: t('messages.transplant_success')
|
|
||||||
else
|
|
||||||
# if the save fails, we should probably roll back the finishing of the original planting
|
|
||||||
@planting.update(finished: false, finished_at: nil)
|
|
||||||
redirect_to @planting, alert: t('messages.transplant_error', errors: new_planting.errors.full_messages.to_sentence)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def update_crop_medians
|
def update_crop_medians
|
||||||
@@ -140,7 +106,7 @@ class PlantingsController < DataController
|
|||||||
:crop_id, :description, :garden_id, :planted_at,
|
:crop_id, :description, :garden_id, :planted_at,
|
||||||
:parent_seed_id,
|
:parent_seed_id,
|
||||||
:quantity, :sunniness, :planted_from, :finished,
|
:quantity, :sunniness, :planted_from, :finished,
|
||||||
:finished_at, :failed, :overall_rating
|
:finished_at
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -160,7 +126,7 @@ class PlantingsController < DataController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def matching_seeds
|
def matching_seeds
|
||||||
@matching_seeds ||= Seed.where(crop: @planting.crop, owner: @planting.owner)
|
Seed.where(crop: @planting.crop, owner: @planting.owner)
|
||||||
.where('(finished_at IS NULL OR finished_at >= ?)', @planting.planted_at)
|
.where('(finished_at IS NULL OR finished_at >= ?)', @planting.planted_at)
|
||||||
.where('(saved_at IS NULL OR saved_at <= ?)', @planting.planted_at)
|
.where('(saved_at IS NULL OR saved_at <= ?)', @planting.planted_at)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class PostsController < ApplicationController
|
|||||||
respond_to :rss, only: %i(index show)
|
respond_to :rss, only: %i(index show)
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@author = Member.find_by!(slug: params[:member_slug]) if params[:member_slug].present?
|
@author = Member.find_by(slug: params[:member_slug])
|
||||||
@posts = posts
|
@posts = posts
|
||||||
respond_with(@posts)
|
respond_with(@posts)
|
||||||
end
|
end
|
||||||
@@ -21,10 +21,6 @@ class PostsController < ApplicationController
|
|||||||
def new
|
def new
|
||||||
@post = Post.new
|
@post = Post.new
|
||||||
@forum = Forum.find_by(id: params[:forum_id])
|
@forum = Forum.find_by(id: params[:forum_id])
|
||||||
if params[:crop_id]
|
|
||||||
@crop = Crop.friendly.find(params[:crop_id])
|
|
||||||
@post.body = "[#{@crop.name}](crop)"
|
|
||||||
end
|
|
||||||
respond_with(@post)
|
respond_with(@post)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -33,17 +29,17 @@ class PostsController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
params[:post][:author_id] = current_member.id
|
params[:post][:author_id] = current_member.id
|
||||||
@post = Post.new(post_params)
|
@post = Post.new(post_params)
|
||||||
flash[:notice] = t('posts.created') if @post.save
|
flash[:notice] = 'Post was successfully created.' if @post.save
|
||||||
respond_with(@post)
|
respond_with(@post)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
flash[:notice] = t('posts.updated') if @post.update(post_params)
|
flash[:notice] = 'Post was successfully updated.' if @post.update(post_params)
|
||||||
respond_with(@post)
|
respond_with(@post)
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
flash[:notice] = t('posts.deleted') if @post.destroy
|
flash[:notice] = 'Post was deleted.' if @post.destroy
|
||||||
respond_with(@post)
|
respond_with(@post)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
class RegistrationsController < Devise::RegistrationsController
|
class RegistrationsController < Devise::RegistrationsController
|
||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
prepend_before_action :check_captcha, only: [:create] # Change this to be any actions you want to protect with recaptcha.
|
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@flickr_auth = current_member.auth('flickr')
|
@twitter_auth = current_member.auth('twitter')
|
||||||
|
@flickr_auth = current_member.auth('flickr')
|
||||||
|
@facebook_auth = current_member.auth('facebook')
|
||||||
render "edit"
|
render "edit"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -38,12 +38,6 @@ class RegistrationsController < Devise::RegistrationsController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def regenerate_api_token
|
|
||||||
current_member.regenerate_api_token
|
|
||||||
set_flash_message :notice, :api_token_regenerated
|
|
||||||
redirect_to edit_member_registration_path + '#apps'
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if @member.valid_password?(params.require(:member)[:current_password])
|
if @member.valid_password?(params.require(:member)[:current_password])
|
||||||
@member.discard
|
@member.discard
|
||||||
@@ -53,25 +47,6 @@ class RegistrationsController < Devise::RegistrationsController
|
|||||||
render "edit"
|
render "edit"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def sign_up_params
|
|
||||||
params.require(:member).permit(:login_name, :email, :tos_agreement, :newsletter, :password, :password_confirmation)
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_captcha
|
|
||||||
return if verify_recaptcha # verify_recaptcha(action: 'signup') for v3
|
|
||||||
|
|
||||||
self.resource = resource_class.new sign_up_params
|
|
||||||
resource.validate # Look for any other validation errors besides reCAPTCHA
|
|
||||||
set_minimum_password_length
|
|
||||||
|
|
||||||
respond_with_navigational(resource) do
|
|
||||||
flash.discard(:recaptcha_error) # We need to discard flash to avoid showing it on the next page reload
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# check if we need the current password to update fields
|
# check if we need the current password to update fields
|
||||||
|
|||||||