versionify 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 +4 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/lib/tasks/versionify.rake +1 -0
- data/lib/version_manager.rb +4 -0
- data/lib/versionify/version.rb +3 -0
- data/lib/versionify.rb +69 -0
- data/versionify.gemspec +21 -0
- metadata +64 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Versionify.install_rake_tasks
|
data/lib/versionify.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
module Versionify
|
2
|
+
def self.bump level = :patch
|
3
|
+
version = read_or_create
|
4
|
+
|
5
|
+
case level
|
6
|
+
when :major
|
7
|
+
version[0] +=1
|
8
|
+
version[1] = 0
|
9
|
+
version[2] = 0
|
10
|
+
when :minor
|
11
|
+
version[1] += 1
|
12
|
+
version[0] += (version[1].to_f / 10).to_i
|
13
|
+
version[1] = (version[1].to_f / 10).to_s.split('.')[1].to_i
|
14
|
+
version[2] = 0
|
15
|
+
when :patch
|
16
|
+
version[2] += 1
|
17
|
+
end
|
18
|
+
|
19
|
+
write version
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.get_version
|
23
|
+
read_or_create.join '.'
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.print_version
|
27
|
+
puts "version #{get_version}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.install_rake_tasks
|
31
|
+
|
32
|
+
desc 'print the current source version'
|
33
|
+
task :version do
|
34
|
+
print_version
|
35
|
+
end
|
36
|
+
|
37
|
+
namespace :version do
|
38
|
+
namespace :bump do
|
39
|
+
task :patch do
|
40
|
+
bump :patch
|
41
|
+
print_version
|
42
|
+
end
|
43
|
+
task :minor do
|
44
|
+
bump :minor
|
45
|
+
print_version
|
46
|
+
end
|
47
|
+
task :major do
|
48
|
+
bump :major
|
49
|
+
print_version
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
protected
|
57
|
+
def self.filepath
|
58
|
+
'.versionify'
|
59
|
+
end
|
60
|
+
def self.read_or_create
|
61
|
+
fs = File.exists?(filepath) ? File.read(filepath).strip : '0.0.0'
|
62
|
+
fs.split('.').map {|s| s.to_i}
|
63
|
+
end
|
64
|
+
def self.write version
|
65
|
+
File.open(filepath,"w+") do |f|
|
66
|
+
f.write version.join('.')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/versionify.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "versionify/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "versionify"
|
7
|
+
s.version = Versionify::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Sam Taylor"]
|
10
|
+
s.email = ["sjltaylor@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{version functionality for rails apps}
|
13
|
+
#s.description = %q{TODO: Write a gem description}
|
14
|
+
|
15
|
+
s.rubyforge_project = "versionify"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: versionify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sam Taylor
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-11 00:00:00 +01:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description:
|
18
|
+
email:
|
19
|
+
- sjltaylor@gmail.com
|
20
|
+
executables: []
|
21
|
+
|
22
|
+
extensions: []
|
23
|
+
|
24
|
+
extra_rdoc_files: []
|
25
|
+
|
26
|
+
files:
|
27
|
+
- .gitignore
|
28
|
+
- Gemfile
|
29
|
+
- Rakefile
|
30
|
+
- lib/tasks/versionify.rake
|
31
|
+
- lib/version_manager.rb
|
32
|
+
- lib/versionify.rb
|
33
|
+
- lib/versionify/version.rb
|
34
|
+
- versionify.gemspec
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: ""
|
37
|
+
licenses: []
|
38
|
+
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
requirements: []
|
57
|
+
|
58
|
+
rubyforge_project: versionify
|
59
|
+
rubygems_version: 1.5.0
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: version functionality for rails apps
|
63
|
+
test_files: []
|
64
|
+
|