Sha256: 56f359d426a01b75d60403b563f8b66160bd62933526cef30eea638440d75eee

Contents?: true

Size: 798 Bytes

Versions: 2

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

module RailsApp
  class Command
    attr_reader :app_name, :bundling, :assets

    def initialize(app_name:, assets:)
      @app_name = app_name
      @assets = assets
    end

    def template
      File.join(__dir__, "template", "template.rb")
    end

    def run
      command = "rails new #{@app_name} --no-rc #{skip_spring} #{asset_management} #{javascript_bundling} #{styling_framework} #{testing_framework} -m #{template}"
      system(command)
    end

    def skip_spring
      "--skip-spring"
    end

    def javascript_bundling
      "-j esbuild"
    end

    def asset_management
      "-a propshaft" unless assets == "sprockets"
    end

    def styling_framework
      "--css bootstrap"
    end

    def testing_framework
      "-T"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_app-0.2.0 lib/rails_app/command.rb
rails_app-0.1.0 lib/rails_app/command.rb