Class: Bueller::Commands::Version::Base

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

Direct Known Subclasses

BumpMajor, BumpMinor, BumpPatch, Write

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bueller) ⇒ Base

Returns a new instance of Base.



16
17
18
# File 'lib/bueller/commands/version/base.rb', line 16

def initialize(bueller)
  @bueller = bueller
end

Instance Attribute Details

#buellerObject (readonly)

Returns the value of attribute bueller.



14
15
16
# File 'lib/bueller/commands/version/base.rb', line 14

def bueller
  @bueller
end

#gemspecObject

Returns the value of attribute gemspec.



13
14
15
# File 'lib/bueller/commands/version/base.rb', line 13

def gemspec
  @gemspec
end

#version_helperObject

Returns the value of attribute version_helper.



13
14
15
# File 'lib/bueller/commands/version/base.rb', line 13

def version_helper
  @version_helper
end

Class Method Details

.run_for(bueller) ⇒ Object



7
8
9
10
11
# File 'lib/bueller/commands/version/base.rb', line 7

def self.run_for(bueller)
  command = new bueller
  command.run
  command
end

Instance Method Details

#commitObject



23
# File 'lib/bueller/commands/version/base.rb', line 23

def commit; bueller.commit; end

#commit_versionObject



39
40
41
42
43
44
45
# File 'lib/bueller/commands/version/base.rb', line 39

def commit_version
  if repo and commit
    repo.add gemspec_helper.path
    repo.add version_helper.path
    repo.commit "Version bump to #{version_helper.to_s}"
  end
end

#gemspec_helperObject



21
# File 'lib/bueller/commands/version/base.rb', line 21

def gemspec_helper; bueller.gemspec_helper; end

#repoObject



22
# File 'lib/bueller/commands/version/base.rb', line 22

def repo; bueller.repo; end

#runObject



25
26
27
28
29
30
31
32
33
# File 'lib/bueller/commands/version/base.rb', line 25

def run
  update_version

  gemspec_helper.set_date
  gemspec_helper.write
  version_helper.write_version

  commit_version
end

#update_versionObject



35
36
37
# File 'lib/bueller/commands/version/base.rb', line 35

def update_version
  raise "Subclasses should implement this"
end