lib/gemsmith/generators/documentation.rb in gemsmith-15.3.0 vs lib/gemsmith/generators/documentation.rb in gemsmith-15.4.0
- old
+ new
@@ -4,26 +4,33 @@
module Gemsmith
module Generators
# Generates documentation support.
class Documentation < Base
+ def initialize cli, configuration: {}, writer: Tocer::Writer.new
+ super cli, configuration: configuration
+ @writer = writer
+ end
+
def run
create_files
update_readme
end
private
+ attr_reader :writer
+
def create_files
template "%gem_name%/README.md.tt"
template "%gem_name%/CONTRIBUTING.md.tt"
template "%gem_name%/CODE_OF_CONDUCT.md.tt"
template "%gem_name%/LICENSE.md.tt"
template "%gem_name%/CHANGES.md.tt"
end
def update_readme
- gem_root.join("README.md").then { |path| Tocer::Writer.new(path).call }
+ gem_root.join("README.md").then { |path| writer.call path }
end
end
end
end