beerdb 1.2.0 → 1.2.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 +37 -0
- data/lib/beerdb/cli/main.rb +9 -3
- data/lib/beerdb/cli/version.rb +1 -1
- 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: 177fe9285da137d665f5d8053008f23cae6cf5ac
|
4
|
+
data.tar.gz: 4029035763dd219cd9d766e4247a7e55857fbdab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be0866bd97e04d308dc627101be7d7ed61ece520bfe22ab59da4f025ac8e161748045f060566a3fa01efcb313858746ca516098b744de62af51e21266446109b
|
7
|
+
data.tar.gz: 47343c28a37d146ea3660ec64df5e3f851864c3ea93a44daa3b85b470b473d318d26fe77827cf4d9428c03dbadfd74b76267f7031e40d3e85d17b9f5d9a7d01a
|
data/lib/beerdb.rb
CHANGED
@@ -27,11 +27,48 @@ module BeerDb
|
|
27
27
|
end # module BeerDb
|
28
28
|
|
29
29
|
|
30
|
+
|
30
31
|
####
|
31
32
|
## used for server/service command
|
32
33
|
## "preconfigured" base class for webservice
|
33
34
|
class BeerDbService < Webservice::Base
|
34
35
|
include BeerDb::Models # e.g. Beer, Brewery, Brand, etc.
|
36
|
+
|
37
|
+
## (auto-)add some (built-in) routes
|
38
|
+
|
39
|
+
get '/version(s)?' do
|
40
|
+
{
|
41
|
+
"beerdb": BeerDbTool::VERSION,
|
42
|
+
"beerdb/models": BeerDb::VERSION,
|
43
|
+
## todo/fix: add beerdb/note version - if present
|
44
|
+
## todo/fix: add worlddb/models version
|
45
|
+
## todo/fix: add some more libs - why? why not??
|
46
|
+
"activerecord": [ActiveRecord::VERSION::MAJOR,ActiveRecord::VERSION::MINOR,ActiveRecord::VERSION::TINY].join('.'),
|
47
|
+
"webservice": Webservice::VERSION,
|
48
|
+
"rack": "#{Rack::RELEASE} (#{Rack::VERSION.join('.')})", ## note: VERSION is the protocoll version as an array e.g.[1,2]
|
49
|
+
"ruby": "#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]",
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
get '/(stats|tables)' do
|
54
|
+
{
|
55
|
+
"beers": BeerDb::Model::Beer.count,
|
56
|
+
"brands": BeerDb::Model::Brand.count,
|
57
|
+
"breweries": BeerDb::Model::Brewery.count,
|
58
|
+
"system": {
|
59
|
+
"props": ConfDb::Models::Prop.count,
|
60
|
+
"logs": LogDb::Models::Log.count,
|
61
|
+
}
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
get '/props(.:format)?' do # note: add format - lets you use props.csv and props.html
|
66
|
+
ConfDb::Models::Prop.all
|
67
|
+
end
|
68
|
+
|
69
|
+
get '/logs(.:format)?' do
|
70
|
+
LogDb::Models::Log.all
|
71
|
+
end
|
35
72
|
end
|
36
73
|
|
37
74
|
|
data/lib/beerdb/cli/main.rb
CHANGED
@@ -284,9 +284,15 @@ command [:serve,:server,:s] do |c|
|
|
284
284
|
## todo: document optional script arg (defaults to service)
|
285
285
|
script = args[0] || 'service'
|
286
286
|
|
287
|
-
script_path = "#{script}.rb"
|
288
|
-
|
289
|
-
|
287
|
+
script_path = "#{script}.rb" ## auto-add .rb extension
|
288
|
+
|
289
|
+
unless File.exist?( script_path ) ## if file doesn't exist try to fetch service script
|
290
|
+
script_path = "./#{script}.rb" ## use / save script in local (current) working dir/folder
|
291
|
+
worker = Fetcher::Worker.new
|
292
|
+
## note: lets use http:// instead of https:// for now - lets us use person proxy (NOT working w/ https for now)
|
293
|
+
worker.copy( "http://github.com/beerkit/beer.db.service/raw/master/#{script}.rb", script_path )
|
294
|
+
end
|
295
|
+
|
290
296
|
|
291
297
|
code = File.read_utf8( script_path )
|
292
298
|
|
data/lib/beerdb/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beerdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.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: 2017-08-
|
11
|
+
date: 2017-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: beerdb-models
|