Sha256: 16a22ce19617839b8b5bee6a8dea24450babf0a48c5f178b02e0bd4a35de1a8d

Contents?: true

Size: 891 Bytes

Versions: 2

Compression:

Stored size: 891 Bytes

Contents

# frozen_string_literal: true

require "refinements/struct"

module Hanamismith
  module Builders
    # Builds project skeleton setup script.
    class Setup < Rubysmith::Builders::Setup
      using Refinements::Struct

      def call
        return false unless settings.build_setup

        super
        append
        true
      end

      private

      def append
        builder.call(settings.merge(template_path: "%project_name%/bin/setup.erb"))
               .insert_after(%(Runner.call "bundle install"\n), <<~CONTENT.gsub(/^(?=\w)/, "  "))

                 puts "Installing packages..."
                 Runner.call "npm install"

                 puts "Configuring databases..."
                 Runner.call "hanami db prepare"

                 puts "Compiling assets..."
                 Runner.call "hanami assets compile"
               CONTENT
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hanamismith-0.50.0 lib/hanamismith/builders/setup.rb
hanamismith-0.49.1 lib/hanamismith/builders/setup.rb