semgit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c8adab7c9756cf927a7969db84a4b277d3fa6c9a
4
+ data.tar.gz: dd6307d409aabca7f7f13922e963a39a873377c7
5
+ SHA512:
6
+ metadata.gz: 0450abd1fe005ee6edba8c7dd492b636bc2a425ff7d9a32ae8d3d646e3520102312cc0550ac0d31b41f4ceef06f4136c50caa6ae3c36c358046d08f82e29c42c
7
+ data.tar.gz: 674853de27bf78d367ddf825e0e0117026858629166b0c9a46b658e9b3e9dba9a30b596a022863947895dc68ae70c6161ffe383370898a41260696e1aa250c90
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in semgit.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Waldemar
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Semgit
2
+
3
+ Automated semantic tagging for git.
4
+
5
+ Automatically creates new tags if a mendatory description is given.
6
+ Leave description empty to cancle.
7
+
8
+ ## Installation
9
+
10
+ `gem install semgit`
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ Usage:
16
+ semgit current
17
+ semgit inc (major | minor | patch)
18
+ ```
19
+
20
+
21
+ ## Contributing
22
+
23
+ 1. Fork it
24
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
25
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
26
+ 4. Push to the branch (`git push origin my-new-feature`)
27
+ 5. Create new Pull Request
28
+
29
+ ## License
30
+
31
+ MIT License
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/semgit ADDED
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
4
+ require 'semgit'
5
+ require 'sem_version'
6
+ require 'docopt'
7
+ doc = <<DOCOPT
8
+ Automated semantic tagging for git.
9
+
10
+ Usage:
11
+ #{__FILE__} current
12
+ #{__FILE__} inc (major | minor | patch)
13
+ DOCOPT
14
+
15
+
16
+ def versions
17
+ tags = `git tag`.split("\n")
18
+
19
+ tags.each_with_object([]) do |raw_tag, a|
20
+ m = /.*(\d+.\d*.\d+.*)/.match(raw_tag)
21
+ tag = m[1]
22
+ a << SemVersion.new(tag) if SemVersion.valid?(tag)
23
+ end
24
+ end
25
+
26
+ def print_current_version
27
+ puts versions.max
28
+ end
29
+
30
+ def increment_major(version)
31
+ version.major += 1
32
+ version.minor = 0
33
+ version.patch = 0
34
+ version.prerelease = nil
35
+ version.metadata = nil
36
+ version
37
+ end
38
+
39
+ def increment_minor(version)
40
+ version.minor += 1
41
+ version.patch = 0
42
+ version.prerelease = nil
43
+ version.metadata = nil
44
+ version
45
+ end
46
+
47
+ def increment_patch(version)
48
+ version.patch += 1
49
+ version.prerelease = nil
50
+ version.metadata = nil
51
+ version
52
+ end
53
+
54
+ def create_new_tag(version)
55
+ `git tag -a #{version}`
56
+ end
57
+
58
+ def main(args)
59
+ if args["current"]
60
+ print_current_version
61
+ elsif args["inc"]
62
+ current_version = versions.max
63
+ current_version = SemVersion.new("0.0.0") if current_version.nil?
64
+
65
+ new_version = increment_major(current_version) if args["major"]
66
+ new_version = increment_minor(current_version) if args["minor"]
67
+ new_version = increment_patch(current_version) if args["patch"]
68
+
69
+ create_new_tag(new_version)
70
+ end
71
+ end
72
+
73
+ # Here we go!
74
+ begin
75
+ main(Docopt::docopt(doc))
76
+ rescue Docopt::Exit => e
77
+ puts e.message
78
+ end
@@ -0,0 +1,3 @@
1
+ module Semgit
2
+ VERSION = "1.0.0"
3
+ end
data/lib/semgit.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "semgit/version"
2
+
3
+ module Semgit
4
+ # Your code goes here...
5
+ end
data/semgit.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'semgit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "semgit"
8
+ spec.version = Semgit::VERSION
9
+ spec.authors = ["Velrok"]
10
+ spec.email = ["waldemar.schwan@gmail.com"]
11
+ spec.description = %q{A binary that creates new sem ver based git tags, given a current version and a incrementer.}
12
+ spec.summary = %q{Create sem ver based git tags.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "sem_version", "~> 2.0.0"
25
+ spec.add_development_dependency "docopt"
26
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: semgit
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Velrok
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sem_version
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: docopt
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: A binary that creates new sem ver based git tags, given a current version
84
+ and a incrementer.
85
+ email:
86
+ - waldemar.schwan@gmail.com
87
+ executables:
88
+ - semgit
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - .gitignore
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/semgit
98
+ - lib/semgit.rb
99
+ - lib/semgit/version.rb
100
+ - semgit.gemspec
101
+ homepage: ''
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.0.6
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Create sem ver based git tags.
125
+ test_files: []