Commit Graph

440 Commits

Author SHA1 Message Date
Casey Rodarmor
6a0e3abb32 Improve shebang execution error message (#184)
I was reusing TmpdirIoError for a few cases, but one of them
usually has more to do with the contents of the shebang line than
an actual io error involving the tmpdir. Pull it out into its own
RunError variant and improve the message.
2017-04-22 19:05:51 -07:00
Casey Rodarmor
a6e1cc8ac5 Uppercase integration test exported variable names (#183)
For windows, since windows environment variables are not case
sensitive.
2017-04-22 16:39:13 -07:00
Casey Rodarmor
8d1ef2f54f Fix type in unit test panic message (#182) 2017-04-22 16:22:54 -07:00
Casey Rodarmor
b0c5fa23ee Multi shell integration tests (#181)
* Run integration tests on multiple shells

To make sure that I don't break tests for shells other than my
dev-box's `sh` and the `sh` on travis, each integration test case
now runs using `sh`, `dash`, and `bash.
2017-04-22 16:15:15 -07:00
Casey Rodarmor
2b294f0b30 Create platform module (#178)
Moves platform specific functionality into its own module.

Thanks to @Meralis40 for starting this!

This also gets just building on windows \^_^/

Although a lot of tests still fail (✖╭╮✖)

The `PlatformInterface` trait contains functions which abstract
over platform specific functionality, with implementations for
different platforms behind #[cfg(*)] attributes.

- `make_shebang_command()` constructs a command which will execute
  the given script as if by a shebang. On linux this executes the
  file, on windows it runs the interpreter directly.

- `set_execute_permission()` sets the execute permission on a
  file. This is a nop on windows, since all files are executable.

- `signal_from_exit_status()` extracts the signal a process was
  halted by from its exit status, if it was halted by a signal.
2017-04-21 22:20:13 -07:00
Casey Rodarmor
6a26c72131 Use libc::{EXIT_SUCCESS, EXIT_FAILURE} for status (#177) 2017-04-21 22:11:18 -07:00
Casey Rodarmor
f38f984f12 Use CAPITALIZED option names (#176)
Since this seems to be the convention.
2017-04-20 23:24:23 -07:00
Casey Rodarmor
c9ce4601b9 Add --shell option to specify the shell to use (#175)
Mostly for debugging purposes, so I can make sure behavior is
consistent across different shells. Although I suppose this might
also be of use if you've got a mega weird `sh` that you'd like to
avoid.

Defaults to `sh` so current behavior is preserved.
2017-04-20 23:06:03 -07:00
Casey Rodarmor
799986dd34 Sort clap arguments alphabetically (#174) 2017-04-20 22:49:51 -07:00
Casey Rodarmor
d7bb94ab5b Update and adapt to latest versions of dependencies (#171)
- Unicode 9 defines emoji to be wide characters; before their
  width was ambiguous. unicode-width has picked this up, so the
  tests which expected emoji to be single-width have been updated.

- The ordering of the --quiet and --dry-run flags seems to be
  have flipped in a clap error message, which broke a test, which
  is unbroken by this commit
2017-04-20 21:38:44 -07:00
Casey Rodarmor
95ef27b32b Add a gitter badge (#170) 2017-04-18 22:18:36 -07:00
Casey Rodarmor
435b4c5ea3 Remove trailing whitespace (#167) 2017-04-02 20:39:23 -07:00
Casey Rodarmor
e45164da4d Improve syntax highlighting suggestions in readme (#164)
- Recognize Justfile as a justfile for vim filetypes snippet
- Add vim modeline and emacs local variables block
2017-03-12 19:20:33 -07:00
Casey Rodarmor
d68f7867ca Set emacs and vim filetype in justfile for syntax highlighting (#163) 2017-03-12 19:17:52 -07:00
Casey Rodarmor
b6b01bf6d4 🔥 Disallow names that start with '-' (#154)
This is done for two reasons:

1. Such names cannot be given on the command line, since clap will
intercept them and wrongly interpret them as flags.

2. The name '---' can conflict with yaml document delimiters. Kind of
speculative, but I was thinking that it would be nice to make sure that
'---' and '...' are illegal in a justfile, so that that one can be
included in a yaml document stream. Is this silly? I am really not sure.

This is backwards incompatible, but I don't think anyone will notice,
since names that start with '-' are likely to be rare.
2017-02-10 20:15:25 -08:00
Casey Rodarmor
763f5798be Bump version: 0.2.25 -> 0.2.26 (#150) 2017-01-18 22:07:21 -08:00
Casey Rodarmor
bed28c1df5 Resolve dependencies after the first (#149)
The recipe dependency resolver had a bug which caused it to not resolve
dependencies after the first.

This caused the parameter check later in the program to crash.

Added a test and fixed it.

Fixes #148.
2017-01-18 20:32:55 -08:00
Casey Rodarmor
1befc8674e Test all errors and error messages (#145) 2017-01-08 19:01:48 -08:00
Casey Rodarmor
64e4905e49 Capitalize all error messages (#144) 2017-01-08 17:26:34 -08:00
Casey Rodarmor
9c552fe8d0 readme: 'the in' -> 'in the' (#143) 2016-12-30 01:01:57 -08:00
Casey Rodarmor
2cb88cc06c Bump version to 0.2.25 (#142) 2016-12-30 00:25:32 -08:00
Casey Rodarmor
d17911a573 Use '/' instead of "/" as argument to rfind (#141) 2016-12-30 00:23:32 -08:00
Casey Rodarmor
02a160d2e0 Bump version: 0.2.23 -> 0.2.24 (#140) 2016-12-30 00:22:02 -08:00
Casey Rodarmor
b267d0444e Allow path-prefixed first arguments (#139)
If the first argument to just contains a `/`, then it will be handled
specially. Everything before the last `/` is treated as a directory, and
just will search for the justfile starting there, instead of in the
current directory.
2016-12-30 00:09:35 -08:00
Casey Rodarmor
86755582bb Readme: email -> issue (#138) 2016-12-15 18:48:31 -08:00
Casey Rodarmor
c6256333ed Lift limitations on recipes that take parameters (#137)
Previously, only one recipe with parameters could be passed on the
command line. This was to avoid confusion in case the number of
parameters a recipe took changed, and wound up using as an argument was
was once a recipe.

However, I don't think this is actually particularly confusing in
practice, and could be a slightly annoying limitation.

Now, any number of recipes with parameters may be given on the command
line.

Fixes #70
2016-12-10 16:35:52 -08:00
Casey Rodarmor
af543d7258 Remove duplicate return (#136) 2016-12-10 16:31:38 -08:00
Casey Rodarmor
99e48fe2c6 Mention prebuilts in readme (#135) 2016-11-23 20:41:58 -08:00
Casey Rodarmor
f47e69ceae mkdir -p tmp/... (#134)
This is needed in case we're on a branch which didn't have a ./tmp
2016-11-23 20:32:03 -08:00
Casey Rodarmor
efb4d5e908 Checkout master when building linux binaries (#133) 2016-11-23 20:28:40 -08:00
Casey Rodarmor
6b9922fc2c Build Linux binaries using Vagrant (#132)
Adds a Vagrantfile to provision a Debian VM, and recipes to build for
linux on the VM.
2016-11-23 20:20:32 -08:00
Casey Rodarmor
da8108f19d Add recipes to build binaries for release (#131) 2016-11-23 19:40:06 -08:00
Casey Rodarmor
0195a15e68 Add FLAGS to push recipe, get rid of push-f recipe (#130) 2016-11-18 07:14:48 -08:00
Casey Rodarmor
bf42b23be3 Bump version to v0.2.23 (#129) 2016-11-18 07:10:14 -08:00
Casey Rodarmor
11c0d349db Collapse unnecessary block (#128) 2016-11-18 07:07:20 -08:00
Casey Rodarmor
1ac5b4ea42 Add variadic parameters (#127)
Recipes may now have a final variadic parameter:

```make
foo bar+:
  @echo {{bar}}
```

Variadic parameters accept one or more arguments, and expand to a string containing those arguments separated by spaces:

```sh
$ just foo a b c d e
a b c d e
```

I elected to accept one or more arguments instead of zero or more arguments since unexpectedly empty arguments can sometimes be dangerous. 

```make
clean dir:
  rm -rf {{dir}}/bin
```

If `dir` is empty in the above recipe, you'll delete `/bin`, which is probably not what was intended.
2016-11-18 07:03:34 -08:00
Casey Rodarmor
9ece0b9a6b Add comment to push-f recipe (#126) 2016-11-16 22:20:26 -08:00
Casey Rodarmor
cef117f8bd Report line number in recipe failure messages (#125)
The grammar now permits blank lines in recipes.

Note that inside of recipes, the token `NEWLINE` is used instead of the
non-terminal `eol`. This is because an `eol` optionally includes a
comment, whereas inside recipes bodies comments get no special
treatment.
2016-11-16 22:18:55 -08:00
Casey Rodarmor
07634d9390 Fix line numbers (#124)
Blank lines were being ignored by the parser, so lines would be reported
incorrectly in error messages from shebang recipes. Blank lines are now
included by the parser, so shebang recipes expand to have the non-blank
lines in the expected place in the file.
2016-11-16 21:37:43 -08:00
Casey Rodarmor
2f4bcc57bc Add --verbose flag (#123)
Causes all recipe lines to be printed, regardless of --quiet or `@`.
Prints the name of each recipe before running it. Hopefully useful for
diagnosing problems.
2016-11-16 21:06:51 -08:00
Casey Rodarmor
133b4a2ada Renames: Parser::file and just::parse (#122)
Parser::file -> Parser::justfile
just::parse -> just::compile

Also get rid of super::, super::std
2016-11-16 20:17:24 -08:00
Casey Rodarmor
e628378dbb Avoid using panic! outside of tests (#121)
Don't panic.
2016-11-15 20:39:56 -08:00
Casey Rodarmor
d11e679e4b Just is no longer a trival program ;_; (#120) 2016-11-15 19:29:41 -08:00
Casey Rodarmor
0ac2cdd124 Mention {{...}} substitution gotcha in readme (#117)
Fixes #116
2016-11-14 20:19:35 -08:00
Casey Rodarmor
91d1e59667 Fix override argument processing bug (#115)
An invocation like `just foo=bar` would lead to no recipe being run due
to the way that override arguments were being processed.

Fix that and add a test that covers that case.
2016-11-13 21:26:28 -08:00
Casey Rodarmor
aaee7341c4 Deny clippy lints by default (#112) 2016-11-13 15:03:33 -08:00
Casey Rodarmor
de4a299899 Make quine-text multiline string (#111) 2016-11-13 14:33:41 -08:00
Casey Rodarmor
1690da3e6b Bump version to v0.2.22 (#110) 2016-11-13 14:28:27 -08:00
Casey Rodarmor
3d7888708c Add multiline raw string example to readme (#109) 2016-11-13 14:21:34 -08:00
Casey Rodarmor
1e7a0fa63b Fix readme typo (#108)
'rather not rust' -> 'rather not install rust'
2016-11-13 14:07:04 -08:00