Module: Releasetool::Util

Included in:
Release, Release
Defined in:
lib/releasetool/util.rb

Constant Summary collapse

DIR =
"release_notes"
TEMPLATE_FILE =

relative to DIR

"__TEMPLATE__.md"
RELEASE_MARKER_FILE =

should be a config var

".RELEASE_NEW_VERSION"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.version_fileObject



12
13
14
15
# File 'lib/releasetool/util.rb', line 12

def self.version_file
  # rails out of box
  ENV['RELEASETOOL_VERSION_FILE'] || "config/initializers/00-version.rb"
end

Instance Method Details

#configReleasetool::Configuration



41
42
43
# File 'lib/releasetool/util.rb', line 41

def config
  @config ||= Releasetool::Configuration.new
end

#guarded_capture(command) ⇒ Object

Raises:

  • (Thor::Error)


32
33
34
35
36
37
38
# File 'lib/releasetool/util.rb', line 32

def guarded_capture(command)
  puts command
  output = `#{command}`
  raise Thor::Error.new("Couldn't '#{command}'") unless $CHILD_STATUS

  output
end

#guarded_system(command) ⇒ Object



27
28
29
30
# File 'lib/releasetool/util.rb', line 27

def guarded_system(command)
  puts command
  system(command) or raise Thor::Error.new("Couldn't '#{command}'")
end

#remove_stored_versionObject



23
24
25
# File 'lib/releasetool/util.rb', line 23

def remove_stored_version
  guarded_system("rm #{RELEASE_MARKER_FILE}") if File.exist?(RELEASE_MARKER_FILE)
end

#stored_versionObject



17
18
19
20
21
# File 'lib/releasetool/util.rb', line 17

def stored_version
  fail Thor::Error.new("No stored version... did you forget to do release start?") unless File.exist?(RELEASE_MARKER_FILE)

  File.read(RELEASE_MARKER_FILE).strip
end