Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rake task execution: test coverage and refactoring #197

Merged
merged 2 commits into from
Sep 3, 2022

Conversation

flavorjones
Copy link
Member

@flavorjones flavorjones commented Sep 3, 2022

This PR introduces CI pipeline test coverage for our documented user journey, which will exercise the rake tasks. It also closes #184.

After the first commit, we see the expected failure for #184:

Specified input file D:/a/tailwindcss-rails/tailwindcss-rails/Has\ does not exist.

Note that this is a pretty heavy refactoring, where code is being moved
from exe/tailwindcss to lib/tailwindcss/commands.rb where we can
more easily run unit tests on it.

Note also that we no longer use Shellwords to build command strings, a
library which does not generate correct strings on Windows
platforms. Instead we consistently use arrays of command arguments,
which can be passed to exec or system however we see fit.

The wrapper script conditionally uses system on windows platforms
because exec can't find the executable (see related issue at
rubys/sprockets-esbuild#4).

Finally, note that the rake tasks no longer use the exe/tailwindcss
wrapper script, and instead use the binary executable directly. We can
reverse this decision if we ever decide to support manually-installed
tailwindcss somewhere on the $PATH; but because previously the rake
tasks hardcoded the path/to/exe/tailwindcss, we're not introducing any
new constraints by skipping the wrapper.

@flavorjones flavorjones force-pushed the flavorjones-better-command-execution branch 3 times, most recently from f9eca84 to 978ae4c Compare September 3, 2022 15:39
primarily this is to exercise the rake tasks.
@flavorjones flavorjones force-pushed the flavorjones-better-command-execution branch from 978ae4c to a3f6e46 Compare September 3, 2022 15:46
Note that this is a pretty heavy refactoring, where code was moved
from `exe/tailwindcss` to `lib/tailwindcss/commands.rb` where we can
more easily run unit tests on it.

Note also that we no longer use Shellwords to build command strings, a
library which does not generate correct strings on Windows
platforms. Instead we consistently use arrays of command arguments,
which can be passed to `exec` or `system` however we see fit.

The wrapper script conditionally uses `system` on windows platforms
because `exec` can't find the executable (see related issue at
rubys/sprockets-esbuild#4).

Finally, note that the rake tasks no longer use the `exe/tailwindcss`
wrapper script, and instead use the binary executable directly. We can
reverse this decision if we ever decide to support manually-installed
tailwindcss somewhere on the $PATH; but because previously the rake
tasks hardcoded the path/to/exe/tailwindcss, we're not introducing any
new constraints by skipping the wrapper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant