ooor 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/ooor +57 -0
- data/lib/app/models/open_object_resource.rb +11 -2
- data/lib/app/models/type_casting.rb +2 -0
- metadata +6 -5
data/bin/ooor
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
puts "*** OOOR - OpenObject on Rails! is published under the AGPL license by Akretion.com ***"
|
4
|
+
|
5
|
+
require 'irb'
|
6
|
+
require 'rubygems'
|
7
|
+
require 'ooor'
|
8
|
+
|
9
|
+
begin
|
10
|
+
#require 'bond' #auto-completion
|
11
|
+
#Bond.start
|
12
|
+
require 'irb/completion'
|
13
|
+
rescue
|
14
|
+
require 'irb/completion'
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
unless ARGV.empty?
|
19
|
+
username = ARGV[0].split(".")[0]
|
20
|
+
database = ARGV[0].split(".")[1].split("@")[0]
|
21
|
+
if ARGV[0].index("@")
|
22
|
+
base_url = ARGV[0].split("@")[1]
|
23
|
+
else
|
24
|
+
base_url = "localhost"
|
25
|
+
end
|
26
|
+
port_given = false
|
27
|
+
if base_url.index(":") #port in URL
|
28
|
+
t = base_url.split(":")
|
29
|
+
base_url = t[0]
|
30
|
+
port = t[1]
|
31
|
+
port_given = true
|
32
|
+
else
|
33
|
+
port = "8069"
|
34
|
+
end
|
35
|
+
url = "http://#{base_url}:#{port}/xmlrpc"
|
36
|
+
if ARGV[1] && ARGV[1] != "-s"
|
37
|
+
password = ARGV[1]
|
38
|
+
else
|
39
|
+
puts "password?"
|
40
|
+
password = $stdin.gets.chomp!
|
41
|
+
end
|
42
|
+
|
43
|
+
if ARGV[1] == "-s" || ARGV[2] == "-s" #secure mode
|
44
|
+
url.gsub!("http", "https")
|
45
|
+
url.gsub!("8069", "8071") unless port_given
|
46
|
+
end
|
47
|
+
else
|
48
|
+
puts "USAGE: ooor admin.database@host\nor ooor admin.database@host:port\nor ooor admin.database for localhost\nyou can specify the password with ooor admin.database@host password\nyou can use the -s option for secure HTTPS mode"
|
49
|
+
exit 0
|
50
|
+
end
|
51
|
+
|
52
|
+
ARGV = []
|
53
|
+
ARGV << '--readline' << '--prompt' << 'inf-ruby'
|
54
|
+
|
55
|
+
ooor = Ooor.new(:url => url, :database => database || 'demo', :username => username || 'admin', :password => password || 'admin')
|
56
|
+
|
57
|
+
IRB.start(__FILE__)
|
@@ -124,7 +124,16 @@ module Ooor
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def rpc_execute_with_object(object, method, *args)
|
127
|
-
|
127
|
+
if args[-1].is_a? Hash #context
|
128
|
+
user_id = args[-1].delete(:user_id) || args[-1].delete('user_id') || @user_id || @ooor.config[:user_id]
|
129
|
+
password = args[-1].delete(:password) || args[-1].delete('password') || @password || @ooor.config[:password]
|
130
|
+
database = args[-1].delete(:database) || args[-1].delete('database') || @database || @ooor.config[:database]
|
131
|
+
else
|
132
|
+
user_id = @user_id || @ooor.config[:user_id] #TODO @user_id useless?
|
133
|
+
password = @password || @ooor.config[:password]
|
134
|
+
database = @database || @ooor.config[:database]
|
135
|
+
end
|
136
|
+
rpc_execute_with_all(database, user_id, password, object, method, *args)
|
128
137
|
end
|
129
138
|
|
130
139
|
#corresponding method for OpenERP osv.execute(self, db, uid, obj, method, *args, **kw) method
|
@@ -232,7 +241,7 @@ module Ooor
|
|
232
241
|
attr_accessor :associations, :loaded_associations, :ir_model_data_id, :object_session
|
233
242
|
|
234
243
|
def object_db; object_session[:database] || self.class.database || self.class.ooor.config[:database]; end
|
235
|
-
def object_uid;object_session[:user_id] || self.class.user_id || self.class.ooor.config[:user_id]; end
|
244
|
+
def object_uid; object_session[:user_id] || self.class.user_id || self.class.ooor.config[:user_id]; end
|
236
245
|
def object_pass; object_session[:password] || self.class.password || self.class.ooor.config[:password]; end
|
237
246
|
|
238
247
|
#try to wrap the object context inside the query.
|
@@ -40,6 +40,8 @@ module Ooor
|
|
40
40
|
map[k] = "#{v.year}-#{v.month}-#{v.day} #{v.hour}:#{v.min}:#{v.sec}"
|
41
41
|
elsif !v.is_a?(Numeric) && !v.is_a?(Integer) && v.respond_to?(:day) && v.respond_to?(:year)#really ensure that's a date type
|
42
42
|
map[k] = "#{v.year}-#{v.month}-#{v.day}"
|
43
|
+
elsif v == "false" #may happen with OOORBIT
|
44
|
+
map[k] = false
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 1.5.
|
8
|
+
- 2
|
9
|
+
version: 1.5.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Raphael Valyi - www.akretion.com
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-03-
|
17
|
+
date: 2011-03-31 00:00:00 -03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -34,8 +34,8 @@ dependencies:
|
|
34
34
|
version_requirements: *id001
|
35
35
|
description: OOOR exposes business object proxies to your Ruby (Rails or not) application, that map seamlessly to your remote OpenObject/OpenERP server using webservices. It extends the standard ActiveResource API.
|
36
36
|
email: rvalyi@akretion.com
|
37
|
-
executables:
|
38
|
-
|
37
|
+
executables:
|
38
|
+
- ooor
|
39
39
|
extensions: []
|
40
40
|
|
41
41
|
extra_rdoc_files: []
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- lib/app/ui/form_model.rb
|
59
59
|
- lib/app/ui/menu.rb
|
60
60
|
- spec/ooor_spec.rb
|
61
|
+
- bin/ooor
|
61
62
|
has_rdoc: true
|
62
63
|
homepage: http://github.com/rvalyi/ooor
|
63
64
|
licenses: []
|