versionator 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,6 +12,22 @@ Install with bundler
12
12
 
13
13
  $ bundle install
14
14
 
15
+ == Github
16
+
17
+ Versionator pushes the git tag and VERSION file to your project's github repository (origin master) each time you run the rake tasks. It is recommended that you commit all code and push to master before bumping your version.
18
+
19
+ Order of execution for the rake tasks:
20
+
21
+ 1. Bump the version locally based on the version in /your_app/VERSION
22
+ 2. Write the new version to /your_app/VERSION
23
+ 3. git checkout master
24
+ 4. git pull
25
+ 5. git tag new version
26
+ 6. git commit (This will commit your new VERSION file)
27
+ 7. git push (new tag and VERSION file)
28
+
29
+ TODO: Currently there is no error checking in place for each of these automated steps. The rake tasks should be changed to stop execution if there is code to be committed or new code from the pull
30
+
15
31
  == Usage
16
32
 
17
33
  There are 3 rake tasks for each version category. If the VERSION file does not exist in the app root directory, the rake task will create it automatically
@@ -41,7 +57,7 @@ Example: v1.1.1 moves to v2.0.0
41
57
  * Commit and push until you are happy with your contribution
42
58
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
43
59
  * 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.
44
- *** Tests are located in a separate repository, since their needs to be a project to tag against. Here is the test repo: git@github.com:johnmcaliley/test_app.git
60
+ *** Tests are located in a separate repository, since their needs to be a project to tag against. Here is the test repo: https://github.com/johnmcaliley/test_app
45
61
 
46
62
  == Copyright
47
63
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.1.0
@@ -1,28 +1,32 @@
1
1
  module Versionator
2
2
  module Git
3
- def git_checkout
4
- git_command("git checkout master")
3
+ def git_current_branch
4
+ git_command("git branch").split(/\n/).grep(/\*/).first.gsub('* ', '')
5
5
  end
6
6
 
7
- def git_pull
8
- git_command("git pull origin master")
7
+ def git_checkout(branch = 'master')
8
+ git_command("git checkout #{branch}")
9
+ end
10
+
11
+ def git_pull(branch = 'master')
12
+ git_command("git pull origin #{branch}")
9
13
  end
10
14
 
11
15
  def git_tag
12
16
  git_command("git tag v#{version_name}")
13
17
  end
14
18
 
15
- def git_commit(message=nil)
19
+ def git_commit(message = nil)
16
20
  message = "tag new release v#{version_name}" if message.blank?
17
21
  git_command("git commit -a -m '#{message}'")
18
22
  end
19
23
 
20
- def git_push
21
- git_command("git push origin master --tags")
24
+ def git_push(branch = 'master')
25
+ git_command("git push origin #{branch} --tags")
22
26
  end
23
27
 
24
28
  def git_command(str)
25
29
  systemu(str).drop(1).join(" ")
26
30
  end
27
31
  end
28
- end
32
+ end
@@ -40,18 +40,29 @@ module Versionator
40
40
  end
41
41
 
42
42
  def git_release
43
- output = git_checkout
44
- output += git_pull
45
- output += git_tag
46
- output += git_commit
47
- output += git_push
43
+ current_branch = git_current_branch
44
+ if current_branch == 'master' || confirm_branch(current_branch)
45
+ output = git_checkout(current_branch)
46
+ output += git_pull(current_branch)
47
+ output += git_tag
48
+ output += git_commit
49
+ output += git_push(current_branch)
50
+ else
51
+ output = "Aborting tag. Check out the correct branch and try again."
52
+ end
48
53
  output
49
54
  end
50
55
 
56
+ def confirm_branch(branch)
57
+ print "Tagging new version on current branch [#{branch}]. Continue? [y]: "
58
+ response = $stdin.gets
59
+ (response =~ /y/i || response == "\n")
60
+ end
61
+
51
62
  def release(category)
52
63
  bump(category)
53
64
  write(version_name)
54
65
  git_release
55
66
  end
56
67
  end
57
- end
68
+ end
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{versionator}
8
- s.version = "0.0.4"
7
+ s.name = "versionator"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["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}
12
+ s.date = "2012-03-13"
13
+ s.description = "set of rake tasks that allow you to update your release version, tag it and push to github"
14
+ s.email = "john.mcaliley@gmail.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.rdoc"
@@ -32,14 +32,13 @@ Gem::Specification.new do |s|
32
32
  "lib/versionator/version.rb",
33
33
  "versionator.gemspec"
34
34
  ]
