beerdb 0.10.0 → 0.10.1

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: bd5af8feb16a5a25aac740c6cc34a08aec1109b6
4
- data.tar.gz: dd4b95c41c8a89754e9f3c864234ba00758f8437
3
+ metadata.gz: 59415fcdf9c465ad302782f2e3d7dbbe523f7a9b
4
+ data.tar.gz: 3eb0dfd42d04170b294318fccb23869d5782b85d
5
5
  SHA512:
6
- metadata.gz: 37052c2727905e75c047d20ef2c8f300f58523102108ae6a670e3d945debbfa820c78b329135d308659714f999f970dc1eba6121fd5080be9383e97edecee28a
7
- data.tar.gz: 9db94348d1f538e861c927eec9edc8358cf0cca72d43435d36f297f6eb7a3311e20c05aee1b15e5df81c32fd4f7edd8a4e82b9e9f88cdb9c54842ade45e7e31c
6
+ metadata.gz: 825ee22938f4aab62b1c52add08f041db453ac76b6f8dee449ad007438f318747e35214f1971ec135c3fac2cc24f2a05596510e4b7d8e3b43de894dfc0c6ff6a
7
+ data.tar.gz: d0dda165ce1173a9d731baf0a453e1ae0cae1f56f104ad251529226e98b945bd4b3df3a3ce3701feb17984218e2f4084d8059412938ddadd7fe44b1324b52ea7
data/lib/beerdb.rb CHANGED
@@ -3,10 +3,10 @@
3
3
  require 'beerdb/models' # Note: pull in all required deps via beerdb-models
4
4
 
5
5
 
6
- require 'gli'
7
-
8
- require 'datafile'
9
6
  require 'fetcher'
7
+ require 'datafile'
8
+
9
+ require 'gli'
10
10
 
11
11
  # our own code
12
12
 
@@ -76,6 +76,83 @@ switch [:q, :quiet], negatable: false
76
76
 
77
77
 
78
78
 
79
+ desc "Build DB (download/create/read); use ./Datafile - zips get downloaded to ./tmp"
80
+ command [:build,:b] do |c|
81
+
82
+ c.action do |g,o,args|
83
+
84
+ datafile = Datafile::Datafile.load_file( './Datafile' )
85
+ datafile.download # datafile step 1 - download all datasets/zips
86
+
87
+ connect_to_db( opts )
88
+
89
+ BeerDb.create_all
90
+
91
+ datafile.read # datafile step 2 - read all datasets
92
+
93
+ puts 'Done.'
94
+ end # action
95
+ end # command setup
96
+
97
+
98
+ desc "Read datasets; use ./Datafile - zips required in ./tmp"
99
+ command [:read,:r] do |c|
100
+
101
+ c.action do |g,o,args|
102
+
103
+ connect_to_db( opts )
104
+
105
+ datafile = Datafile::Datafile.load_file( './Datafile' )
106
+ datafile.read
107
+
108
+ puts 'Done.'
109
+ end # action
110
+ end # command setup
111
+
112
+ desc "Download datasets; use ./Datafile - zips get downloaded to ./tmp"
113
+ command [:download,:dl] do |c|
114
+
115
+ c.action do |g,o,args|
116
+
117
+ # note: no database connection needed (check - needed for logs?? - not setup by default???)
118
+
119
+ datafile = Datafile::Datafile.load_file( './Datafile' )
120
+ datafile.download
121
+
122
+ puts 'Done.'
123
+ end # action
124
+ end # command setup
125
+
126
+
127
+ desc "Build DB w/ quick starter Datafile templates"
128
+ arg_name 'NAME' # optional setup profile name
129
+ command [:new,:n] do |c|
130
+
131
+ c.action do |g,o,args|
132
+
133
+ ## todo: required template name (defaults to worldcup2014)
134
+ setup = args[0] || 'at'
135
+
136
+ worker = Fetcher::Worker.new
137
+ ## note: lets use http:// instead of https:// for now - lets us use person proxy (NOT working w/ https for now)
138
+ worker.copy( "http://github.com/openbeer/datafile/raw/master/#{setup}.rb", './Datafile' )
139
+
140
+ ## step 2: same as command build (todo - reuse code)
141
+ datafile = Datafile::Datafile.load_file( './Datafile' )
142
+ datafile.download # datafile step 1 - download all datasets/zips
143
+
144
+ connect_to_db( opts ) ### todo: check let connect go first?? - for logging (logs) to db ???
145
+
146
+ BeerDb.create_all
147
+
148
+ datafile.read # datafile step 2 - read all datasets
149
+
150
+ puts 'Done.'
151
+ end # action
152
+ end # command setup
153
+
154
+
155
+
79
156
  desc 'Create DB schema'
80
157
  command [:create] do |c|
81
158
 
@@ -7,7 +7,7 @@ module BeerDbCli # todo/check - rename to BeerDbTool or BeerDbCommands or Bee
7
7
 
8
8
  MAJOR = 0
9
9
  MINOR = 10
10
- PATCH = 0
10
+ PATCH = 1
11
11
  VERSION = [MAJOR,MINOR,PATCH].join('.')
12
12
 
13
13
  def self.version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beerdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer