git-version-bump 0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/git-version-bump DELETED
@@ -1,69 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- if ARGV[0].nil? or
4
- ARGV[0].empty? or
5
- (ARGV.length == 1 && (ARGV[0] == "-d" || ARGV[0] == "--dry-run")) or
6
- ARGV[0] == '-h' or
7
- ARGV[0] == '--help'
8
- $stderr.puts <<-EOF.gsub(/^\t\t/, '')
9
- Usage: git version-bump [-n|--notes] [-l|--lite-tags] [-d|--dry-run] <major|minor|patch|show>
10
-
11
- 'major': x.y.z -> x+1.0.0
12
- 'minor': x.y.z -> x.y+1.0
13
- 'patch': x.y.z -> x.y.z+1
14
-
15
- 'show': Display the current GVB version
16
-
17
- -d, --dry-run: Calculate and return the bump value, but don't update git workspace or remote
18
- -n, --notes: Prompt for "release notes" to add to the release tag
19
- -l, --lite-tags: Include non-annotated git tags
20
- EOF
21
- end
22
-
23
- release_notes = ARGV.delete('-n') || ARGV.delete('--notes')
24
- dry_run = ARGV.delete('-d') || ARGV.delete('--dry-run')
25
- lite_tags = ARGV.delete('-l') || ARGV.delete('--lite-tags')
26
-
27
- if ARGV[0].nil? or ARGV[0].empty?
28
- exit 1
29
- elsif ARGV[0] == '-h' or ARGV[0] == '--help'
30
- exit 0
31
- end
32
-
33
- begin
34
- require 'git-version-bump'
35
-
36
- result = case ARGV[0].downcase
37
- when /^maj?o?r?$/
38
- "#{GVB.major_version(true) + 1}.0.0"
39
- when /^min?o?r?$/
40
- "#{GVB.major_version(true)}.#{GVB.minor_version(true)+1}.0"
41
- when /^pa?t?c?h?$/
42
- "#{GVB.major_version(true)}.#{GVB.minor_version(true)}.#{GVB.patch_version(true)+1}"
43
- when /^sh?o?w?$/
44
- puts GVB.version(true)
45
- exit 0
46
- else
47
- $stderr.puts "Unknown argument: #{ARGV[0]}. Try --help."
48
- exit 1
49
- end
50
-
51
- if dry_run
52
- puts result
53
- else
54
- unless GVB.tag_version result, release_notes, lite_tags
55
- exit 1
56
- end
57
- puts "Version is now #{GVB.version(true)}."
58
- end
59
- rescue GVB::VersionUnobtainable => ex
60
- $stderr.puts "Could not obtain version information. #{ex.message} (git available: #{GVB.git_available?.inspect})"
61
- exit 1
62
- rescue GVB::CommandFailure => ex
63
- $stderr.puts "#{ex.message} (exit status: #{ex.exitstatus})"
64
- $stderr.puts "command output was:"
65
- $stderr.puts "----8<----"
66
- $stderr.puts ex.output
67
- $stderr.puts "---->8----"
68
- exit 1
69
- end
@@ -1,33 +0,0 @@
1
- module GitVersionBump
2
- def self.VERSION
3
- GVB.version
4
- end
5
-
6
- def self.MAJOR_VERSION
7
- GVB.major_version
8
- end
9
-
10
- def self.MINOR_VERSION
11
- GVB.minor_version
12
- end
13
-
14
- def self.PATCH_VERSION
15
- GVB.patch_version
16
- end
17
-
18
- def self.INTERNAL_REVISION
19
- GVB.internal_revision
20
- end
21
-
22
- def self.DATE
23
- GVB.date
24
- end
25
-
26
- def self.const_missing(c)
27
- if self.respond_to?(c) && c =~ /\A[A-Z_]+\z/
28
- public_send c
29
- else
30
- super
31
- end
32
- end
33
- end