Sha256: e3588b1b636774b8fe537b8ed24695bce580f5ee9728b59605cf2f0df96b7587
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
# frozen_string_literal: true module Rubysmith module Builders # Builds project skeleton documentation. class Documentation def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call def initialize configuration, builder: Builder @configuration = configuration @builder = builder end def call return unless configuration.build_documentation private_methods.sort.grep(/render_/).each { |method| __send__ method } end private attr_reader :configuration, :builder def render_changes builder.call(configuration.with(template_path: "%project_name%/CHANGES.#{kind}.erb")) .render end def render_conduct configuration.with(template_path: "%project_name%/CODE_OF_CONDUCT.#{kind}.erb") .then { |updated_configuration| builder.call(updated_configuration).render } end def render_contributions builder.call(configuration.with(template_path: "%project_name%/CONTRIBUTING.#{kind}.erb")) .render end def render_license configuration.with(template_path: "%project_name%/LICENSE-#{license}.#{kind}.erb") .then do |updated_configuration| builder.call(updated_configuration).render.rename "LICENSE.#{kind}" end end def render_readme builder.call(configuration.with(template_path: "%project_name%/README.#{kind}.erb")) .render .replace("\n\n\n", "\n\n") end def kind = configuration.documentation_format || "md" def license = configuration.documentation_license || "mit" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubysmith-0.11.0 | lib/rubysmith/builders/documentation.rb |
rubysmith-0.10.0 | lib/rubysmith/builders/documentation.rb |