Class: Jeweler::Commands::Version::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/jeweler/commands/version/base.rb

Direct Known Subclasses

BumpMajor, BumpMinor, BumpPatch, Write

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commitObject

Returns the value of attribute commit.



6
7
8
# File 'lib/jeweler/commands/version/base.rb', line 6

def commit
  @commit
end

#gemspecObject

Returns the value of attribute gemspec.



6
7
8
# File 'lib/jeweler/commands/version/base.rb', line 6

def gemspec
  @gemspec
end

#repoObject

Returns the value of attribute repo.



6
7
8
# File 'lib/jeweler/commands/version/base.rb', line 6

def repo
  @repo
end

#version_helperObject

Returns the value of attribute version_helper.



6
7
8
# File 'lib/jeweler/commands/version/base.rb', line 6

def version_helper
  @version_helper
end

Class Method Details

.build_for(jeweler) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/jeweler/commands/version/base.rb', line 29

def self.build_for(jeweler)
  command = new
  command.repo = jeweler.repo
  command.version_helper = jeweler.version_helper
  command.gemspec = jeweler.gemspec
  command.commit = jeweler.commit

  command
end

Instance Method Details

#commit_versionObject



21
22
23
24
25
26
# File 'lib/jeweler/commands/version/base.rb', line 21

def commit_version
  if self.repo
    self.repo.add(version_helper.path)
    self.repo.commit("Version bump to #{self.version_helper.to_s}")
  end
end

#runObject



8
9
10
11
12
13
14
15
# File 'lib/jeweler/commands/version/base.rb', line 8

def run
  update_version

  self.version_helper.write
  self.gemspec.version = self.version_helper.to_s

  commit_version if self.repo && self.commit
end

#update_versionObject



17
18
19
# File 'lib/jeweler/commands/version/base.rb', line 17

def update_version
  raise "Subclasses should implement this"
end