{"url":"https://api.github.com/gists/a6621376393821d6d206ccfc8dbf86ec","forks_url":"https://api.github.com/gists/a6621376393821d6d206ccfc8dbf86ec/forks","commits_url":"https://api.github.com/gists/a6621376393821d6d206ccfc8dbf86ec/commits","id":"a6621376393821d6d206ccfc8dbf86ec","node_id":"MDQ6R2lzdGE2NjIxMzc2MzkzODIxZDZkMjA2Y2NmYzhkYmY4NmVj","git_pull_url":"https://gist.github.com/a6621376393821d6d206ccfc8dbf86ec.git","git_push_url":"https://gist.github.com/a6621376393821d6d206ccfc8dbf86ec.git","html_url":"https://gist.github.com/michaellihs/a6621376393821d6d206ccfc8dbf86ec","files":{"SemVer.groovy":{"filename":"SemVer.groovy","type":"text/plain","language":"Groovy","raw_url":"https://gist.githubusercontent.com/michaellihs/a6621376393821d6d206ccfc8dbf86ec/raw/c916e687d46cd41485c4311c12f2e2f7988ae6af/SemVer.groovy","size":1447,"truncated":false,"content":"enum PatchLevel {\n    MAJOR, MINOR, PATCH\n}\n\nclass SemVer implements Serializable {\n\n    private int major, minor, patch\n\n    SemVer(String version) {\n        def versionParts = version.tokenize('.')\n        println versionParts\n        if (versionParts.size != 3) {\n            throw new IllegalArgumentException(\"Wrong version format - expected MAJOR.MINOR.PATCH - got ${version}\")\n        }\n        this.major = versionParts[0].toInteger()\n        this.minor = versionParts[1].toInteger()\n        this.patch = versionParts[2].toInteger()\n    }\n\n    SemVer(int major, int minor, int patch) {\n        this.major = major\n        this.minor = minor\n        this.patch = patch\n    }\n\n    SemVer bump(PatchLevel patchLevel) {\n        switch (patchLevel) {\n            case PatchLevel.MAJOR:\n                return new SemVer(major + 1, 0, 0)\n                break\n            case PatchLevel.MINOR:\n                return new SemVer(major, minor + 1, 0)\n                break\n            case PatchLevel.PATCH:\n                return new SemVer(major, minor, patch + 1)\n                break\n        }\n        return new SemVer()\n    }\n\n    String toString() {\n        return \"${major}.${minor}.${patch}\"\n    }\n\n}\n\ndef version = new SemVer(\"0.0.1\")\nprintln(version.bump(PatchLevel.MAJOR).toString())\nprintln(version.bump(PatchLevel.MINOR).toString())\nprintln(version.bump(PatchLevel.PATCH).toString())\n\n/*\n  will output\n  \n  1.0.0\n  0.1.0\n  0.0.2\n\n*/","encoding":"utf-8"}},"public":true,"created_at":"2017-04-12T21:42:01Z","updated_at":"2024-06-04T21:02:25Z","description":"Semantic Versioning class for Groovy","comments":1,"user":null,"comments_enabled":true,"comments_url":"https://api.github.com/gists/a6621376393821d6d206ccfc8dbf86ec/comments","owner":{"login":"michaellihs","id":575011,"node_id":"MDQ6VXNlcjU3NTAxMQ==","avatar_url":"https://avatars.githubusercontent.com/u/575011?v=4","gravatar_id":"","url":"https://api.github.com/users/michaellihs","html_url":"https://github.com/michaellihs","followers_url":"https://api.github.com/users/michaellihs/followers","following_url":"https://api.github.com/users/michaellihs/following{/other_user}","gists_url":"https://api.github.com/users/michaellihs/gists{/gist_id}","starred_url":"https://api.github.com/users/michaellihs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaellihs/subscriptions","organizations_url":"https://api.github.com/users/michaellihs/orgs","repos_url":"https://api.github.com/users/michaellihs/repos","events_url":"https://api.github.com/users/michaellihs/events{/privacy}","received_events_url":"https://api.github.com/users/michaellihs/received_events","type":"User","user_view_type":"public","site_admin":false},"forks":[{"url":"https://api.github.com/gists/339a69ddeea573bca61b9aecab5508b9","user":{"login":"pramehro1","id":42447350,"node_id":"MDQ6VXNlcjQyNDQ3MzUw","avatar_url":"https://avatars.githubusercontent.com/u/42447350?v=4","gravatar_id":"","url":"https://api.github.com/users/pramehro1","html_url":"https://github.com/pramehro1","followers_url":"https://api.github.com/users/pramehro1/followers","following_url":"https://api.github.com/users/pramehro1/following{/other_user}","gists_url":"https://api.github.com/users/pramehro1/gists{/gist_id}","starred_url":"https://api.github.com/users/pramehro1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pramehro1/subscriptions","organizations_url":"https://api.github.com/users/pramehro1/orgs","repos_url":"https://api.github.com/users/pramehro1/repos","events_url":"https://api.github.com/users/pramehro1/events{/privacy}","received_events_url":"https://api.github.com/users/pramehro1/received_events","type":"User","user_view_type":"public","site_admin":false,"name":null,"company":null,"blog":"","location":null,"email":null,"hireable":null,"bio":null,"twitter_username":null,"public_repos":8,"public_gists":1,"followers":0,"following":0,"created_at":"2018-08-16T17:05:41Z","updated_at":"2020-07-07T11:47:48Z"},"id":"339a69ddeea573bca61b9aecab5508b9","created_at":"2018-08-30T11:14:31Z","updated_at":"2018-08-30T11:14:31Z"},{"url":"https://api.github.com/gists/2bf480e2f8feccfd0aae67965a1bb11b","user":{"login":"michaa76","id":3788410,"node_id":"MDQ6VXNlcjM3ODg0MTA=","avatar_url":"https://avatars.githubusercontent.com/u/3788410?v=4","gravatar_id":"","url":"https://api.github.com/users/michaa76","html_url":"https://github.com/michaa76","followers_url":"https://api.github.com/users/michaa76/followers","following_url":"https://api.github.com/users/michaa76/following{/other_user}","gists_url":"https://api.github.com/users/michaa76/gists{/gist_id}","starred_url":"https://api.github.com/users/michaa76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaa76/subscriptions","organizations_url":"https://api.github.com/users/michaa76/orgs","repos_url":"https://api.github.com/users/michaa76/repos","events_url":"https://api.github.com/users/michaa76/events{/privacy}","received_events_url":"https://api.github.com/users/michaa76/received_events","type":"User","user_view_type":"public","site_admin":false,"name":null,"company":null,"blog":"","location":null,"email":null,"hireable":null,"bio":null,"twitter_username":null,"public_repos":21,"public_gists":22,"followers":0,"following":0,"created_at":"2013-03-06T15:05:02Z","updated_at":"2022-07-22T09:55:31Z"},"id":"2bf480e2f8feccfd0aae67965a1bb11b","created_at":"2018-09-28T11:00:53Z","updated_at":"2018-09-28T11:00:53Z"},{"url":"https://api.github.com/gists/6361097179d4436ec17766b5c3c2bffd","user":{"login":"zionyx","id":1426398,"node_id":"MDQ6VXNlcjE0MjYzOTg=","avatar_url":"https://avatars.githubusercontent.com/u/1426398?v=4","gravatar_id":"","url":"https://api.github.com/users/zionyx","html_url":"https://github.com/zionyx","followers_url":"https://api.github.com/users/zionyx/followers","following_url":"https://api.github.com/users/zionyx/following{/other_user}","gists_url":"https://api.github.com/users/zionyx/gists{/gist_id}","starred_url":"https://api.github.com/users/zionyx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zionyx/subscriptions","organizations_url":"https://api.github.com/users/zionyx/orgs","repos_url":"https://api.github.com/users/zionyx/repos","events_url":"https://api.github.com/users/zionyx/events{/privacy}","received_events_url":"https://api.github.com/users/zionyx/received_events","type":"User","user_view_type":"public","site_admin":false,"name":"Lee","company":null,"blog":"","location":"Denmark","email":null,"hireable":null,"bio":null,"twitter_username":null,"public_repos":20,"public_gists":23,"followers":10,"following":31,"created_at":"2012-02-10T13:50:51Z","updated_at":"2022-10-27T08:17:10Z"},"id":"6361097179d4436ec17766b5c3c2bffd","created_at":"2020-03-12T15:14:01Z","updated_at":"2020-03-12T15:14:01Z"},{"url":"https://api.github.com/gists/9a5514181e9bbf58b96a9bea826a0748","user":{"login":"imranakhan","id":9386212,"node_id":"MDQ6VXNlcjkzODYyMTI=","avatar_url":"https://avatars.githubusercontent.com/u/9386212?v=4","gravatar_id":"","url":"https://api.github.com/users/imranakhan","html_url":"https://github.com/imranakhan","followers_url":"https://api.github.com/users/imranakhan/followers","following_url":"https://api.github.com/users/imranakhan/following{/other_user}","gists_url":"https://api.github.com/users/imranakhan/gists{/gist_id}","starred_url":"https://api.github.com/users/imranakhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imranakhan/subscriptions","organizations_url":"https://api.github.com/users/imranakhan/orgs","repos_url":"https://api.github.com/users/imranakhan/repos","events_url":"https://api.github.com/users/imranakhan/events{/privacy}","received_events_url":"https://api.github.com/users/imranakhan/received_events","type":"User","user_view_type":"public","site_admin":false,"name":"Imran Khan","company":null,"blog":"","location":"Chicago, IL","email":null,"hireable":null,"bio":"\"Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.\"\r\n- Linus Torvalds","twitter_username":null,"public_repos":37,"public_gists":1,"followers":10,"following":52,"created_at":"2014-10-24T20:09:21Z","updated_at":"2026-04-09T13:01:51Z"},"id":"9a5514181e9bbf58b96a9bea826a0748","created_at":"2020-07-24T16:55:19Z","updated_at":"2020-07-26T03:23:34Z"},{"url":"https://api.github.com/gists/97520f73d0b1cde020c772aca2b5ed54","user":{"login":"turboBasic","id":25524600,"node_id":"MDQ6VXNlcjI1NTI0NjAw","avatar_url":"https://avatars.githubusercontent.com/u/25524600?v=4","gravatar_id":"","url":"https://api.github.com/users/turboBasic","html_url":"https://github.com/turboBasic","followers_url":"https://api.github.com/users/turboBasic/followers","following_url":"https://api.github.com/users/turboBasic/following{/other_user}","gists_url":"https://api.github.com/users/turboBasic/gists{/gist_id}","starred_url":"https://api.github.com/users/turboBasic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turboBasic/subscriptions","organizations_url":"https://api.github.com/users/turboBasic/orgs","repos_url":"https://api.github.com/users/turboBasic/repos","events_url":"https://api.github.com/users/turboBasic/events{/privacy}","received_events_url":"https://api.github.com/users/turboBasic/received_events","type":"User","user_view_type":"public","site_admin":false,"name":" andriy melnyk","company":"@Cargonautica","blog":"https://github.com/turboBasic","location":"Germany","email":"andrii7melnyk@proton.me","hireable":true,"bio":"devops, cloud, infrastructure-as-code, application/service integration\r\n","twitter_username":null,"public_repos":84,"public_gists":180,"followers":15,"following":21,"created_at":"2017-02-03T08:05:57Z","updated_at":"2026-04-14T21:11:54Z"},"id":"97520f73d0b1cde020c772aca2b5ed54","created_at":"2020-11-28T13:07:46Z","updated_at":"2020-11-28T13:08:12Z"},{"url":"https://api.github.com/gists/15a0a9dd767a91f0d4f81e788fccc3da","user":{"login":"sigurbjorngudjonsson","id":13980107,"node_id":"MDQ6VXNlcjEzOTgwMTA3","avatar_url":"https://avatars.githubusercontent.com/u/13980107?v=4","gravatar_id":"","url":"https://api.github.com/users/sigurbjorngudjonsson","html_url":"https://github.com/sigurbjorngudjonsson","followers_url":"https://api.github.com/users/sigurbjorngudjonsson/followers","following_url":"https://api.github.com/users/sigurbjorngudjonsson/following{/other_user}","gists_url":"https://api.github.com/users/sigurbjorngudjonsson/gists{/gist_id}","starred_url":"https://api.github.com/users/sigurbjorngudjonsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigurbjorngudjonsson/subscriptions","organizations_url":"https://api.github.com/users/sigurbjorngudjonsson/orgs","repos_url":"https://api.github.com/users/sigurbjorngudjonsson/repos","events_url":"https://api.github.com/users/sigurbjorngudjonsson/events{/privacy}","received_events_url":"https://api.github.com/users/sigurbjorngudjonsson/received_events","type":"User","user_view_type":"public","site_admin":false,"name":"Sigurbjörn Guðjónsson","company":null,"blog":"","location":null,"email":null,"hireable":null,"bio":null,"twitter_username":null,"public_repos":3,"public_gists":1,"followers":0,"following":0,"created_at":"2015-08-26T10:57:07Z","updated_at":"2026-04-05T11:44:45Z"},"id":"15a0a9dd767a91f0d4f81e788fccc3da","created_at":"2021-03-11T21:58:44Z","updated_at":"2021-03-11T22:27:52Z"},{"url":"https://api.github.com/gists/fd8bad8f4d80d973c2146b4903d2b989","user":{"login":"akomakom","id":12100822,"node_id":"MDQ6VXNlcjEyMTAwODIy","avatar_url":"https://avatars.githubusercontent.com/u/12100822?v=4","gravatar_id":"","url":"https://api.github.com/users/akomakom","html_url":"https://github.com/akomakom","followers_url":"https://api.github.com/users/akomakom/followers","following_url":"https://api.github.com/users/akomakom/following{/other_user}","gists_url":"https://api.github.com/users/akomakom/gists{/gist_id}","starred_url":"https://api.github.com/users/akomakom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akomakom/subscriptions","organizations_url":"https://api.github.com/users/akomakom/orgs","repos_url":"https://api.github.com/users/akomakom/repos","events_url":"https://api.github.com/users/akomakom/events{/privacy}","received_events_url":"https://api.github.com/users/akomakom/received_events","type":"User","user_view_type":"public","site_admin":false,"name":null,"company":null,"blog":"","location":null,"email":null,"hireable":null,"bio":null,"twitter_username":null,"public_repos":96,"public_gists":14,"followers":5,"following":0,"created_at":"2015-04-24T14:36:45Z","updated_at":"2026-03-18T12:13:54Z"},"id":"fd8bad8f4d80d973c2146b4903d2b989","created_at":"2021-07-06T18:19:01Z","updated_at":"2024-02-01T19:58:41Z"},{"url":"https://api.github.com/gists/854fbf9926b30e7b5fa5421c3c3abe69","user":{"login":"freebreix","id":29557337,"node_id":"MDQ6VXNlcjI5NTU3MzM3","avatar_url":"https://avatars.githubusercontent.com/u/29557337?v=4","gravatar_id":"","url":"https://api.github.com/users/freebreix","html_url":"https://github.com/freebreix","followers_url":"https://api.github.com/users/freebreix/followers","following_url":"https://api.github.com/users/freebreix/following{/other_user}","gists_url":"https://api.github.com/users/freebreix/gists{/gist_id}","starred_url":"https://api.github.com/users/freebreix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freebreix/subscriptions","organizations_url":"https://api.github.com/users/freebreix/orgs","repos_url":"https://api.github.com/users/freebreix/repos","events_url":"https://api.github.com/users/freebreix/events{/privacy}","received_events_url":"https://api.github.com/users/freebreix/received_events","type":"User","user_view_type":"public","site_admin":false,"name":"Brendon Ignath","company":"Ryze Media GmbH","blog":"https://sparkdigital.at","location":"Austria","email":"brendon.ignath@gmail.com","hireable":null,"bio":"💻 Making production & refurbishment workflows smarter - synced in real time, delivered faster 🚚","twitter_username":null,"public_repos":15,"public_gists":3,"followers":10,"following":8,"created_at":"2017-06-19T22:55:33Z","updated_at":"2026-03-15T11:48:26Z"},"id":"854fbf9926b30e7b5fa5421c3c3abe69","created_at":"2021-07-29T17:13:29Z","updated_at":"2021-07-29T17:13:48Z"}],"history":[{"user":{"login":"michaellihs","id":575011,"node_id":"MDQ6VXNlcjU3NTAxMQ==","avatar_url":"https://avatars.githubusercontent.com/u/575011?v=4","gravatar_id":"","url":"https://api.github.com/users/michaellihs","html_url":"https://github.com/michaellihs","followers_url":"https://api.github.com/users/michaellihs/followers","following_url":"https://api.github.com/users/michaellihs/following{/other_user}","gists_url":"https://api.github.com/users/michaellihs/gists{/gist_id}","starred_url":"https://api.github.com/users/michaellihs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaellihs/subscriptions","organizations_url":"https://api.github.com/users/michaellihs/orgs","repos_url":"https://api.github.com/users/michaellihs/repos","events_url":"https://api.github.com/users/michaellihs/events{/privacy}","received_events_url":"https://api.github.com/users/michaellihs/received_events","type":"User","user_view_type":"public","site_admin":false},"version":"86da740eca2798ca1404086a07aa4a53d73d2652","committed_at":"2017-04-12T21:42:00Z","change_status":{"total":59,"additions":59,"deletions":0},"url":"https://api.github.com/gists/a6621376393821d6d206ccfc8dbf86ec/86da740eca2798ca1404086a07aa4a53d73d2652"}],"truncated":false}