bbmb 2.1.6 → 2.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/History.txt +6 -0
- data/bbmb.gemspec +1 -1
- data/lib/bbmb/util/app.rb +80 -0
- data/lib/bbmb/util/server.rb +10 -14
- data/lib/bbmb/version.rb +1 -1
- data/test/util/test_invoicer.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6e2c40f9e08bfaa1590a132dfd79a843dcab512
|
4
|
+
data.tar.gz: 5ba3de786806de5a811194f9b56385afad3dd8aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2042e778619244928656a79f4ebf46a52ef3ab48c3e4e0c0dc17a4ed25486647960d5700e4796aae71451638727f622f1573246ff07efb8114e596adead7179d
|
7
|
+
data.tar.gz: 22b23be9e8bbd187a99b1e7beccda8378de9fdc072ed1457c9235534e7c325cee3964558055dc0d6a4ad2643ca02abfe015fc1c09b4f415e7d066a7dec1f8adc
|
data/.travis.yml
CHANGED
data/History.txt
CHANGED
data/bbmb.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency "ydbd-pg", '>= 0.5.2'
|
22
22
|
spec.add_dependency "ydbi", '>= 0.5.3'
|
23
23
|
spec.add_dependency "json"
|
24
|
-
spec.add_dependency "sbsm", '>= 1.3.
|
24
|
+
spec.add_dependency "sbsm", '>= 1.3.9'
|
25
25
|
spec.add_dependency "htmlgrid"
|
26
26
|
spec.add_dependency "ydim", '>= 0.5.1'
|
27
27
|
spec.add_dependency "syck"
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Util::Server -- de.bbmb.org -- 01.09.2006 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'bbmb/config'
|
5
|
+
require 'bbmb/html/util/known_user'
|
6
|
+
require 'bbmb/html/util/session'
|
7
|
+
require 'bbmb/html/util/validator'
|
8
|
+
require 'bbmb/util/invoicer'
|
9
|
+
require 'bbmb/util/invoicer'
|
10
|
+
require 'bbmb/util/mail'
|
11
|
+
require 'bbmb/util/updater'
|
12
|
+
require 'bbmb/model/order' # needed to be enable to invoice later
|
13
|
+
require 'bbmb/model/customer'
|
14
|
+
require 'date'
|
15
|
+
require 'sbsm/app'
|
16
|
+
require 'bbmb/persistence/odba'
|
17
|
+
require 'bbmb/model/customer'
|
18
|
+
require 'bbmb/model/quota'
|
19
|
+
require 'bbmb/model/product'
|
20
|
+
require 'bbmb/model/promotion'
|
21
|
+
require 'bbmb/util/server'
|
22
|
+
|
23
|
+
module BBMB
|
24
|
+
def self.persistence
|
25
|
+
@@persistence ||= BBMB::Persistence::ODBA
|
26
|
+
end
|
27
|
+
module Util
|
28
|
+
class App < SBSM::App
|
29
|
+
attr_accessor :db_manager, :yus_server
|
30
|
+
attr_accessor :auth, :config, :persistence, :server
|
31
|
+
|
32
|
+
def start_service
|
33
|
+
case BBMB.config.persistence
|
34
|
+
when 'odba'
|
35
|
+
DRb.install_id_conv ODBA::DRbIdConv.new
|
36
|
+
@persistence = BBMB::Persistence::ODBA
|
37
|
+
end
|
38
|
+
@auth = DRb::DRbObject.new(nil, BBMB.config.auth_url)
|
39
|
+
puts "installed @auth #{@auth}"
|
40
|
+
@server = BBMB::Util::Server.new(@persistence, self)
|
41
|
+
@server.extend(DRbUndumped)
|
42
|
+
BBMB.server = @server
|
43
|
+
puts "installed BBMB.server #{BBMB.server}"
|
44
|
+
if(BBMB.config.update?)
|
45
|
+
@server.run_updater
|
46
|
+
end
|
47
|
+
if(BBMB.config.invoice?)
|
48
|
+
@server.run_invoicer
|
49
|
+
end
|
50
|
+
url = BBMB.config.server_url
|
51
|
+
url.untaint
|
52
|
+
DRb.start_service(url, @server)
|
53
|
+
$SAFE = 1
|
54
|
+
$0 = BBMB.config.name
|
55
|
+
SBSM.logger.info('start') { sprintf("starting bbmb-server on %s", url) }
|
56
|
+
DRb.thread.join
|
57
|
+
SBSM.logger.info('finished') { sprintf("starting bbmb-server on %s", url) }
|
58
|
+
rescue Exception => error
|
59
|
+
SBSM.logger.error('fatal') { error }
|
60
|
+
raise
|
61
|
+
end
|
62
|
+
def initialize
|
63
|
+
super
|
64
|
+
puts "Starting Rack-Service #{self.class} and service #{BBMB.config.server_url}"
|
65
|
+
Thread.new {
|
66
|
+
start_service
|
67
|
+
}
|
68
|
+
end
|
69
|
+
def login(email, pass)
|
70
|
+
session = BBMB.auth.login(email, pass, BBMB.config.auth_domain)
|
71
|
+
Html::Util::KnownUser.new(session)
|
72
|
+
end
|
73
|
+
def logout(session)
|
74
|
+
# Here we start when logging in from the home page
|
75
|
+
BBMB.auth.logout(session)
|
76
|
+
rescue DRb::DRbError, RangeError, NameError
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/lib/bbmb/util/server.rb
CHANGED
@@ -44,7 +44,14 @@ module BBMB
|
|
44
44
|
@app.inject_order(customer_id, products, infos, opts)
|
45
45
|
end
|
46
46
|
def rename_user(old_name, new_name)
|
47
|
-
|
47
|
+
return if old_name.eql?(new_name)
|
48
|
+
@app.auth.autosession(BBMB.config.auth_domain) do |session|
|
49
|
+
if(old_name.nil?)
|
50
|
+
session.create_entity(new_name)
|
51
|
+
else
|
52
|
+
session.rename(old_name, new_name)
|
53
|
+
end
|
54
|
+
end
|
48
55
|
end
|
49
56
|
def run_invoicer
|
50
57
|
@invoicer ||= Thread.new {
|
@@ -200,16 +207,5 @@ module BBMB
|
|
200
207
|
end
|
201
208
|
end
|
202
209
|
end
|
203
|
-
|
204
|
-
|
205
|
-
session = BBMB.auth.login(email, pass, BBMB.config.auth_domain)
|
206
|
-
Html::Util::KnownUser.new(session)
|
207
|
-
end
|
208
|
-
def logout(session)
|
209
|
-
# Here we start when logging in from the home page
|
210
|
-
BBMB.auth.logout(session)
|
211
|
-
rescue DRb::DRbError, RangeError, NameError
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
215
|
-
end
|
210
|
+
end
|
211
|
+
end
|
data/lib/bbmb/version.rb
CHANGED
data/test/util/test_invoicer.rb
CHANGED
@@ -76,7 +76,7 @@ class TestInvoicer < Minitest::Test
|
|
76
76
|
range = Time.local(2006,9)..Time.local(2006,10)
|
77
77
|
@drb_server = DRb.start_service(@ydim_url, @ydim_server)
|
78
78
|
sleep 0.5
|
79
|
-
result = Invoicer.create_invoice(range, Util::Money.new(24), [order1, order2], today
|
79
|
+
result = Invoicer.create_invoice(range, Util::Money.new(24), [order1, order2], today)
|
80
80
|
if result.is_a?(FlexMock::Undefined)
|
81
81
|
msg = "Skipping this sometimes failing test "
|
82
82
|
puts msg
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbmb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaomi Hatakeyama, Zeno R.R. Davatz, Niklaus Giger
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.3.
|
75
|
+
version: 1.3.9
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.3.
|
82
|
+
version: 1.3.9
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: htmlgrid
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -414,6 +414,7 @@ files:
|
|
414
414
|
- lib/bbmb/persistence/odba/model/order.rb
|
415
415
|
- lib/bbmb/persistence/odba/model/product.rb
|
416
416
|
- lib/bbmb/persistence/odba/model/quota.rb
|
417
|
+
- lib/bbmb/util/app.rb
|
417
418
|
- lib/bbmb/util/invoicer.rb
|
418
419
|
- lib/bbmb/util/mail.rb
|
419
420
|
- lib/bbmb/util/multilingual.rb
|