Sha256: 13939a28a29ef8129aabfaa6296e8ba37a207eca338cb0516b7eb3ccf880593f

Contents?: true

Size: 700 Bytes

Versions: 2

Compression:

Stored size: 700 Bytes

Contents

# frozen_string_literal: true

require "fileutils"

module Bootboot
  class Command < Bundler::Plugin::API
    def setup
      self.class.command("bootboot")
    end

    def exec(_cmd, _args)
      FileUtils.cp(GEMFILE_LOCK, GEMFILE_NEXT_LOCK)

      File.open(GEMFILE, "a+") do |f|
        f.write(<<~EOM)
          Plugin.send(:load_plugin, 'bootboot') if Plugin.installed?('bootboot')

          if ENV['#{Bootboot.env_next}']
            enable_dual_booting if Plugin.installed?('bootboot')

            # Add any gem you want here, they will be loaded only when running
            # bundler command prefixed with `#{Bootboot.env_next}=1`.
          end
        EOM
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootboot-0.2.2 lib/bootboot/command.rb
bootboot-0.2.1 lib/bootboot/command.rb