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
@@ -198,7 +198,7 @@ module DataMapper
|
|
198
198
|
attrs = []
|
199
199
|
|
200
200
|
properties.each do |property|
|
201
|
-
value = if
|
201
|
+
value = if !attribute_loaded?(property.name) && !new_record?
|
202
202
|
'<not loaded>'
|
203
203
|
else
|
204
204
|
send(property.getter).inspect
|
@@ -491,13 +491,13 @@ module DataMapper
|
|
491
491
|
# --
|
492
492
|
# @api public
|
493
493
|
def attributes=(values_hash)
|
494
|
-
values_hash.
|
495
|
-
|
494
|
+
values_hash.each do |name, value|
|
495
|
+
name = name.to_s.sub(/\?\z/, '')
|
496
496
|
|
497
|
-
if
|
498
|
-
send(setter,
|
497
|
+
if self.class.public_method_defined?(setter = "#{name}=")
|
498
|
+
send(setter, value)
|
499
499
|
else
|
500
|
-
raise
|
500
|
+
raise ArgumentError, "The property '#{name}' is not a public property."
|
501
501
|
end
|
502
502
|
end
|
503
503
|
end
|
@@ -528,6 +528,19 @@ module DataMapper
|
|
528
528
|
model.to_query(repository, key, query) unless new_record?
|
529
529
|
end
|
530
530
|
|
531
|
+
# TODO: add docs
|
532
|
+
# @api private
|
533
|
+
def _dump(*)
|
534
|
+
repository_name = repository.name
|
535
|
+
attributes = {}
|
536
|
+
|
537
|
+
model.properties(repository_name).slice(*loaded_attributes).compact.each do |property|
|
538
|
+
attributes[property.name] = property.get(self) if property.writer_visibility == :public
|
539
|
+
end
|
540
|
+
|
541
|
+
Marshal.dump([ repository_name, attributes ])
|
542
|
+
end
|
543
|
+
|
531
544
|
protected
|
532
545
|
|
533
546
|
def properties
|
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,5 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
gem 'dm-core', '~>0.9.
|
2
|
+
gem 'dm-core', '~>0.9.9'
|
3
3
|
require 'dm-core'
|
4
4
|
require 'benchmark'
|
5
5
|
require File.dirname(__FILE__) + '/sql'
|
@@ -196,19 +196,21 @@ module DataMapper
|
|
196
196
|
|
197
197
|
# Quoted table name, for the adapter
|
198
198
|
def migration_info_table
|
199
|
-
@migration_info_table ||=
|
199
|
+
@migration_info_table ||= quote_table_name('migration_info')
|
200
200
|
end
|
201
201
|
|
202
202
|
# Quoted `migration_name` column, for the adapter
|
203
203
|
def migration_name_column
|
204
|
-
@migration_name_column ||=
|
204
|
+
@migration_name_column ||= quote_column_name('migration_name')
|
205
205
|
end
|
206
206
|
|
207
207
|
def quote_table_name(table_name)
|
208
|
+
# TODO: Fix this for 1.9 - can't use this hack to access a private method
|
208
209
|
@adapter.send(:quote_table_name, table_name.to_s)
|
209
210
|
end
|
210
211
|
|
211
212
|
def quote_column_name(column_name)
|
213
|
+
# TODO: Fix this for 1.9 - can't use this hack to access a private method
|
212
214
|
@adapter.send(:quote_column_name, column_name.to_s)
|
213
215
|
end
|
214
216
|
end
|
File without changes
|
File without changes
|
data/lib/gems/{dm-migrations-0.9.7 → dm-migrations-0.9.9}/lib/spec/matchers/migration_matchers.rb
RENAMED
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
|
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :db do
|
2
|
+
|
3
|
+
# pass the relative path to the migrations directory by MIGRATION_DIR
|
4
|
+
task :setup_migration_dir do
|
5
|
+
unless defined?(MIGRATION_DIR)
|
6
|
+
migration_dir = ENV["MIGRATION_DIR"] || File.join("db", "migrations")
|
7
|
+
MIGRATION_DIR = File.expand_path(File.join(File.dirname(__FILE__), migration_dir))
|
8
|
+
end
|
9
|
+
FileUtils.mkdir_p MIGRATION_DIR
|
10
|
+
end
|
11
|
+
|
12
|
+
# set DIRECTION to migrate down
|
13
|
+
desc "Run your system's migrations"
|
14
|
+
task :migrate => [:setup_migration_dir] do
|
15
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "lib", "migration_runner.rb"))
|
16
|
+
require File.expand_path(File.join(MIGRATION_DIR, "config.rb"))
|
17
|
+
|
18
|
+
Dir[File.join(MIGRATION_DIR, "*.rb")].each { |file| require file }
|
19
|
+
|
20
|
+
ENV["DIRECTION"] != "down" ? migrate_up! : migrate_down!
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
def sudo_gem(cmd)
|
2
|
+
sh "#{SUDO} #{RUBY} -S gem #{cmd}", :verbose => false
|
3
|
+
end
|
4
|
+
|
5
|
+
desc "Install #{GEM_NAME} #{GEM_VERSION}"
|
6
|
+
task :install => [ :package ] do
|
7
|
+
sudo_gem "install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Uninstall #{GEM_NAME} #{GEM_VERSION}"
|
11
|
+
task :uninstall => [ :clobber ] do
|
12
|
+
sudo_gem "uninstall #{GEM_NAME} -v#{GEM_VERSION} -Ix"
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
begin
|
2
|
+
gem 'rspec', '~>1.1.11'
|
3
|
+
require 'spec'
|
4
|
+
require 'spec/rake/spectask'
|
5
|
+
|
6
|
+
task :default => [ :spec ]
|
7
|
+
|
8
|
+
desc 'Run specifications'
|
9
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
10
|
+
t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
|
11
|
+
t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
|
12
|
+
|
13
|
+
begin
|
14
|
+
gem 'rcov', '~>0.8'
|
15
|
+
t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
|
16
|
+
t.rcov_opts << '--exclude' << 'spec'
|
17
|
+
t.rcov_opts << '--text-summary'
|
18
|
+
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
|
19
|
+
rescue LoadError
|
20
|
+
# rcov not installed
|
21
|
+
end
|
22
|
+
end
|
23
|
+
rescue LoadError
|
24
|
+
# rspec not installed
|
25
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
def sudo_gem(cmd)
|
2
|
+
sh "#{SUDO} #{RUBY} -S gem #{cmd}", :verbose => false
|
3
|
+
end
|
4
|
+
|
5
|
+
desc "Install #{GEM_NAME} #{GEM_VERSION}"
|
6
|
+
task :install => [ :package ] do
|
7
|
+
sudo_gem "install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Uninstall #{GEM_NAME} #{GEM_VERSION}"
|
11
|
+
task :uninstall => [ :clobber ] do
|
12
|
+
sudo_gem "uninstall #{GEM_NAME} -v#{GEM_VERSION} -Ix"
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
begin
|
2
|
+
gem 'rspec', '~>1.1.11'
|
3
|
+
require 'spec'
|
4
|
+
require 'spec/rake/spectask'
|
5
|
+
|
6
|
+
task :default => [ :spec ]
|
7
|
+
|
8
|
+
desc 'Run specifications'
|
9
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
10
|
+
t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
|
11
|
+
t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
|
12
|
+
|
13
|
+
begin
|
14
|
+
gem 'rcov', '~>0.8'
|
15
|
+
t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
|
16
|
+
t.rcov_opts << '--exclude' << 'spec'
|
17
|
+
t.rcov_opts << '--text-summary'
|
18
|
+
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
|
19
|
+
rescue LoadError
|
20
|
+
# rcov not installed
|
21
|
+
end
|
22
|
+
end
|
23
|
+
rescue LoadError
|
24
|
+
# rspec not installed
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module DataMapper
|
2
|
+
module Serialize
|
3
|
+
# Returns propreties to serialize based on :only or :exclude arrays, if provided
|
4
|
+
# :only takes precendence over :exclude
|
5
|
+
#
|
6
|
+
# @return <Array> properties that need to be serialized
|
7
|
+
def properties_to_serialize(options)
|
8
|
+
only_properties = Array(options[:only])
|
9
|
+
excluded_properties = Array(options[:exclude])
|
10
|
+
|
11
|
+
self.class.properties(repository.name).reject do |p|
|
12
|
+
if only_properties.include? p.name
|
13
|
+
false
|
14
|
+
else
|
15
|
+
excluded_properties.include?(p.name) || !(only_properties.empty? || only_properties.include?(p.name))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module Resource
|
22
|
+
include Serialize
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'dm-serializer/common'
|
2
|
+
|
3
|
+
begin
|
4
|
+
gem('fastercsv')
|
5
|
+
require 'faster_csv'
|
6
|
+
rescue LoadError
|
7
|
+
nil
|
8
|
+
end
|
9
|
+
|
10
|
+
module DataMapper
|
11
|
+
module Serialize
|
12
|
+
# Serialize a Resource to comma-separated values (CSV).
|
13
|
+
#
|
14
|
+
# @return <String> a CSV representation of the Resource
|
15
|
+
def to_csv(writer = '')
|
16
|
+
FasterCSV.generate(writer) do |csv|
|
17
|
+
row = []
|
18
|
+
self.class.properties(repository.name).each do |property|
|
19
|
+
row << send(property.name).to_s
|
20
|
+
end
|
21
|
+
csv << row
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Collection
|
27
|
+
def to_csv
|
28
|
+
result = ""
|
29
|
+
each do |item|
|
30
|
+
result << item.to_csv + "\n"
|
31
|
+
end
|
32
|
+
result
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'dm-serializer/common'
|
2
|
+
|
3
|
+
begin
|
4
|
+
gem('json')
|
5
|
+
require 'json/ext'
|
6
|
+
rescue LoadError
|
7
|
+
gem('json_pure')
|
8
|
+
require 'json/pure'
|
9
|
+
end
|
10
|
+
|
11
|
+
module DataMapper
|
12
|
+
module Serialize
|
13
|
+
# Serialize a Resource to JavaScript Object Notation (JSON; RFC 4627)
|
14
|
+
#
|
15
|
+
# @return <String> a JSON representation of the Resource
|
16
|
+
def to_json(*args)
|
17
|
+
options = args.first || {}
|
18
|
+
result = '{ '
|
19
|
+
fields = []
|
20
|
+
|
21
|
+
propset = properties_to_serialize(options)
|
22
|
+
|
23
|
+
fields += propset.map do |property|
|
24
|
+
"#{property.name.to_json}: #{send(property.getter).to_json}"
|
25
|
+
end
|
26
|
+
|
27
|
+
# add methods
|
28
|
+
(options[:methods] || []).each do |meth|
|
29
|
+
if self.respond_to?(meth)
|
30
|
+
fields << "#{meth.to_json}: #{send(meth).to_json}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Note: if you want to include a whole other model via relation, use :methods
|
35
|
+
# comments.to_json(:relationships=>{:user=>{:include=>[:first_name],:methods=>[:age]}})
|
36
|
+
# add relationships
|
37
|
+
# TODO: This needs tests and also needs to be ported to #to_xml and #to_yaml
|
38
|
+
(options[:relationships] || {}).each do |rel,opts|
|
39
|
+
if self.respond_to?(rel)
|
40
|
+
fields << "#{rel.to_json}: #{send(rel).to_json(opts)}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
result << fields.join(', ')
|
45
|
+
result << ' }'
|
46
|
+
result
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
module Associations
|
51
|
+
# the json gem adds Object#to_json, which breaks the DM proxies, since it
|
52
|
+
# happens *after* the proxy has been blank slated. This code removes the added
|
53
|
+
# method, so it is delegated correctly to the Collection
|
54
|
+
proxies = []
|
55
|
+
|
56
|
+
proxies << ManyToMany::Proxy if defined?(ManyToMany::Proxy)
|
57
|
+
proxies << OneToMany::Proxy if defined?(OneToMany::Proxy)
|
58
|
+
proxies << ManyToOne::Proxy if defined?(ManyToOne::Proxy)
|
59
|
+
|
60
|
+
proxies.each do |proxy|
|
61
|
+
if proxy.public_instance_methods.any? { |m| m.to_sym == :to_json }
|
62
|
+
proxy.send(:undef_method, :to_json)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class Collection
|
68
|
+
def to_json(*args)
|
69
|
+
opts = args.first || {}
|
70
|
+
"[" << map {|e| e.to_json(opts)}.join(",") << "]"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|