Sha256: fd63f25e905d13ce6ac7acd819452c07153f043a7c2bc5b330d8fb8eb00e7e73

Contents?: true

Size: 951 Bytes

Versions: 4

Compression:

Stored size: 951 Bytes

Contents

# frozen_string_literal: true

module RSGem
  module Dependencies
    class Base
      attr_reader :config_file_destination, :config_file_source, :mode, :name, :version

      def initialize(config_file_source: nil, config_file_destination: nil, mode: :development,
                     name:, version: nil)
        @config_file_source = config_file_source
        @config_file_destination = config_file_destination
        @mode = mode # Either `development' or `runtime'
        @name = name
        @version = version ? "'#{version}'" : nil
      end

      def install(context)
        if config_file_source
          File.open("#{context.folder_path}/#{config_file_destination}", 'w') do |file|
            file.puts config_file_source_content
          end
        end

        puts "\t#{name.capitalize} installed"
      end

      private

      def config_file_source_content
        File.read(config_file_source)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rsgem-0.1.3 lib/rsgem/dependencies/base.rb
rsgem-0.1.2 lib/rsgem/dependencies/base.rb
rsgem-0.1.1 lib/rsgem/dependencies/base.rb
rsgem-0.1.0 lib/rsgem/dependencies/base.rb