versionator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+
9
+ group :development do
10
+ gem "shoulda", ">= 0"
11
+ gem "bundler", "~> 1.0.0"
12
+ gem "jeweler", "~> 1.5.2"
13
+ gem "rcov", ">= 0"
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.5.2)
6
+ bundler (~> 1.0.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.9.2)
10
+ rcov (0.9.9)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.5.2)
19
+ rcov
20
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 John McAliley
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,51 @@
1
+ = versionator
2
+
3
+ Version management for your Rails 3 app. Provides a VERSION text file and rake tasks to bump patch, minor, and major versions. This will create a git tag, commit the new VERSION file and push the tag & VERSION to github
4
+
5
+ == Install
6
+
7
+ Add to your Gemfile
8
+
9
+ gem 'versionator'
10
+
11
+ Install with bundler
12
+
13
+ $ bundle install
14
+
15
+ Create initial VERSION file
16
+
17
+ bundle exec rake versionator:install
18
+
19
+ == Usage
20
+
21
+ Bump a patch version, git tag and push to github
22
+ v1.1.1 moves to v1.1.2
23
+
24
+ bundle exec rake versionator:patch
25
+
26
+ Bump a minor version, git tag and push to github
27
+ v1.1.1 moves to v1.2.0
28
+
29
+ bundle exec rake versionator:minor
30
+
31
+ Bump a major version, git tag and push to github
32
+ v1.1.1 moves to v2.0.0
33
+
34
+ bundle exec rake versionator:major
35
+
36
+
37
+ == Contributing to versionator
38
+
39
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
40
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
41
+ * Fork the project
42
+ * Start a feature/bugfix branch
43
+ * Commit and push until you are happy with your contribution
44
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
45
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
46
+
47
+ == Copyright
48
+
49
+ Copyright (c) 2011 John McAliley. See LICENSE.txt for
50
+ further details.
51
+
data/Rakefile ADDED
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "versionator"
16
+ gem.homepage = "http://github.com/charlotte-ruby/versionator"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{versioning for your Rails 3 app}
19
+ gem.description = %Q{set of rake tasks that allow you to update your release version, tag it and push to github}
20
+ gem.email = "john.mcaliley@gmail.com"
21
+ gem.authors = ["John McAliley"]
22
+ gem.add_dependency "systemu"
23
+ gem.files.exclude 'test_app/**/*'
24
+ gem.files.exclude 'test_app/**/.*'
25
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
26
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
27
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
28
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
29
+ end
30
+ Jeweler::RubygemsDotOrgTasks.new
31
+
32
+ require 'rake/testtask'
33
+ Rake::TestTask.new(:test) do |test|
34
+ test.libs << 'lib' << 'test'
35
+ test.pattern = 'test/**/test_*.rb'
36
+ test.verbose = true
37
+ end
38
+
39
+ require 'rcov/rcovtask'
40
+ Rcov::RcovTask.new do |test|
41
+ test.libs << 'test'
42
+ test.pattern = 'test/**/test_*.rb'
43
+ test.verbose = true
44
+ end
45
+
46
+ task :default => :test
47
+
48
+ require 'rake/rdoctask'
49
+ Rake::RDocTask.new do |rdoc|
50
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
51
+
52
+ rdoc.rdoc_dir = 'rdoc'
53
+ rdoc.title = "versionator #{version}"
54
+ rdoc.rdoc_files.include('README*')
55
+ rdoc.rdoc_files.include('lib/**/*.rb')
56
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,21 @@
1
+ VERSION_FILE = "#{Rails.root}/VERSION"
2
+
3
+ namespace :versionator do
4
+ desc "patch version"
5
+ task :patch => :environment do
6
+ versionator = Versionatorator.new
7
+ versionator.release(:patch)
8
+ end
9
+
10
+ desc "minor version"
11
+ task :minor => :environment do
12
+ versionator = Versionator.new
13
+ versionator.release(:minor)
14
+ end
15
+
16
+ desc "major version"
17
+ task :major => :environment do
18
+ versionator = Versionator.new
19
+ versionator.release(:major)
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ module Versionator
2
+ module File
3
+ def write(version="0.0.0")
4
+ ::File.open(Versionator.version_file, 'w') {|f| f.write(version) }
5
+ end
6
+
7
+ def read
8
+ IO.read(Versionator.version_file) rescue nil
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,28 @@
1
+ module Versionator
2
+ module Git
3
+ def git_checkout
4
+ git_command("git checkout master")
5
+ end
6
+
7
+ def git_pull
8
+ git_command("git pull origin master")
9
+ end
10
+
11
+ def git_tag
12
+ git_command("git tag v#{version_name}")
13
+ end
14
+
15
+ def git_commit(message=nil)
16
+ message = "tag new release v#{version_name}" if message.blank?
17
+ git_command("git commit -a -m '#{message}'")
18
+ end
19
+
20
+ def git_push
21
+ git_command("git push origin master --tags")
22
+ end
23
+
24
+ def git_command(str)
25
+ systemu(str).drop(1).join(" ")
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,10 @@
1
+ require 'rails'
2
+ require 'versionator'
3
+
4
+ module Versionator
5
+ class Railtie < Rails::Railtie
6
+ initializer "set_module_var" do
7
+ Versionator.version_file = "#{Rails.root}/VERSION"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,57 @@
1
+ module Versionator
2
+ class Version
3
+ include Versionator::File
4
+ include Versionator::Git
5
+ attr_accessor :major, :minor, :patch
6
+
7
+ def initialize
8
+ version_file_content = read rescue nil
9
+ if version_file_content.nil?
10
+ write
11
+ version_file_content = read
12
+ puts "Versionator file created: #{Versionator.version_file}"
13
+ end
14
+ categories = version_categories(version_file_content)
15
+ @major = categories[0]
16
+ @minor = categories[1]
17
+ @patch = categories[2]
18
+ end
19
+
20
+ def version_categories(version_str)
21
+ version_str.split(".").collect{|s|s.to_i}
22
+ end
23
+
24
+ def bump(category)
25
+ case category
26
+ when :major
27
+ @major += 1
28
+ @minor = 0
29
+ @patch = 0
30
+ when :minor
31
+ @minor += 1
32
+ @patch = 0
33
+ when :patch
34
+ @patch += 1
35
+ end
36
+ end
37
+
38
+ def version_name
39
+ [@major,@minor,@patch].join(".")
40
+ end
41
+
42
+ def git_release
43
+ output = git_checkout
44
+ output += git_pull
45
+ output += git_tag
46
+ output += git_commit
47
+ output += git_push
48
+ output
49
+ end
50
+
51
+ def release(category)
52
+ bump(category)
53
+ write(version_name)
54
+ git_release
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,9 @@
1
+ require 'versionator/railtie'
2
+ require 'versionator/git'
3
+ require 'versionator/file'
4
+ require 'versionator/version'
5
+ require 'systemu'
6
+
7
+ module Versionator
8
+ mattr_accessor :version_file
9
+ end
@@ -0,0 +1,65 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{versionator}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{John McAliley}]
12
+ s.date = %q{2011-07-21}
13
+ s.description = %q{set of rake tasks that allow you to update your release version, tag it and push to github}
14
+ s.email = %q{john.mcaliley@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/tasks/versionator.rake",
28
+ "lib/versionator.rb",
29
+ "lib/versionator/file.rb",
30
+ "lib/versionator/git.rb",
31
+ "lib/versionator/railtie.rb",
32
+ "lib/versionator/version.rb",
33
+ "versionator.gemspec"
34
+ ]
35
+ s.homepage = %q{http://github.com/charlotte-ruby/versionator}
36
+ s.licenses = [%q{MIT}]
37
+ s.require_paths = [%q{lib}]
38
+ s.rubygems_version = %q{1.8.5}
39
+ s.summary = %q{versioning for your Rails 3 app}
40
+
41
+ if s.respond_to? :specification_version then
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
46
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
48
+ s.add_development_dependency(%q<rcov>, [">= 0"])
49
+ s.add_runtime_dependency(%q<systemu>, [">= 0"])
50
+ else
51
+ s.add_dependency(%q<shoulda>, [">= 0"])
52
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
53
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
54
+ s.add_dependency(%q<rcov>, [">= 0"])
55
+ s.add_dependency(%q<systemu>, [">= 0"])
56
+ end
57
+ else
58
+ s.add_dependency(%q<shoulda>, [">= 0"])
59
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
60
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
61
+ s.add_dependency(%q<rcov>, [">= 0"])
62
+ s.add_dependency(%q<systemu>, [">= 0"])
63
+ end
64
+ end
65
+
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: versionator
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - John McAliley
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-07-21 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: shoulda
17
+ requirement: &id001 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: bundler
28
+ requirement: &id002 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: jeweler
39
+ requirement: &id003 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 1.5.2
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: rcov
50
+ requirement: &id004 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: systemu
61
+ requirement: &id005 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ type: :runtime
68
+ prerelease: false
69
+ version_requirements: *id005
70
+ description: set of rake tasks that allow you to update your release version, tag it and push to github
71
+ email: john.mcaliley@gmail.com
72
+ executables: []
73
+
74
+ extensions: []
75
+
76
+ extra_rdoc_files:
77
+ - LICENSE.txt
78
+ - README.rdoc
79
+ files:
80
+ - .document
81
+ - Gemfile
82
+ - Gemfile.lock
83
+ - LICENSE.txt
84
+ - README.rdoc
85
+ - Rakefile
86
+ - VERSION
87
+ - lib/tasks/versionator.rake
88
+ - lib/versionator.rb
89
+ - lib/versionator/file.rb
90
+ - lib/versionator/git.rb
91
+ - lib/versionator/railtie.rb
92
+ - lib/versionator/version.rb
93
+ - versionator.gemspec
94
+ homepage: http://github.com/charlotte-ruby/versionator
95
+ licenses:
96
+ - MIT
97
+ post_install_message:
98
+ rdoc_options: []
99
+
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ hash: -1372792823086288347
108
+ segments:
109
+ - 0
110
+ version: "0"
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: "0"
117
+ requirements: []
118
+
119
+ rubyforge_project:
120
+ rubygems_version: 1.8.5
121
+ signing_key:
122
+ specification_version: 3
123
+ summary: versioning for your Rails 3 app
124
+ test_files: []
125
+