git-version-bump 0 → 0.1.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.
data/.gitignore CHANGED
@@ -1,3 +1,2 @@
1
- pkg/
2
- .bundle/
1
+ .bundle
3
2
  Gemfile.lock
data/README.md CHANGED
@@ -1,56 +1,14 @@
1
1
  Maintain your program versions entirely within git. No local files
2
- required! All versioning information is stored using git tags.
2
+ required!
3
3
 
4
- This gem contains a command-line tool and set of Rake tasks to increment
5
- and display your version numbers via git tags, and some associated Ruby code to use
6
- inside a gemspec or your program to retrieve the current version number, for
7
- use in builds and at runtime.
4
+ This gem contains a set of Rake tasks and associated code to manage the
5
+ versioning of your code via git tags. No in-repo file is required to store
6
+ your version, which reduces unnecessary duplication of information.
8
7
 
9
8
 
10
9
  # Usage
11
10
 
12
- Most of your day-to-day usage of `git-version-bump` will be via the command
13
- line. When you bump a version, a new tag will be created representing the newly
14
- incremented version number at the current commit. If no tags currently
15
- exist, the previous version will be taken to be `0.0.0` and then incremented
16
- accordingly.
17
-
18
-
19
- ## On the command line
20
-
21
- Pretty damned trivial:
22
-
23
- git version-bump <major|minor|patch|show>
24
-
25
- You can also shorten the specifier to any unique substring:
26
-
27
- git version-bump ma
28
- git version-bump mi
29
- git version-bump p
30
- git version-bump s
31
-
32
- I recommend adding an alias to your `~/.gitconfig` file, for less typing:
33
-
34
- [alias]
35
- vb = version-bump
36
-
37
- You can also add your own release notes to your release tags, by using the
38
- `-n` (or `--notes`, if you like typing) option:
39
-
40
- git version-bump -n minor
41
-
42
- This will open an editor, containing a list of the commits since the last
43
- release tag, in which you can type your release notes. If you follow
44
- standard git commit style (a "heading" line, then a blank line, followed by
45
- free-form text) you're perfectly positioned to use
46
- [github-release](http://theshed.hezmatt.org/github-release) to make
47
- gorgeous-looking release announcements to Github.
48
-
49
-
50
- ## In your `Rakefile`
51
-
52
- If you'd like to have access to the version-bumping goodness via `rake`, add
53
- the following line to your `Rakefile`:
11
+ In your `Rakefile`, add the following line:
54
12
 
55
13
  require 'git-version-bump/rake-tasks'
56
14
 
@@ -59,14 +17,11 @@ You will now have the following rake tasks available:
59
17
  rake version:bump:major # bump major version (x.y.z -> x+1.0.0)
60
18
  rake version:bump:minor # bump minor version (x.y.z -> x.y+1.0)
61
19
  rake version:bump:patch # bump patch version (x.y.z -> x.y.z+1)
62
- rake version:bump:show # Print current version number
63
-
64
- (Since `version:bump:major` is a lot of typing, there are also shortcuts:
65
- `v:b:major`, `v:b:maj`, `v:b:minor`, `v:b:min`, `v:b:patch`, `v:b:pat`, and
66
- `v:b:p`)
67
-
68
20
 
69
- ## In your Ruby code
21
+ By running any of those, a new tag will be created representing the newly
22
+ incremented version number at the current commit. If no tags currently
23
+ exist, the previous version will be taken to be `0.0.0` and then incremented
24
+ accordingly.
70
25
 
71
26
  To get access to this version information in your code (such as in your
72
27
  `gemspec`, or the definition of a `::VERSION` constant), you can `require
@@ -91,7 +46,7 @@ information available, the version will be assumed to be `0.0.0.1.ENOTAG`
91
46
  with a date of `1970-01-01`.
92
47
 
93
48
 
94
- ### In your gemspec
49
+ ## In your gemspec
95
50
 
96
51
  Typically, you want to encode your version and commit date into your
97
52
  gemspec, like this:
@@ -99,7 +54,7 @@ gemspec, like this:
99
54
  Gem::Specification.new do |s|
100
55
  s.version = GVB.version
101
56
  s.date = GVB.date
102
-
57
+
103
58
  ...
104
59
  end
105
60
 
@@ -110,61 +65,18 @@ system was built from pristine sources, or with that experimental patch you
110
65
  were trying out...
111
66
 
112
67
 
113
- ### In your gem
68
+ ## In your gem
114
69
 
115
70
  If, like me, you're one of those people who likes to be able to easily see
116
- what version of a library you're running, then you probably like to define a
71
+ what version of a library I'm running, then you probably like to define a
117
72
  `VERSION` constant somewhere in your gem's namespace. That, too, is simple
118
73
  to do:
119
74
 
120
75
  require 'git-version-bump'
121
-
76
+
122
77
  class Foobar
123
78
  VERSION = GVB.version
124
79
  end
125
80
 
126
81
  This will work correctly inside your git tree, and also in your installed
127
82
  gem. Magical!
128
-
129
- #### For projects using lite tags
130
-
131
- If you are using GitHub releases for your project or some other method that
132
- involves light tags (tags with no annotations), you might notice that these
133
- tags are not detected by git-version-bump by default. If you want these
134
- commits to be detected then use the following configuration:
135
-
136
- require 'git-version-bump'
137
-
138
- class Foobar
139
- # First parameter is use_local_git, second is include_lite_tags
140
- VERSION = GVB.version(false, true)
141
- end
142
-
143
-
144
- ## Overriding the version
145
-
146
- In very rare circumstances, while running in a git repo, you may wish to explicitly set the version or date returned by `GVB.version` or `GVB.date`, respectively.
147
- This can be done by setting the repo's `versionBump.versionOverride` or `versionBump.dateOverride` config values, like so:
148
-
149
- ```bash
150
- git config versionBump.versionOverride 1.2.3
151
- git config versionBump.dateOverride 1970-01-01
152
- ```
153
-
154
- Note that whatever you set those values to is used without validity checking; if you set it to something weird, you'll get weird results.
155
-
156
-
157
- # Contributing
158
-
159
- Send your pull requests to the [Github
160
- repo](https://github.com/mpalmer/git-version-bump), or send patches to
161
- `theshed+git-version-bump@hezmatt.org`. Bug reports can be sent to the same
162
- place, although I greatly prefer patches.
163
-
164
-
165
- # Licence
166
-
167
- Unless otherwise specified, all code in this repository is licenced under
168
- the terms of the GNU Public Licence, version 3, as published by the Free
169
- Software Foundation. The full terms of this licence can be found in the
170
- file LICENCE.
data/Rakefile CHANGED
@@ -1,5 +1,14 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
+ require_relative 'lib/git-version-bump/rake-tasks'
4
+
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
3
12
 
4
13
  Bundler::GemHelper.install_tasks
5
14
 
@@ -10,8 +19,3 @@ Rake::RDocTask.new do |rd|
10
19
  rd.title = 'git-version-bump'
11
20
  rd.rdoc_files.include("README.md", "lib/**/*.rb")
12
21
  end
13
-
14
- task :release do
15
- sh "git push --follow-tags"
16
- sh "git release"
17
- end
@@ -1,6 +1,4 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'git-version-bump'
1
+ require File.expand_path('../lib/git-version-bump', __FILE__)
4
2
 
5
3
  Gem::Specification.new do |s|
6
4
  s.name = "git-version-bump"
@@ -8,18 +6,15 @@ Gem::Specification.new do |s|
8
6
  s.version = GVB.version
9
7
  s.date = GVB.date
10
8
 
11
- s.platform = Gem::Platform::RUBY
12
- s.required_ruby_version = ">= 2.1.0"
9
+ s.platform = Gem::Platform::RUBY
13
10
 
14
- s.homepage = "https://github.com/mpalmer/git-version-bump"
11
+ s.homepage = "http://theshed.hezmatt.org/git-version-bump"
15
12
  s.summary = "Manage your app version entirely via git tags"
16
13
  s.authors = ["Matt Palmer"]
17
14
 
18
15
  s.extra_rdoc_files = ["README.md"]
19
16
  s.files = `git ls-files`.split("\n")
20
- s.executables = ["git-version-bump"]
21
-
22
- s.add_development_dependency 'github-release'
17
+
23
18
  s.add_development_dependency 'rake'
24
19
  s.add_development_dependency 'bundler'
25
20
  s.add_development_dependency 'rdoc'
@@ -1,4 +1,4 @@
1
- require 'git-version-bump'
1
+ require_relative '../git-version-bump'
2
2
 
3
3
  namespace :version do
4
4
  namespace :bump do
@@ -22,28 +22,5 @@ namespace :version do
22
22
 
23
23
  puts "Version is now #{GVB.version}"
24
24
  end
25
-
26
- desc "Print current version"
27
- task :show do
28
- puts GVB.version
29
- end
30
- end
31
- end
32
-
33
- namespace :v do
34
- namespace :b do
35
- task :major => "version:bump:major"
36
- task :maj => "version:bump:major"
37
-
38
- task :minor => "version:bump:minor"
39
- task :min => "version:bump:minor"
40
-
41
- task :patch => "version:bump:patch"
42
- task :pat => "version:bump:patch"
43
- task :p => "version:bump:patch"
44
-
45
- task :show => "version:bump:show"
46
- task :sh => "version:bump:show"
47
- task :s => "version:bump:show"
48
25
  end
49
26
  end