Class: Rake::VersionTask

Inherits:
TaskLib
  • Object
show all
Defined in:
lib/rake/version_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename = 'VERSION') {|_self| ... } ⇒ VersionTask

Creates a new VersionTask with the given filename. Attempts to autodetect the filetype and whether or not git or hg is present.

Yields:

  • (_self)

Yield Parameters:



42
43
44
45
46
47
48
49
50
51
# File 'lib/rake/version_task.rb', line 42

def initialize(filename = 'VERSION')
  self.filename = filename
  self.with_git = File.exist?('.git')
  self.with_hg = File.exist?('.hg')
  self.with_svn = File.exist?('.svn')
  
  yield(self) if block_given?
  
  self.define
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



7
8
9
# File 'lib/rake/version_task.rb', line 7

def filename
  @filename
end

#filetypeObject

The filetype of the file to be generated. Is determined automatically if not set.



57
58
59
# File 'lib/rake/version_task.rb', line 57

def filetype
  @filetype || self.path.extname[1..-1]
end

#with_commit_messageObject

when set allows to override commit message



36
37
38
# File 'lib/rake/version_task.rb', line 36

def with_commit_message
  @with_commit_message
end

#with_gemspecObject

when set with a Gem::Specification, automatically emits an updated gemspec on version bumps



33
34
35
# File 'lib/rake/version_task.rb', line 33

def with_gemspec
  @with_gemspec
end

#with_gitObject

when true, commits version bumps automatically (default: autodetect)



11
12
13
# File 'lib/rake/version_task.rb', line 11

def with_git
  @with_git
end

#with_git_tagObject

when true, tags version bumps automatically (default: false)



14
15
16
# File 'lib/rake/version_task.rb', line 14

def with_git_tag
  @with_git_tag
end

#with_hgObject

when true, commits version bumps automatically (default: autodetect)



17
18
19
# File 'lib/rake/version_task.rb', line 17

def with_hg
  @with_hg
end

#with_hg_tagObject

when true, tags version bumps automatically (default: false)



20
21
22
# File 'lib/rake/version_task.rb', line 20

def with_hg_tag
  @with_hg_tag
end

#with_svnObject

when true, commits version bumps automatically (default: autodetect)



23
24
25
# File 'lib/rake/version_task.rb', line 23

def with_svn
  @with_svn
end

#with_svn_tagObject

when true, tags version bumps automatically if the current svn URL either ends in ‘<base>/trunk’ or ‘<base>/branches/<branch>’ by copying the current svn URL to the ‘<base>/tags/<version>’ (default: false)



29
30
31
# File 'lib/rake/version_task.rb', line 29

def with_svn_tag
  @with_svn_tag
end

Instance Method Details

#gemspecObject



61
62
63
# File 'lib/rake/version_task.rb', line 61

def gemspec
  Pathname("#{with_gemspec.name}.gemspec") if with_gemspec
end