Class: JewelerStyleVersioning::Commands::Version::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/jeweler_style_versioning/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

#base_dirObject

Returns the value of attribute base_dir.



8
9
10
# File 'lib/jeweler_style_versioning/commands/version/base.rb', line 8

def base_dir
  @base_dir
end

#version_helperObject

Returns the value of attribute version_helper.



8
9
10
# File 'lib/jeweler_style_versioning/commands/version/base.rb', line 8

def version_helper
  @version_helper
end

Class Method Details

.build_for(jeweler) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/jeweler_style_versioning/commands/version/base.rb', line 32

def self.build_for(jeweler)
  command = new
  command.version_helper = jeweler.version_helper
  command.base_dir = jeweler.base_dir

  command
end

Instance Method Details

#base_dir_pathObject



27
28
29
# File 'lib/jeweler_style_versioning/commands/version/base.rb', line 27

def base_dir_path
  Pathname.new(base_dir).realpath
end

#runObject



10
11
12
13
14
# File 'lib/jeweler_style_versioning/commands/version/base.rb', line 10

def run
  update_version

  self.version_helper.write
end

#update_versionObject



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

def update_version
  raise "Subclasses should implement this"
end

#working_subdirObject



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

def working_subdir
  return @working_subdir if @working_subdir
  cwd = base_dir_path
  @working_subdir = cwd.relative_path_from(Pathname.new(repo.dir.path))
  @working_subdir
end