35
- s.homepage = %q{http://github.com/charlotte-ruby/versionator}
35
+ s.homepage = "http://github.com/charlotte-ruby/versionator"
36
36
  s.licenses = ["MIT"]
37
37
  s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.3.7}
39
- s.summary = %q{versioning for your Rails 3 app}
38
+ s.rubygems_version = "1.8.10"
39
+ s.summary = "versioning for your Rails 3 app"
40
40
 
41
41
  if s.respond_to? :specification_version then
42
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
42
  s.specification_version = 3
44
43
 
45
44
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
metadata CHANGED
@@ -1,101 +1,80 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: versionator
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 4
9
- version: 0.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - John McAliley
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-07-21 00:00:00 -04:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-13 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: shoulda
22
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2173366100 !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
30
22
  type: :development
31
23
  prerelease: false
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
24
+ version_requirements: *2173366100
25
+ - !ruby/object:Gem::Dependency
34
26
  name: bundler
35
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ requirement: &2173365620 !ruby/object:Gem::Requirement
36
28
  none: false
37
- requirements:
29
+ requirements:
38
30
  - - ~>
39
- - !ruby/object:Gem::Version
40
- segments:
41
- - 1
42
- - 0
43
- - 0
31
+ - !ruby/object:Gem::Version
44
32
  version: 1.0.0
45
33
  type: :development
46
34
  prerelease: false
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *2173365620
36
+ - !ruby/object:Gem::Dependency
49
37
  name: jeweler
50
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ requirement: &2173365140 !ruby/object:Gem::Requirement
51
39
  none: false
52
- requirements:
40
+ requirements:
53
41
  - - ~>
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 1
57
- - 5
58
- - 2
42
+ - !ruby/object:Gem::Version
59
43
  version: 1.5.2
60
44
  type: :development
61
45
  prerelease: false
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
46
+ version_requirements: *2173365140
47
+ - !ruby/object:Gem::Dependency
64
48
  name: rcov
65
- requirement: &id004 !ruby/object:Gem::Requirement
49
+ requirement: &2173364660 !ruby/object:Gem::Requirement
66
50
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- segments:
71
- - 0
72
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
73
55
  type: :development
74
56
  prerelease: false
75
- version_requirements: *id004
76
- - !ruby/object:Gem::Dependency
57
+ version_requirements: *2173364660
58
+ - !ruby/object:Gem::Dependency
77
59
  name: systemu
78
- requirement: &id005 !ruby/object:Gem::Requirement
60
+ requirement: &2173364180 !ruby/object:Gem::Requirement
79
61
  none: false
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- segments:
84
- - 0
85
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
86
66
  type: :runtime
87
67
  prerelease: false
88
- version_requirements: *id005
89
- description: set of rake tasks that allow you to update your release version, tag it and push to github
68
+ version_requirements: *2173364180
69
+ description: set of rake tasks that allow you to update your release version, tag
70
+ it and push to github
90
71
  email: john.mcaliley@gmail.com
91
72
  executables: []
92
-
93
73
  extensions: []
94
-
95
- extra_rdoc_files:
74
+ extra_rdoc_files:
96
75
  - LICENSE.txt
97
76
  - README.rdoc
98
- files:
77
+ files:
99
78
  - .document
100
79
  - Gemfile
101
80
  - Gemfile.lock
@@ -110,38 +89,32 @@ files:
110
89
  - lib/versionator/railties/versionator.rake
111
90
  - lib/versionator/version.rb
112
91
  - versionator.gemspec
113
- has_rdoc: true
114
92
  homepage: http://github.com/charlotte-ruby/versionator
115
- licenses:
93
+ licenses:
116
94
  - MIT
117
95
  post_install_message:
118
96
  rdoc_options: []
119
-
120
- require_paths:
97
+ require_paths:
121
98
  - lib
122
- required_ruby_version: !ruby/object:Gem::Requirement
99
+ required_ruby_version: !ruby/object:Gem::Requirement
123
100
  none: false
124
- requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- hash: 257450501227032483
128
- segments:
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ segments:
129
106
  - 0
130
- version: "0"
131
- required_rubygems_version: !ruby/object:Gem::Requirement
107
+ hash: -1753993591317228235
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
109
  none: false
133
- requirements:
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- segments:
137
- - 0
138
- version: "0"
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
139
114
  requirements: []
140
-
141
115
  rubyforge_project:
142
- rubygems_version: 1.3.7
116
+ rubygems_version: 1.8.10
143
117
  signing_key:
144
118
  specification_version: 3
145
119
  summary: versioning for your Rails 3 app
146
120
  test_files: []
147
-