jeweler_style_versioning 0.0.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +42 -0
- data/VERSION +1 -1
- data/jeweler_style_versioning.gemspec +4 -3
- data/lib/jeweler_style_versioning.rb +8 -5
- data/lib/jeweler_style_versioning/commands.rb +11 -0
- data/lib/jeweler_style_versioning/commands/version/base.rb +2 -15
- data/lib/jeweler_style_versioning/commands/version/bump_major.rb +1 -1
- data/lib/jeweler_style_versioning/commands/version/bump_minor.rb +1 -1
- data/lib/jeweler_style_versioning/commands/version/bump_patch.rb +1 -1
- data/lib/jeweler_style_versioning/commands/version/write.rb +1 -1
- data/lib/jeweler_style_versioning/tasks.rb +9 -11
- data/lib/jeweler_style_versioning/version_helper.rb +1 -1
- metadata +6 -5
- data/README.rdoc +0 -19
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# jeweler_style_versioning
|
2
|
+
|
3
|
+
The versioning tasks from the Jeweler gem ripped out and put into it's own gem. Literally copied and pasted the code.
|
4
|
+
|
5
|
+
# Instructions
|
6
|
+
|
7
|
+
#### Add the gem to your project
|
8
|
+
|
9
|
+
gem "jeweler_style_versioning"
|
10
|
+
|
11
|
+
#### Include and initialize the rake tasks
|
12
|
+
|
13
|
+
Add these lines to your Rakefile.
|
14
|
+
|
15
|
+
require 'jeweler_style_versioning'
|
16
|
+
JewelerStyleVersioning::Tasks.new
|
17
|
+
|
18
|
+
#### Call rake tasks as normal
|
19
|
+
|
20
|
+
All tasks are exactly the same except you use versioning instead of versioning. For example
|
21
|
+
|
22
|
+
rake versioning:write
|
23
|
+
rake versioning:bump:patch
|
24
|
+
|
25
|
+
## Special Thanks
|
26
|
+
|
27
|
+
* The [Jeweler](http://github.com/technicalpickles/jeweler) gem writers for writing all my code.
|
28
|
+
|
29
|
+
## Contributing to jeweler_style_versioning
|
30
|
+
|
31
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
32
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
33
|
+
* Fork the project
|
34
|
+
* Start a feature/bugfix branch
|
35
|
+
* Commit and push until you are happy with your contribution
|
36
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
37
|
+
* 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.
|
38
|
+
|
39
|
+
## Copyright
|
40
|
+
|
41
|
+
Copyright (c) 2012 jeremiahishere. See LICENSE.txt for
|
42
|
+
further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
1.0.0
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{jeweler_style_versioning}
|
8
|
-
s.version = "
|
8
|
+
s.version = "1.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["jeremiahishere"]
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.email = %q{jeremiah@cloudspace.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
|
-
"README.
|
17
|
+
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
@@ -22,11 +22,12 @@ Gem::Specification.new do |s|
|
|
22
22
|
"Gemfile",
|
23
23
|
"Gemfile.lock",
|
24
24
|
"LICENSE.txt",
|
25
|
-
"README.
|
25
|
+
"README.md",
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
28
|
"jeweler_style_versioning.gemspec",
|
29
29
|
"lib/jeweler_style_versioning.rb",
|
30
|
+
"lib/jeweler_style_versioning/commands.rb",
|
30
31
|
"lib/jeweler_style_versioning/commands/version/base.rb",
|
31
32
|
"lib/jeweler_style_versioning/commands/version/bump_major.rb",
|
32
33
|
"lib/jeweler_style_versioning/commands/version/bump_minor.rb",
|
@@ -1,10 +1,13 @@
|
|
1
1
|
class JewelerStyleVersioning
|
2
2
|
autoload :VersionHelper, 'jeweler_style_versioning/version_helper'
|
3
|
+
autoload :Commands, 'jeweler_style_versioning/commands'
|
4
|
+
autoload :Tasks, 'jeweler_style_versioning/tasks'
|
3
5
|
|
4
6
|
attr_reader :version_helper
|
7
|
+
attr_accessor :base_dir
|
5
8
|
|
6
9
|
def initialize(base_dir = ".")
|
7
|
-
@version_helper =
|
10
|
+
@version_helper = JewelerStyleVersioning::VersionHelper.new(base_dir)
|
8
11
|
end
|
9
12
|
|
10
13
|
# Major version, as defined by the gemspec's Version module.
|
@@ -34,26 +37,26 @@ class JewelerStyleVersioning
|
|
34
37
|
#
|
35
38
|
# 1.5.1 -> 1.5.2
|
36
39
|
def bump_patch_version()
|
37
|
-
|
40
|
+
JewelerStyleVersioning::Commands::Version::BumpPatch.build_for(self).run
|
38
41
|
end
|
39
42
|
|
40
43
|
# Bumps the minor version.
|
41
44
|
#
|
42
45
|
# 1.5.1 -> 1.6.0
|
43
46
|
def bump_minor_version()
|
44
|
-
|
47
|
+
JewelerStyleVersioning::Commands::Version::BumpMinor.build_for(self).run
|
45
48
|
end
|
46
49
|
|
47
50
|
# Bumps the major version.
|
48
51
|
#
|
49
52
|
# 1.5.1 -> 2.0.0
|
50
53
|
def bump_major_version()
|
51
|
-
|
54
|
+
JewelerStyleVersioning::Commands::Version::BumpMajor.build_for(self).run
|
52
55
|
end
|
53
56
|
|
54
57
|
# Bumps the version, to the specific major/minor/patch version, writing out the appropriate version.rb, and then reloads it.
|
55
58
|
def write_version(major, minor, patch, build, options = {})
|
56
|
-
command =
|
59
|
+
command = JewelerStyleVersioning::Commands::Version::Write.build_for(self)
|
57
60
|
command.major = major
|
58
61
|
command.minor = minor
|
59
62
|
command.patch = patch
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class JewelerStyleVersioning
|
2
|
+
module Commands
|
3
|
+
module Version
|
4
|
+
autoload :Base, 'jeweler_style_versioning/commands/version/base'
|
5
|
+
autoload :BumpMajor, 'jeweler_style_versioning/commands/version/bump_major'
|
6
|
+
autoload :BumpMinor, 'jeweler_style_versioning/commands/version/bump_minor'
|
7
|
+
autoload :BumpPatch, 'jeweler_style_versioning/commands/version/bump_patch'
|
8
|
+
autoload :Write, 'jeweler_style_versioning/commands/version/write'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,32 +1,22 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
|
3
|
-
class
|
3
|
+
class JewelerStyleVersioning
|
4
4
|
module Commands
|
5
5
|
module Version
|
6
6
|
class Base
|
7
7
|
|
8
|
-
attr_accessor :
|
8
|
+
attr_accessor :version_helper, :base_dir
|
9
9
|
|
10
10
|
def run
|
11
11
|
update_version
|
12
12
|
|
13
13
|
self.version_helper.write
|
14
|
-
self.gemspec.version = self.version_helper.to_s
|
15
|
-
|
16
|
-
commit_version if self.repo && self.commit
|
17
14
|
end
|
18
15
|
|
19
16
|
def update_version
|
20
17
|
raise "Subclasses should implement this"
|
21
18
|
end
|
22
19
|
|
23
|
-
def commit_version
|
24
|
-
if self.repo
|
25
|
-
self.repo.add(working_subdir.join(version_helper.path))
|
26
|
-
self.repo.commit("Version bump to #{self.version_helper.to_s}")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
20
|
def working_subdir
|
31
21
|
return @working_subdir if @working_subdir
|
32
22
|
cwd = base_dir_path
|
@@ -41,10 +31,7 @@ class Jeweler
|
|
41
31
|
|
42
32
|
def self.build_for(jeweler)
|
43
33
|
command = new
|
44
|
-
command.repo = jeweler.repo
|
45
34
|
command.version_helper = jeweler.version_helper
|
46
|
-
command.gemspec = jeweler.gemspec
|
47
|
-
command.commit = jeweler.commit
|
48
35
|
command.base_dir = jeweler.base_dir
|
49
36
|
|
50
37
|
command
|
@@ -37,7 +37,7 @@ class JewelerStyleVersioning
|
|
37
37
|
#
|
38
38
|
# In addition, it provides reasonable defaults for several values. See Jeweler::Specification for more details.
|
39
39
|
class Tasks < ::Rake::TaskLib
|
40
|
-
attr_accessor :
|
40
|
+
attr_accessor :jeweler_style_versioning
|
41
41
|
|
42
42
|
def initialize
|
43
43
|
Rake.application.jeweler_style_versioning_tasks = self
|
@@ -54,14 +54,12 @@ class JewelerStyleVersioning
|
|
54
54
|
private
|
55
55
|
|
56
56
|
def define
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
57
|
+
desc "Displays the current version"
|
58
|
+
task :versioning do
|
59
|
+
$stdout.puts "Current version: #{jeweler_style_versioning.version}"
|
61
60
|
end
|
62
|
-
|
63
|
-
|
64
|
-
namespace :version do
|
61
|
+
|
62
|
+
namespace :versioning do
|
65
63
|
desc "Writes out an explicit version. Respects the following environment variables, or defaults to 0: MAJOR, MINOR, PATCH. Also recognizes BUILD, which defaults to nil"
|
66
64
|
task :write do
|
67
65
|
major, minor, patch, build = ENV['MAJOR'].to_i, ENV['MINOR'].to_i, ENV['PATCH'].to_i, (ENV['BUILD'] || nil )
|
@@ -71,19 +69,19 @@ class JewelerStyleVersioning
|
|
71
69
|
|
72
70
|
namespace :bump do
|
73
71
|
desc "Bump the major version by 1"
|
74
|
-
task :major => [:
|
72
|
+
task :major => [:versioning] do
|
75
73
|
jeweler_style_versioning.bump_major_version
|
76
74
|
$stdout.puts "Updated version: #{jeweler_style_versioning.version}"
|
77
75
|
end
|
78
76
|
|
79
77
|
desc "Bump the a minor version by 1"
|
80
|
-
task :minor => [:
|
78
|
+
task :minor => [:versioning] do
|
81
79
|
jeweler_style_versioning.bump_minor_version
|
82
80
|
$stdout.puts "Updated version: #{jeweler_style_versioning.version}"
|
83
81
|
end
|
84
82
|
|
85
83
|
desc "Bump the patch version by 1"
|
86
|
-
task :patch => [:
|
84
|
+
task :patch => [:versioning] do
|
87
85
|
jeweler_style_versioning.bump_patch_version
|
88
86
|
$stdout.puts "Updated version: #{jeweler_style_versioning.version}"
|
89
87
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jeweler_style_versioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.0
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- jeremiahishere
|
@@ -88,18 +88,19 @@ extensions: []
|
|
88
88
|
|
89
89
|
extra_rdoc_files:
|
90
90
|
- LICENSE.txt
|
91
|
-
- README.
|
91
|
+
- README.md
|
92
92
|
files:
|
93
93
|
- .document
|
94
94
|
- .rspec
|
95
95
|
- Gemfile
|
96
96
|
- Gemfile.lock
|
97
97
|
- LICENSE.txt
|
98
|
-
- README.
|
98
|
+
- README.md
|
99
99
|
- Rakefile
|
100
100
|
- VERSION
|
101
101
|
- jeweler_style_versioning.gemspec
|
102
102
|
- lib/jeweler_style_versioning.rb
|
103
|
+
- lib/jeweler_style_versioning/commands.rb
|
103
104
|
- lib/jeweler_style_versioning/commands/version/base.rb
|
104
105
|
- lib/jeweler_style_versioning/commands/version/bump_major.rb
|
105
106
|
- lib/jeweler_style_versioning/commands/version/bump_minor.rb
|
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= jeweler_style_versioning
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Contributing to jeweler_style_versioning
|
6
|
-
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
-
* Fork the project
|
10
|
-
* Start a feature/bugfix branch
|
11
|
-
* Commit and push until you are happy with your contribution
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* 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.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2012 jeremiahishere. See LICENSE.txt for
|
18
|
-
further details.
|
19
|
-
|