Class: Buildr::Release

Inherits:
Object show all
Defined in:
lib/buildr/core/build.rb

Overview

:nodoc:

Direct Known Subclasses

GitRelease, SvnRelease

Constant Summary collapse

THIS_VERSION_PATTERN =
/(THIS_VERSION|VERSION_NUMBER)\s*=\s*(["'])(.*)\2/

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.commit_messageObject

Use this to specify a different commit message to commit the buildfile with the next version in source control. You can set the commit message or a proc that will be called with the next version number, for example:

Release.commit_message = lambda { |ver| "Changed version number to #{ver}" }


240
241
242
# File 'lib/buildr/core/build.rb', line 240

def commit_message
  @commit_message
end

.tag_nameObject

Use this to specify a different tag name for tagging the release in source control. You can set the tag name or a proc that will be called with the version number, for example:

Release.tag_name = lambda { |ver| "foo-#{ver}" }


234
235
236
# File 'lib/buildr/core/build.rb', line 234

def tag_name
  @tag_name
end

Class Method Details

.add(release) ⇒ Object Also known as: <<

:call-seq:

add(MyReleaseClass)

Add a Release implementation to the list of available Release classes.



246
247
248
249
# File 'lib/buildr/core/build.rb', line 246

def add(release)
  @list ||= []
  @list |= [release]
end

.findObject

Finds and returns the Release instance for this project.



258
259
260
261
262
263
264
# File 'lib/buildr/core/build.rb', line 258

def find
  unless @release
    klass = list.detect { |impl| impl.applies_to? }
    @release = klass.new if klass
  end
  @release
end

.listObject

The list of supported Release implementations



253
254
255
# File 'lib/buildr/core/build.rb', line 253

def list
  @list ||= []
end

Instance Method Details

#extract_versionObject

:call-seq:

extract_version() => this_versin

Extract the current version number from the buildfile. Raise an error if not found.



289
290
291
292
293
294
# File 'lib/buildr/core/build.rb', line 289

def extract_version
  buildfile = File.read(Buildr.application.buildfile.to_s)
  buildfile.scan(THIS_VERSION_PATTERN)[0][2]
rescue
  fail 'Looking for THIS_VERSION = "..." in your Buildfile, none found'
end

#makeObject

:call-seq:

make()

Make a release.



272
273
274
275
276
277
278
279
280
281
282
# File 'lib/buildr/core/build.rb', line 272

def make
  check
  with_release_candidate_version do |release_candidate_buildfile|
    args = '-S', 'buildr', "_#{Buildr::VERSION}_", '--buildfile', release_candidate_buildfile
    args << '--environment' << Buildr.environment unless Buildr.environment.to_s.empty?
    args << 'clean' << 'upload' << 'DEBUG=no'
    ruby *args 
  end
  tag_release resolve_tag
  update_version_to_next
end

#tag_name(tag_proc) ⇒ Object

Use this to specify a different tag name for tagging the release in source control. You can set the tag name or a proc that will be called with the version number, for example:

Release.find.tag_name = lambda { |ver| "foo-#{ver}" }

Deprecated: you should use Release.tag_name instead



301
302
303
304
# File 'lib/buildr/core/build.rb', line 301

def tag_name(tag_proc)
  warn("Release.find.tag_name is deprecated. You should use Release.tag_name instead")
  Release.tag_name(tag_proc)
end