cosing 0.1.0 → 0.1.2

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: 4c1d24a9645d88deb596a2e1be49ed985f87ff340581bb80b105944a1b85683c
4
- data.tar.gz: dc7ba8882733e0826751ba07ff486e06b5b153edbde606b2cf37558cb3e45e63
3
+ metadata.gz: f8245d14649aa663ff0ca0040225bc053ed852f7c031aa3bb47f79ca56661053
4
+ data.tar.gz: e781a56530b98ae057254e5a8d1519ed0a0ba92bf92f31bc40e48e71ff9d4576
5
5
  SHA512:
6
- metadata.gz: ce698dfb511c4054ba58a7781ad0bd6d404b12d6006b58cfe3239386f4c279dde97db90dcf6012dec02a4b6f87b3b29d613d80656aa3180be2f3dc15c9c5ab9b
7
- data.tar.gz: 913dc114a5948ece59fcb6dccdc4071d5ab59cd9a68d119f6d929d66c818e7031d3159af61cf71a385677374ef37a99a44a69173c9ea7a9ddd75b39186717255
6
+ metadata.gz: dbf059495373b414a5a369b8e099b02809c2f977eb34263802c984841a640994489c75448df2c39c0e963fcdc0cd9ce8a071b635206c268b5aecf93754ce8c02
7
+ data.tar.gz: 686d2f6b59dea8a9d110cff1e2fe0aa711b1c8265d7922968425a741d6f2f7762c8942954b28d134df85621e3e755e7baeaa56293dc4ce127b5ab04dafb105d5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.2] - 2023-12-03
4
+
5
+ - Fixes missing pathname require
6
+
7
+ ## [0.1.1] - 2023-12-03
8
+
9
+ - Fixes gem paths
10
+
3
11
  ## [0.1.0] - 2023-12-03
4
12
 
5
13
  - Initial release
data/lib/cosing/annex.rb CHANGED
@@ -15,7 +15,7 @@ module Cosing
15
15
 
16
16
  def parse(path)
17
17
  CSV.parse(
18
- File.read(path),
18
+ File.read(Cosing.gem_path(path)),
19
19
  headers: true,
20
20
  liberal_parsing: true,
21
21
  header_converters: :symbol
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cosing
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/cosing.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "csv"
4
4
  require "json"
5
+ require "pathname"
5
6
  require "dry/types"
6
7
  require "dry/struct"
7
8
  require_relative "cosing/version"
@@ -13,12 +14,15 @@ require_relative "cosing/database"
13
14
  module Cosing
14
15
  module_function
15
16
 
17
+ GEM_ROOT = File.expand_path("..", __dir__)
18
+
16
19
  class Error < StandardError; end
17
20
  # Your code goes here...
18
21
 
19
22
  def load
20
23
  Database.new(Annex.load).tap do |database|
21
- ingredient_file = File.read("data/ingredients.csv").delete("\r")
24
+ path = gem_path("data/ingredients.csv")
25
+ ingredient_file = File.read(path).delete("\r")
22
26
 
23
27
  CSV.parse(
24
28
  ingredient_file,
@@ -36,4 +40,8 @@ module Cosing
36
40
  end
37
41
  end
38
42
  end
43
+
44
+ def gem_path(path)
45
+ Pathname.new(GEM_ROOT).join(path)
46
+ end
39
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nolan J Tait