Sha256: 4677b8a0a96c6ec3ee2ce6ca302b456bd8e4c71daac0baede2208446f21fc5c7
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true require "bundler" require "bundler/cli" require "refinements/pathnames" module Rubysmith module Builders # Builds Bundler Gemfile configuration and installs gem dependencies for project skeleton. class Bundler using Refinements::Pathnames def self.call(...) = new(...).call def initialize configuration, builder: Builder, client: ::Bundler::CLI @configuration = configuration @builder = builder @client = client end def call builder.call(configuration.with(template_path: "%project_name%/Gemfile.erb")) .render .replace(/\n\s+group/, "\n\ngroup") .replace(/\n\s+gem/, "\n gem") .replace(/ (?=.+(refinements|zeitwerk))/, "") .replace(/(\n+|\s+)end/, "\nend") .replace(/\n\ngroup :(code_quality|test|tools) do\nend/, "") .replace(/org"\n+/, "org\"\n\n") configuration.project_root.change_dir { client.start %w[install --quiet] } nil end private attr_reader :configuration, :builder, :client end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubysmith-0.13.0 | lib/rubysmith/builders/bundler.rb |
rubysmith-0.12.0 | lib/rubysmith/builders/bundler.rb |