Skip to content

Commit

Permalink
Upload to snapcraft store (#5)
Browse files Browse the repository at this point in the history
* Add snapcraft.yaml and update .gitignore

Added a new snapcraft.yaml file to enable Snap packaging of the CC2P tool. The .gitignore file has been updated to ignore snap packaging artifact files (*.snap). This allows for efficient conversion of CSV files to parquet format with the added utility of Snap packaging.

* Change strip setting and make functions public

This commit changes debug info stripping configuration to true in Cargo.toml, for optimized binary size. Simultaneously, it also changes the functions `delete_if_exist` and `remove_deduplicate_columns` to be publicly accessible, for external use. Lastly, the argument name for `clean_column_name` function has been changed from 's' to 'column_name' for clarity.

* Update package version and add snap support

The package version was updated to '0.2.5' in both Cargo.toml and snapcraft.yaml files. In addition, the snap package's confinement mode has been changed from 'devmode' to 'strict' and the grade from 'devel' to 'stable', indicating that the package has moved to a stable release.

* Update .gitignore and snapcraft.yaml files

Updated the .gitignore to ignore certain txt files and added the project website and architecture details in the snapcraft.yaml file. This will help avoid unnecessary tracked files in git and provides more information about the project and its build in the snapcraft file.

* Update .gitignore and snapcraft.yaml files

Updated the .gitignore to ignore certain txt files and added the project website and architecture details in the snapcraft.yaml file. This will help avoid unnecessary tracked files in git and provides more information about the project and its build in the snapcraft file.
  • Loading branch information
rayyildiz committed Apr 30, 2024
1 parent 2dd7ea3 commit dc9c3d6
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -8,3 +8,5 @@ tmp/
target/
.DS_Store
testdata/*.parquet
*.snap
cc2p_amd64-*.txt
30 changes: 15 additions & 15 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cc2p"
version = "0.2.4"
version = "0.2.5"
edition = "2021"
description = "Convert a CSV to parquet file format"
authors = ["rayyildiz"]
Expand All @@ -27,5 +27,5 @@ codegen-units = 1
lto = true
panic = "abort"
debug = false
strip = "debuginfo"
strip = true
opt-level = 3
25 changes: 25 additions & 0 deletions snapcraft.yaml
@@ -0,0 +1,25 @@
name: cc2p
base: core22
website: https://rayyildiz.com/projects/cc2p/
version: '0.2.5'
summary: CC2P is a tool for efficient conversion of CSV files to parquet format.
description: |
(CC2P) is a Rust-based project that converts CSV files in a selected
folder into parquet format. This tool provides a simple and efficient
way of handling and converting your CSV data files.
architectures:
- build-on: amd64

grade: stable
confinement: strict

parts:
apps:
plugin: rust
source: .


apps:
apps:
command: bin/cc2p
10 changes: 5 additions & 5 deletions src/lib.rs
Expand Up @@ -97,7 +97,7 @@ pub fn convert_to_parquet(
///
/// Returns `Err` if there is an error accessing the file or deleting it.
///
fn delete_if_exist(filename: &str) -> Result<(), Box<dyn std::error::Error>> {
pub fn delete_if_exist(filename: &str) -> Result<(), Box<dyn std::error::Error>> {
if fs::metadata(filename).is_ok() {
fs::remove_file(filename)?;
}
Expand All @@ -116,7 +116,7 @@ struct Empty {}
/// # Returns
///
/// Returns an `Arc` containing the deduplicated schema.
fn remove_deduplicate_columns(sc: arrow_schema::Schema) -> Arc<arrow_schema::Schema> {
pub fn remove_deduplicate_columns(sc: arrow_schema::Schema) -> Arc<arrow_schema::Schema> {
let mut index = 1;
let mut deduplicated_fields = Vec::new();
let mut names = HashMap::new();
Expand Down Expand Up @@ -207,7 +207,7 @@ pub fn find_files(pattern: &str) -> Vec<PathBuf> {
///
/// # Arguments
///
/// * `s` - The string to be cleaned.
/// * `column_name` - The string to be cleaned.
///
/// # Examples
///
Expand All @@ -224,8 +224,8 @@ pub fn find_files(pattern: &str) -> Vec<PathBuf> {
/// # Returns
///
/// A `String` containing the cleaned string, with all non-alphanumeric characters removed.
pub fn clean_column_name(s: &str) -> String {
let cleaned = regex::Regex::new(r"[^a-zA-Z0-9_\-\s]").unwrap().replace_all(s, "");
pub fn clean_column_name(column_name: &str) -> String {
let cleaned = regex::Regex::new(r"[^a-zA-Z0-9_\-\s]").unwrap().replace_all(column_name, "");

cleaned.to_string()
}
Expand Down

0 comments on commit dc9c3d6

Please sign in to comment.