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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad253b418044180093357ced2612f6a0423292b0
4
- data.tar.gz: 5e3a6c5baba4ab6d14af19bf55dd565eb938b840
3
+ metadata.gz: 177fe9285da137d665f5d8053008f23cae6cf5ac
4
+ data.tar.gz: 4029035763dd219cd9d766e4247a7e55857fbdab
5
5
  SHA512:
6
- metadata.gz: f1da644e8f307b75f64a4ccd20b77b229799ace3d25c0c64a4de477d77a78d9bd453cb72d01a59ca482e2498f30c00fa3d959c9885865f03093b05d9aa988b18
7
- data.tar.gz: df049aafb599771214bd66f5307932a0967ca27d884f3050a2fabb9b81beb33bb3cda610ace1745283ff984d51eae1c9df65cfb8c5470f43c03b934ae9af357b
6
+ metadata.gz: be0866bd97e04d308dc627101be7d7ed61ece520bfe22ab59da4f025ac8e161748045f060566a3fa01efcb313858746ca516098b744de62af51e21266446109b
7
+ data.tar.gz: 47343c28a37d146ea3660ec64df5e3f851864c3ea93a44daa3b85b470b473d318d26fe77827cf4d9428c03dbadfd74b76267f7031e40d3e85d17b9f5d9a7d01a
@@ -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
 
@@ -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" ## auto-add .rb extension
288
- ###############
289
- ## todo/fix: add fetch if not found locally!!!
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
 
@@ -7,7 +7,7 @@ module BeerDbTool # todo/check - rename to BeerDbCli or BeerDbCommands or Bee
7
7
 
8
8
  MAJOR = 1
9
9
  MINOR = 2
10
- PATCH = 0
10
+ PATCH = 1
11
11
  VERSION = [MAJOR,MINOR,PATCH].join('.')
12
12
 
13
13
  def self.version
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.0
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-27 00:00:00.000000000 Z
11
+ date: 2017-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: beerdb-models