kangaroo 0.0.1.pre → 0.0.1.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/Gemfile.lock +1 -1
- data/features/configuration.feature +10 -0
- data/features/step_definitions/basic_steps.rb +1 -7
- data/features/step_definitions/{connection_steps.rb → configuration_steps.rb} +9 -1
- data/features/utility_services.feature +0 -6
- data/lib/kangaroo/model/field.rb +9 -3
- data/lib/kangaroo/util/configuration.rb +1 -1
- data/lib/kangaroo/util/loader.rb +2 -0
- data/lib/kangaroo/util/proxy/object.rb +0 -1
- data/lib/kangaroo/version.rb +1 -1
- metadata +8 -7
- data/features/connection.feature +0 -5
data/.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
.yardoc
|
1
|
+
.yardoc
|
2
|
+
*.gem
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Configuration
|
2
|
+
Scenario: Connect to an OpenERP server
|
3
|
+
Given i have a configuration file
|
4
|
+
When i setup a configuration
|
5
|
+
Then i should be able to login
|
6
|
+
|
7
|
+
Scenario: Load models
|
8
|
+
Given i'm connected to an OpenERP server
|
9
|
+
When i load models matching "res.*"
|
10
|
+
Then "Oo::Res::Country" should be defined
|
@@ -4,15 +4,9 @@ Given /^i'm connected to an OpenERP server$/ do
|
|
4
4
|
@config.login
|
5
5
|
end
|
6
6
|
|
7
|
-
Given /^setup a proxy to "([^"]*)"$/ do |service|
|
8
|
-
proxy = Kangaroo::Util::Proxy.const_get(service.camelize).new @config.client.send("#{service}_service")
|
9
|
-
self.instance_variable_set "@#{service}", proxy
|
10
|
-
end
|
11
|
-
|
12
7
|
When /^i call (.*)\.(.*)$/ do |service, method|
|
13
|
-
proxy =
|
8
|
+
proxy = Kangaroo::Util::Proxy.const_get(service.camelize).new @config.client.send("#{service}_service")
|
14
9
|
@result = proxy.__send__ method
|
15
|
-
puts @result.inspect
|
16
10
|
end
|
17
11
|
|
18
12
|
Then /^i should see "([^"]*)"$/ do |arg1|
|
@@ -3,7 +3,7 @@ Given /^i have a configuration file$/ do
|
|
3
3
|
end
|
4
4
|
|
5
5
|
When /^i setup a configuration$/ do
|
6
|
-
@logger = Logger.new(
|
6
|
+
@logger = Logger.new(File.open("/dev/null", 'w'))
|
7
7
|
@config = Kangaroo::Util::Configuration.new @config_hash, @logger
|
8
8
|
end
|
9
9
|
|
@@ -11,3 +11,11 @@ Then /^i should be able to login$/ do
|
|
11
11
|
@logger.should_not_receive :warn
|
12
12
|
@config.login
|
13
13
|
end
|
14
|
+
|
15
|
+
When /^i load models matching "([^"]*)"$/ do |arg1|
|
16
|
+
Kangaroo::Util::Loader.new('res.*', @config.database).load!
|
17
|
+
end
|
18
|
+
|
19
|
+
Then /^"([^"]*)" should be defined$/ do |arg1|
|
20
|
+
lambda { arg1.constantize }.should_not raise_error
|
21
|
+
end
|
@@ -1,38 +1,32 @@
|
|
1
1
|
Feature: Utility Services
|
2
2
|
Scenario: Get server information
|
3
3
|
Given i'm connected to an OpenERP server
|
4
|
-
And setup a proxy to "common"
|
5
4
|
When i call common.about
|
6
5
|
Then i should see "OpenERP"
|
7
6
|
|
8
7
|
Scenario: Get server environment
|
9
8
|
Given i'm connected to an OpenERP server
|
10
|
-
And setup a proxy to "common"
|
11
9
|
When i call common.get_server_environment
|
12
10
|
Then i should see "OpenERP-Server Version : 6"
|
13
11
|
And i should see "Python Version : 2.6"
|
14
12
|
|
15
13
|
Scenario: Get server stats
|
16
14
|
Given i'm connected to an OpenERP server
|
17
|
-
And setup a proxy to "common"
|
18
15
|
When i call common.get_stats
|
19
16
|
Then i should see "HTTPd: running"
|
20
17
|
|
21
18
|
Scenario: List available HTTP services
|
22
19
|
Given i'm connected to an OpenERP server
|
23
|
-
And setup a proxy to "common"
|
24
20
|
When i call common.list_http_services
|
25
21
|
Then the list should include "service.http_server.XMLRPCRequestHandler"
|
26
22
|
|
27
23
|
Scenario: List available databases
|
28
24
|
Given i'm connected to an OpenERP server
|
29
|
-
And setup a proxy to "db"
|
30
25
|
When i call db.list
|
31
26
|
Then the list should include "kangaroo_test_database"
|
32
27
|
|
33
28
|
Scenario: List available languages
|
34
29
|
Given i'm connected to an OpenERP server
|
35
|
-
And setup a proxy to "db"
|
36
30
|
When i call db.list_lang
|
37
31
|
Then the list should include "English"
|
38
32
|
|
data/lib/kangaroo/model/field.rb
CHANGED
@@ -6,15 +6,21 @@ module Kangaroo
|
|
6
6
|
include Attributes
|
7
7
|
|
8
8
|
attr_accessor :name
|
9
|
-
|
9
|
+
define_multiple_accessors :change_default, :context, :digits, :domain, :fnct_inv, :fnct_inv_arg,
|
10
|
+
:fnct_search, :func_method, :func_obj, :function, :help, :invisible,
|
11
|
+
:readonly, :related_columns, :relation, :required, :select, :selectable,
|
12
|
+
:selection, :size, :states, :store, :string, :third_table, :translate,
|
13
|
+
:type
|
14
|
+
|
10
15
|
def initialize name, attributes = {}
|
11
16
|
@attributes = {}
|
12
17
|
@name = name
|
13
|
-
|
18
|
+
|
14
19
|
attributes.each do |key, val|
|
15
20
|
write_attribute key, val
|
16
21
|
end
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
20
|
-
end
|
25
|
+
end
|
26
|
+
|
@@ -31,7 +31,7 @@ module Kangaroo
|
|
31
31
|
end
|
32
32
|
|
33
33
|
login
|
34
|
-
Loader.new(@database
|
34
|
+
Loader.new(models, @database).load!
|
35
35
|
logger.info "Loaded OpenERP models matching #{models.inspect}."
|
36
36
|
rescue Exception => e
|
37
37
|
logger.error "Loading of OpenERP models failed.\n#{e.inspect}"
|
data/lib/kangaroo/util/loader.rb
CHANGED
data/lib/kangaroo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kangaroo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1923831973
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- 1
|
10
10
|
- pre
|
11
|
-
|
11
|
+
- 2
|
12
|
+
version: 0.0.1.pre2
|
12
13
|
platform: ruby
|
13
14
|
authors:
|
14
15
|
- Michael Eickenberg
|
@@ -17,7 +18,7 @@ autorequire:
|
|
17
18
|
bindir: bin
|
18
19
|
cert_chain: []
|
19
20
|
|
20
|
-
date: 2011-02-
|
21
|
+
date: 2011-02-27 00:00:00 +01:00
|
21
22
|
default_executable:
|
22
23
|
dependencies:
|
23
24
|
- !ruby/object:Gem::Dependency
|
@@ -146,10 +147,10 @@ files:
|
|
146
147
|
- docs/Architecture.md
|
147
148
|
- docs/Installation.md
|
148
149
|
- docs/Usage.md
|
149
|
-
- features/
|
150
|
+
- features/configuration.feature
|
150
151
|
- features/env.rb
|
151
152
|
- features/step_definitions/basic_steps.rb
|
152
|
-
- features/step_definitions/
|
153
|
+
- features/step_definitions/configuration_steps.rb
|
153
154
|
- features/support/test.yml
|
154
155
|
- features/utility_services.feature
|
155
156
|
- kangaroo.gemspec
|
@@ -237,10 +238,10 @@ signing_key:
|
|
237
238
|
specification_version: 3
|
238
239
|
summary: Kang! ActiveRecord-ish OpenObject
|
239
240
|
test_files:
|
240
|
-
- features/
|
241
|
+
- features/configuration.feature
|
241
242
|
- features/env.rb
|
242
243
|
- features/step_definitions/basic_steps.rb
|
243
|
-
- features/step_definitions/
|
244
|
+
- features/step_definitions/configuration_steps.rb
|
244
245
|
- features/support/test.yml
|
245
246
|
- features/utility_services.feature
|
246
247
|
- spec/model/attributes_spec.rb
|