stimpack 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51aa29c2b4753868e002f2317fa395fe14daee1f534fddea2d04eeae81feb6fe
4
- data.tar.gz: 44ca94cec6bad72328db16adfb5c809c4b0f0f630bfb33ecdc9be2492cc1270a
3
+ metadata.gz: 8a182ce65cfc7f331c0b8aab98cb9f66f74e24b2892f07759b6fc0663d2ed9d2
4
+ data.tar.gz: cfbdf8284d0b3c054c2708bd69bfc0eb63341044e93ca064cf9971b17e391a06
5
5
  SHA512:
6
- metadata.gz: 297365c1a65d1f4e783c7ec9a13b764904eb45ef4f083516d85288b7bfdbd45d69b576c0756449d207e721c7be5a91d3e965985fa2517db6efa864ddb323e7a1
7
- data.tar.gz: a2f6604cdf86b588f290b6c1b503e8883fecbbb6083a21fd03d6e815596fcada6f90c5d49cd929030f39c248cbaf32d1b1ddb7d0bb3be11493b183372f34f149
6
+ metadata.gz: 7dfc2c8a19b50159cddb6f5ace4a593e8f69d8719ee607c3994fed1b1541cfb639fa1bba1bb458eff632487cf65e84181899bd3c3343192ddd5f03abd6f8bd7a
7
+ data.tar.gz: 1c7f5dce375f55b6733ac771d86f3799aa408335e0d17b11cff6c9e7d47e7ff6d53ccd54c5f944419bad9a9eda2a0c2146c4048dcf26ff643e056119302fb66c
@@ -3,11 +3,10 @@
3
3
  module Stimpack
4
4
  class Pack
5
5
  class Configuration
6
- FILE = "package.yml"
7
6
  KEY = "metadata"
8
7
 
9
- def initialize(pack)
10
- @pack = pack
8
+ def initialize(path)
9
+ @path = path
11
10
  end
12
11
 
13
12
  def engine
@@ -18,7 +17,7 @@ module Stimpack
18
17
  private
19
18
 
20
19
  def data
21
- @data ||= YAML.load_file(@pack.path.join(FILE)).fetch(KEY, {}).freeze
20
+ @data ||= YAML.load_file(@path).fetch(KEY, {}).freeze
22
21
  end
23
22
  end
24
23
  end
data/lib/stimpack/pack.rb CHANGED
@@ -2,12 +2,18 @@
2
2
 
3
3
  module Stimpack
4
4
  class Pack
5
+ PACKAGE_FILE = "package.yml"
6
+
5
7
  autoload :Configuration, "stimpack/pack/configuration"
6
8
 
7
9
  attr_reader :name
8
10
  attr_reader :path
9
11
  attr_reader :engine
10
12
 
13
+ def self.create(path)
14
+ new(path) if path.join(PACKAGE_FILE).exist?
15
+ end
16
+
11
17
  def initialize(path)
12
18
  @path = path
13
19
  @name = path.relative_path_from(Packs.root)
@@ -22,7 +28,7 @@ module Stimpack
22
28
  end
23
29
 
24
30
  def config
25
- @config ||= Configuration.new(self)
31
+ @config ||= Configuration.new(path.join(PACKAGE_FILE))
26
32
  end
27
33
 
28
34
  private
@@ -14,7 +14,7 @@ module Stimpack
14
14
  def resolve
15
15
  # Gather all the packs under the root directory and create packs.
16
16
  root.children.select(&:directory?).sort!.each do |path|
17
- pack = Pack.new(path)
17
+ next unless pack = Pack.create(path)
18
18
  @packs[pack.name] = pack
19
19
  end
20
20
  @packs.freeze
@@ -1,3 +1,3 @@
1
1
  module Stimpack
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ngan Pham