Sha256: 233508ea2be2d03dc3783621adb8b8bf0695bfc7066152c64285ea49a178ed60
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true require "refinements/string" require "refinements/struct" module Rubysmith module Builders # Builds project skeleton core structure and minimum file support. class Core < Abstract using Refinements::String using Refinements::Struct def call render_implementation render_specification configuration end private def render_implementation builder.call(configuration.merge(template_path: "%project_name%/lib/%project_path%.rb.erb")) .render .replace(" require", "require") .replace(/ (?=(Zeit|loader|end))/, "") .replace("\n \n", "\n\n") .insert_before("module #{module_name}", "#{indentation}# Main namespace.\n") end def render_specification return unless configuration.build_zeitwerk path = "%project_name%/spec/lib/%project_path%_spec.rb.erb" builder.call(configuration.merge(template_path: path)).render end def indentation = ::Core::EMPTY_STRING.indent configuration.project_levels def module_name = configuration.project_class end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubysmith-6.10.0 | lib/rubysmith/builders/core.rb |
rubysmith-6.9.0 | lib/rubysmith/builders/core.rb |