Class: EnginePack::PackageConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/engine_pack/package_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(package_path) ⇒ PackageConfig

Returns a new instance of PackageConfig.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
# 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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/engine_pack/package_config.rb', line 5

def path
  @path
end

Instance Method Details

#package_files_pathsObject



15
16
17
18
19
# 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