Skip to content

Commit

Permalink
require --name for update cmd (#11)
Browse files Browse the repository at this point in the history
* try new build flags for faster compile

* clean

* clean

* require --name for update

* clean

* clean

* up ver
  • Loading branch information
ysawa0 authored Nov 17, 2023
1 parent d85e662 commit d6a3101
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 9 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ github.ref_name }} --generate-notes --title "Version ${{ github.ref_name }}"
run: gh release create ${{ github.ref_name }} --generate-notes --title "${{ github.ref_name }}"

upload-release:
name: Build and Release
Expand All @@ -34,22 +34,27 @@ jobs:
- uses: actions/checkout@v4

- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly

- name: Print Runner OS
run: echo "Runner OS is ${{ runner.os }}"
- name: Set up
run: |
echo "Runner OS is ${{ runner.os }}"
# cargo install sccache

- name: Cache target dir
uses: actions/cache@v3
with:
path: |
target
# ~/.cache/sccache
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
${{ runner.os }}-cargo-
- name: Build Release
# env:
# RUSTC_WRAPPER: sccache # Setting sccache as Rust compiler wrapper
run: cargo build --release

- name: Archive Release Binary (Windows)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
[package]
name = "cpa"
version = "0.0.9"
version = "0.0.10"
edition = "2021"

[dependencies]
askama = "0.12.1"
clap = { version = "4.4.6", features = ["derive"] }
regex = "1.10.2"

[profile.dev]
opt-level = 1

[profile.release]
opt-level = 1

[build]
rustflags = ["-Z", "threads=4"]
# rustc-wrapper = "sccache" # Use sccache for caching compilation
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ Example:
cpa create --name myproject --preset python3.10
```

Update current working directory with CPA preset.

```bash
cpa update --name myproject --preset python3.10
```

# Goals

- **Speed up Project Creation**: Reduce the time spent on repetitive setup tasks
Expand Down
1 change: 1 addition & 0 deletions example/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This file was configured by CPA. For additional details: https://github.com/ysawa0/create-python-app
[tool.poetry]
name = "example"
version = "0.0.1"
Expand Down
13 changes: 10 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ struct CreateArgs {

#[derive(Parser)]
struct UpdateArgs {
#[clap(long, required = true)]
name: String,
#[clap(long, required = false, default_value = "python3.10")]
preset: String,
}
Expand All @@ -58,9 +60,14 @@ fn main() {
}
}
Cli::Update(args) => {
println!("Updating project with preset: {:?}", args.preset);
check_pyver(&args.preset);
setup_preset(&args.preset, "".to_string(), false);
println!("Updating project with name: {}", args.name);
println!("Using preset: {:?} ", args.preset);
if args.preset.starts_with("python") {
check_pyver(&args.preset);
setup_preset(&args.preset, args.name, false);
} else {
eprintln!("Preset: {:?} not supported", args.preset);
}
}
}
}
1 change: 1 addition & 0 deletions templates/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This file was configured by CPA. For additional details: https://github.com/ysawa0/create-python-app
[tool.poetry]
name = "{{ name }}"
version = "0.0.1"
Expand Down

0 comments on commit d6a3101

Please sign in to comment.