Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semver binary #100

Closed
lunemec opened this issue Jan 30, 2017 · 10 comments
Closed

semver binary #100

lunemec opened this issue Jan 30, 2017 · 10 comments

Comments

@lunemec
Copy link

lunemec commented Jan 30, 2017

Hello,

I ran into a problem with my CI scripts needing to be bumped by 1 minor version + added a -ci at the end. I couldn't find any "easy" way to do it in bash (except for some crazy AWK scripts which didn't work).

I wanted to write this binary in rust, but since most of the work is done here, I just wanted to ask if you'd be opposed to me writing a binary version to semver (which could be included, or as separate project).

The idea is following:

# A bump example. (+patch)
OLD_VERSION = "1.2.3"
echo $OLD_VERSION | semver [patch]
"1.2.4"
# Minor update.
OLD_VERSION = "1.2.3"
echo $OLD_VERSION | semver minor
"1.3.0"
# Major update.
OLD_VERSION = "1.2.3"
echo $OLD_VERSION | semver major
"2.0.0"
# CI example.
OLD_VERSION = "1.2.3"
echo $OLD_VERSION | semver --meta=ci  # this may contain git-commit tag
"1.2.3+ci"

The main usage is for gitlab CI/CD scripts, which need to parse previous program version, and deploy +CI version in metadata. Since I have multiple programming environments, each uses diferent tools to manage versions and some (docker) don't have any.

I wanted to start rust-semver project on my github profile, but I didn't want to rip-off this project (since it will do most of the work).

Thank you!

@lunemec
Copy link
Author

lunemec commented Jan 30, 2017

Issue #100! YAY! 😄

@steveklabnik
Copy link
Contributor

I would not mind including it here! This would be useful.

@lunemec
Copy link
Author

lunemec commented Jan 30, 2017

Cool!

@lunemec
Copy link
Author

lunemec commented Jan 30, 2017

Hmm, I didn't think of Cargo.toml dependencies, it turns out, cargo does not yet support binary-only dependencies (rust-lang/cargo#1982), which is unfortunate, because you'd get them in library-only use but not use them....

Anyways, I'll first write it, then we can decide what :)

@lunemec
Copy link
Author

lunemec commented Jan 30, 2017

Here is a first prototype:
https://github.com/lunemec/semver/tree/binary

@lunemec
Copy link
Author

lunemec commented Jan 31, 2017

Pull request: #101.

@lunemec lunemec closed this as completed Jan 31, 2017
@lunemec
Copy link
Author

lunemec commented Feb 7, 2017

I updated the semver-parser (made common public: steveklabnik/semver-parser#13) but I think you should take a look first. Here is "working" version of semver: https://github.com/lunemec/semver/tree/binary

I didn't create PR because semver-parser with version 0.7.1 doesn't exist. I tested it against my github fork with changes, and everything works fine.

Now the dependencies only contain clap without default features, that means these libraries (from clap alone):

[dependencies]
bitflags = "0.7.0"
vec_map = "0.6.0"
unicode-width = "0.1.4"
unicode-segmentation = "1.0.1"

I'm not sure if that is OK with you or not. If not, I suggest creating another project semver-bin where these dependencies can be.

Thanks!

@lunemec lunemec reopened this Feb 7, 2017
@lunemec
Copy link
Author

lunemec commented Feb 13, 2017

/cc @steveklabnik

@steveklabnik
Copy link
Contributor

Yeah, still thinking, sorry!

@dtolnay
Copy link
Owner

dtolnay commented May 25, 2021

I would prefer not to build this into this crate. It seems appropriate for a separate standalone project though!

@dtolnay dtolnay closed this as completed May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants