lore 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/Manifest.txt +7 -0
- data/Rakefile +12 -0
- data/{custom_functions.sql → bin/custom_functions.sql} +0 -0
- data/bin/setup_db.rb +9 -0
- data/{README → lib/lore/README.txt} +28 -18
- data/{aspect.rb → lib/lore/aspect.rb} +0 -0
- data/{behaviours → lib/lore/behaviours}/lockable.rb +0 -0
- data/{behaviours → lib/lore/behaviours}/movable.rb +0 -0
- data/{behaviours → lib/lore/behaviours}/versioned.rb +0 -0
- data/{bits.rb → lib/lore/bits.rb} +0 -0
- data/{cache → lib/lore/cache}/abstract_entity_cache.rb +0 -0
- data/{cache → lib/lore/cache}/bits.rb +0 -0
- data/{cache → lib/lore/cache}/cacheable.rb +0 -0
- data/{cache → lib/lore/cache}/cached_entities.rb +0 -0
- data/{cache → lib/lore/cache}/file_index.rb +0 -0
- data/{cache → lib/lore/cache}/mmap_entity_cache.rb +5 -1
- data/{clause.rb → lib/lore/clause.rb} +0 -0
- data/{connection.rb → lib/lore/connection.rb} +1 -1
- data/{exception → lib/lore/exception}/ambiguous_attribute.rb +0 -0
- data/{exception → lib/lore/exception}/cache_exception.rb +0 -0
- data/{exception → lib/lore/exception}/invalid_klass_parameters.rb +0 -0
- data/{exception → lib/lore/exception}/invalid_parameter.rb +0 -0
- data/{exception → lib/lore/exception}/unknown_typecode.rb +0 -0
- data/{gui → lib/lore/gui}/erb_template.rb +0 -0
- data/{gui → lib/lore/gui}/erb_template_helpers.rhtml +0 -0
- data/{gui → lib/lore/gui}/form.rb +0 -0
- data/{gui → lib/lore/gui}/form_element.rb +0 -0
- data/{gui → lib/lore/gui}/form_generator.rb +0 -0
- data/{gui → lib/lore/gui}/templates/button.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/checkbox.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/checkbox_row.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/file.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/file_readonly.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/form_element.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/form_element_horizontal.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/form_element_listed.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/form_table.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/form_table_blank.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/form_table_horizontal.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/password.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/password_readonly.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/radio.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/radio_row.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/select.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/text.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/text_readonly.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/textarea.rhtml +0 -0
- data/{gui → lib/lore/gui}/templates/textarea_readonly.rhtml +0 -0
- data/{migration.rb → lib/lore/migration.rb} +0 -0
- data/{model.rb → lib/lore/model.rb} +0 -0
- data/{model_factory.rb → lib/lore/model_factory.rb} +0 -0
- data/{model_shortcuts.rb → lib/lore/model_shortcuts.rb} +0 -0
- data/{query_shortcuts.rb → lib/lore/query_shortcuts.rb} +0 -0
- data/{result.rb → lib/lore/result.rb} +0 -0
- data/{symbol.rb → lib/lore/symbol.rb} +0 -0
- data/{table_accessor.rb → lib/lore/table_accessor.rb} +0 -0
- data/{table_deleter.rb → lib/lore/table_deleter.rb} +0 -0
- data/{table_inserter.rb → lib/lore/table_inserter.rb} +0 -0
- data/{table_instance.rb → lib/lore/table_instance.rb} +0 -0
- data/{table_selector.rb → lib/lore/table_selector.rb} +0 -0
- data/{table_updater.rb → lib/lore/table_updater.rb} +0 -0
- data/{types.rb → lib/lore/types.rb} +0 -0
- data/{validation → lib/lore/validation}/message.rb +0 -0
- data/{validation → lib/lore/validation}/parameter_validator.rb +0 -0
- data/{validation → lib/lore/validation}/reason.rb +1 -3
- data/{validation → lib/lore/validation}/type_validator.rb +0 -0
- data/{validation.rb → lib/lore/validation.rb} +0 -0
- data/{lore.rb → lib/lore.rb} +2 -0
- data/lore-0.4.3.gem +0 -0
- data/lore.gemspec +12 -10
- data/test/custom_models.rb +18 -0
- data/test/lore_test.log +617 -8218
- data/test/{ts_lore.rb → test_lore.rb} +0 -0
- metadata +84 -88
- data/benchmark.rb +0 -193
- data/file_index.sql +0 -56
- data/reserved_methods.txt +0 -3
- data/test/test.log +0 -181
data/History.txt
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
=== 0.4.2 / 2008-11-10
|
2
|
+
|
3
|
+
* Major performance increase due to
|
4
|
+
* Optimized queries
|
5
|
+
* Mmap caching
|
6
|
+
* Minor refactoring - major effects
|
7
|
+
* Overhead of Lore is quite the same as Rails::ActiveRecord's
|
8
|
+
* Further unit tests
|
9
|
+
* Extended prepared statements
|
10
|
+
|
data/Manifest.txt
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/lore.rb'
|
6
|
+
|
7
|
+
Hoe.new('lore', Lore::VERSION) do |p|
|
8
|
+
p.rubyforge_name = 'lore' # if different than lowercase project name
|
9
|
+
p.developer('Tobias Fuchs', 'fuchs@wortundform.de')
|
10
|
+
end
|
11
|
+
|
12
|
+
# vim: syntax=Ruby
|
File without changes
|
data/bin/setup_db.rb
ADDED
@@ -3,31 +3,41 @@ Q: Are there adapters for other DBMS than PostgreSQL?
|
|
3
3
|
A: PostgreSQL is - to me and everyone using Lore i know of -
|
4
4
|
the best (free) choice for sophisticated database-driven
|
5
5
|
apps, so frankly said: Implementing adapters is not on my
|
6
|
-
top priority list.
|
7
|
-
performance, by introducing an additional level of
|
8
|
-
abstraction.
|
6
|
+
top priority list.
|
9
7
|
So far, Lore supports PostgreSQL (7.4 to 8.3 tested).
|
10
8
|
Adapters are planned for oracle mysql and sqlite though.
|
11
9
|
Lore is SQL 92 compatible and not using any exotic
|
12
10
|
Postgres features, so it *might* work fine on e.g. mysql
|
13
|
-
and sqlite with just minor modifications.
|
14
|
-
about cascading dependencies etc, so you don't even
|
15
|
-
foreign keys or table inheritance.
|
11
|
+
and sqlite with just minor modifications. Lore is caring
|
12
|
+
about cascading dependencies etc itself, so you don't even
|
13
|
+
need foreign keys or table inheritance.
|
16
14
|
You will have to change the code establishing DB
|
17
15
|
connections (see connection.rb), but as those are
|
18
16
|
abstracted, just a couple of lines of code in connection.rb
|
19
17
|
had to be changed.
|
20
18
|
|
21
19
|
Q: How do i establish a DB connection at all?
|
22
|
-
A:
|
23
|
-
about connections itself.
|
24
|
-
You have to enter a so-called context (database, that is),
|
25
|
-
though:
|
20
|
+
A: First provide login data for a database (aka Context):
|
26
21
|
|
27
|
-
Lore
|
22
|
+
Lore.add_login_data('dbname' => ['user', 'pass'])
|
23
|
+
Lore.add_login_data('other_dbname' => ['user', 'pass'])
|
24
|
+
|
25
|
+
Now, activate a context. You can stack them, too:
|
26
|
+
|
27
|
+
Lore::Context.enter :dbname
|
28
|
+
# Operate in database dbname
|
29
|
+
Lore::Context.enter :other_dbname
|
30
|
+
# Operate in database other_dbname
|
31
|
+
Lore::Context.leave
|
32
|
+
# Operate in database dbname
|
33
|
+
Lore::Context.enter :other_dbname
|
28
34
|
|
29
35
|
Q: What about connection pooling?
|
30
|
-
A:
|
36
|
+
A: Lore re-uses connections per-process, that is: There is
|
37
|
+
one connection for every context you entered in every
|
38
|
+
process Lore is running in.
|
39
|
+
In case you need connections shared over multiple
|
40
|
+
processes, use PGPool for that, it's way better than any
|
31
41
|
implementation of connection pooling in ruby.
|
32
42
|
Install PGPool and tell lore to connect to PGPool's port
|
33
43
|
instead of PostgreSQL's one.
|
@@ -38,15 +48,16 @@ A: Use PGPool for that, it's way better than any
|
|
38
48
|
That's it!
|
39
49
|
|
40
50
|
Q: Which solution do you recommend for query result caching?
|
41
|
-
A: There are many possibilities: Tempfiles,
|
51
|
+
A: There are many possibilities: Tempfiles, Mmap and Memcached
|
42
52
|
are the most widespread solutions known to me.
|
43
53
|
Many will agree that MMap is the best solution in matters
|
44
54
|
of performance on a single server, and memcached as soon as
|
45
55
|
more than one server is involved in your application.
|
56
|
+
To enable caching for all models:
|
46
57
|
|
47
|
-
|
48
|
-
|
49
|
-
|
58
|
+
Lore::Model.use_entity_cache Lore::Cache::Mmap_Entity_Cache
|
59
|
+
or
|
60
|
+
Lore::Model.use_entity_cache Lore::Cache::Memcached_Entity_Cache
|
50
61
|
|
51
62
|
Q: After creating a model via Model_Factory: How do i change
|
52
63
|
it?
|
@@ -54,8 +65,7 @@ A: At the moment, this is not implemented, but tracked as
|
|
54
65
|
'missing feature'. This will be possible in version 1.0 at
|
55
66
|
the latest.
|
56
67
|
|
57
|
-
Q:
|
58
|
-
helpful. Where can i get more info and examples?
|
68
|
+
Q: Where to look for documentation and examples?
|
59
69
|
A: Have a look at the wiki. I'm updating it quite often, and
|
60
70
|
new features are explained in the wiki first:
|
61
71
|
http://infranode.com/wiki/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,7 +1,11 @@
|
|
1
1
|
|
2
2
|
require 'lore'
|
3
3
|
require 'lore/cache/abstract_entity_cache'
|
4
|
-
|
4
|
+
begin
|
5
|
+
require 'mmap'
|
6
|
+
rescue LoadError
|
7
|
+
Lore.log { 'Mmap for Ruby could not be found. You won\'t be able to use Mmap_Entity_Cache. ' }
|
8
|
+
end
|
5
9
|
|
6
10
|
module Lore
|
7
11
|
module Cache
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,5 @@
|
|
1
1
|
|
2
2
|
require('lore/validation/message')
|
3
|
-
require('htmlentities')
|
4
3
|
|
5
4
|
module Lore
|
6
5
|
module Validation
|
@@ -12,8 +11,7 @@ module Validation
|
|
12
11
|
attr_reader :options
|
13
12
|
|
14
13
|
def message()
|
15
|
-
|
16
|
-
return @message.map { |m| HTMLEntities.new.decode(m) }
|
14
|
+
@message
|
17
15
|
end
|
18
16
|
|
19
17
|
def initialize(message, options) # {{{
|
File without changes
|
File without changes
|
data/{lore.rb → lib/lore.rb}
RENAMED
data/lore-0.4.3.gem
ADDED
File without changes
|
data/lore.gemspec
CHANGED
@@ -14,25 +14,27 @@ spec = Gem::Specification.new { |s|
|
|
14
14
|
and result caching using memory mapping (MMap).
|
15
15
|
Lore is currently using PostgreSQL as database backend.
|
16
16
|
EOF
|
17
|
-
s.version = '0.4.
|
17
|
+
s.version = '0.4.3'
|
18
18
|
s.author = 'Tobias Fuchs'
|
19
19
|
s.email = 'fuchs@atomnode.net'
|
20
20
|
s.date = Time.now
|
21
21
|
s.files = '*.rb'
|
22
|
-
s.add_dependency('mmap', '>= 0.1')
|
23
22
|
s.add_dependency('postgres', '>= 0.1')
|
24
23
|
s.files = FileList['*',
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
'lib/*',
|
25
|
+
'lib/lore/*',
|
26
|
+
'lib/lore/behaviours/*',
|
27
|
+
'lib/lore/cache/*',
|
28
|
+
'lib/lore/validation/*',
|
29
|
+
'lib/lore/gui/*',
|
30
|
+
'lib/lore/gui/templates/*',
|
31
|
+
'lib/lore/exception/*',
|
32
|
+
'bin/*',
|
33
|
+
'test/*'].to_a
|
32
34
|
|
33
35
|
s.has_rdoc = true
|
34
36
|
s.rdoc_options << '--title' << 'Lore ORM' <<
|
35
|
-
'--main' << 'README' <<
|
37
|
+
'--main' << 'README.txt' <<
|
36
38
|
'--line-numbers'
|
37
39
|
|
38
40
|
s.homepage = 'http://lore.rubyforge.org'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
require('lore/model')
|
3
|
+
|
4
|
+
module Some
|
5
|
+
module App
|
6
|
+
|
7
|
+
class New_Model < Lore::Model
|
8
|
+
table :new_model, :public
|
9
|
+
primary_key :model_id, :model_id_seq
|
10
|
+
has_attribute :name, Lore::Type.integer
|
11
|
+
has_attribute :created, Lore::Type.timestamp
|
12
|
+
has_attribute :model_id, Lore::Type.integer
|
13
|
+
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|