buildar 0.3.0.3 → 0.3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/rakefile.rb +34 -7
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1.1
|
data/rakefile.rb
CHANGED
@@ -62,6 +62,11 @@ module Buildar
|
|
62
62
|
def self.bump(position, version)
|
63
63
|
pos = [:major, :minor, :patch, :build].index(position) || position
|
64
64
|
places = version.split('.')
|
65
|
+
if pos >= places.length and pos <= places.length + 2
|
66
|
+
# add zeroes to places up to pos
|
67
|
+
# allows bump(:build, '0') #=> '0.0.0.1'
|
68
|
+
places.length.upto(pos) { |i| places[i] = 0 }
|
69
|
+
end
|
65
70
|
raise "bad position: #{pos} (for version #{version})" unless places[pos]
|
66
71
|
places.map.with_index { |place, i|
|
67
72
|
if i < pos
|
@@ -81,24 +86,31 @@ end
|
|
81
86
|
#
|
82
87
|
#
|
83
88
|
|
84
|
-
# task :test runs your test files
|
89
|
+
# i.e. task :test, runs your test files
|
85
90
|
#
|
86
91
|
Rake::TestTask.new :test do |t|
|
87
92
|
t.pattern = 'test/*.rb' # FIX for your layout
|
88
93
|
end
|
89
94
|
|
95
|
+
# display project name and version
|
96
|
+
#
|
90
97
|
task :version do
|
91
98
|
puts "#{Buildar::PROJECT_NAME} #{Buildar.version}"
|
92
99
|
end
|
93
100
|
|
101
|
+
# make sure ENV['message'] is populated
|
102
|
+
#
|
94
103
|
task :message do
|
95
104
|
unless ENV['message']
|
96
|
-
|
97
|
-
print "> "
|
105
|
+
print "Enter a one-line message:\n> "
|
98
106
|
ENV['message'] = $stdin.gets.chomp
|
99
107
|
end
|
100
108
|
end
|
101
109
|
|
110
|
+
# if USE_GIT:
|
111
|
+
# create annotated git tag based on VERSION and ENV['message'] if available
|
112
|
+
# push tags to origin
|
113
|
+
#
|
102
114
|
task :tag => [:test] do
|
103
115
|
if Buildar::USE_GIT
|
104
116
|
message = ENV['message'] || "auto-tagged #{tagname} by Rake"
|
@@ -107,18 +119,26 @@ task :tag => [:test] do
|
|
107
119
|
end
|
108
120
|
end
|
109
121
|
|
122
|
+
# display Buildar's understanding of the MANIFEST.txt file
|
123
|
+
#
|
110
124
|
task :manifest do
|
111
125
|
puts Buildar.manifest.join("\n")
|
112
126
|
end
|
113
127
|
|
128
|
+
# roughly equivalent to `gem build foo.gemspec`
|
129
|
+
# places .gem file in pkg/
|
130
|
+
#
|
114
131
|
task :build => [:test, :bump_build] do
|
115
|
-
#
|
132
|
+
# definine the task at runtime, rather than requiretime
|
116
133
|
# so that the gemspec will reflect any version bumping since requiretime
|
117
134
|
#
|
118
135
|
Gem::PackageTask.new(Buildar.gemspec).define
|
119
136
|
Rake::Task["package"].invoke
|
120
137
|
end
|
121
138
|
|
139
|
+
# e.g. task :bump_build, with VERSION 1.2.3.4, updates VERSION to 1.2.3.5
|
140
|
+
# if USE_GIT and GIT_COMMIT_VERSION: add VERSION and commit
|
141
|
+
#
|
122
142
|
[:major, :minor, :patch, :build].each { |v|
|
123
143
|
task "bump_#{v}" do
|
124
144
|
old_version = Buildar.version
|
@@ -131,8 +151,13 @@ end
|
|
131
151
|
end
|
132
152
|
end
|
133
153
|
}
|
154
|
+
|
155
|
+
# not used internally, but if the user wants a bump, make it a patch
|
156
|
+
#
|
134
157
|
task :bump => [:bump_patch]
|
135
158
|
|
159
|
+
# just make sure the ~/.gem/credentials file is readable
|
160
|
+
#
|
136
161
|
task :verify_publish_credentials do
|
137
162
|
if Buildar::PUBLISH[:rubygems]
|
138
163
|
creds = '~/.gem/credentials'
|
@@ -142,6 +167,9 @@ task :verify_publish_credentials do
|
|
142
167
|
end
|
143
168
|
end
|
144
169
|
|
170
|
+
|
171
|
+
# roughly, gem push foo-VERSION.gem
|
172
|
+
#
|
145
173
|
task :publish => [:verify_publish_credentials] do
|
146
174
|
if Buildar::PUBLISH[:rubygems]
|
147
175
|
fragment = "-#{Buildar.version}.gem"
|
@@ -160,12 +188,11 @@ task :publish => [:verify_publish_credentials] do
|
|
160
188
|
end
|
161
189
|
end
|
162
190
|
|
191
|
+
# if USE_GIT: git push origin
|
192
|
+
#
|
163
193
|
task :gitpush do
|
164
194
|
# may prompt
|
165
195
|
sh "git push origin" if Buildar::USE_GIT
|
166
|
-
# this kills the automation
|
167
|
-
# use key-based auth?
|
168
|
-
# consider a timeout?
|
169
196
|
end
|
170
197
|
|
171
198
|
task :release => [:message, :build, :tag, :publish, :gitpush]
|