class EnginePack::PackageConfig

Attributes

config[R]
path[R]

Public Class Methods

new(package_path) click to toggle source
# File lib/engine_pack/package_config.rb, line 7
def initialize(package_path)
  @path = package_path

  raise ArgumentError, "#{package_path} does not have a package.json file." unless File.exist?(config_path)

  @config = JSON.parse(File.read(config_path))
end

Public Instance Methods

package_files_paths() click to toggle source
# File lib/engine_pack/package_config.rb, line 15
def package_files_paths
  specified_files.map { |f| "#{path}/#{f}" }.tap do |paths|
    paths << config_path unless paths.include?(config_path)
  end
end

Private Instance Methods

config_path() click to toggle source
# File lib/engine_pack/package_config.rb, line 25
def config_path
  "#{path}/package.json"
end
specified_files() click to toggle source
# File lib/engine_pack/package_config.rb, line 29
def specified_files
  config.fetch('files', [])
end