GithubHelp home page GithubHelp logo

haf / semver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from flazz/semver

36.0 36.0 9.0 90 KB

gem: "semver2" fork. simple command line util & ruby module for managing versions according to http://semver.org

License: MIT License

Ruby 100.00%

semver's People

Contributors

berkes avatar flazz avatar glensc avatar haf avatar ikatz-drizly avatar jameschildress avatar reiz avatar timmfin avatar zenonas 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

Watchers

 avatar  avatar  avatar

semver's Issues

Publish current state as a new gem version.

I tried to package this gem using gem2rpm in the Open Build Service, but it requires RPM files to have a License field, and the current gem version on rubygems.org does not contain the license information.
The commits adding this information were made shortly after the release of the current version (3.4.2) and it would be great if a new version of this gem with these changes could be published.

Add support for format to be loaded from configuration

My convention to tag is without v prefix. could the format be loaded from .semver as well, so other project users follow same tagging format.

repeating semver format "%M.%m.%p%s" is tedious.

[alias]
    release = !semver increment patch && tag=$(semver format "%M.%m.%p%s") && git tag -a "$tag" -m \"Release $tag\" && git show "$tag"

ruby 3.2.0 failures

...
/opt/homebrew/lib/ruby/gems/3.2.0/gems/semver2-3.4.2/lib/xsemver.rb:29:in `block in find_file': undefined method `exists?' for File:Class (NoMethodError)

        while !File.exists? path do
                   ^^^^^^^^
Did you mean?  exist?
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/semver2-3.4.2/lib/xsemver.rb:28:in `chdir'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/semver2-3.4.2/lib/xsemver.rb:28:in `find_file'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/semver2-3.4.2/lib/xsemver.rb:18:in `find'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/semver2-3.4.2/lib/runner.rb:59:in `block in <class:Runner>'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/semver2-3.4.2/lib/dsl.rb:23:in `run_command'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/semver2-3.4.2/lib/runner.rb:15:in `initialize'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/semver2-3.4.2/bin/semver:6:in `new'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/semver2-3.4.2/bin/semver:6:in `<top (required)>'
	from /usr/local/opt/gems/bin/semver:25:in `load'
	from /usr/local/opt/gems/bin/semver:25:in `<main>'

โœ–  ruby --version
ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]

Support for incrementing versions

According to https://semver.org/#spec-item-7 and https://semver.org/#spec-item-8 :

Patch version MUST be reset to 0 when minor version is incremented.
Patch and minor versions MUST be reset to 0 when major version is incremented.

# irb
irb(main):001:0> require 'semver'
=> true
irb(main):002:0> s = SemVer.new(1,2,3)
=> #<SemVer:0x0000557120b63050 @major=1, @minor=2, @patch=3, @special="", @metadata="">
irb(main):003:0> s.major += 1
=> 2
irb(main):004:0> s
=> #<SemVer:0x0000557120b63050 @major=2, @minor=2, @patch=3, @special="", @metadata="">

I'm using this locally:

class SemVer
  def next_major
    n = clone
    n.major += 1
    %w(minor patch).each { |v| n.send("#{v}=", 0) }
    n
  end

  def next_minor
    n = clone
    n.minor += 1
    n.patch = 0
    n
  end

  def next_patch
    n = clone
    n.patch += 1
    n
  end
end

init from version string

It would be nice if init (some new command is fine too) can initialize from existing version.

For example, to ensure the tags created by other means do not conflict.

$ semver init $(git describe --tags --abbrev=0)
$ cat .semver
---
:major: 0
:minor: 0
:patch: 0
:special: ''
:metadata: ''

License

Would be nice to define a license in the gemspec ;-) Maybe MIT ;)

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.