This PR is a WIP that aims to address the first 3 steps in #1833.
This is in anticipation of using `forc test` to support unit testing
(rather than Rust integration testing) #1832.
The `forc test` command remains for now, but outputs a message
explaining that the command is now reserved for unit testing and links
to the issues above.
## TODO
- [x] Create a new `sway-test-rs` repo or similar that can be used as a
`cargo generate` template.
- [x] Update Rust integration testing docs in the Sway book to describe
how to use the `cargo generate` command to easily add Sway integration
testing to an existing Rust project.
## Follow-up
- Create a `forc-test-rs` crate that re-exports and extends `fuels` with
useful `forc` functionality for integration testing (e.g. re-exporting
`forc_pkg::build` to ensure sway code is built and available under
`out/` at the start of testing).
* Copy over changes from PR#1669
* Rework `forc new` in terms of `forc init`
This removes all of the duplicated logic from the `forc new` command in
favour of re-using the `forc init` op.
* Add missing doc
* Add missing comment
Co-authored-by: Rashad Alston <rashad@Rashads-MacBook-Pro.local>
Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>
Co-authored-by: Rashad Alston <rashad@Rashads-MBP.attlocal.net>
* Add instructions to update mdbook-forc-documenter if 'Commands' or 'Plugins' chapter names change
* replace forc gm example with forc explore, and add 'or plugin' after every reference to command
* Add instructions to add plugin installation within CI
* newline
* more info on taking action
* consistent wording
* Clearer wording on removing plugin
* fix: behaviour -> behavior
* Use permalinks
* use permalink in docs/README.d as well
* forc template resolves the HEAD and fetches the repo. Prints the requested directorie's path
* forc template works with and without template name
* forc init --template removed, pkg.rs unused pub modifier removed
* extra info added before copy, cargo-toml-lint, udeps fix, mdbook fix
* invoke CI
* Update scripts/mdbook-forc-documenter/examples/forc_template.md
Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
* Update scripts/mdbook-forc-documenter/examples/forc_template.md
Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
* default url provided, project_name is last parameter to pass without --project_name
* cargo fmt
* println to tracing::info
* local_repo_name to template_name
Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
* Refactoring to get ready for plugin documentation integration
* Check for errors when updating doucmentation
* Fix formatting of error text
* Remove unused BorrowMut
* Add plugin docs
* strip whitespace to remove version no. from plugin command header
* Better naming for commands/plugins within preprocessor
* extract inject_content
* handle parsing subcommand
* Refactor
* Install plugins within ci and gh-pages
* order plugins alphabetically
* official_plugin_commands -> plugin_commands, since they mean the same
* Handle error messages better
* subcommand_is_parsed -> has_parsed_subcommand_header for consistency
* More consistent expect message
* Add additional white spaces for test_format_subcommand_line
* cargo install --debug to speed things up
* Update input from &Vec<String> to &[String]
* Move forc-explore, forc-fmt, forc-lsp, into forc-plugins dir
* Update CI ymls with new plugins path
* Update all references to forc plugins in ci
* Programatically get plugins from forc-plugins
* Update ci.yml
* Properly install plugins
* Re-add removed cancel-previous-run
* Remove unused actions-rs/cargo
* Update plugins installation for gh-pages.yml
* Improve plugins.rs
* Improved find_forc_plugins_dir
* Remove return line within format_header_line
* Fix bug where preprocessor would panic if not in Sway root (#1618)
While testing, I noticed that the build would panic if you attempted to
`mdbook build` the book while in the `docs` directory. I then realised
we had a misuse of the `current_dir` function which must have slipped
through in a previous PR review. I've fixed this by adding a
`find_sway_repo_root` fn and implementing functions to find the plugins
and examples directories in terms of it.
Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>