datafile 0.2.3 → 0.2.4

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
  SHA1:
3
- metadata.gz: d39f9bca67fd30470e40bd1b4985594eb2697326
4
- data.tar.gz: 6e9fd82ae31c9507194dfd61e9d8112f66fdf0ea
3
+ metadata.gz: f9f0a43352a4989c9765d93fe542af5da3cbda95
4
+ data.tar.gz: c820968abf2f69166d53769bd751fd4148ea69b8
5
5
  SHA512:
6
- metadata.gz: 799c1587b0fea635d95d3cd28c0ed4fe0b6bfbdfbecf7b4805c126daded83e79791bdffc859adccb5c6321ccb4d336999ea915d9f2781ee4bd54cf14ff6fb6a3
7
- data.tar.gz: ff6a33747c7ee59fd3bc6d41b1aa277b36982f4e14a5df9fa802f86b270d6bd366e914dfa9c36001a982e5e2cbd8d3a329e0ad7a3bc37a1f440ac6e7efdc318c
6
+ metadata.gz: faa87526560edf1e71ea81f6bcef56ed69cae4a817feaedaa61d9245161f9c5aa9099659d2533b605db5c24e0248d3b3fe1ab22b976a916fb626505a12b568f7
7
+ data.tar.gz: 24e5c266da7b42fa76248c4f0a2e7e0b566117fd834ed299273602045fa688d55dbdcb82f9046b08af294e8bcf7134a8ea6588f061596441d80839889597d9db
@@ -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
 
@@ -4,7 +4,7 @@ module Datafile
4
4
 
5
5
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
6
6
  MINOR = 2
7
- PATCH = 3
7
+ PATCH = 4
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
@@ -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.3
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-06-08 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logutils