portable 1.0.0.pre.alpha.4 → 1.0.0.pre.alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/portable/data/provider.rb +8 -1
- data/lib/portable/version.rb +1 -1
- data/lib/portable/writers/base.rb +8 -0
- data/lib/portable/writers/csv.rb +0 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b9fa7e8020098fb9dd2d9e2c9c984e0d71ff0aa02d4f568879bb013ae65b8d4
|
4
|
+
data.tar.gz: 1e01f15d35797f4954b5a4861b6a8d44e54f3571fc81cd73c5ff2c08ac8ef550
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97d59eb7d25b5ea806d908995f8978c8f711d280bd9c8b1e2dd0c09ca173f1c2fcf132f828e2218c17f3637fc6d92e8f7e12b827212ae404c153b2c5722cbbeb
|
7
|
+
data.tar.gz: 3878dc2b2f38b9de6cc90c6644e3913379cecefd21adef98b35adf9cbcce3bf0fae4832491de6f3a063477b2d64416778c55e4f0383820cdfc75970d0ece5152
|
@@ -17,6 +17,8 @@ module Portable
|
|
17
17
|
include Uniqueness
|
18
18
|
acts_as_hashable
|
19
19
|
|
20
|
+
DEFAULT_NAME = ''
|
21
|
+
|
20
22
|
def initialize(data_sources: [])
|
21
23
|
sources = Source.array(data_sources)
|
22
24
|
@data_sources_by_name = pivot_by_name(sources)
|
@@ -26,8 +28,13 @@ module Portable
|
|
26
28
|
freeze
|
27
29
|
end
|
28
30
|
|
31
|
+
# Use exact name if possible, if not then use the "default" one (noted by a blank name).
|
32
|
+
# Fail hard if we cannot identify which data source to use. This should help prevent
|
33
|
+
# possible configuration issues (i.e. typos.)
|
29
34
|
def data_source(name)
|
30
|
-
data_sources_by_name
|
35
|
+
data_sources_by_name[name.to_s] ||
|
36
|
+
data_sources_by_name[DEFAULT_NAME] ||
|
37
|
+
raise(ArgumentError, "data source: '#{name}' cannot be found.")
|
31
38
|
end
|
32
39
|
|
33
40
|
private
|
data/lib/portable/version.rb
CHANGED
data/lib/portable/writers/csv.rb
CHANGED
@@ -67,12 +67,6 @@ module Portable
|
|
67
67
|
sheet.footer_rows.each { |row| csv << row }
|
68
68
|
end
|
69
69
|
|
70
|
-
def ensure_directory_exists(filename)
|
71
|
-
path = File.dirname(filename)
|
72
|
-
|
73
|
-
FileUtils.mkdir_p(path) unless File.exist?(path)
|
74
|
-
end
|
75
|
-
|
76
70
|
def extrapolate_filenames(filename, count)
|
77
71
|
dir = File.dirname(filename)
|
78
72
|
ext = File.extname(filename)
|