Sha256: 24dd278dc6e399be88bec6a6bc4f241cf58ef929e90ea562e7cb2ec3d3095287

Contents?: true

Size: 769 Bytes

Versions: 6

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true

module Rubysmith
  module Builders
    # Builds project skeleton Rake support.
    class Rake
      def self.call(...) = new(...).call

      def initialize configuration, builder: Builder
        @configuration = configuration
        @builder = builder
      end

      def call
        return unless configuration.build_rake

        builder.call(configuration.with(template_path: "%project_name%/Rakefile.erb"))
               .render
               .replace(/\[\s+/, "[")
               .replace(/\s+\]/, "]")
               .replace("  ", "")
               .replace(/\n+(?=require)/, "\n")
               .replace(/\n{2,}/, "\n\n")
        nil
      end

      private

      attr_reader :configuration, :builder
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubysmith-0.16.1 lib/rubysmith/builders/rake.rb
rubysmith-0.16.0 lib/rubysmith/builders/rake.rb
rubysmith-0.15.0 lib/rubysmith/builders/rake.rb
rubysmith-0.14.0 lib/rubysmith/builders/rake.rb
rubysmith-0.13.0 lib/rubysmith/builders/rake.rb
rubysmith-0.12.0 lib/rubysmith/builders/rake.rb