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 +4 -4
- data/lib/beerdb.rb +3 -3
- data/lib/beerdb/cli/main.rb +77 -0
- data/lib/beerdb/cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59415fcdf9c465ad302782f2e3d7dbbe523f7a9b
|
4
|
+
data.tar.gz: 3eb0dfd42d04170b294318fccb23869d5782b85d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 825ee22938f4aab62b1c52add08f041db453ac76b6f8dee449ad007438f318747e35214f1971ec135c3fac2cc24f2a05596510e4b7d8e3b43de894dfc0c6ff6a
|
7
|
+
data.tar.gz: d0dda165ce1173a9d731baf0a453e1ae0cae1f56f104ad251529226e98b945bd4b3df3a3ce3701feb17984218e2f4084d8059412938ddadd7fe44b1324b52ea7
|
data/lib/beerdb.rb
CHANGED
data/lib/beerdb/cli/main.rb
CHANGED
@@ -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
|
|
data/lib/beerdb/cli/version.rb
CHANGED