datafile 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -0
- data/lib/datafile.rb +1 -0
- data/lib/datafile/builder.rb +5 -0
- data/lib/datafile/datafile.rb +15 -0
- data/lib/datafile/datasets/beer.rb +18 -0
- data/lib/datafile/datasets/dataset.rb +3 -1
- data/lib/datafile/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8782dd8b936ebd15c057be430754b81935000a53
|
4
|
+
data.tar.gz: 6761a2f36be11909f9caf6ffbbe4645e2e30f440
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df27e034db8d08fc858bef78b83c6ae42b702879d1bb86edadd3fc514e43db4b0152b29a8fc48a4e8759fa2fb059189f61500f80edc1722cb1ef29ce3fb97c6e
|
7
|
+
data.tar.gz: 8b59c770f07f82a022c17b9b291ed09321db17a2b0a3f59ecd22683ba16b01adaa406e27d5051c5f7c2e91e0b72da267dc02cb986c3ef5ff12f3d589c2321fe6
|
data/Manifest.txt
CHANGED
data/lib/datafile.rb
CHANGED
@@ -9,6 +9,7 @@ require 'datafile/version' # let it always go first
|
|
9
9
|
|
10
10
|
require 'datafile/datasets/dataset'
|
11
11
|
require 'datafile/datasets/football'
|
12
|
+
require 'datafile/datasets/beer'
|
12
13
|
require 'datafile/datasets/world'
|
13
14
|
require 'datafile/datafile'
|
14
15
|
require 'datafile/builder'
|
data/lib/datafile/builder.rb
CHANGED
@@ -24,6 +24,11 @@ class Builder
|
|
24
24
|
end
|
25
25
|
|
26
26
|
|
27
|
+
def beer( name, opts={} )
|
28
|
+
logger.info( "[builder] add beer-dataset '#{name}'" )
|
29
|
+
@datafile.datasets << BeerDataset.new( name, opts )
|
30
|
+
end
|
31
|
+
|
27
32
|
def football( name, opts={} )
|
28
33
|
logger.info( "[builder] add football-dataset '#{name}'" )
|
29
34
|
@datafile.datasets << FootballDataset.new( name, opts )
|
data/lib/datafile/datafile.rb
CHANGED
@@ -8,6 +8,21 @@ class Datafile
|
|
8
8
|
|
9
9
|
attr_reader :datasets
|
10
10
|
|
11
|
+
|
12
|
+
## convenience method - use like Datafile.load_file()
|
13
|
+
def self.load_file( path='./Datafile' )
|
14
|
+
code = File.read_utf8( path )
|
15
|
+
self.load( code )
|
16
|
+
end
|
17
|
+
|
18
|
+
## another convenience method - use like Datafile.load()
|
19
|
+
def self.load( code )
|
20
|
+
builder = Builder.new
|
21
|
+
builder.instance_eval( code )
|
22
|
+
builder.datafile # note: return datafile (of course, NOT the builder)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
11
26
|
def initialize()
|
12
27
|
@datasets = []
|
13
28
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Datafile
|
4
|
+
|
5
|
+
class BeerDataset < Dataset
|
6
|
+
|
7
|
+
def initialize( name, opts={} )
|
8
|
+
super( name, opts )
|
9
|
+
end
|
10
|
+
|
11
|
+
def read()
|
12
|
+
logger.info( "read beer-dataset '#{@name}', '#{setup}'" )
|
13
|
+
|
14
|
+
BeerDb.read_setup_from_zip( local_zip_name(), setup(), local_zip_root() )
|
15
|
+
end
|
16
|
+
end # class BeerDataset
|
17
|
+
|
18
|
+
end # module Datafile
|
@@ -16,7 +16,9 @@ class Dataset
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def remote_zip_url() # remote zip url
|
19
|
-
|
19
|
+
### note: use http:// for now - lets us use (personal proxy NOT working w/ https) for now
|
20
|
+
## "https://github.com/#{@name}/archive/master.zip"
|
21
|
+
"http://github.com/#{@name}/archive/master.zip"
|
20
22
|
end
|
21
23
|
|
22
24
|
def local_zip_name()
|
data/lib/datafile/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logutils
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/datafile.rb
|
98
98
|
- lib/datafile/builder.rb
|
99
99
|
- lib/datafile/datafile.rb
|
100
|
+
- lib/datafile/datasets/beer.rb
|
100
101
|
- lib/datafile/datasets/dataset.rb
|
101
102
|
- lib/datafile/datasets/football.rb
|
102
103
|
- lib/datafile/datasets/world.rb
|