Class: Gemsmith::Generators::Documentation

Inherits:
Base
  • Object
show all
Defined in:
lib/gemsmith/generators/documentation.rb

Overview

Generates documentation support.

Instance Method Summary collapse

Methods inherited from Base

#initialize, run

Constructor Details

This class inherits a constructor from Gemsmith::Generators::Base

Instance Method Details

#create_filesObject



9
10
11
12
13
14
15
# File 'lib/gemsmith/generators/documentation.rb', line 9

def create_files
  cli.template "%gem_name%/README.md.tt", configuration
  cli.template "%gem_name%/CONTRIBUTING.md.tt", configuration
  cli.template "%gem_name%/CODE_OF_CONDUCT.md.tt", configuration
  cli.template "%gem_name%/LICENSE.md.tt", configuration
  cli.template "%gem_name%/CHANGES.md.tt", configuration
end

#runObject



22
23
24
25
# File 'lib/gemsmith/generators/documentation.rb', line 22

def run
  create_files
  update_readme
end

#update_readmeObject



17
18
19
20
# File 'lib/gemsmith/generators/documentation.rb', line 17

def update_readme
  file = File.join cli.destination_root, configuration.dig(:gem, :name), "README.md"
  Tocer::Writer.new(file).write
end