versionista 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 +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +2 -0
- data/VERSION +1 -0
- data/bin/versionista +5 -0
- data/lib/versionista.rb +82 -0
- data/versionista.gemspec +23 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8213c03e34da69d65f968ff0a476956acd3a232e
|
4
|
+
data.tar.gz: 62eb28477badbb904f72461cde89b9cf48e6e8ee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 100a3a2fb9df16c9849721ab5848442edb4ded9b40f0bc29bb1cfa2216147dee28b6cc933321053441032d10ecd709b831f6f1e6bd30b14c9c22bcdf396199d4
|
7
|
+
data.tar.gz: b21f3f8e754ee3c6c9abcca6b8d73d873e2a1c30d1ac675a4dd2e4c160b7cf86f447c88f070ef46d8a5792cd81c929036030f6c029f18ec96131c33264b5f7d1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Łukasz Korecki
|
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,53 @@
|
|
1
|
+
# Versionista
|
2
|
+
|
3
|
+
Simple `VERSION` file manager
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'versionista'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install versionista
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```
|
24
|
+
$ versionista --init --version-file VERSION
|
25
|
+
|
26
|
+
I, [2015-01-16T16:25:32.986654 #15963] INFO -- : Initializing /home/lukasz/work/versionista/VERSION with version: 1.0.0
|
27
|
+
|
28
|
+
$ versionista --bump minor --version-file VERSION
|
29
|
+
|
30
|
+
I, [2015-01-16T16:25:41.912433 #15998] INFO -- : Moving from 1.0.0 to 1.1.0 (in /home/lukasz/work/versionista/VERSION)
|
31
|
+
I, [2015-01-16T16:25:41.912701 #15998] INFO -- : Done
|
32
|
+
|
33
|
+
$ versionista --bump patch --version-file VERSION
|
34
|
+
|
35
|
+
I, [2015-01-16T16:25:46.154216 #16030] INFO -- : Moving from 1.1.0 to 1.1.1 (in /home/lukasz/work/versionista/VERSION)
|
36
|
+
I, [2015-01-16T16:25:46.154477 #16030] INFO -- : Done
|
37
|
+
|
38
|
+
$ versionista --bump major --version-file VERSION
|
39
|
+
|
40
|
+
I, [2015-01-16T16:25:51.195717 #16064] INFO -- : Moving from 1.1.1 to 2.1.1 (in /home/lukasz/work/versionista/VERSION)
|
41
|
+
I, [2015-01-16T16:25:51.196019 #16064] INFO -- : Done
|
42
|
+
|
43
|
+
$ cat VERSION
|
44
|
+
2.1.1
|
45
|
+
```
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it ( https://github.com/[my-github-username]/versionista/fork )
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/bin/versionista
ADDED
data/lib/versionista.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
module Versionista
|
5
|
+
VERSION = File.read(File.expand_path('../../VERSION', __FILE__))
|
6
|
+
|
7
|
+
def self.from_args(args)
|
8
|
+
options = {}
|
9
|
+
|
10
|
+
optparse = OptionParser.new do |opts|
|
11
|
+
opts.banner = <<-EOF
|
12
|
+
Versionista! #{VERSION}
|
13
|
+
|
14
|
+
|
15
|
+
Manage version files. To get started run
|
16
|
+
|
17
|
+
$ versionista --init --version-file ./path/to/File
|
18
|
+
EOF
|
19
|
+
.gsub(/^\s*/,'')
|
20
|
+
|
21
|
+
opts.on('-f', '--version-file FILE', 'Path to version file') do |file|
|
22
|
+
options[:file] = File.expand_path(file)
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on('-b', '--bump WHICH', 'Bump: major/minor/patch') do |which|
|
26
|
+
options[:which] = which
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on('-i', '--init', 'Initialize version file') do
|
30
|
+
options[:init] = true
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on('-h', '--help', 'halp') do
|
34
|
+
puts opts
|
35
|
+
exit 0
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
optparse.parse! args
|
40
|
+
|
41
|
+
if options.empty?
|
42
|
+
puts optparse
|
43
|
+
exit 0
|
44
|
+
end
|
45
|
+
|
46
|
+
Manager.new(options[:init], options[:file], options[:which])
|
47
|
+
end
|
48
|
+
|
49
|
+
class Manager < Struct.new(:init, :file, :which)
|
50
|
+
def run
|
51
|
+
abort 'No file' if !file || (!File.exist?(file) && !init)
|
52
|
+
abort "Wrong specifier: #{which}" unless (%w(minor major patch).include? which) || init
|
53
|
+
if init
|
54
|
+
log.info "Initializing #{file} with version: 1.0.0"
|
55
|
+
File.write(file, '1.0.0')
|
56
|
+
exit 0
|
57
|
+
end
|
58
|
+
|
59
|
+
bump!(which)
|
60
|
+
end
|
61
|
+
|
62
|
+
def bump!(which)
|
63
|
+
current_version = File.read(file).strip.chomp
|
64
|
+
|
65
|
+
version_hash = Hash[%w(major minor patch).zip(current_version.split('.').map(&:to_i))]
|
66
|
+
|
67
|
+
version_hash[which] += 1
|
68
|
+
|
69
|
+
next_version = version_hash.values.join('.')
|
70
|
+
|
71
|
+
log.info "Moving from #{current_version} to #{next_version} (in #{file})"
|
72
|
+
File.write(file, next_version)
|
73
|
+
log.info 'Done'
|
74
|
+
end
|
75
|
+
|
76
|
+
def log
|
77
|
+
@log ||= Logger.new(STDERR).tap do |l|
|
78
|
+
l.formatter = Logger::Formatter.new
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
data/versionista.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'versionista'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "versionista"
|
8
|
+
spec.version = Versionista::VERSION
|
9
|
+
spec.authors = ["Łukasz Korecki"]
|
10
|
+
spec.email = ["lukasz@korecki.me"]
|
11
|
+
spec.summary = %q{Simple VERSION file manager.}
|
12
|
+
spec.description = %q{No fuss and extra features. Simply bump major/minor/patch version of your software stored in VERSION file. You can create it too}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: versionista
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "Łukasz Korecki"
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-16 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.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: No fuss and extra features. Simply bump major/minor/patch version of
|
42
|
+
your software stored in VERSION file. You can create it too
|
43
|
+
email:
|
44
|
+
- lukasz@korecki.me
|
45
|
+
executables:
|
46
|
+
- versionista
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- ".gitignore"
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- VERSION
|
56
|
+
- bin/versionista
|
57
|
+
- lib/versionista.rb
|
58
|
+
- versionista.gemspec
|
59
|
+
homepage: ''
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.4.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Simple VERSION file manager.
|
83
|
+
test_files: []
|