Giter VIP home page Giter VIP logo

semver's People

Contributors

i-vovk avatar kp-cat avatar liliolett avatar naratzul avatar neargye avatar platzer avatar striezel avatar timblechmann avatar tylerjang27 avatar xvitaly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

semver's Issues

from_string() `invalid argument` exception

Hi,
I am trying to use from_string(). I am also using Qt.

Below code works fine:
semver::version version_in_db = semver::from_string(QString("1.0.0").toStdString());

But the below code fails with an exeption of 'invalid argument':
semver::version version_in_db = semver::from_string(QString("1.0.0-beta").toStdString());

Adding the '-beta' seems to be causing it to fail.

Build Metadata

Hi @Neargye,

thanks for implementing semver! We've been using it in our project since version 0.1.8, but had to add the build metadata ourselves. It would be nice if you could add this also to the official repo.

https://semver.org/#spec-item-10

We use it to store and compare the build hash.

Example:
1.4.0-alpha.1+6703c608

Adding semver to vcpkg

Hi! I created a pull request to the vcpkg repository adding support for your library that you can see here: microsoft/vcpkg#12406. Alas, maintainers requested that the name in vcpkg be changed to something more specific than semver which they deemed to generic given the unestabilished status of the library.

Do you have any other preferences or should we go with the proposed Neargye-semver?

using via vcpkg

Closing the issue, found what I was doing wrong.

FFR - and maybe should be added to README.md in the vcpkg section

in CMakeLists.txt use the following:

find_package(semver CONFIG REQUIRED)

[Feature Request] Support for Semver Ranges

Hey, could you add support for ranges to the library? These are not in the official standard, but are still widely used.

Example: ^1.2.3 means >= 1.2.3 && < 2.0.0

So maybe add a class semver::range with:

  • a constructor that takes a range string
  • an inRange() method that takes a single semver object and checks if the passed semver fits into the range

Here's the node documentation for semver ranges. This github project also has test cases.

feature request: from_string accepts incomplete version strings

The test

TEST_CASE("semver::from_string", "[demo]")
{
    using namespace semver;
    // auto version = semver::from_string("1.0.0"); // SUCCEEDS
    auto version = semver::from_string("1.0"); // FAILS
    REQUIRE(version == "1.0.0"_version);
}

fails with an exception

semver::version::from_string invalid version.

It is quite common to omit the patch version. So the from_string/from_chars function pair should be robust against the omission and add .0.

Check for beta-updates

Hi,
is there an option to check for new beta versions as well?
When comparing 0.10.0-beta.2 > 0.10.0-beta.1, the result will be FALSE.
I'd also like to check if the beta version increased.

Best regards
Axel

Exception in parsing "1.37.0-1"

Nice header-only project, but unfortunately not usable for me, because the following code throws an exeption (semver::version::from_string invalid version).

semver::version vNew = semver::from_string("1.37.0-1");

According to semver.org, this is a valid version with "pre-release" tag.

Improve to/from string

  • constexpr from_chars
  • constexpr to_chars
  • inline to_string
  • constexpr from_string
  • template operator<<
    template operator>>

constexpr function never produces a constant expression

Hello,

Thanks for your nice library.
Trying to compile it with clang 6.0.1 results on compiler error : constexpr function never produces a constant expression

/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:513:26: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
    auto is_logical_or = [&parser]() constexpr noexcept -> bool { return parser.current_token.type == range_token_type::logical_or; };
                         ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:513:74: note: read of non-constexpr variable 'parser' is not allowed in a constant expression
    auto is_logical_or = [&parser]() constexpr noexcept -> bool { return parser.current_token.type == range_token_type::logical_or; };
                                                                         ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:511:18: note: declared here
    range_parser parser{str_};
                 ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:515:24: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
    auto is_operator = [&parser]() constexpr noexcept -> bool { return parser.current_token.type == range_token_type::range_operator; };
                       ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:515:72: note: read of non-constexpr variable 'parser' is not allowed in a constant expression
    auto is_operator = [&parser]() constexpr noexcept -> bool { return parser.current_token.type == range_token_type::range_operator; };
                                                                       ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:511:18: note: declared here
    range_parser parser{str_};
                 ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:517:22: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
    auto is_number = [&parser]() constexpr noexcept -> bool { return parser.current_token.type == range_token_type::number; };
                     ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:517:70: note: read of non-constexpr variable 'parser' is not allowed in a constant expression
    auto is_number = [&parser]() constexpr noexcept -> bool { return parser.current_token.type == range_token_type::number; };
                                                                     ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:511:18: note: declared here
    range_parser parser{str_};
                 ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:581:9: warning: default label in switch which covers all enumeration values [-Wcovered-switch-default]
        default:
        ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:609:53: warning: constructor parameter 'text' shadows the field 'text' of 'range_lexer' [-Wshadow-field-in-constructor]
    constexpr explicit range_lexer(std::string_view text) noexcept : text{text}, pos{0} {}
                                                    ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:606:22: note: previous declaration is here
    std::string_view text;
                     ^
/home/runner/work/YAODAQ/YAODAQ/build/_deps/semver-src/include/semver.hpp:794:3: warning: default label in switch which covers all enumeration values [-Wcovered-switch-default]
  default:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.