Skip to content

Commit d6a3101

Browse files
authored
require --name for update cmd (#11)
* try new build flags for faster compile * clean * clean * require --name for update * clean * clean * up ver
1 parent d85e662 commit d6a3101

7 files changed

Lines changed: 39 additions & 9 deletions

File tree

.github/workflows/release.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Create release
2121
env:
2222
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23-
run: gh release create ${{ github.ref_name }} --generate-notes --title "Version ${{ github.ref_name }}"
23+
run: gh release create ${{ github.ref_name }} --generate-notes --title "${{ github.ref_name }}"
2424

2525
upload-release:
2626
name: Build and Release
@@ -34,22 +34,27 @@ jobs:
3434
- uses: actions/checkout@v4
3535

3636
- name: Install Rust Toolchain
37-
uses: dtolnay/rust-toolchain@stable
37+
uses: dtolnay/rust-toolchain@nightly
3838

39-
- name: Print Runner OS
40-
run: echo "Runner OS is ${{ runner.os }}"
39+
- name: Set up
40+
run: |
41+
echo "Runner OS is ${{ runner.os }}"
42+
# cargo install sccache
4143

4244
- name: Cache target dir
4345
uses: actions/cache@v3
4446
with:
4547
path: |
4648
target
49+
# ~/.cache/sccache
4750
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
4851
restore-keys: |
4952
${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
5053
${{ runner.os }}-cargo-
5154
5255
- name: Build Release
56+
# env:
57+
# RUSTC_WRAPPER: sccache # Setting sccache as Rust compiler wrapper
5358
run: cargo build --release
5459

5560
- name: Archive Release Binary (Windows)

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
[package]
22
name = "cpa"
3-
version = "0.0.9"
3+
version = "0.0.10"
44
edition = "2021"
55

66
[dependencies]
77
askama = "0.12.1"
88
clap = { version = "4.4.6", features = ["derive"] }
99
regex = "1.10.2"
10+
11+
[profile.dev]
12+
opt-level = 1
13+
14+
[profile.release]
15+
opt-level = 1
16+
17+
[build]
18+
rustflags = ["-Z", "threads=4"]
19+
# rustc-wrapper = "sccache" # Use sccache for caching compilation

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ Example:
5151
cpa create --name myproject --preset python3.10
5252
```
5353

54+
Update current working directory with CPA preset.
55+
56+
```bash
57+
cpa update --name myproject --preset python3.10
58+
```
59+
5460
# Goals
5561

5662
- **Speed up Project Creation**: Reduce the time spent on repetitive setup tasks

example/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This file was configured by CPA. For additional details: https://github.com/ysawa0/create-python-app
12
[tool.poetry]
23
name = "example"
34
version = "0.0.1"

src/main.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ struct CreateArgs {
3333

3434
#[derive(Parser)]
3535
struct UpdateArgs {
36+
#[clap(long, required = true)]
37+
name: String,
3638
#[clap(long, required = false, default_value = "python3.10")]
3739
preset: String,
3840
}
@@ -58,9 +60,14 @@ fn main() {
5860
}
5961
}
6062
Cli::Update(args) => {
61-
println!("Updating project with preset: {:?}", args.preset);
62-
check_pyver(&args.preset);
63-
setup_preset(&args.preset, "".to_string(), false);
63+
println!("Updating project with name: {}", args.name);
64+
println!("Using preset: {:?} ", args.preset);
65+
if args.preset.starts_with("python") {
66+
check_pyver(&args.preset);
67+
setup_preset(&args.preset, args.name, false);
68+
} else {
69+
eprintln!("Preset: {:?} not supported", args.preset);
70+
}
6471
}
6572
}
6673
}

templates/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This file was configured by CPA. For additional details: https://github.com/ysawa0/create-python-app
12
[tool.poetry]
23
name = "{{ name }}"
34
version = "0.0.1"

0 commit comments

Comments
 (0)