version: '3' ## # IMPORTANT: All tasks listed in this file should be executed from the root folder. # https://taskfile.dev/usage/#task-directory # # NOTE: Examples of multiline strings in YAML. # https://yaml-multiline.info/ # # NOTE: Use `[ "${IN_DOCKER_CONTAINER}" == "true" ] && echo true || echo false` to debug ``[ "${IN_DOCKER_CONTAINER}" == "true" ]`. # # NOTE: Forwarding CLI arguments to commands ({{.CLI_ARGS}}). # https://taskfile.dev/usage/#forwarding-cli-arguments-to-commands # tasks: default: cmds: - task: test ## # NOTE: `task console` is also aliased as `task playground`. # console: cmds: - bundle exec rake playground interactive: true ## # NOTE: `task console:all` is also aliased as `task playground:all`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # console:all: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "all"].join("_")' interactive: true ## # NOTE: `task console:dry` is also aliased as `task playground:dry`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # console:dry: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "dry"].join("_")' interactive: true ## # NOTE: `task console:rails_5.2` is also aliased as `task playground:rails_5.2`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # console:rails_5.2: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_5.2"].join("_")' interactive: true ## # NOTE: `task console:rails_6.0` is also aliased as `task playground:rails_6.0`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # console:rails_6.0: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_6.0"].join("_")' interactive: true ## # NOTE: `task console:rails_6.1` is also aliased as `task playground:rails_6.1`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # console:rails_6.1: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_6.1"].join("_")' interactive: true ## # NOTE: `task console:rails_7.0` is also aliased as `task playground:rails_7.0`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # console:rails_7.0: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_7.0"].join("_")' interactive: true ## # NOTE: `task console:standard` is also aliased as `task playground:standard`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # console:standard: cmds: - bundle exec rake playground interactive: true coverage:lcov:merge: cmds: - npx --yes lcov-result-merger 'coverage/**/lcov.info' coverage/lcov.info coverage:open: cmds: - open coverage/index.html preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) deps: cmds: - task: deps:install ## # NOTE: `task deps:install` is also aliased as `task install`. # deps:install: cmds: - bundle install - bundle exec appraisal install deps:clean: cmds: - "bundle exec rake confirm \"This task removes Gemfile*.lock and gemfiles/**/*. Are you sure?\"" - rm Gemfile*.lock - rm -rf gemfiles ## # NOTE: JRuby 9.4 aims CRuby 3.1 compatibility. # - https://www.jruby.org/download # docker:bash:jruby_9.4: cmds: - docker run --rm -it -v $(pwd):/gem convenient_service:jruby-9.4 bash interactive: true preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) docker:bash:ruby_2.7: cmds: - docker run --rm -it -v $(pwd):/gem convenient_service:2.7 bash interactive: true preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) docker:bash:ruby_3.0: cmds: - docker run --rm -it -v $(pwd):/gem convenient_service:3.0 bash interactive: true preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) docker:bash:ruby_3.1: cmds: - docker run --rm -it -v $(pwd):/gem convenient_service:3.1 bash interactive: true preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) docker:bash:ruby_3.2: cmds: - docker run --rm -it -v $(pwd):/gem convenient_service:3.2 bash interactive: true preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) ## # NOTE: TruffleRuby 22.3 aims CRuby 3.1 compatibility. # - https://github.com/oracle/truffleruby/blob/master/doc/user/compatibility.md # docker:bash:truffleruby_22.3: cmds: - docker run --rm -it -v $(pwd):/gem convenient_service:truffleruby-22.3 bash interactive: true preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) docker:build: cmds: - task: docker:build:ruby_2.7 - task: docker:build:ruby_3.0 - task: docker:build:ruby_3.1 - task: docker:build:ruby_3.2 - task: docker:build:jruby_9.4 - task: docker:build:truffleruby_22.3 preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) ## # NOTE: JRuby 9.4 aims CRuby 3.1 compatibility. # - https://www.jruby.org/download # docker:build:jruby_9.4: cmds: ## # NOTE: Meaning of `|| 2> /dev/null`. # https://stackoverflow.com/a/10250395/12201472 # # NOTE: Meaning of `|| true`. # https://superuser.com/a/887349/1180656 # - rm Gemfile.jruby-9.4 2> /dev/null || true - rm Gemfile.jruby-9.4.lock 2> /dev/null || true - cp Gemfile Gemfile.jruby-9.4 - docker build . -f docker/jruby-9.4/Dockerfile -t convenient_service:jruby-9.4 preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) docker:build:ruby_2.7: cmds: ## # NOTE: Meaning of `|| 2> /dev/null`. # https://stackoverflow.com/a/10250395/12201472 # # NOTE: Meaning of `|| true`. # https://superuser.com/a/887349/1180656 # - rm Gemfile.2.7 2> /dev/null || true - rm Gemfile.2.7.lock 2> /dev/null || true - cp Gemfile Gemfile.2.7 - docker build . -f docker/2.7/Dockerfile -t convenient_service:2.7 preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) docker:build:ruby_3.0: cmds: ## # NOTE: Meaning of `|| 2> /dev/null`. # https://stackoverflow.com/a/10250395/12201472 # # NOTE: Meaning of `|| true`. # https://superuser.com/a/887349/1180656 # - rm Gemfile.3.0 2> /dev/null || true - rm Gemfile.3.0.lock 2> /dev/null || true - cp Gemfile Gemfile.3.0 - docker build . -f docker/3.0/Dockerfile -t convenient_service:3.0 preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) docker:build:ruby_3.1: cmds: ## # NOTE: Meaning of `|| 2> /dev/null`. # https://stackoverflow.com/a/10250395/12201472 # # NOTE: Meaning of `|| true`. # https://superuser.com/a/887349/1180656 # - rm Gemfile.3.1 2> /dev/null || true - rm Gemfile.3.1.lock 2> /dev/null || true - cp Gemfile Gemfile.3.1 - docker build . -f docker/3.1/Dockerfile -t convenient_service:3.1 preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) docker:build:ruby_3.2: cmds: ## # NOTE: Meaning of `|| 2> /dev/null`. # https://stackoverflow.com/a/10250395/12201472 # # NOTE: Meaning of `|| true`. # https://superuser.com/a/887349/1180656 # - rm Gemfile.3.2 2> /dev/null || true - rm Gemfile.3.2.lock 2> /dev/null || true - cp Gemfile Gemfile.3.2 - docker build . -f docker/3.2/Dockerfile -t convenient_service:3.2 preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) ## # NOTE: TruffleRuby 22.3 aims CRuby 3.1 compatibility. # - https://github.com/oracle/truffleruby/blob/master/doc/user/compatibility.md # docker:build:truffleruby_22.3: cmds: ## # NOTE: Meaning of `|| 2> /dev/null`. # https://stackoverflow.com/a/10250395/12201472 # # NOTE: Meaning of `|| true`. # https://superuser.com/a/887349/1180656 # - rm Gemfile.truffleruby-22.3 2> /dev/null || true - rm Gemfile.truffleruby-22.3.lock 2> /dev/null || true - cp Gemfile Gemfile.truffleruby-22.3 - docker build . -f docker/truffleruby-22.3/Dockerfile -t convenient_service:truffleruby-22.3 preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) ## # NOTE: Dev only command. # NOTE: macOS specific command. # docker:start: cmds: - open -a Docker ## # NOTE: `sdoc` (wrapper for `rdoc`) is replaced by `yard`, since you have a feeling like every time is a first time with `rdoc`. # - https://kapeli.com/cheat_sheets/Yard.docset/Contents/Resources/Documents/index # - https://rubydoc.info/gems/yard/file/README.md # - `yardoc --help` # # NOTE: `commonmarker` supports GitHub Flavored Markdown. # - https://github.com/gjtorikian/commonmarker # - https://github.github.com/gfm/ # - https://github.com/github/markup#markups # - https://github.com/lsegal/yard/pull/1388 # # TODO: Contribute. Forward `--parse-option LIBERAL_HTML_TAG` to commonmarker. # # NOTE: options are specified in the `.yardopts` file. # docs:generate: cmds: - bundle exec yardoc docs:generate:open: cmds: - task: docs:generate - task: docs:open docs:lint: cmds: - task: yard_junk docs:missed: cmds: ## # NOTE: Options are taken from `.inch.yml`. # - bundle exec inch docs:open: cmds: - open docs/index.html preconditions: - sh: '[ "${IN_DOCKER_CONTAINER}" != "true" ]' msg: This task can be invoked only from the host operating system (https://www.ibm.com/cloud/learn/containerization) ## # NOTE: Dev only command. # editor:open: cmds: - code . ## # NOTE: A trailing "/**" matches everything inside. # https://git-scm.com/docs/gitignore # git:staged:specs: cmds: - git diff --cached --name-only --diff-filter=d "spec/**" ## # NOTE: Dev only command. # NOTE: macOS specific command. # github:open: cmds: - open -na "Google Chrome" --args --new-window --incognito "https://github.com/marian13/convenient_service" ## # NOTE: `task install` is also aliased as `task deps:install`. # install: cmds: - task: deps:install lint: cmds: - task: rubocop - task: docs:lint lint:autocorrect: cmds: - task: rubocop:autocorrect ## # TODO: Add to CI. # minitest: cmds: - bundle exec ruby minitest.rb ## # - https://github.com/mbj/mutant/blob/main/docs/mutant-rspec.md#run-through-example # mutant: cmds: - bundle exec mutant run --include lib --require convenient_service --integration rspec -- 'ConvenientService*' ## # NOTE: `task playground` is also aliased as `task console`. # playground: cmds: - bundle exec rake playground interactive: true ## # NOTE: `task playground:all` is also aliased as `task console:all`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # playground:all: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "all"].join("_")' interactive: true ## # NOTE: `task playground:dry` is also aliased as `task console:dry`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # playground:dry: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "dry"].join("_")' interactive: true ## # NOTE: `task playground:rails_5.2` is also aliased as `task console:rails_5.2`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # playground:rails_5.2: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_5.2"].join("_")' interactive: true ## # NOTE: `task playground:rails_6.0` is also aliased as `task console:rails_6.0`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # playground:rails_6.0: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_6.0"].join("_")' interactive: true ## # NOTE: `task playground:rails_6.1` is also aliased as `task console:rails_6.1`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # playground:rails_6.1: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_6.1"].join("_")' interactive: true ## # NOTE: `task playground:rails_7.0` is also aliased as `task console:rails_7.0`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # playground:rails_7.0: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rake playground vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_7.0"].join("_")' interactive: true ## # NOTE: `task playground:standard` is also aliased as `task console:standard`. # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # playground:standard: cmds: - bundle exec rake playground interactive: true release: cmds: - gem release rspec: cmds: - task: rspec:standard - task: rspec:rails_7.0 - task: rspec:rails_6.1 - task: rspec:rails_6.0 - task: rspec:rails_5.2 - task: rspec:dry ## # NOTE: Run rspec only for git staged spec files. # https://githowto.com/staging_and_committing # rspec:staged: cmds: - task: rspec:standard:staged - task: rspec:rails_5.2:staged - task: rspec:rails_6.0:staged - task: rspec:rails_6.1:staged - task: rspec:rails_7.0:staged - task: rspec:dry:staged ## # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # rspec:dry: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rspec --format progress --require dry_helper {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}} vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "dry"].join("_")' rspec:dry:staged: - task: rspec:dry vars: GIT_STAGED_SPEC_FILES: ## # NOTE: `task: git:staged:specs` does NOT work. # sh: task git:staged:specs --silent ## # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # rspec:rails_5.2: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rspec --format progress --require rails_helper {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}} vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_5.2"].join("_")' rspec:rails_5.2:staged: - task: rspec:rails_5.2 vars: GIT_STAGED_SPEC_FILES: ## # NOTE: `task: git:staged:specs` does NOT work. # sh: task git:staged:specs --silent ## # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # rspec:rails_6.0: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rspec --format progress --require rails_helper {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}} vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_6.0"].join("_")' rspec:rails_6.0:staged: - task: rspec:rails_6.0 vars: GIT_STAGED_SPEC_FILES: ## # NOTE: `task: git:staged:specs` does NOT work. # sh: task git:staged:specs --silent ## # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # rspec:rails_6.1: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rspec --format progress --require rails_helper {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}} vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_6.1"].join("_")' rspec:rails_6.1:staged: - task: rspec:rails_6.1 vars: GIT_STAGED_SPEC_FILES: ## # NOTE: `task: git:staged:specs` does NOT work. # sh: task git:staged:specs --silent ## # NOTE: `APPRAISAL_NAME` should be kept in sync with `Appraisals` file. # rspec:rails_7.0: cmds: - bundle exec appraisal {{.APPRAISAL_NAME}} rspec --format progress --require rails_helper {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}} vars: APPRAISAL_NAME: sh: ruby -e 'print [::RUBY_ENGINE, ::RUBY_VERSION, "rails_7.0"].join("_")' rspec:rails_7.0:staged: - task: rspec:rails_7.0 vars: GIT_STAGED_SPEC_FILES: ## # NOTE: `task: git:staged:specs` does NOT work. # sh: task git:staged:specs --silent rspec:standard: cmds: - bundle exec rspec --format progress {{.GIT_STAGED_SPEC_FILES}} {{.CLI_ARGS}} rspec:standard:staged: cmds: - task: rspec:standard vars: GIT_STAGED_SPEC_FILES: ## # NOTE: `task: git:staged:specs` does NOT work. # sh: task git:staged:specs --silent rubocop: cmds: - bundle exec rubocop --config .rubocop.yml {{.CLI_ARGS}} rubocop:autocorrect: cmds: - bundle exec rubocop --config .rubocop.yml -A {{.CLI_ARGS}} test: cmds: - task: rspec - task: minitest ## # NOTE: Dev only command. # tmuxinator:start: cmds: - tmuxinator start convenient_service --project-config=.dev/.tmuxinator.yml yard_junk: cmds: - mkdir -p docs - bundle exec yard-junk --text --html docs/junk-yard.html