Class: Gemsmith::Rake::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/gemsmith/rake/build.rb

Overview

Provides gem build functionality. Meant to be wrapped in Rake tasks.

Instance Method Summary collapse

Constructor Details

#initialize(shell: Bundler::UI::Shell.new, kernel: Kernel) ⇒ Build

Returns a new instance of Build.



7
8
9
10
# File 'lib/gemsmith/rake/build.rb', line 7

def initialize shell: Bundler::UI::Shell.new, kernel: Kernel
  @shell = shell
  @kernel = kernel
end

Instance Method Details

#clean!Object



21
22
23
24
# File 'lib/gemsmith/rake/build.rb', line 21

def clean!
  FileUtils.rm_rf "pkg"
  shell.info "Gem artifacts cleaned."
end

#table_of_contentsObject



12
13
14
15
16
17
18
19
# File 'lib/gemsmith/rake/build.rb', line 12

def table_of_contents
  if kernel.system("command -v doctoc > /dev/null")
    kernel.system %(doctoc --title "# Table of Contents" README.md)
  else
    shell.error error_message
    kernel.exit 1
  end
end