@@ -83,7 +83,6 @@ fn create_default_docs_structure(docs_dir: &Path) -> Result<(), DynError> {
8383 r#"[book]
8484authors = ["OpenProt Team"]
8585language = "en"
86- multilingual = false
8786src = "src"
8887title = "OpenProt Documentation"
8988
@@ -98,244 +97,34 @@ command = "mdbook-mermaid"
9897 let src_dir = docs_dir. join ( "src" ) ;
9998 sh. create_dir ( & src_dir) ?;
10099
101- let summary_md = src_dir. join ( "SUMMARY.md" ) ;
100+ let summary = src_dir. join ( "SUMMARY.md" ) ;
102101 sh. write_file (
103- & summary_md,
104- r#"# Summary
105-
106- [Introduction](./introduction.md)
107-
108- # User Guide
102+ & summary,
103+ r#"# OpenProt Documentation
109104
105+ - [Introduction](./introduction.md)
110106- [Getting Started](./getting-started.md)
111107- [Usage](./usage.md)
112-
113- # Developer Guide
114-
115- - [Architecture](./architecture.md)
116108- [Contributing](./contributing.md)
117109"# ,
118110 ) ?;
119111
120- // Create introduction.md
121- let intro_md = src_dir. join ( "introduction.md" ) ;
122- sh. write_file ( & intro_md, r#"# Introduction
123-
124- Welcome to the OpenProt documentation!
125-
126- This documentation provides comprehensive information about the OpenProt project, including user guides, developer documentation, and API references.
127-
128- ## What is OpenProt?
129-
130- OpenProt is a Rust-based project that provides...
131-
132- ## Quick Start
133-
134- To get started with OpenProt:
135-
136- ```bash
137- cargo xtask build
138- cargo xtask test
139- ```
140-
141- For more detailed instructions, see the [Getting Started](./getting-started.md) guide.
142- "# ) ?;
143-
144- // Create getting-started.md
145- let getting_started_md = src_dir. join ( "getting-started.md" ) ;
146- sh. write_file (
147- & getting_started_md,
148- r#"# Getting Started
149-
150- ## Prerequisites
151-
152- - Rust 1.70 or later
153- - Cargo
154-
155- ## Installation
156-
157- Clone the repository:
158-
159- ```bash
160- git clone <repository-url>
161- cd openprot
162- ```
163-
164- Build the project:
165-
166- ```bash
167- cargo xtask build
168- ```
169-
170- Run tests:
171-
172- ```bash
173- cargo xtask test
174- ```
175-
176- ## Next Steps
177-
178- - Read the [Usage](./usage.md) guide
179- - Check out the [Architecture](./architecture.md) documentation
180- - Learn about [Contributing](./contributing.md)
181- "# ,
182- ) ?;
183-
184- // Create usage.md
185- let usage_md = src_dir. join ( "usage.md" ) ;
186- sh. write_file (
187- & usage_md,
188- r#"# Usage
189-
190- ## Available Commands
191-
192- The project uses xtask for automation. Here are the available commands:
193-
194- ### Build Commands
195-
196- ```bash
197- cargo xtask build # Build the project
198- cargo xtask check # Run cargo check
199- cargo xtask clippy # Run clippy lints
200- ```
201-
202- ### Test Commands
203-
204- ```bash
205- cargo xtask test # Run all tests
206- ```
207-
208- ### Formatting Commands
209-
210- ```bash
211- cargo xtask fmt # Format code
212- cargo xtask fmt --check # Check formatting
213- ```
214-
215- ### Distribution Commands
216-
217- ```bash
218- cargo xtask dist # Create distribution
219- ```
220-
221- ### Documentation Commands
222-
223- ```bash
224- cargo xtask docs # Build documentation
225- ```
226-
227- ### Utility Commands
228-
229- ```bash
230- cargo xtask clean # Clean build artifacts
231- cargo xtask cargo-lock # Manage Cargo.lock
232- ```
233- "# ,
234- ) ?;
235-
236- // Create architecture.md
237- let arch_md = src_dir. join ( "architecture.md" ) ;
238- sh. write_file (
239- & arch_md,
240- r#"# Architecture
241-
242- ## Project Structure
243-
244- ```
245- openprot/
246- ├── openprot/ # Main application
247- │ ├── src/
248- │ │ ├── lib.rs # Library code
249- │ │ └── main.rs # Binary entry point
250- │ └── Cargo.toml
251- ├── xtask/ # Build automation
252- │ ├── src/
253- │ │ ├── main.rs # Task runner
254- │ │ ├── cargo_lock.rs # Cargo.lock management
255- │ │ └── docs.rs # Documentation generation
256- │ └── Cargo.toml
257- ├── docs/ # Documentation source
258- ├── .cargo/ # Cargo configuration
259- └── Cargo.toml # Workspace configuration
260- ```
261-
262- ## Components
263-
264- ### Main Application (`openprot/`)
265-
266- The main application provides...
267-
268- ### Build System (`xtask/`)
269-
270- The xtask system provides automated build tasks including:
271-
272- - Building and testing
273- - Code formatting and linting
274- - Distribution creation
275- - Documentation generation
276- - Dependency management
277-
278- ### Documentation (`docs/`)
279-
280- Documentation is built using mdbook and includes:
281-
282- - User guides
283- - Developer documentation
284- - API references
285- - Architecture documentation
286- "# ,
287- ) ?;
288-
289- // Create contributing.md
290- let contrib_md = src_dir. join ( "contributing.md" ) ;
112+ // Create a basic introduction file
113+ let intro = src_dir. join ( "introduction.md" ) ;
291114 sh. write_file (
292- & contrib_md,
293- r#"# Contributing
294-
295- ## Development Setup
296-
297- 1. Clone the repository
298- 2. Install dependencies: `cargo xtask check`
299- 3. Run tests: `cargo xtask test`
300- 4. Format code: `cargo xtask fmt`
115+ & intro,
116+ r#"# Introduction
301117
302- ## Code Style
303-
304- - Use `cargo xtask fmt` to format code
305- - Run `cargo xtask clippy` to check for lints
306- - Ensure all tests pass with `cargo xtask test`
307-
308- ## Documentation
309-
310- - Update documentation in the `docs/` directory
311- - Build docs with `cargo xtask docs`
312- - Documentation is built with mdbook
313-
314- ## Pull Requests
315-
316- 1. Fork the repository
317- 2. Create a feature branch
318- 3. Make your changes
319- 4. Run the full test suite
320- 5. Submit a pull request
321-
322- ## Issues
323-
324- Please report issues on the GitHub issue tracker.
118+ Welcome to OpenProt Documentation.
325119"# ,
326120 ) ?;
327121
328- println ! (
329- "Created default documentation structure in {}" ,
330- docs_dir. display( )
331- ) ;
332122 Ok ( ( ) )
333123}
334124
335125fn project_root ( ) -> PathBuf {
336- Path :: new ( & env ! ( "CARGO_MANIFEST_DIR" ) )
337- . ancestors ( )
338- . nth ( 1 )
339- . map ( |p| p. to_path_buf ( ) )
340- . unwrap_or_else ( || PathBuf :: from ( "." ) )
126+ let mut xtask_dir = env:: current_exe ( ) . expect ( "current_exe failed" ) ;
127+ xtask_dir. pop ( ) ; // pop /target/debug
128+ xtask_dir. pop ( ) ; // pop /target
129+ xtask_dir
341130}
0 commit comments