datafile 0.2.3 → 0.2.4
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/datafile/datafile.rb +17 -1
- data/lib/datafile/datasets/dataset.rb +25 -0
- data/lib/datafile/version.rb +1 -1
- data/lib/datafile/workers/file/dataset.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9f0a43352a4989c9765d93fe542af5da3cbda95
|
4
|
+
data.tar.gz: c820968abf2f69166d53769bd751fd4148ea69b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faa87526560edf1e71ea81f6bcef56ed69cae4a817feaedaa61d9245161f9c5aa9099659d2533b605db5c24e0248d3b3fe1ab22b976a916fb626505a12b568f7
|
7
|
+
data.tar.gz: 24e5c266da7b42fa76248c4f0a2e7e0b566117fd834ed299273602045fa688d55dbdcb82f9046b08af294e8bcf7134a8ea6588f061596441d80839889597d9db
|
data/lib/datafile/datafile.rb
CHANGED
@@ -58,7 +58,11 @@ class Datafile
|
|
58
58
|
|
59
59
|
# Note: return datafile (of course, NOT the builder)
|
60
60
|
# if you want a builder use Datafile::Builder ;-)
|
61
|
-
builder.datafile
|
61
|
+
datafile = builder.datafile
|
62
|
+
## check for auto-configure (just guessing)
|
63
|
+
## zip or file worker
|
64
|
+
datafile.guess_file_or_zip_worker
|
65
|
+
datafile
|
62
66
|
end
|
63
67
|
|
64
68
|
|
@@ -83,6 +87,18 @@ class Datafile
|
|
83
87
|
end
|
84
88
|
end
|
85
89
|
|
90
|
+
def guess_file_or_zip_worker ## change/rename to configure_file_or_zip_worker - why? why not??
|
91
|
+
## if opts file or zip exists do NOT change (assume set manually)
|
92
|
+
return if @opts[:file] || @opts[:zip]
|
93
|
+
|
94
|
+
## for now only change if single (just 1) dataset and it's present
|
95
|
+
if @datasets.size == 1 && @datasets[0].file?
|
96
|
+
puts " bingo!! assume (in-situ) datafile; use file workers"
|
97
|
+
@worker = FileWorker.new( self )
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
|
86
102
|
attr_reader :datasets
|
87
103
|
attr_reader :scripts ## calc(ulation) scripts (calc blocks)
|
88
104
|
attr_reader :inlines ## inline script blocks -- use before?? run before datasets
|
@@ -34,9 +34,34 @@ class Dataset
|
|
34
34
|
value = @opts[:setup] || 'all'
|
35
35
|
"setups/#{value}"
|
36
36
|
end
|
37
|
+
|
38
|
+
def file? # note: use file? (not exit? might use zip? later to check if zip exists? -why? why not?)
|
39
|
+
## hack/convenience shortcut:
|
40
|
+
## 1) check if dataset exists as local (in situ) file dataset
|
41
|
+
## e.g. working folder == name of dataset
|
42
|
+
##
|
43
|
+
## todo/fix: 2) also check
|
44
|
+
## via (file)registry - why, why not??
|
45
|
+
|
46
|
+
## split name in org/user + project (e.g. openfootball/at-austria)
|
47
|
+
parts = @name.split( '/' )
|
48
|
+
|
49
|
+
basename = parts[1]
|
50
|
+
## e.g.
|
51
|
+
## ./ (working folder) => at-austria
|
52
|
+
## openfootball/at-austria
|
53
|
+
if File.basename( Dir.getwd ) == basename
|
54
|
+
puts " bingo!! working folder >#{basename}< matches dataset"
|
55
|
+
true ## return true
|
56
|
+
else
|
57
|
+
false ## return false
|
58
|
+
end
|
59
|
+
end ## file?
|
60
|
+
|
37
61
|
end # class Dataset
|
38
62
|
|
39
63
|
|
64
|
+
|
40
65
|
class WorldDataset < Dataset
|
41
66
|
def initialize( name_easy, opts={} )
|
42
67
|
|
data/lib/datafile/version.rb
CHANGED
@@ -20,6 +20,17 @@ class FileDataset < DatasetNode
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def repo_dir ### check: use (rename to) include dir (or local_repo_dir) - why, why not ???
|
23
|
+
## note: for easy testing allow "in situ" datasets
|
24
|
+
## e.g. ./ (e.g. mu-mauritius) is openfootball/mu-mauritius
|
25
|
+
## split name in org/user + project (e.g. openfootball/at-austria)
|
26
|
+
parts = name.split( '/' )
|
27
|
+
|
28
|
+
basename = parts[1]
|
29
|
+
if File.basename( Dir.getwd ) == basename
|
30
|
+
puts " bingo!! working folder >#{basename}< matches dataset"
|
31
|
+
return Dir.getwd ## assume working directory/folder is repo dir
|
32
|
+
end
|
33
|
+
|
23
34
|
registry.lookup( name )
|
24
35
|
end
|
25
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datafile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logutils
|