Class: GemKit::Release::Generators::Setup

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/gem_kit/release/generators/setup.rb

Overview

gem kit setup — a Thor generator, which is what Rails' own generators are. Using one rather than hand-rolled File.write buys the whole conflict protocol for free: create/identical/conflict status lines, a prompt offering diff/overwrite/skip when a file exists and differs, and --force / --skip / --pretend to answer that prompt ahead of time.

It writes the two documents that describe this toolchain, rendered for the project's own name and versions. They are copies rather than links because a policy nobody can read in their own repo is a policy nobody follows, and because the examples are worth more with real numbers in them.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

Written into the project, not the working directory: gem kit setup run from a subdirectory still belongs to the gem.



39
# File 'lib/gem_kit/release/generators/setup.rb', line 39

def self.banner = "gem kit setup"

.source_rootObject



33
34
35
# File 'lib/gem_kit/release/generators/setup.rb', line 33

def self.source_root
  File.expand_path("../templates", __dir__)
end

Instance Method Details

#deprecations_documentObject

The policy is the repository's — one deprecation policy governs every gem in it — so DEPRECATIONS.md is written once, whichever gem you named.



44
45
46
# File 'lib/gem_kit/release/generators/setup.rb', line 44

def deprecations_document
  template("DEPRECATIONS.md.erb", File.join(project.root, "DEPRECATIONS.md"))
end

#release_documentObject

The process is the gem's: every command in it names a version and a changelog belonging to one gem. So a repository with two gems gets RELEASE-.md apiece, matching the changelogs.



51
52
53
# File 'lib/gem_kit/release/generators/setup.rb', line 51

def release_document
  template("RELEASE.md.erb", File.join(project.root, release_document_name))
end


55
56
57
58
# File 'lib/gem_kit/release/generators/setup.rb', line 55

def where_to_link_them
  say ""
  say "Link them from your README and AGENTS.md so they are found."
end