mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-24 05:56:22 +00:00
197 lines
5 KiB
YAML
197 lines
5 KiB
YAML
---
|
|
version: "3"
|
|
vars:
|
|
CURRENT_BRANCH:
|
|
sh: "git rev-parse --abbrev-ref HEAD"
|
|
shopt:
|
|
- "globstar"
|
|
dotenv:
|
|
- ".env.development"
|
|
- ".env"
|
|
- ".env.local"
|
|
- ".env.development.local"
|
|
tasks:
|
|
credentials:
|
|
desc: "Generate credentials file"
|
|
cmds:
|
|
- "cp --no-clobber config/credentials.yml.enc.ci config/credentials.yml.enc"
|
|
sources:
|
|
- "config/credentials.yml.enc.ci"
|
|
generates:
|
|
- "config/credentials.yml.enc"
|
|
gems:
|
|
desc: "Install gems"
|
|
deps:
|
|
- "credentials"
|
|
cmds:
|
|
- "{{.HAINISH}} bundle config set --local path './vendor'"
|
|
- "{{.HAINISH}} bundle install"
|
|
sources:
|
|
- "Gemfile"
|
|
generates:
|
|
- "Gemfile.lock"
|
|
status:
|
|
- "test -d vendor/ruby"
|
|
clean:
|
|
desc: "Clean"
|
|
cmds:
|
|
- "rm -rf _sites/test-* _deploy/test-* log/*.log tmp/cache tmp/letter_opener tmp/miniprofiler tmp/storage"
|
|
node-modules:
|
|
desc: "Install Node modules"
|
|
cmds:
|
|
- "{{.HAINISH}} yarn"
|
|
sources:
|
|
- "package.json"
|
|
- "yarn.lock"
|
|
status:
|
|
- "test -d node_modules"
|
|
assets:
|
|
desc: "Generate assets"
|
|
deps:
|
|
- "node-modules"
|
|
- "gems"
|
|
cmds:
|
|
- "git lfs fetch"
|
|
- "git lfs checkout"
|
|
- task: "rails"
|
|
vars:
|
|
CLI_ARGS: "webpacker:clobber RAILS_ENV=production"
|
|
- task: "rails"
|
|
vars:
|
|
CLI_ARGS: "assets:precompile RAILS_ENV=production"
|
|
- task: "rails"
|
|
vars:
|
|
CLI_ARGS: "assets:clean RAILS_ENV=production"
|
|
sources:
|
|
- "package.json"
|
|
- "yarn.lock"
|
|
- "app/assets/**/*"
|
|
- "app/javascript/**/*"
|
|
generates:
|
|
- "public/packs/manifest.json"
|
|
hosts:
|
|
desc: "Local DNS resolution for hostnames"
|
|
interactive: true
|
|
cmds:
|
|
- "echo -e \"127.0.0.1 panel.{{.SUTTY}} api.{{.SUTTY}} postgresql.{{.SUTTY}}\" | sudo tee -a /etc/hosts"
|
|
- "echo -e \"::1 panel.{{.SUTTY}} api.{{.SUTTY}} postgresql.{{.SUTTY}}\" | sudo tee -a /etc/hosts"
|
|
status:
|
|
- "grep -q \" panel.{{.SUTTY}} \" /etc/hosts"
|
|
database-init:
|
|
desc: "Database install"
|
|
cmds:
|
|
- "{{.HAINISH}} /usr/bin/initdb --locale en_US.utf8 -E UTF8 -D /var/lib/postgresql/{{.PGVER}}/data"
|
|
- "echo \"host all all samenet trust\" >> ../hain/var/lib/postgresql/{{.PGVER}}/data/pg_hba.conf"
|
|
- "echo \"listen_addresses = '*'\" >> ../hain/var/lib/postgresql/{{.PGVER}}/data/postgresql.conf"
|
|
- "echo \"external_pid_file = '{{.PGPID}}'\" >> ../hain/var/lib/postgresql/{{.PGVER}}/data/postgresql.conf"
|
|
- "install -dm755 ../hain/run/postgresql"
|
|
status:
|
|
- "test -d ../hain/var/lib/postgresql/{{.PGVER}}/data"
|
|
- "test -f ../hain/var/lib/postgresql/{{.PGVER}}/data/postgresql.conf"
|
|
database:
|
|
desc: "Database"
|
|
deps:
|
|
- "database-init"
|
|
cmds:
|
|
- "{{.HAINISH}} daemonize -c /var/lib/postgresql/{{.PGVER}}/data /usr/bin/postgres -D /var/lib/postgresql/{{.PGVER}}/data"
|
|
status:
|
|
- "test -f ../hain{{.PGPID}}"
|
|
- "pgrep -F ../hain{{.PGPID}}"
|
|
prepare:
|
|
desc: "Create database or run pending migrations"
|
|
deps:
|
|
- "database"
|
|
cmds:
|
|
- task: "rails"
|
|
vars:
|
|
CLI_ARGS: "db:prepare"
|
|
serve:
|
|
desc: "Run Rails development server"
|
|
deps:
|
|
- "prepare"
|
|
- "gems"
|
|
cmds:
|
|
- ": == Development server running at https://panel.{{.SUTTY_WITH_PORT}} =="
|
|
- task: "rails"
|
|
vars:
|
|
CLI_ARGS: "server"
|
|
status:
|
|
- "test -f tmp/pids/server.pid"
|
|
- "pgrep -F tmp/pids/server.pid"
|
|
yarn:
|
|
desc: "Yarn. Call with: go-task yarn -- arguments"
|
|
deps:
|
|
- "node-modules"
|
|
cmds:
|
|
- "{{.HAINISH}} yarn {{.CLI_ARGS}}"
|
|
- defer:
|
|
task: "notify"
|
|
bundle:
|
|
desc: "Bundle. Call with: go-task bundle -- arguments"
|
|
interactive: true
|
|
deps:
|
|
- "gems"
|
|
cmds:
|
|
- "{{.HAINISH}} bundle {{.CLI_ARGS}}"
|
|
- defer:
|
|
task: "notify"
|
|
rails:
|
|
desc: "Rails. Call with: go-task rails -- arguments"
|
|
cmds:
|
|
- task: "bundle"
|
|
vars:
|
|
CLI_ARGS: "exec rails {{.CLI_ARGS}}"
|
|
console:
|
|
desc: "Rails console"
|
|
interactive: true
|
|
cmds:
|
|
- task: "rails"
|
|
vars:
|
|
CLI_ARGS: "console"
|
|
doc:
|
|
desc: "Build documentation"
|
|
deps:
|
|
- "gems"
|
|
cmds:
|
|
- task: "bundle"
|
|
vars:
|
|
CLI_ARGS: "exec yardoc -o public/doc app lib config db"
|
|
gem-audit:
|
|
desc: "Audit Gem dependencies"
|
|
deps:
|
|
- "gems"
|
|
- "bundler-audit"
|
|
cmds:
|
|
- task: "bundle"
|
|
vars:
|
|
CLI_ARGS: "audit --update"
|
|
node-audit:
|
|
desc: "Audit Node dependencies"
|
|
deps:
|
|
- "node-modules"
|
|
cmds:
|
|
- task: "yarn"
|
|
vars:
|
|
CLI_ARGS: "audit"
|
|
notify:
|
|
internal: true
|
|
cmds:
|
|
- "echo -e \"\a\""
|
|
bundler-audit:
|
|
internal: true
|
|
cmds:
|
|
- "{{.HAINISH}} gem install bundler-audit"
|
|
status:
|
|
- "test -f ../hain/usr/bin/bundler-audit"
|
|
rubocop:
|
|
desc: "Ruby linting"
|
|
deps:
|
|
- "gems"
|
|
cmds:
|
|
- "./bin/modified_files | ./bin/with_extension rb | xargs -r {{.HAINISH}} bundle exec rubocop {{.CLI_ARGS}}"
|
|
haml-lint:
|
|
desc: "HAML linting"
|
|
deps:
|
|
- "gems"
|
|
cmds:
|
|
- "./bin/modified_files | ./bin/with_extension haml | xargs -r {{.HAINISH}} bundle exec haml-lint {{.CLI_ARGS}}"
|