kangaroo 0.0.3 → 0.1.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -1
- data/Gemfile +11 -0
- data/README.md +23 -132
- data/Rakefile +0 -8
- data/bin/kang +5 -64
- data/bin/kangdoc +21 -0
- data/bin/kangviz +21 -0
- data/config/kangaroo.yml.sample +12 -2
- data/docs/Architecture.md +1 -0
- data/docs/Classes.md +67 -0
- data/docs/Installation.md +2 -1
- data/docs/Usage.md +1 -0
- data/kangaroo.gemspec +8 -8
- data/lib/kangaroo.rb +3 -2
- data/lib/kangaroo/commands/base.rb +123 -0
- data/lib/kangaroo/commands/cli.rb +65 -0
- data/lib/kangaroo/commands/doc.rb +44 -0
- data/lib/kangaroo/commands/endpoint.rb +33 -0
- data/lib/kangaroo/commands/viz.rb +58 -0
- data/lib/kangaroo/doc.rb +2 -0
- data/lib/kangaroo/exception.rb +3 -0
- data/lib/kangaroo/hirb.rb +2 -1
- data/lib/kangaroo/model/associations.rb +33 -0
- data/lib/kangaroo/model/associations/many2one.rb +43 -0
- data/lib/kangaroo/model/associations/one2many.rb +41 -0
- data/lib/kangaroo/model/attributes.rb +88 -93
- data/lib/kangaroo/model/base.rb +44 -15
- data/lib/kangaroo/model/condition_normalizer.rb +7 -7
- data/lib/kangaroo/model/data_import.rb +28 -0
- data/lib/kangaroo/model/default_attributes.rb +20 -14
- data/lib/kangaroo/model/dynamic_finder.rb +42 -0
- data/lib/kangaroo/model/field.rb +52 -1
- data/lib/kangaroo/model/field/readonly.rb +39 -0
- data/lib/kangaroo/model/finder.rb +6 -2
- data/lib/kangaroo/model/inspector.rb +1 -4
- data/lib/kangaroo/model/mass_import.rb +42 -0
- data/lib/kangaroo/model/open_object_orm.rb +51 -5
- data/lib/kangaroo/model/persistence.rb +43 -19
- data/lib/kangaroo/model/readonly_attributes.rb +43 -0
- data/lib/kangaroo/model/relation.rb +40 -9
- data/lib/kangaroo/model/remote_execute.rb +1 -1
- data/lib/kangaroo/model/required_attributes.rb +26 -0
- data/lib/kangaroo/railtie.rb +13 -3
- data/lib/kangaroo/ruby_adapter/base.rb +2 -1
- data/lib/kangaroo/ruby_adapter/class_definition.rb +18 -3
- data/lib/kangaroo/ruby_adapter/fields.rb +27 -2
- data/lib/kangaroo/ruby_adapter/many2one.rb +38 -0
- data/lib/kangaroo/ruby_adapter/one2many.rb +31 -0
- data/lib/kangaroo/util/client.rb +29 -4
- data/lib/kangaroo/util/configuration.rb +15 -10
- data/lib/kangaroo/util/database.rb +8 -8
- data/lib/kangaroo/util/loader.rb +18 -22
- data/lib/kangaroo/util/loader/information_repository.rb +56 -0
- data/lib/kangaroo/util/loader/namespace.rb +1 -1
- data/lib/kangaroo/util/loader/reflection.rb +61 -0
- data/lib/kangaroo/util/loader/root_namespace.rb +12 -21
- data/lib/kangaroo/util/proxy.rb +9 -0
- data/lib/kangaroo/util/proxy/common.rb +28 -4
- data/lib/kangaroo/util/proxy/db.rb +14 -0
- data/lib/kangaroo/util/proxy/object.rb +40 -1
- data/lib/kangaroo/util/proxy/superadmin.rb +13 -0
- data/lib/kangaroo/version.rb +1 -1
- data/lib/kangaroo/viz.rb +1 -0
- data/lib/kangaroo/viz/base.rb +92 -0
- data/spec/commands/base_spec.rb +42 -0
- data/spec/functional/associations/many2one_spec.rb +72 -0
- data/spec/functional/associations/one2many_spec.rb +65 -0
- data/spec/functional/common_service_spec.rb +25 -0
- data/spec/functional/data_import_spec.rb +48 -0
- data/spec/functional/dynamic_finder_spec.rb +35 -0
- data/spec/functional/exception_handling_spec.rb +18 -0
- data/spec/functional/identity_spec.rb +48 -0
- data/spec/functional/import_export_spec.rb +39 -0
- data/spec/functional/lazy_loading_spec.rb +18 -11
- data/spec/functional/ordering_spec.rb +33 -0
- data/spec/functional/readonly_attributes_spec.rb +37 -0
- data/spec/functional/required_attributes_spec.rb +37 -0
- data/spec/functional/root_namespace_spec.rb +19 -0
- data/spec/functional/select_relation_spec.rb +26 -0
- data/spec/model/attributes_spec.rb +1 -0
- data/spec/model/base_spec.rb +1 -0
- data/spec/model/default_attributes_spec.rb +3 -1
- data/spec/model/finder_spec.rb +2 -1
- data/spec/model/inspector_spec.rb +1 -0
- data/spec/model/open_object_orm_spec.rb +5 -2
- data/spec/model/persistence_spec.rb +1 -0
- data/spec/model/relation_spec.rb +2 -2
- data/spec/ruby_adapter/class_definition_spec.rb +1 -0
- data/spec/server_helper.rb +0 -1
- data/spec/spec_helper.rb +4 -1
- data/spec/util/loader_spec.rb +6 -6
- metadata +152 -159
- data/Gemfile.lock +0 -69
- data/features/configuration.feature +0 -10
- data/features/env.rb +0 -8
- data/features/step_definitions/basic_steps.rb +0 -18
- data/features/step_definitions/configuration_steps.rb +0 -21
- data/features/support/test.yml +0 -11
- data/features/utility_services.feature +0 -33
data/Gemfile.lock
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
kangaroo (0.0.2)
|
5
|
-
activerecord (>= 3.0.0)
|
6
|
-
activesupport (>= 3.0.0)
|
7
|
-
hirb
|
8
|
-
rapuncel (~> 0.0.2)
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: http://rubygems.org/
|
12
|
-
specs:
|
13
|
-
activemodel (3.0.6)
|
14
|
-
activesupport (= 3.0.6)
|
15
|
-
builder (~> 2.1.2)
|
16
|
-
i18n (~> 0.5.0)
|
17
|
-
activerecord (3.0.6)
|
18
|
-
activemodel (= 3.0.6)
|
19
|
-
activesupport (= 3.0.6)
|
20
|
-
arel (~> 2.0.2)
|
21
|
-
tzinfo (~> 0.3.23)
|
22
|
-
activesupport (3.0.6)
|
23
|
-
arel (2.0.9)
|
24
|
-
builder (2.1.2)
|
25
|
-
columnize (0.3.2)
|
26
|
-
cucumber (0.10.2)
|
27
|
-
builder (>= 2.1.2)
|
28
|
-
diff-lcs (>= 1.1.2)
|
29
|
-
gherkin (>= 2.3.5)
|
30
|
-
json (>= 1.4.6)
|
31
|
-
term-ansicolor (>= 1.0.5)
|
32
|
-
diff-lcs (1.1.2)
|
33
|
-
gherkin (2.3.5)
|
34
|
-
json (>= 1.4.6)
|
35
|
-
hirb (0.4.3)
|
36
|
-
i18n (0.5.0)
|
37
|
-
json (1.5.1)
|
38
|
-
linecache (0.43)
|
39
|
-
nokogiri (1.4.4)
|
40
|
-
rapuncel (0.0.2)
|
41
|
-
activesupport (>= 3.0.0)
|
42
|
-
nokogiri
|
43
|
-
rspec (2.5.0)
|
44
|
-
rspec-core (~> 2.5.0)
|
45
|
-
rspec-expectations (~> 2.5.0)
|
46
|
-
rspec-mocks (~> 2.5.0)
|
47
|
-
rspec-core (2.5.1)
|
48
|
-
rspec-expectations (2.5.0)
|
49
|
-
diff-lcs (~> 1.1.2)
|
50
|
-
rspec-mocks (2.5.0)
|
51
|
-
ruby-debug (0.10.4)
|
52
|
-
columnize (>= 0.1)
|
53
|
-
ruby-debug-base (~> 0.10.4.0)
|
54
|
-
ruby-debug-base (0.10.4)
|
55
|
-
linecache (>= 0.3)
|
56
|
-
term-ansicolor (1.0.5)
|
57
|
-
tzinfo (0.3.26)
|
58
|
-
yard (0.6.8)
|
59
|
-
|
60
|
-
PLATFORMS
|
61
|
-
ruby
|
62
|
-
|
63
|
-
DEPENDENCIES
|
64
|
-
bundler
|
65
|
-
cucumber
|
66
|
-
kangaroo!
|
67
|
-
rspec
|
68
|
-
ruby-debug
|
69
|
-
yard
|
@@ -1,10 +0,0 @@
|
|
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
|
data/features/env.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Given /^i'm connected to an OpenERP server$/ do
|
2
|
-
logger = Logger.new(File.open("/dev/null", 'w'))
|
3
|
-
@config = Kangaroo::Util::Configuration.new 'features/support/test.yml', logger
|
4
|
-
@config.login
|
5
|
-
end
|
6
|
-
|
7
|
-
When /^i call (.*)\.(.*)$/ do |service, method|
|
8
|
-
proxy = Kangaroo::Util::Proxy.const_get(service.camelize).new @config.client.send("#{service}_service")
|
9
|
-
@result = proxy.__send__ method
|
10
|
-
end
|
11
|
-
|
12
|
-
Then /^i should see "([^"]*)"$/ do |arg1|
|
13
|
-
@result.should include(arg1)
|
14
|
-
end
|
15
|
-
|
16
|
-
Then /^the list should include "([^"]*)"$/ do |arg1|
|
17
|
-
@result.flatten.join("\n").should include(arg1)
|
18
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
Given /^i have a configuration file$/ do
|
2
|
-
@config_hash = YAML.load "features/support/test.yml"
|
3
|
-
end
|
4
|
-
|
5
|
-
When /^i setup a configuration$/ do
|
6
|
-
@logger = Logger.new(File.open("/dev/null", 'w'))
|
7
|
-
@config = Kangaroo::Util::Configuration.new @config_hash, @logger
|
8
|
-
end
|
9
|
-
|
10
|
-
Then /^i should be able to login$/ do
|
11
|
-
@logger.should_not_receive :warn
|
12
|
-
@config.login
|
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
|
data/features/support/test.yml
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
Feature: Utility Services
|
2
|
-
Scenario: Get server information
|
3
|
-
Given i'm connected to an OpenERP server
|
4
|
-
When i call common.about
|
5
|
-
Then i should see "OpenERP"
|
6
|
-
|
7
|
-
Scenario: Get server environment
|
8
|
-
Given i'm connected to an OpenERP server
|
9
|
-
When i call common.get_server_environment
|
10
|
-
Then i should see "OpenERP-Server Version : 6"
|
11
|
-
And i should see "Python Version : 2.6"
|
12
|
-
|
13
|
-
Scenario: Get server stats
|
14
|
-
Given i'm connected to an OpenERP server
|
15
|
-
When i call common.get_stats
|
16
|
-
Then i should see "HTTPd: running"
|
17
|
-
|
18
|
-
Scenario: List available HTTP services
|
19
|
-
Given i'm connected to an OpenERP server
|
20
|
-
When i call common.list_http_services
|
21
|
-
Then the list should include "service.http_server.XMLRPCRequestHandler"
|
22
|
-
|
23
|
-
Scenario: List available databases
|
24
|
-
Given i'm connected to an OpenERP server
|
25
|
-
When i call db.list
|
26
|
-
Then the list should include "kangaroo_test_database"
|
27
|
-
|
28
|
-
Scenario: List available languages
|
29
|
-
Given i'm connected to an OpenERP server
|
30
|
-
When i call db.list_lang
|
31
|
-
Then the list should include "English"
|
32
|
-
|
33
|
-
|