Sha256: 61a698d021df7fa097864e7e6096c15dea5c6f7c1bc2f1eb0aeda3769392a886
Contents?: true
Size: 1.1 KB
Versions: 9
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true require "refinements/strings" require "refinements/structs" module Rubysmith module Builders # Builds project skeleton core structure and minimum file support. class Core using Refinements::Strings using Refinements::Structs def self.call(...) = new(...).call def initialize configuration, builder: Builder @configuration = configuration @builder = builder end def call 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") .replace("end\n end", " end\n end") configuration end private def indentation = ::Core::EMPTY_STRING.indent configuration.project_levels def module_name = configuration.project_class attr_reader :configuration, :builder end end end
Version data entries
9 entries across 9 versions & 1 rubygems