mack-data_mapper 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gems/{addressable-2.0.0 → addressable-2.0.1}/lib/addressable/idna.rb +0 -0
- data/lib/gems/{addressable-2.0.0 → addressable-2.0.1}/lib/addressable/uri.rb +62 -21
- data/lib/gems/{addressable-2.0.0 → addressable-2.0.1}/lib/addressable/version.rb +1 -1
- data/lib/gems/addressable-2.0.1/tasks/clobber.rake +2 -0
- data/lib/gems/addressable-2.0.1/tasks/gem.rake +68 -0
- data/lib/gems/addressable-2.0.1/tasks/git.rake +40 -0
- data/lib/gems/addressable-2.0.1/tasks/metrics.rake +22 -0
- data/lib/gems/addressable-2.0.1/tasks/rdoc.rake +29 -0
- data/lib/gems/addressable-2.0.1/tasks/rubyforge.rake +89 -0
- data/lib/gems/addressable-2.0.1/tasks/spec.rake +64 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects.rb +46 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects/command.rb +30 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects/connection.rb +107 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects/field.rb +19 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects/logger.rb +233 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects/quoting.rb +103 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects/reader.rb +22 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects/result.rb +13 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects/transaction.rb +45 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb +34 -0
- data/lib/gems/data_objects-0.9.10.1/lib/data_objects/version.rb +3 -0
- data/lib/gems/{dm-aggregates-0.9.7 → dm-aggregates-0.9.9}/lib/dm-aggregates.rb +1 -1
- data/lib/gems/{dm-aggregates-0.9.7 → dm-aggregates-0.9.9}/lib/dm-aggregates/adapters/data_objects_adapter.rb +0 -0
- data/lib/gems/{dm-aggregates-0.9.7 → dm-aggregates-0.9.9}/lib/dm-aggregates/aggregate_functions.rb +0 -0
- data/lib/gems/{dm-aggregates-0.9.7 → dm-aggregates-0.9.9}/lib/dm-aggregates/collection.rb +4 -0
- data/lib/gems/{dm-aggregates-0.9.7 → dm-aggregates-0.9.9}/lib/dm-aggregates/model.rb +4 -0
- data/lib/gems/{dm-aggregates-0.9.7 → dm-aggregates-0.9.9}/lib/dm-aggregates/repository.rb +0 -0
- data/lib/gems/{dm-aggregates-0.9.7 → dm-aggregates-0.9.9}/lib/dm-aggregates/support/symbol.rb +0 -0
- data/lib/gems/dm-aggregates-0.9.9/lib/dm-aggregates/version.rb +5 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core.rb +5 -5
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/adapters.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/adapters/abstract_adapter.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/adapters/data_objects_adapter.rb +1 -1
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/adapters/in_memory_adapter.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/adapters/mysql_adapter.rb +1 -1
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/adapters/postgres_adapter.rb +1 -1
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/adapters/sqlite3_adapter.rb +1 -1
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/associations.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/associations/many_to_many.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/associations/many_to_one.rb +1 -1
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/associations/one_to_many.rb +3 -6
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/associations/one_to_one.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/associations/relationship.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/associations/relationship_chain.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/auto_migrations.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/collection.rb +26 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/dependency_queue.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/hook.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/identity_map.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/is.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/logger.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/migrations/destructive_migrations.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/migrator.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/model.rb +29 -3
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/naming_conventions.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/property.rb +13 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/property_set.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/query.rb +51 -3
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/repository.rb +8 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/resource.rb +19 -6
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/scope.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/support.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/support/array.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/support/assertions.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/support/errors.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/support/kernel.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/support/symbol.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/transaction.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/type.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/type_map.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/types.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/types/boolean.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/types/discriminator.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/types/object.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/types/paranoid_boolean.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/types/paranoid_datetime.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/types/serial.rb +0 -0
- data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/types/text.rb +0 -0
- data/lib/gems/dm-core-0.9.9/lib/dm-core/version.rb +3 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/dm-migrations.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/dm-migrations/version.rb +1 -1
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/migration.rb +5 -3
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/migration_runner.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/spec/example/migration_example_group.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/spec/matchers/migration_matchers.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/sql.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/sql/column.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/sql/mysql.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/sql/postgresql.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/sql/sqlite3.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/sql/table.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/sql/table_creator.rb +0 -0
- data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/sql/table_modifier.rb +0 -0
- data/lib/gems/dm-migrations-0.9.9/tasks/db.rb +22 -0
- data/lib/gems/dm-migrations-0.9.9/tasks/install.rb +13 -0
- data/lib/gems/dm-migrations-0.9.9/tasks/spec.rb +25 -0
- data/lib/gems/{dm-observer-0.9.7 → dm-observer-0.9.9}/lib/dm-observer.rb +1 -1
- data/lib/gems/{dm-observer-0.9.7 → dm-observer-0.9.9}/lib/dm-observer/version.rb +1 -1
- data/lib/gems/dm-observer-0.9.9/tasks/install.rb +13 -0
- data/lib/gems/dm-observer-0.9.9/tasks/spec.rb +25 -0
- data/lib/gems/dm-serializer-0.9.9/lib/dm-serializer.rb +4 -0
- data/lib/gems/dm-serializer-0.9.9/lib/dm-serializer/common.rb +24 -0
- data/lib/gems/dm-serializer-0.9.9/lib/dm-serializer/to_csv.rb +35 -0
- data/lib/gems/dm-serializer-0.9.9/lib/dm-serializer/to_json.rb +73 -0
- data/lib/gems/dm-serializer-0.9.9/lib/dm-serializer/to_xml.rb +61 -0
- data/lib/gems/dm-serializer-0.9.9/lib/dm-serializer/to_yaml.rb +48 -0
- data/lib/gems/{dm-serializer-0.9.7 → dm-serializer-0.9.9}/lib/dm-serializer/version.rb +1 -1
- data/lib/gems/dm-serializer-0.9.9/lib/dm-serializer/xml_serializers.rb +17 -0
- data/lib/gems/dm-serializer-0.9.9/lib/dm-serializer/xml_serializers/libxml.rb +29 -0
- data/lib/gems/dm-serializer-0.9.9/lib/dm-serializer/xml_serializers/nokogiri.rb +28 -0
- data/lib/gems/dm-serializer-0.9.9/lib/dm-serializer/xml_serializers/rexml.rb +23 -0
- data/lib/gems/dm-serializer-0.9.9/tasks/install.rb +13 -0
- data/lib/gems/dm-serializer-0.9.9/tasks/spec.rb +25 -0
- data/lib/gems/dm-timestamps-0.9.9/lib/dm-timestamps.rb +58 -0
- data/lib/gems/{dm-timestamps-0.9.7 → dm-timestamps-0.9.9}/lib/dm-timestamps/version.rb +1 -1
- data/lib/gems/dm-timestamps-0.9.9/tasks/install.rb +13 -0
- data/lib/gems/dm-timestamps-0.9.9/tasks/spec.rb +25 -0
- data/lib/gems/dm-types-0.9.9/lib/dm-types.rb +26 -0
- data/lib/gems/dm-types-0.9.9/lib/dm-types/bcrypt_hash.rb +33 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/csv.rb +0 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/enum.rb +4 -4
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/epoch_time.rb +0 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/file_path.rb +0 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/flag.rb +0 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/ip_address.rb +0 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/json.rb +3 -6
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/regexp.rb +0 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/serial.rb +0 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/slug.rb +0 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/uri.rb +2 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/uuid.rb +3 -0
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/version.rb +1 -1
- data/lib/gems/{dm-types-0.9.7 → dm-types-0.9.9}/lib/dm-types/yaml.rb +1 -2
- data/lib/gems/dm-types-0.9.9/tasks/install.rb +13 -0
- data/lib/gems/dm-types-0.9.9/tasks/spec.rb +25 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations.rb +1 -1
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/absent_field_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/acceptance_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/auto_validate.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/block_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/confirmation_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/contextual_validators.rb +2 -3
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/custom_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/format_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/formats/email.rb +1 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/formats/url.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/generic_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/length_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/method_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/numeric_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/primitive_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/required_field_validator.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/support/object.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/uniqueness_validator.rb +1 -1
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/validation_errors.rb +0 -0
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/version.rb +1 -1
- data/lib/gems/{dm-validations-0.9.7 → dm-validations-0.9.9}/lib/dm-validations/within_validator.rb +0 -0
- data/lib/gems/dm-validations-0.9.9/tasks/install.rb +13 -0
- data/lib/gems/dm-validations-0.9.9/tasks/spec.rb +25 -0
- data/lib/gems/json_pure-1.1.3/tools/fuzz.rb +140 -0
- data/lib/gems/json_pure-1.1.3/tools/server.rb +62 -0
- data/lib/mack-data_mapper/dm_patches/migrations.rb +22 -1
- data/lib/mack-data_mapper/migration_generator/templates/db/migrations/%=@migration_name%.rb.template +1 -1
- metadata +216 -172
- data/lib/gems/dm-aggregates-0.9.7/lib/dm-aggregates/version.rb +0 -7
- data/lib/gems/dm-core-0.9.7/lib/dm-core/version.rb +0 -3
- data/lib/gems/dm-core-0.9.7/script/all +0 -5
- data/lib/gems/dm-core-0.9.7/script/performance.rb +0 -284
- data/lib/gems/dm-core-0.9.7/script/profile.rb +0 -87
- data/lib/gems/dm-serializer-0.9.7/lib/dm-serializer.rb +0 -183
- data/lib/gems/dm-timestamps-0.9.7/lib/dm-timestamps.rb +0 -57
- data/lib/gems/dm-types-0.9.7/lib/dm-types.rb +0 -28
- data/lib/gems/dm-types-0.9.7/lib/dm-types/bcrypt_hash.rb +0 -31
- data/lib/gems/json_pure-1.1.3/GPL +0 -340
- data/lib/gems/uuidtools-1.0.3/lib/uuidtools.rb +0 -648
- data/lib/gems/uuidtools-1.0.3/lib/uuidtools/version.rb +0 -32
@@ -0,0 +1,22 @@
|
|
1
|
+
module DataObjects
|
2
|
+
class Reader
|
3
|
+
|
4
|
+
def fields
|
5
|
+
raise NotImplementedError.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def values
|
9
|
+
raise NotImplementedError.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def close
|
13
|
+
raise NotImplementedError.new
|
14
|
+
end
|
15
|
+
|
16
|
+
# Moves the cursor forward.
|
17
|
+
def next!
|
18
|
+
raise NotImplementedError.new
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module DataObjects
|
2
|
+
class Result
|
3
|
+
attr_accessor :insert_id, :affected_rows
|
4
|
+
|
5
|
+
def initialize(command, affected_rows, insert_id = nil)
|
6
|
+
@command, @affected_rows, @insert_id = command, affected_rows, insert_id
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_i
|
10
|
+
@affected_rows
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'digest'
|
2
|
+
require 'digest/sha2'
|
3
|
+
|
4
|
+
module DataObjects
|
5
|
+
|
6
|
+
class Transaction
|
7
|
+
|
8
|
+
HOST = "#{Socket::gethostbyname(Socket::gethostname)[0]}" rescue "localhost"
|
9
|
+
@@counter = 0
|
10
|
+
|
11
|
+
attr_reader :connection
|
12
|
+
attr_reader :id
|
13
|
+
|
14
|
+
def self.create_for_uri(uri)
|
15
|
+
uri = uri.is_a?(String) ? URI::parse(uri) : uri
|
16
|
+
DataObjects.const_get(uri.scheme.capitalize)::Transaction.new(uri)
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# Creates a Transaction bound to the given connection
|
21
|
+
#
|
22
|
+
# ==== Parameters
|
23
|
+
# conn<DataObjects::Connection>:: The Connection to bind the new Transaction to
|
24
|
+
#
|
25
|
+
def initialize(uri)
|
26
|
+
@connection = DataObjects::Connection.new(uri)
|
27
|
+
@id = Digest::SHA256.hexdigest("#{HOST}:#{$$}:#{Time.now.to_f}:#{@@counter += 1}")
|
28
|
+
end
|
29
|
+
|
30
|
+
def close
|
31
|
+
@connection.close
|
32
|
+
end
|
33
|
+
|
34
|
+
[:begin, :commit, :rollback, :rollback_prepared, :prepare].each do |method_name|
|
35
|
+
|
36
|
+
eval <<EOF
|
37
|
+
def #{method_name}
|
38
|
+
raise NotImplementedError
|
39
|
+
end
|
40
|
+
EOF
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
gem 'addressable', '~>2.0'
|
2
|
+
require 'addressable/uri'
|
3
|
+
|
4
|
+
module DataObjects
|
5
|
+
URI = Struct.new(:scheme, :user, :password, :host, :port, :path, :query, :fragment)
|
6
|
+
|
7
|
+
class URI
|
8
|
+
def self.parse(uri)
|
9
|
+
return uri if uri.kind_of?(self)
|
10
|
+
uri = Addressable::URI::parse(uri) unless uri.kind_of?(Addressable::URI)
|
11
|
+
self.new(uri.scheme, uri.user, uri.password, uri.host, uri.port, uri.path, uri.query_values, uri.fragment)
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
string = ""
|
16
|
+
string << "#{scheme}://" if scheme
|
17
|
+
if user
|
18
|
+
string << "#{user}"
|
19
|
+
string << ":#{password}" if password
|
20
|
+
string << "@"
|
21
|
+
end
|
22
|
+
string << "#{host}" if host
|
23
|
+
string << ":#{port}" if port
|
24
|
+
string << path.to_s
|
25
|
+
if query
|
26
|
+
string << "?" << query.map do |key, value|
|
27
|
+
"#{key}=#{value}"
|
28
|
+
end.join("&")
|
29
|
+
end
|
30
|
+
string << "##{fragment}" if fragment
|
31
|
+
string
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
File without changes
|
data/lib/gems/{dm-aggregates-0.9.7 → dm-aggregates-0.9.9}/lib/dm-aggregates/aggregate_functions.rb
RENAMED
File without changes
|
File without changes
|
data/lib/gems/{dm-aggregates-0.9.7 → dm-aggregates-0.9.9}/lib/dm-aggregates/support/symbol.rb
RENAMED
File without changes
|
@@ -11,20 +11,20 @@
|
|
11
11
|
|
12
12
|
require 'date'
|
13
13
|
require 'pathname'
|
14
|
+
require 'rubygems'
|
14
15
|
require 'set'
|
15
16
|
require 'time'
|
16
17
|
require 'yaml'
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
gem 'addressable', '~>2.0'
|
19
|
+
gem 'addressable', '~>2.0.1'
|
21
20
|
require 'addressable/uri'
|
22
21
|
|
23
|
-
gem 'extlib', '~>0.9.
|
22
|
+
gem 'extlib', '~>0.9.9'
|
24
23
|
require 'extlib'
|
25
|
-
require
|
24
|
+
require 'extlib/inflection'
|
26
25
|
|
27
26
|
begin
|
27
|
+
gem 'fastthread', '~>1.0.1'
|
28
28
|
require 'fastthread'
|
29
29
|
rescue LoadError
|
30
30
|
# fastthread not installed
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -48,7 +48,7 @@ module DataMapper
|
|
48
48
|
class Proxy
|
49
49
|
include Assertions
|
50
50
|
|
51
|
-
instance_methods.each { |m| undef_method m unless %w[ __id__ __send__
|
51
|
+
instance_methods.each { |m| undef_method m unless %w[ __id__ __send__ kind_of? respond_to? assert_kind_of should should_not instance_variable_set instance_variable_get ].include?(m.to_s) }
|
52
52
|
|
53
53
|
def replace(parent)
|
54
54
|
@parent = parent
|
@@ -72,7 +72,7 @@ module DataMapper
|
|
72
72
|
class Proxy
|
73
73
|
include Assertions
|
74
74
|
|
75
|
-
instance_methods.each { |m| undef_method m unless %w[ __id__ __send__ class kind_of? respond_to? assert_kind_of should should_not instance_variable_set instance_variable_get ].include?(m) }
|
75
|
+
instance_methods.each { |m| undef_method m unless %w[ __id__ __send__ class kind_of? respond_to? assert_kind_of should should_not instance_variable_set instance_variable_get ].include?(m.to_s) }
|
76
76
|
|
77
77
|
# FIXME: remove when RelationshipChain#get_children can return a Collection
|
78
78
|
def all(query = {})
|
@@ -306,11 +306,8 @@ module DataMapper
|
|
306
306
|
end
|
307
307
|
|
308
308
|
def method_missing(method, *args, &block)
|
309
|
-
results = children.
|
310
|
-
|
311
|
-
return self if LazyArray::RETURN_SELF.include?(method) && results.kind_of?(Array)
|
312
|
-
|
313
|
-
results
|
309
|
+
results = children.send(method, *args, &block)
|
310
|
+
results.equal?(children) ? self : results
|
314
311
|
end
|
315
312
|
end # class Proxy
|
316
313
|
end # module OneToMany
|
File without changes
|
File without changes
|
data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/associations/relationship_chain.rb
RENAMED
File without changes
|
File without changes
|
@@ -494,6 +494,32 @@ module DataMapper
|
|
494
494
|
super || model.public_methods(false).include?(method.to_s) || relationships.has_key?(method)
|
495
495
|
end
|
496
496
|
|
497
|
+
# TODO: add docs
|
498
|
+
# @api private
|
499
|
+
def _dump(*)
|
500
|
+
Marshal.dump([ query, to_a ])
|
501
|
+
end
|
502
|
+
|
503
|
+
# TODO: add docs
|
504
|
+
# @api private
|
505
|
+
def self._load(marshalled)
|
506
|
+
query, array = Marshal.load(marshalled)
|
507
|
+
|
508
|
+
# XXX: IMHO it is a code smell to be forced to use allocate
|
509
|
+
# and instance_variable_set to load an object. You should
|
510
|
+
# be able to use a constructor to provide all the info needed
|
511
|
+
# to initialize an object. This should be fixed in the edge
|
512
|
+
# branch dkubb/dm-core
|
513
|
+
|
514
|
+
collection = allocate
|
515
|
+
collection.instance_variable_set(:@query, query)
|
516
|
+
collection.instance_variable_set(:@array, array)
|
517
|
+
collection.instance_variable_set(:@loaded, true)
|
518
|
+
collection.instance_variable_set(:@key_properties, collection.send(:model).key(collection.repository.name))
|
519
|
+
collection.instance_variable_set(:@cache, {})
|
520
|
+
collection
|
521
|
+
end
|
522
|
+
|
497
523
|
protected
|
498
524
|
|
499
525
|
##
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/gems/{dm-core-0.9.7 → dm-core-0.9.9}/lib/dm-core/migrations/destructive_migrations.rb
RENAMED
File without changes
|
File without changes
|
@@ -306,11 +306,30 @@ module DataMapper
|
|
306
306
|
resource
|
307
307
|
end
|
308
308
|
|
309
|
-
|
309
|
+
##
|
310
|
+
# Copy a set of records from one repository to another.
|
311
|
+
#
|
312
|
+
# @param [String] source
|
313
|
+
# The name of the Repository the resources should be copied _from_
|
314
|
+
# @param [String] destination
|
315
|
+
# The name of the Repository the resources should be copied _to_
|
316
|
+
# @param [Hash] query
|
317
|
+
# The conditions with which to find the records to copy. These
|
318
|
+
# conditions are merged with Model.query
|
319
|
+
#
|
320
|
+
# @return [DataMapper::Collection]
|
321
|
+
# A Collection of the Resource instances created in the operation
|
322
|
+
#
|
323
|
+
# @api public
|
310
324
|
def copy(source, destination, query = {})
|
325
|
+
|
326
|
+
# get the list of properties that exist in the source and destination
|
327
|
+
destination_properties = properties(destination)
|
328
|
+
fields = query[:fields] ||= properties(source).select { |p| destination_properties.has_property?(p.name) }
|
329
|
+
|
311
330
|
repository(destination) do
|
312
|
-
|
313
|
-
|
331
|
+
all(query.merge(:repository => repository(source))).map do |resource|
|
332
|
+
create(fields.map { |p| [ p.name, p.get(resource) ] }.to_hash)
|
314
333
|
end
|
315
334
|
end
|
316
335
|
end
|
@@ -366,6 +385,13 @@ module DataMapper
|
|
366
385
|
Query.new(repository, self, query.merge(conditions))
|
367
386
|
end
|
368
387
|
|
388
|
+
# TODO: add docs
|
389
|
+
# @api private
|
390
|
+
def _load(marshalled)
|
391
|
+
repository_name, attributes = Marshal.load(marshalled)
|
392
|
+
repository(repository_name) { new(attributes) }
|
393
|
+
end
|
394
|
+
|
369
395
|
def typecast_key(key)
|
370
396
|
self.key(repository_name).zip(key).map { |k, v| k.typecast(v) }
|
371
397
|
end
|
File without changes
|
@@ -512,6 +512,19 @@ module DataMapper
|
|
512
512
|
"#<Property:#{@model}:#{@name}>"
|
513
513
|
end
|
514
514
|
|
515
|
+
# TODO: add docs
|
516
|
+
# @api private
|
517
|
+
def _dump(*)
|
518
|
+
Marshal.dump([ repository, model, name ])
|
519
|
+
end
|
520
|
+
|
521
|
+
# TODO: add docs
|
522
|
+
# @api private
|
523
|
+
def self._load(marshalled)
|
524
|
+
repository, model, name = Marshal.load(marshalled)
|
525
|
+
model.properties(repository.name)[name]
|
526
|
+
end
|
527
|
+
|
515
528
|
private
|
516
529
|
|
517
530
|
def initialize(model, name, type, options = {})
|
File without changes
|
@@ -51,11 +51,10 @@ module DataMapper
|
|
51
51
|
@limit = other.limit unless other.limit == nil
|
52
52
|
@order = other.order unless other.order == model.default_order
|
53
53
|
@add_reversed = other.add_reversed? unless other.add_reversed? == false
|
54
|
+
@fields = other.fields unless other.fields == @properties.defaults
|
54
55
|
@links = other.links unless other.links == []
|
55
56
|
@includes = other.includes unless other.includes == []
|
56
57
|
|
57
|
-
@fields == @properties.defaults ? @fields = other.fields : @fields |= other.fields
|
58
|
-
|
59
58
|
update_conditions(other)
|
60
59
|
|
61
60
|
self
|
@@ -152,6 +151,55 @@ module DataMapper
|
|
152
151
|
"#<#{self.class.name} #{attrs.map { |(k,v)| "@#{k}=#{v.inspect}" } * ' '}>"
|
153
152
|
end
|
154
153
|
|
154
|
+
# TODO: add docs
|
155
|
+
# @api public
|
156
|
+
def to_hash
|
157
|
+
hash = {
|
158
|
+
:reload => reload?,
|
159
|
+
:unique => unique?,
|
160
|
+
:offset => offset,
|
161
|
+
:order => order,
|
162
|
+
:add_reversed => add_reversed?,
|
163
|
+
:fields => fields,
|
164
|
+
}
|
165
|
+
|
166
|
+
hash[:limit] = limit unless limit == nil
|
167
|
+
hash[:links] = links unless links == []
|
168
|
+
hash[:includes] = includes unless includes == []
|
169
|
+
|
170
|
+
conditions = {}
|
171
|
+
raw_queries = []
|
172
|
+
bind_values = []
|
173
|
+
|
174
|
+
conditions.each do |condition|
|
175
|
+
if condition[0] == :raw
|
176
|
+
raw_queries << condition[1]
|
177
|
+
bind_values << condition[2]
|
178
|
+
else
|
179
|
+
operator, property, bind_value = condition
|
180
|
+
conditions[ Query::Operator.new(property, operator) ] = bind_value
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
if raw_queries.any?
|
185
|
+
hash[:conditions] = [ raw_queries.join(' ') ].concat(bind_values)
|
186
|
+
end
|
187
|
+
|
188
|
+
hash.update(conditions)
|
189
|
+
end
|
190
|
+
|
191
|
+
# TODO: add docs
|
192
|
+
# @api private
|
193
|
+
def _dump(*)
|
194
|
+
Marshal.dump([ repository, model, to_hash ])
|
195
|
+
end
|
196
|
+
|
197
|
+
# TODO: add docs
|
198
|
+
# @api private
|
199
|
+
def self._load(marshalled)
|
200
|
+
new(*Marshal.load(marshalled))
|
201
|
+
end
|
202
|
+
|
155
203
|
private
|
156
204
|
|
157
205
|
def initialize(repository, model, options = {})
|
@@ -574,7 +622,7 @@ module DataMapper
|
|
574
622
|
class Path
|
575
623
|
include Assertions
|
576
624
|
|
577
|
-
|
625
|
+
instance_methods.each { |m| undef_method m if %w[ id type ].include?(m.to_s) }
|
578
626
|
|
579
627
|
attr_reader :relationships, :model, :property, :operator
|
580
628
|
|