├── TODO ├── History.txt ├── dm-observer ├── TODO ├── History.txt ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── lib │ └── dm-observer │ │ └── version.rb ├── Manifest.txt ├── README.txt └── LICENSE ├── dm-sweatshop ├── TODO ├── History.txt ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── README.txt ├── lib │ ├── dm-sweatshop │ │ ├── version.rb │ │ └── model.rb │ └── dm-sweatshop.rb ├── Manifest.txt └── LICENSE ├── dm-cli ├── History.txt ├── spec │ └── spec.opts ├── lib │ ├── dm-cli.rb │ └── dm-cli │ │ └── version.rb ├── TODO ├── bin │ ├── .irbrc │ └── dm ├── Manifest.txt ├── README.txt └── LICENSE ├── dm-is-versioned ├── TODO ├── History.txt ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── README.txt ├── lib │ ├── dm-is-versioned │ │ └── is │ │ │ └── version.rb │ └── dm-is-versioned.rb ├── Manifest.txt └── LICENSE ├── dm-tags ├── .gitignore ├── spec │ ├── spec.opts │ ├── dm-setup.rb │ ├── spec_helper.rb │ ├── classes.rb │ └── dm-tags │ │ └── tag_spec.rb ├── Rakefile ├── tasks │ ├── environment.rake │ ├── rspec.rake │ └── website.rake ├── History.txt ├── lib │ ├── dm-tags │ │ ├── version.rb │ │ ├── tag.rb │ │ └── tagging.rb │ └── dm-tags.rb ├── config │ └── requirements.rb ├── Manifest.txt └── License.txt ├── dm-adjust ├── History.txt ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── lib │ ├── dm-adjust │ │ ├── version.rb │ │ ├── repository.rb │ │ └── model.rb │ └── dm-adjust.rb ├── TODO ├── Manifest.txt ├── README.txt └── LICENSE ├── dm-is-list ├── History.txt ├── TODO ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── lib │ ├── dm-is-list │ │ └── is │ │ │ └── version.rb │ └── dm-is-list.rb └── Manifest.txt ├── dm-is-tree ├── History.txt ├── spec │ └── spec.opts ├── README.txt ├── lib │ ├── dm-is-tree │ │ └── is │ │ │ └── version.rb │ └── dm-is-tree.rb ├── TODO ├── Manifest.txt └── LICENSE ├── dm-querizer ├── History.txt ├── TODO ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── lib │ ├── dm-querizer │ │ ├── version.rb │ │ ├── collection.rb │ │ └── model.rb │ └── dm-querizer.rb ├── Manifest.txt └── README.txt ├── dm-types ├── History.txt ├── spec │ ├── spec.opts │ ├── integration │ │ ├── json_spec.rb │ │ ├── ip_address_spec.rb │ │ ├── file_path_spec.rb │ │ ├── permalink_spec.rb │ │ ├── uri_spec.rb │ │ ├── yaml_spec.rb │ │ ├── flag_spec.rb │ │ └── uuid_spec.rb │ ├── unit │ │ ├── regexp_spec.rb │ │ └── epoch_time_spec.rb │ └── spec_helper.rb ├── README.txt ├── lib │ ├── dm-types │ │ ├── version.rb │ │ ├── serial.rb │ │ ├── regexp.rb │ │ ├── epoch_time.rb │ │ ├── file_path.rb │ │ ├── csv.rb │ │ ├── uri.rb │ │ ├── permalink.rb │ │ ├── ip_address.rb │ │ ├── bcrypt_hash.rb │ │ ├── yaml.rb │ │ └── json.rb │ └── dm-types.rb ├── TODO └── LICENSE ├── dm-aggregates ├── History.txt ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── lib │ ├── dm-aggregates │ │ ├── version.rb │ │ ├── repository.rb │ │ ├── collection.rb │ │ ├── model.rb │ │ └── support │ │ │ └── symbol.rb │ └── dm-aggregates.rb ├── TODO ├── Manifest.txt └── LICENSE ├── dm-ar-finders ├── History.txt ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── README.txt ├── lib │ └── dm-ar-finders │ │ └── version.rb ├── TODO ├── Manifest.txt └── LICENSE ├── dm-constraints ├── History.txt ├── TODO ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── lib │ ├── dm-constraints │ │ ├── version.rb │ │ ├── postgres_adapter.rb │ │ └── mysql_adapter.rb │ └── dm-constraints.rb ├── README.txt ├── Manifest.txt ├── tasks │ ├── doc.rb │ ├── install.rb │ └── gemspec.rb ├── Rakefile └── LICENSE ├── dm-is-example ├── History.txt ├── TODO ├── spec │ ├── spec.opts │ ├── integration │ │ └── example_spec.rb │ └── spec_helper.rb ├── README.txt ├── lib │ ├── dm-is-example │ │ └── is │ │ │ ├── version.rb │ │ │ └── example.rb │ └── dm-is-example.rb ├── Manifest.txt └── LICENSE ├── dm-is-nested_set ├── History.txt ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── lib │ ├── dm-is-nested_set │ │ └── is │ │ │ └── version.rb │ └── dm-is-nested_set.rb ├── Manifest.txt └── TODO ├── dm-is-searchable ├── History.txt ├── README.txt ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── lib │ ├── dm-is-searchable │ │ └── is │ │ │ └── version.rb │ └── dm-is-searchable.rb └── Manifest.txt ├── dm-migrations ├── History.txt ├── spec │ ├── spec.opts │ ├── unit │ │ ├── sql_spec.rb │ │ └── sql │ │ │ ├── column_spec.rb │ │ │ └── table_spec.rb │ └── spec_helper.rb ├── lib │ ├── dm-migrations.rb │ ├── dm-migrations │ │ └── version.rb │ ├── sql │ │ ├── column.rb │ │ └── table.rb │ └── sql.rb ├── README.txt ├── TODO ├── db │ └── migrations │ │ ├── config.rb │ │ ├── 2_add_dob_to_people.rb │ │ └── 1_create_people_table.rb ├── Manifest.txt └── LICENSE ├── dm-serializer ├── History.txt ├── spec │ ├── spec.opts │ ├── fixtures │ │ ├── quatum_cat.rb │ │ ├── cow.rb │ │ └── planet.rb │ └── unit │ │ └── serializer_spec.rb ├── autotest │ └── discover.rb ├── README.txt ├── lib │ └── dm-serializer │ │ └── version.rb ├── TODO └── Manifest.txt ├── dm-shorthand ├── History.txt ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── lib │ └── dm-shorthand │ │ └── version.rb ├── TODO ├── Manifest.txt ├── README.txt └── LICENSE ├── dm-timestamps ├── History.txt ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── README.txt ├── lib │ ├── dm-timestamps │ │ └── version.rb │ └── dm-timestamps.rb ├── TODO ├── Manifest.txt └── LICENSE ├── dm-validations ├── History.txt ├── spec │ ├── spec.opts │ ├── integration │ │ ├── custom_validator_spec.rb │ │ ├── validation_errors_spec.rb │ │ ├── generic_validator_spec.rb │ │ ├── contextual_validators_spec.rb │ │ └── primitive_validator_spec.rb │ └── spec_helper.rb ├── lib │ └── dm-validations │ │ ├── support │ │ └── object.rb │ │ ├── version.rb │ │ └── formats │ │ └── url.rb └── TODO ├── merb_datamapper ├── History.txt ├── spec │ ├── spec.opts │ ├── spec_helper.rb │ └── generators │ │ └── data_mapper_resource_controller_spec.rb ├── lib │ ├── merb_datamapper │ │ └── version.rb │ ├── generators │ │ ├── templates │ │ │ ├── migration.rb │ │ │ ├── model.rb │ │ │ ├── model_migration.rb │ │ │ └── views │ │ │ │ ├── show.html.erb │ │ │ │ ├── new.html.erb │ │ │ │ ├── edit.html.erb │ │ │ │ └── index.html.erb │ │ ├── data_mapper_migration.rb │ │ ├── data_mapper_model.rb │ │ └── data_mapper_resource_controller.rb │ └── merb │ │ └── orms │ │ └── data_mapper │ │ └── database.yml.sample ├── TODO ├── README.txt └── LICENSE ├── adapters ├── dm-rest-adapter │ ├── TODO │ ├── History.txt │ ├── spec │ │ ├── spec.opts │ │ ├── ruby_forker.rb │ │ ├── spec_helper.rb │ │ ├── create_spec.rb │ │ └── delete_spec.rb │ ├── fixtures │ │ └── book_service │ │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── images │ │ │ │ └── rails.png │ │ │ ├── javascripts │ │ │ │ └── application.js │ │ │ ├── robots.txt │ │ │ ├── dispatch.rb │ │ │ ├── dispatch.cgi │ │ │ ├── dispatch.fcgi │ │ │ ├── 422.html │ │ │ ├── 404.html │ │ │ └── 500.html │ │ │ ├── app │ │ │ ├── helpers │ │ │ │ ├── books_helper.rb │ │ │ │ ├── shelf_helper.rb │ │ │ │ └── application_helper.rb │ │ │ ├── models │ │ │ │ ├── shelf.rb │ │ │ │ └── book.rb │ │ │ ├── views │ │ │ │ ├── shelves │ │ │ │ │ ├── show.html.erb │ │ │ │ │ ├── new.html.erb │ │ │ │ │ ├── edit.html.erb │ │ │ │ │ └── index.html.erb │ │ │ │ ├── books │ │ │ │ │ ├── show.html.erb │ │ │ │ │ ├── new.html.erb │ │ │ │ │ ├── edit.html.erb │ │ │ │ │ └── index.html.erb │ │ │ │ └── layouts │ │ │ │ │ └── books.html.erb │ │ │ └── controllers │ │ │ │ └── application.rb │ │ │ ├── script │ │ │ ├── about │ │ │ ├── console │ │ │ ├── destroy │ │ │ ├── generate │ │ │ ├── plugin │ │ │ ├── runner │ │ │ ├── server │ │ │ ├── dbconsole │ │ │ ├── process │ │ │ │ ├── reaper │ │ │ │ ├── spawner │ │ │ │ └── inspector │ │ │ └── performance │ │ │ │ ├── request │ │ │ │ ├── profiler │ │ │ │ └── benchmarker │ │ │ ├── db │ │ │ ├── development.sqlite3 │ │ │ └── migrate │ │ │ │ ├── 20080621171551_create_shelves.rb │ │ │ │ ├── 20080608165526_create_books.rb │ │ │ │ └── 20080629143033_create_fake_books_and_shelves.rb │ │ │ ├── test │ │ │ ├── fixtures │ │ │ │ ├── shelves.yml │ │ │ │ └── books.yml │ │ │ ├── unit │ │ │ │ ├── book_test.rb │ │ │ │ └── shelf_test.rb │ │ │ └── functional │ │ │ │ └── shelf_controller_test.rb │ │ │ ├── config │ │ │ ├── initializers │ │ │ │ ├── mime_types.rb │ │ │ │ ├── inflections.rb │ │ │ │ └── new_rails_defaults.rb │ │ │ ├── database.yml │ │ │ └── environments │ │ │ │ ├── development.rb │ │ │ │ ├── production.rb │ │ │ │ └── test.rb │ │ │ └── Rakefile │ ├── README.txt │ ├── stories │ │ ├── resources │ │ │ ├── helpers │ │ │ │ ├── story_helper.rb │ │ │ │ └── book.rb │ │ │ └── steps │ │ │ │ └── read.rb │ │ ├── all.rb │ │ ├── crud │ │ │ ├── delete │ │ │ └── stories.rb │ │ └── helper.rb │ ├── lib │ │ └── rest_adapter │ │ │ └── version.rb │ └── Manifest.txt ├── dm-ferret-adapter │ ├── History.txt │ ├── .gitignore │ ├── spec │ │ └── spec.opts │ ├── lib │ │ └── ferret_adapter │ │ │ ├── version.rb │ │ │ └── repository_ext.rb │ ├── TODO │ └── Manifest.txt └── dm-couchdb-adapter │ ├── History.txt │ ├── spec │ ├── testfile.txt │ ├── spec.opts │ └── couchdb_view_spec.rb │ ├── .gitignore │ ├── lib │ └── couchdb_adapter │ │ ├── version.rb │ │ └── json_object.rb │ ├── TODO │ └── Manifest.txt ├── dm-is-state_machine ├── History.txt ├── spec │ ├── spec.opts │ ├── integration │ │ ├── invalid_events_spec.rb │ │ ├── invalid_states_spec.rb │ │ └── invalid_transitions_spec.rb │ ├── examples │ │ ├── invalid_events.rb │ │ ├── invalid_states.rb │ │ ├── invalid_transitions_2.rb │ │ └── invalid_transitions_1.rb │ ├── unit │ │ ├── data │ │ │ ├── state_spec.rb │ │ │ └── event_spec.rb │ │ ├── dsl │ │ │ └── state_dsl_spec.rb │ │ └── state_machine_spec.rb │ └── spec_helper.rb ├── lib │ └── dm-is-state_machine │ │ └── is │ │ ├── version.rb │ │ └── data │ │ ├── state.rb │ │ └── event.rb ├── README.txt ├── TODO ├── Manifest.txt └── LICENSE ├── dm-is-remixable ├── spec │ ├── spec.opts │ ├── data │ │ ├── tag.rb │ │ ├── image.rb │ │ ├── viewable.rb │ │ ├── commentable.rb │ │ ├── billable.rb │ │ ├── topic.rb │ │ ├── taggable.rb │ │ ├── addressable.rb │ │ ├── bot.rb │ │ ├── rating.rb │ │ └── user.rb │ └── spec_helper.rb ├── History.txt ├── lib │ ├── dm-is-remixable │ │ └── is │ │ │ └── version.rb │ └── dm-is-remixable.rb ├── Manifest.txt └── LICENSE ├── lib └── dm-more │ └── version.rb ├── rails_datamapper ├── init.rb └── generators │ ├── dm_model │ ├── templates │ │ ├── model.rb │ │ ├── unit_test.rb │ │ └── migration.rb │ └── dm_model_generator.rb │ └── rspec_dm_model │ ├── templates │ ├── model.rb │ └── model_spec.rb │ └── rspec_dm_model_generator.rb ├── Manifest.txt ├── .gitignore ├── README.txt ├── README.textile ├── tasks └── hoe.rb └── MIT-LICENSE /TODO: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-observer/TODO: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dm-sweatshop/TODO: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dm-cli/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-is-versioned/TODO: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dm-tags/.gitignore: -------------------------------------------------------------------------------- 1 | pkg/* -------------------------------------------------------------------------------- /dm-adjust/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-is-list/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-is-tree/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-observer/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-querizer/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-sweatshop/History.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dm-types/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-aggregates/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-ar-finders/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-constraints/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-is-example/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-is-nested_set/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-is-searchable/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-is-versioned/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-migrations/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-serializer/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-shorthand/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-tags/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --colour -------------------------------------------------------------------------------- /dm-timestamps/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-validations/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /merb_datamapper/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | -------------------------------------------------------------------------------- /dm-is-example/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | -------------------------------------------------------------------------------- /dm-is-state_machine/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dm-querizer/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | -------------------------------------------------------------------------------- /adapters/dm-ferret-adapter/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /adapters/dm-couchdb-adapter/History.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /adapters/dm-ferret-adapter/.gitignore: -------------------------------------------------------------------------------- 1 | index 2 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --colour 2 | -------------------------------------------------------------------------------- /dm-is-searchable/README.txt: -------------------------------------------------------------------------------- 1 | = dm-is-searchable 2 | -------------------------------------------------------------------------------- /adapters/dm-couchdb-adapter/spec/testfile.txt: -------------------------------------------------------------------------------- 1 | test string -------------------------------------------------------------------------------- /dm-adjust/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-cli/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-constraints/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | Everything :) 4 | -------------------------------------------------------------------------------- /dm-types/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-aggregates/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-ar-finders/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-constraints/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-is-example/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-is-list/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | * Add support for scopes 4 | -------------------------------------------------------------------------------- /dm-is-list/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-is-tree/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-migrations/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --colour 2 | --format progress 3 | -------------------------------------------------------------------------------- /dm-observer/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-querizer/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-serializer/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-shorthand/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-sweatshop/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-timestamps/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-validations/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dm-is-nested_set/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-is-searchable/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-is-versioned/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /merb_datamapper/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /adapters/dm-couchdb-adapter/.gitignore: -------------------------------------------------------------------------------- 1 | couchdb.stderr 2 | couchdb.stdout 3 | -------------------------------------------------------------------------------- /adapters/dm-couchdb-adapter/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /adapters/dm-ferret-adapter/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --colour 3 | -------------------------------------------------------------------------------- /dm-cli/lib/dm-cli.rb: -------------------------------------------------------------------------------- 1 | require File.join(File.dirname(__FILE__), "dm-cli", "cli") 2 | -------------------------------------------------------------------------------- /dm-migrations/lib/dm-migrations.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/migration' 2 | -------------------------------------------------------------------------------- /dm-serializer/autotest/discover.rb: -------------------------------------------------------------------------------- 1 | Autotest.add_discovery do 2 | "dmserializer" 3 | end 4 | -------------------------------------------------------------------------------- /dm-is-example/README.txt: -------------------------------------------------------------------------------- 1 | = dm-is-example 2 | 3 | Description of plugin. What it does, and how. 4 | -------------------------------------------------------------------------------- /dm-sweatshop/README.txt: -------------------------------------------------------------------------------- 1 | = dm-sweatshop 2 | 3 | DataMapper plugin for building pseudo random models 4 | -------------------------------------------------------------------------------- /dm-tags/spec/dm-setup.rb: -------------------------------------------------------------------------------- 1 | DataMapper.setup(:default, 'sqlite3::memory:') 2 | DataMapper.auto_migrate! -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/helpers/books_helper.rb: -------------------------------------------------------------------------------- 1 | module BooksHelper 2 | end 3 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/helpers/shelf_helper.rb: -------------------------------------------------------------------------------- 1 | module ShelfHelper 2 | end 3 | -------------------------------------------------------------------------------- /dm-migrations/README.txt: -------------------------------------------------------------------------------- 1 | = dm-migrations 2 | 3 | DataMapper plugin for writing and specing migrations. 4 | -------------------------------------------------------------------------------- /dm-serializer/README.txt: -------------------------------------------------------------------------------- 1 | = dm-serializer 2 | 3 | DataMapper plugin for serializing DataMapper objects. 4 | -------------------------------------------------------------------------------- /lib/dm-more/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module More 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/README.txt: -------------------------------------------------------------------------------- 1 | = dm-rest-adapter 2 | 3 | A DataMapper adapter for REST Web Services 4 | -------------------------------------------------------------------------------- /dm-cli/lib/dm-cli/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | class CLI 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-is-versioned/README.txt: -------------------------------------------------------------------------------- 1 | = dm-is-versioned 2 | 3 | DataMapper plugin enabling simple versioning of models. 4 | -------------------------------------------------------------------------------- /dm-types/README.txt: -------------------------------------------------------------------------------- 1 | = dm-types 2 | 3 | DataMapper plugin providing many extra types for use in data models. 4 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Types 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-ar-finders/README.txt: -------------------------------------------------------------------------------- 1 | = dm-ar-finders 2 | 3 | DataMapper plugin providing support for ActiveRecord-style finders. 4 | -------------------------------------------------------------------------------- /dm-is-remixable/History.txt: -------------------------------------------------------------------------------- 1 | === 0.9.3 / 2008-07-31 2 | 3 | * 1 major enhancement 4 | 5 | * Pre-Release, super beta. 6 | -------------------------------------------------------------------------------- /dm-validations/lib/dm-validations/support/object.rb: -------------------------------------------------------------------------------- 1 | class Object 2 | def validatable? 3 | false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-is-tree/README.txt: -------------------------------------------------------------------------------- 1 | = dm-is-tree 2 | 3 | DataMapper plugin allowing the creation of tree structures from data models. 4 | -------------------------------------------------------------------------------- /dm-observer/lib/dm-observer/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Observer 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-querizer/lib/dm-querizer/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Querizer 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-sweatshop/lib/dm-sweatshop/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | class Sweatshop 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-timestamps/README.txt: -------------------------------------------------------------------------------- 1 | = dm-timestamps 2 | 3 | DataMapper plugin which adds "magic" to created_at, created_on, et cetera. 4 | -------------------------------------------------------------------------------- /dm-ar-finders/lib/dm-ar-finders/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module ARFinders 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-migrations/lib/dm-migrations/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | class Migration 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-serializer/lib/dm-serializer/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Serializer 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-shorthand/lib/dm-shorthand/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Shorthand 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-timestamps/lib/dm-timestamps/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Timestamps 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-constraints/lib/dm-constraints/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Constraints 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /dm-validations/lib/dm-validations/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Validations 3 | VERSION = "0.9.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /merb_datamapper/lib/merb_datamapper/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module MerbDataMapper 3 | VERSION = "0.9.8" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/stories/resources/helpers/story_helper.rb: -------------------------------------------------------------------------------- 1 | require 'spec/story' 2 | require File.dirname(__FILE__) + '/../../../spec/ruby_forker' 3 | -------------------------------------------------------------------------------- /dm-adjust/lib/dm-adjust/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module More 3 | module Adjust 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-is-list/lib/dm-is-list/is/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module List 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-is-tree/lib/dm-is-tree/is/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module Tree 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-constraints/README.txt: -------------------------------------------------------------------------------- 1 | = dm-constraints 2 | 3 | Plugin that adds foreign key constraints to associations. 4 | Currently supports only PostgreSQL and MySQL 5 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/about: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/about' 4 | -------------------------------------------------------------------------------- /dm-aggregates/lib/dm-aggregates/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module More 3 | module Aggregates 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-is-example/lib/dm-is-example/is/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module Example 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-tags/Rakefile: -------------------------------------------------------------------------------- 1 | require 'config/requirements' 2 | require 'config/hoe' # setup Hoe + all gem configuration 3 | 4 | Dir['tasks/**/*.rake'].each { |rake| load rake } -------------------------------------------------------------------------------- /rails_datamapper/init.rb: -------------------------------------------------------------------------------- 1 | gem 'dm-core' 2 | require 'dm-core' 3 | require File.expand_path(File.dirname(__FILE__) + '/lib/rails_datamapper') 4 | create_connection() 5 | -------------------------------------------------------------------------------- /Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | MIT-LICENSE 3 | Manifest.txt 4 | README.textile 5 | README.txt 6 | Rakefile 7 | TODO 8 | lib/dm-more.rb 9 | lib/dm-more/version.rb 10 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/models/shelf.rb: -------------------------------------------------------------------------------- 1 | class Shelf < ActiveRecord::Base 2 | validates_presence_of :name 3 | 4 | has_many :books 5 | end 6 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/console' 4 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/destroy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/destroy' 4 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/generate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/generate' 4 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/plugin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/plugin' 4 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/runner: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/runner' 4 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/server' 4 | -------------------------------------------------------------------------------- /dm-is-nested_set/lib/dm-is-nested_set/is/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module NestedSet 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-is-remixable/lib/dm-is-remixable/is/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module Remixable 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-is-searchable/lib/dm-is-searchable/is/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module Searchable 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-is-versioned/lib/dm-is-versioned/is/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module Versioned 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /rails_datamapper/generators/dm_model/templates/model.rb: -------------------------------------------------------------------------------- 1 | class <%= class_name %> 2 | include DataMapper::Resource 3 | property :id, Integer, :serial => true 4 | end 5 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/dbconsole: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../config/boot' 3 | require 'commands/dbconsole' 4 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/lib/rest_adapter/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module More 3 | class RestAdapter 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /rails_datamapper/generators/rspec_dm_model/templates/model.rb: -------------------------------------------------------------------------------- 1 | class <%= class_name %> 2 | include DataMapper::Resource 3 | property :id, Integer, :serial => true 4 | end 5 | -------------------------------------------------------------------------------- /adapters/dm-ferret-adapter/lib/ferret_adapter/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module More 3 | class FerretAdapter 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-adjust/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | --- 5 | TODO tickets may also be found in the DataMapper Issue Tracker: 6 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 7 | -------------------------------------------------------------------------------- /dm-aggregates/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | --- 5 | TODO tickets may also be found in the DataMapper Issue Tracker: 6 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 7 | -------------------------------------------------------------------------------- /dm-is-state_machine/lib/dm-is-state_machine/is/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module StateMachine 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-tags/tasks/environment.rake: -------------------------------------------------------------------------------- 1 | task :ruby_env do 2 | RUBY_APP = if RUBY_PLATFORM =~ /java/ 3 | "jruby" 4 | else 5 | "ruby" 6 | end unless defined? RUBY_APP 7 | end 8 | -------------------------------------------------------------------------------- /adapters/dm-couchdb-adapter/lib/couchdb_adapter/version.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module More 3 | class CouchDBAdapter 4 | VERSION = "0.9.6" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/process/reaper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/process/reaper' 4 | -------------------------------------------------------------------------------- /dm-aggregates/lib/dm-aggregates/repository.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | class Repository 3 | def aggregate(query) 4 | adapter.aggregate(query) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-cli/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | 5 | 6 | --- 7 | TODO tickets may also be found in the DataMapper Issue Tracker: 8 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 9 | -------------------------------------------------------------------------------- /dm-types/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | 5 | 6 | --- 7 | TODO tickets may also be found in the DataMapper Issue Tracker: 8 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 9 | -------------------------------------------------------------------------------- /merb_datamapper/lib/generators/templates/migration.rb: -------------------------------------------------------------------------------- 1 | migration <%= current_migration_nr + 1 %>, :<%= migration_name %> do 2 | up do 3 | end 4 | 5 | down do 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/db/development.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/dm-more/master/adapters/dm-rest-adapter/fixtures/book_service/db/development.sqlite3 -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/public/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/dm-more/master/adapters/dm-rest-adapter/fixtures/book_service/public/images/rails.png -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/process/spawner: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/process/spawner' 4 | -------------------------------------------------------------------------------- /dm-ar-finders/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | 5 | 6 | --- 7 | TODO tickets may also be found in the DataMapper Issue Tracker: 8 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 9 | -------------------------------------------------------------------------------- /dm-migrations/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | 5 | 6 | --- 7 | TODO tickets may also be found in the DataMapper Issue Tracker: 8 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 9 | -------------------------------------------------------------------------------- /dm-serializer/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | 5 | 6 | --- 7 | TODO tickets may also be found in the DataMapper Issue Tracker: 8 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 9 | -------------------------------------------------------------------------------- /dm-shorthand/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | 5 | 6 | --- 7 | TODO tickets may also be found in the DataMapper Issue Tracker: 8 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 9 | -------------------------------------------------------------------------------- /dm-timestamps/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | 5 | 6 | --- 7 | TODO tickets may also be found in the DataMapper Issue Tracker: 8 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 9 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/performance/request: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/performance/request' 4 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/process/inspector: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/process/inspector' 4 | -------------------------------------------------------------------------------- /dm-adjust/lib/dm-adjust/repository.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | class Repository 3 | def adjust(attributes, query) 4 | adapter.adjust(attributes, query) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /dm-migrations/lib/sql/column.rb: -------------------------------------------------------------------------------- 1 | module SQL 2 | 3 | class Column 4 | 5 | attr_accessor :name, :type, :not_null, :default_value, :primary_key, :unique 6 | 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/performance/profiler: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/performance/profiler' 4 | -------------------------------------------------------------------------------- /dm-shorthand/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.parent.expand_path + 'lib/dm-shorthand' 6 | -------------------------------------------------------------------------------- /adapters/dm-couchdb-adapter/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | 5 | 6 | --- 7 | TODO tickets may also be found in the DataMapper Issue Tracker: 8 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 9 | -------------------------------------------------------------------------------- /adapters/dm-ferret-adapter/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | 5 | 6 | --- 7 | TODO tickets may also be found in the DataMapper Issue Tracker: 8 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 9 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | # Methods added to this helper will be available to all templates in the application. 2 | module ApplicationHelper 3 | end 4 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/script/performance/benchmarker: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require File.dirname(__FILE__) + '/../../config/boot' 3 | require 'commands/performance/benchmarker' 4 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/stories/all.rb: -------------------------------------------------------------------------------- 1 | require File.join(File.dirname(__FILE__), *%w[helper]) 2 | 3 | %w[crud].each do |dir| 4 | require File.join(File.dirname(__FILE__), "#{dir}/stories") 5 | end 6 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/models/book.rb: -------------------------------------------------------------------------------- 1 | class Book < ActiveRecord::Base 2 | validates_presence_of :title 3 | validates_presence_of :author 4 | 5 | belongs_to :shelf 6 | end 7 | -------------------------------------------------------------------------------- /dm-cli/bin/.irbrc: -------------------------------------------------------------------------------- 1 | IRB.conf[:PROMPT] = {:DM => { :PROMPT_I=>"%03n:%i dm> ", :PROMPT_N=>"%03n:%i dm> ", :PROMPT_S=>"%03n:%i%l dm", :PROMPT_C=>"%03n:%i dm*", :RETURN=>"%s\n" }} 2 | IRB.conf[:PROMPT_MODE] = :DM 3 | -------------------------------------------------------------------------------- /dm-tags/History.txt: -------------------------------------------------------------------------------- 1 | == 0.0.1 2008-07-29 2 | 3 | * 1 major enhancement: 4 | * Initial release 5 | 6 | == 0.0.2 2008-07-30 7 | 8 | * 1 major enhancement: 9 | * Added contextual finding to Model.tagged_with -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/tag.rb: -------------------------------------------------------------------------------- 1 | class Tag 2 | include DataMapper::Resource 3 | 4 | property :id, Integer, :key => true, :serial => true 5 | property :name, String, :unique => true, :nullable => false 6 | end -------------------------------------------------------------------------------- /dm-is-tree/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | * dm-is-tree requires specs 5 | 6 | --- 7 | TODO tickets may also be found in the DataMapper Issue Tracker: 8 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 9 | -------------------------------------------------------------------------------- /dm-migrations/db/migrations/config.rb: -------------------------------------------------------------------------------- 1 | DataMapper::Logger.new(STDOUT, :debug) 2 | DataMapper.logger.debug( "Starting Migration" ) 3 | 4 | DataMapper.setup(:default, 'postgres://postgres@localhost/dm_core_test') 5 | -------------------------------------------------------------------------------- /dm-is-tree/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-is-tree.rb 8 | lib/dm-is-tree/is/tree.rb 9 | lib/dm-is-tree/is/version.rb 10 | spec/spec.opts 11 | -------------------------------------------------------------------------------- /dm-is-tree/lib/dm-is-tree.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'pathname' 3 | 4 | gem 'dm-core', '=0.9.6' 5 | require 'dm-core' 6 | 7 | require Pathname(__FILE__).dirname.expand_path / 'dm-is-tree' / 'is' / 'tree.rb' 8 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/test/fixtures/shelves.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 | 3 | # one: 4 | # column: value 5 | # 6 | # two: 7 | # column: value 8 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/views/shelves/show.html.erb: -------------------------------------------------------------------------------- 1 |

2 | Name: 3 | <%=h @shelf.name %> 4 |

5 | 6 | <%= link_to 'Edit', edit_shelf_path(@shelf) %> | 7 | <%= link_to 'Back', shelves_path %> 8 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/public/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // Place your application-specific JavaScript functions and classes here 2 | // This file is automatically included by javascript_include_tag :defaults 3 | -------------------------------------------------------------------------------- /merb_datamapper/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | $TESTING=true 2 | $:.push File.join(File.dirname(__FILE__), '..', 'lib') 3 | 4 | require 'rubygems' 5 | 6 | gem 'dm-core', '=0.9.6' 7 | require 'dm-core' 8 | require 'merb-core' 9 | 10 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/serial.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Types 3 | class Serial < DataMapper::Type 4 | primitive Integer 5 | serial true 6 | end # class Serial 7 | end # module Types 8 | end # module DataMapper 9 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/test/unit/book_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class BookTest < ActiveSupport::TestCase 4 | # Replace this with your real tests. 5 | def test_truth 6 | assert true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /dm-shorthand/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-shorthand.rb 8 | lib/dm-shorthand/version.rb 9 | spec/spec.opts 10 | spec/spec_helper.rb 11 | spec/unit/dm-shorthand.rb 12 | -------------------------------------------------------------------------------- /dm-sweatshop/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | $TESTING=true 2 | $:.push File.join(File.dirname(__FILE__), '..', 'lib') 3 | 4 | require 'dm-sweatshop' 5 | 6 | DataMapper.setup(:default, 'sqlite3::memory:') 7 | 8 | Spec::Runner.configure do |config| 9 | end -------------------------------------------------------------------------------- /dm-tags/lib/dm-tags/version.rb: -------------------------------------------------------------------------------- 1 | require 'dm-core' 2 | module DataMapper::Tags 3 | module VERSION #:nodoc: 4 | MAJOR = 0 5 | MINOR = 0 6 | TINY = 2 7 | 8 | STRING = [MAJOR, MINOR, TINY].join('.') 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/test/unit/shelf_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ShelfTest < ActiveSupport::TestCase 4 | # Replace this with your real tests. 5 | def test_truth 6 | assert true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /dm-cli/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | bin/.irbrc 8 | bin/dm 9 | lib/dm-cli.rb 10 | lib/dm-cli/cli.rb 11 | lib/dm-cli/version.rb 12 | spec/spec.opts 13 | spec/unit/cli_spec.rb 14 | -------------------------------------------------------------------------------- /dm-tags/lib/dm-tags.rb: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__)) unless 2 | $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) 3 | 4 | require 'dm-tags/tagging' 5 | require 'dm-tags/tag' 6 | require 'dm-tags/dm_tags' -------------------------------------------------------------------------------- /rails_datamapper/generators/dm_model/templates/unit_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class <%= class_name %>Test < ActiveSupport::TestCase 4 | # Replace this with your real tests. 5 | def test_truth 6 | assert true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /dm-cli/bin/dm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "rubygems" 3 | 4 | gem "dm-core", ">=0.9.5" 5 | require "dm-core" 6 | require "dm-cli" 7 | require "optparse" 8 | 9 | DataMapper::CLI::BinDir = File.dirname(__FILE__) 10 | DataMapper::CLI.start 11 | -------------------------------------------------------------------------------- /dm-observer/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-observer.rb 8 | lib/dm-observer/version.rb 9 | spec/integration/dm-observer_spec.rb 10 | spec/spec.opts 11 | spec/spec_helper.rb 12 | -------------------------------------------------------------------------------- /dm-ar-finders/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-ar-finders.rb 8 | lib/dm-ar-finders/version.rb 9 | spec/integration/ar-finders_spec.rb 10 | spec/spec.opts 11 | spec/spec_helper.rb 12 | -------------------------------------------------------------------------------- /dm-is-example/spec/integration/example_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES 5 | describe 'DataMapper::Is::Example' do 6 | 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /dm-timestamps/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-timestamps.rb 8 | lib/dm-timestamps/version.rb 9 | spec/integration/timestamps_spec.rb 10 | spec/spec.opts 11 | spec/spec_helper.rb 12 | -------------------------------------------------------------------------------- /dm-is-searchable/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | lib/dm-is-searchable.rb 7 | lib/dm-is-searchable/is/searchable.rb 8 | lib/dm-is-searchable/is/version.rb 9 | spec/spec.opts 10 | spec/spec_helper.rb 11 | -------------------------------------------------------------------------------- /dm-aggregates/lib/dm-aggregates/collection.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | class Collection 3 | include AggregateFunctions 4 | 5 | private 6 | 7 | def property_by_name(property_name) 8 | properties[property_name] 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /dm-cli/README.txt: -------------------------------------------------------------------------------- 1 | = dm-cli 2 | 3 | DataMapper plugin allowing interaction with models through a Command-Line 4 | Interface (CLI). 5 | 6 | For any issues or questions, in addition to tickets please contact wayneeseguin@gmail.com / wayneeseguin on irc.freenode.net. 7 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/test/fixtures/books.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 | 3 | one: 4 | title: MyString 5 | author: MyString 6 | 7 | two: 8 | title: MyString 9 | author: MyString 10 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/stories/resources/helpers/book.rb: -------------------------------------------------------------------------------- 1 | class Book 2 | include DataMapper::Resource 3 | property :author, String 4 | property :created_at, DateTime 5 | property :id, Integer, :serial => true 6 | property :title, String 7 | end 8 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/image.rb: -------------------------------------------------------------------------------- 1 | module Image 2 | include DataMapper::Resource 3 | 4 | is :remixable 5 | 6 | property :id, Integer, :key => true, :serial => true 7 | property :description, String 8 | property :path, String 9 | end 10 | -------------------------------------------------------------------------------- /dm-migrations/spec/unit/sql_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname + '../spec_helper' 3 | 4 | require Pathname(__FILE__).dirname + '../../lib/sql' 5 | 6 | describe 'SQL module' do 7 | 8 | it 'doesnt really do anything' 9 | 10 | end 11 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/test/functional/shelf_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ShelfControllerTest < ActionController::TestCase 4 | # Replace this with your real tests. 5 | def test_truth 6 | assert true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /dm-aggregates/lib/dm-aggregates/model.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Model 3 | include AggregateFunctions 4 | 5 | private 6 | 7 | def property_by_name(property_name) 8 | properties(repository.name)[property_name] 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /dm-is-list/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-is-list.rb 8 | lib/dm-is-list/is/list.rb 9 | lib/dm-is-list/is/version.rb 10 | spec/integration/list_spec.rb 11 | spec/spec.opts 12 | spec/spec_helper.rb 13 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /dm-serializer/spec/fixtures/quatum_cat.rb: -------------------------------------------------------------------------------- 1 | class QuantumCat 2 | include DataMapper::Resource 3 | 4 | property :id, Serial 5 | property :name, String 6 | property :location, String 7 | 8 | repository(:alternate) do 9 | property :is_dead, Boolean 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /dm-tags/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'spec' 3 | # require 'merb-core' 4 | require 'dm-core' 5 | require 'dm-validations' 6 | require File.dirname(__FILE__) + '/../lib/dm-tags' 7 | require File.dirname(__FILE__) + '/classes' 8 | require File.dirname(__FILE__) + '/dm-setup' -------------------------------------------------------------------------------- /dm-is-example/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-is-example.rb 8 | lib/dm-is-example/is/example.rb 9 | lib/dm-is-example/is/version.rb 10 | spec/integration/example_spec.rb 11 | spec/spec.opts 12 | spec/spec_helper.rb 13 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/viewable.rb: -------------------------------------------------------------------------------- 1 | module Viewable 2 | include DataMapper::Resource 3 | 4 | is :remixable, 5 | :suffix => "view" 6 | 7 | property :id, Integer, :key => true, :serial => true 8 | 9 | property :created_at, DateTime 10 | property :ip, String 11 | end 12 | -------------------------------------------------------------------------------- /dm-is-versioned/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-is-versioned.rb 8 | lib/dm-is-versioned/is/version.rb 9 | lib/dm-is-versioned/is/versioned.rb 10 | spec/spec.opts 11 | spec/spec_helper.rb 12 | spec/versioned_spec.rb 13 | -------------------------------------------------------------------------------- /dm-sweatshop/lib/dm-sweatshop.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | gem 'dm-core', '=0.9.6' 4 | require 'dm-core' 5 | require 'randexp' 6 | 7 | dir = Pathname(__FILE__).dirname.expand_path / 'dm-sweatshop' 8 | 9 | require dir / "version" 10 | require dir / "sweatshop" 11 | require dir / "model" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | test_log 2 | pkg 3 | pkg/* 4 | */pkg/* 5 | bundle 6 | bundle/* 7 | doc 8 | *.log 9 | log 10 | !log*.rb 11 | */log 12 | log/* 13 | */log/* 14 | coverage 15 | */coverage 16 | lib/dm-more.rb 17 | *.db 18 | nbproject 19 | .DS_Store 20 | rspec_report.html 21 | *.swp 22 | _Yardoc 23 | -------------------------------------------------------------------------------- /merb_datamapper/lib/generators/templates/model.rb: -------------------------------------------------------------------------------- 1 | <% with_modules(modules) do -%> 2 | class <%= class_name %> 3 | include DataMapper::Resource 4 | <% attributes.each do |name, type| %> 5 | property :<%= name -%>, <%= datamapper_type(type) -%> 6 | <% end %> 7 | 8 | end 9 | <% end -%> 10 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /merb_datamapper/lib/generators/data_mapper_migration.rb: -------------------------------------------------------------------------------- 1 | Merb::Generators::MigrationGenerator.template :migration_datamapper, :orm => :datamapper do |t| 2 | t.source = File.join(File.dirname(__FILE__), 'templates/migration.rb') 3 | t.destination = "#{destination_directory}/#{file_name}.rb" 4 | end 5 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | 2 | == dm-more == 3 | 4 | Extra non-essential parts for DataMapper. 5 | 6 | Including: 7 | 8 | * Migrations 9 | * Validations 10 | * Aggregates 11 | * Observers 12 | 13 | == Aggregates 14 | 15 | Currently includes count, min, max, avg, sum (more info in dm-aggregates/README) 16 | -------------------------------------------------------------------------------- /dm-is-nested_set/lib/dm-is-nested_set.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'pathname' 3 | 4 | gem 'dm-core', '=0.9.6' 5 | require 'dm-core' 6 | 7 | gem 'dm-adjust', '=0.9.6' 8 | require 'dm-adjust' 9 | 10 | require Pathname(__FILE__).dirname.expand_path / 'dm-is-nested_set' / 'is' / 'nested_set.rb' 11 | -------------------------------------------------------------------------------- /dm-is-remixable/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-is-remixable.rb 8 | lib/dm-is-remixable/is/remixable.rb 9 | lib/dm-is-remixable/is/version.rb 10 | spec/integration/remixable_spec.rb 11 | spec/spec.opts 12 | spec/spec_helper.rb 13 | -------------------------------------------------------------------------------- /dm-serializer/spec/unit/serializer_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | describe DataMapper::Serialize do 5 | it "is included into DataMapper::Resource" do 6 | Cow.new.should be_kind_of(DataMapper::Serialize) 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /dm-is-nested_set/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-is-nested_set.rb 8 | lib/dm-is-nested_set/is/nested_set.rb 9 | lib/dm-is-nested_set/is/version.rb 10 | spec/integration/nested_set_spec.rb 11 | spec/spec.opts 12 | spec/spec_helper.rb 13 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/commentable.rb: -------------------------------------------------------------------------------- 1 | module Commentable 2 | include DataMapper::Resource 3 | 4 | is :remixable, 5 | :suffix => "comment" 6 | 7 | property :id, Integer, :key => true, :serial => true 8 | property :comment, String 9 | property :created_at, DateTime 10 | end 11 | -------------------------------------------------------------------------------- /dm-tags/lib/dm-tags/tag.rb: -------------------------------------------------------------------------------- 1 | class Tag 2 | include DataMapper::Resource 3 | property :id, Integer, :serial => true 4 | property :name, String, :nullable => false, :unique => true 5 | 6 | has n, :taggings 7 | 8 | def taggables 9 | taggings.map{|tagging| tagging.taggable} 10 | end 11 | end -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/views/books/show.html.erb: -------------------------------------------------------------------------------- 1 |

2 | Title: 3 | <%=h @book.title %> 4 |

5 | 6 |

7 | Author: 8 | <%=h @book.author %> 9 |

10 | 11 | 12 | <%= link_to 'Edit', edit_book_path(@book) %> | 13 | <%= link_to 'Back', books_path %> 14 | -------------------------------------------------------------------------------- /dm-validations/spec/integration/custom_validator_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | describe DataMapper::Validate::CustomValidator do 5 | it "should have specs" do 6 | pending 7 | # FIXME do something, add specs 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /dm-migrations/db/migrations/2_add_dob_to_people.rb: -------------------------------------------------------------------------------- 1 | migration 2, :add_dob_to_people do 2 | up do 3 | modify_table :people do 4 | add_column :dob, DateTime, :nullable? => true 5 | end 6 | end 7 | 8 | down do 9 | modify_table :people do 10 | drop_column :dob 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /dm-querizer/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-querizer.rb 8 | lib/dm-querizer/collection.rb 9 | lib/dm-querizer/model.rb 10 | lib/dm-querizer/querizer.rb 11 | lib/dm-querizer/version.rb 12 | spec/querizer_spec.rb 13 | spec/spec.opts 14 | spec/spec_helper.rb 15 | -------------------------------------------------------------------------------- /adapters/dm-ferret-adapter/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | bin/ferret 8 | lib/ferret_adapter.rb 9 | lib/ferret_adapter/local_index.rb 10 | lib/ferret_adapter/remote_index.rb 11 | lib/ferret_adapter/repository_ext.rb 12 | lib/ferret_adapter/version.rb 13 | spec/spec.opts 14 | -------------------------------------------------------------------------------- /dm-migrations/lib/sql.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/sql/table_creator' 2 | require File.dirname(__FILE__) + '/sql/table_modifier' 3 | 4 | require File.dirname(__FILE__) + '/sql/sqlite3' 5 | require File.dirname(__FILE__) + '/sql/mysql' 6 | require File.dirname(__FILE__) + '/sql/postgresql' 7 | 8 | module SQL 9 | 10 | end 11 | -------------------------------------------------------------------------------- /merb_datamapper/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | * Fix session support 5 | * Add in model migration generation 6 | * Tidy up Resource Controller generator 7 | * Add property interpolation for views 8 | --- 9 | TODO tickets may also be found in the DataMapper Issue Tracker: 10 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 11 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/db/migrate/20080621171551_create_shelves.rb: -------------------------------------------------------------------------------- 1 | class CreateShelves < ActiveRecord::Migration 2 | def self.up 3 | create_table :shelves do |t| 4 | t.string :name 5 | 6 | t.timestamps 7 | end 8 | end 9 | 10 | def self.down 11 | drop_table :shelves 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /dm-is-list/lib/dm-is-list.rb: -------------------------------------------------------------------------------- 1 | 2 | require 'rubygems' 3 | require 'pathname' 4 | 5 | gem 'dm-core', '=0.9.6' 6 | require 'dm-core' 7 | 8 | gem 'dm-adjust', '=0.9.6' 9 | require 'dm-adjust' 10 | 11 | require Pathname(__FILE__).dirname.expand_path / 'dm-is-list' / 'is' / 'list.rb' 12 | 13 | DataMapper::Model.append_extensions DataMapper::Is::List 14 | -------------------------------------------------------------------------------- /dm-migrations/db/migrations/1_create_people_table.rb: -------------------------------------------------------------------------------- 1 | migration 1, :create_people_table do 2 | up do 3 | create_table :people do 4 | column :id, Integer, :serial => true 5 | column :name, String, :size => 50 6 | column :age, Integer 7 | end 8 | end 9 | down do 10 | drop_table :people 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /rails_datamapper/generators/rspec_dm_model/templates/model_spec.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper') 2 | 3 | describe <%= class_name %> do 4 | before(:each) do 5 | @<%= file_name %> = <%= class_name %>.new 6 | end 7 | 8 | it "should be valid" do 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /dm-serializer/spec/fixtures/cow.rb: -------------------------------------------------------------------------------- 1 | class Cow 2 | include DataMapper::Resource 3 | 4 | property :id, Integer, :key => true 5 | property :composite, Integer, :key => true 6 | property :name, String 7 | property :breed, String 8 | 9 | def serialize_properties 10 | {:extra => "Extra", :another => 42} 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /dm-sweatshop/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.textile 5 | Rakefile 6 | TODO 7 | lib/dm-sweatshop.rb 8 | lib/dm-sweatshop/sweatshop.rb 9 | lib/dm-sweatshop/model.rb 10 | lib/dm-sweatshop/version.rb 11 | spec/dm-sweatshop/model_spec.rb 12 | spec/dm-sweatshop/sweatshop_spec.rb 13 | spec/spec.opts 14 | spec/spec_helper.rb 15 | -------------------------------------------------------------------------------- /dm-is-state_machine/README.txt: -------------------------------------------------------------------------------- 1 | = dm-state-machine 2 | 3 | DataMapper plugin that adds state machine functionality. 4 | 5 | == Installation 6 | 7 | Download dm-more and install dm-is-state_machine. Require it in your app. 8 | 9 | == Getting started 10 | 11 | Please refer to the integration specs in spec/integration, which refer to 12 | spec/examples. 13 | -------------------------------------------------------------------------------- /dm-migrations/lib/sql/table.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/column' 2 | 3 | module SQL 4 | 5 | class Table 6 | 7 | attr_accessor :name, :columns 8 | 9 | def to_s 10 | name 11 | end 12 | 13 | def column(column_name) 14 | @columns.select { |c| c.name == column_name.to_s }.first 15 | end 16 | 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /merb_datamapper/README.txt: -------------------------------------------------------------------------------- 1 | = merb_datamapper 2 | 3 | A plugin for the Merb framework that provides DataMapper access 4 | 5 | To use sessions: 6 | 7 | 1. set the session store to datamapper in init.rb: 8 | Merb::Config.use { |c| 9 | c[:session_store] = 'datamapper' 10 | } 11 | 12 | 2. add the dependency in init.rb: 13 | use_orm :datamapper 14 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/views/shelves/new.html.erb: -------------------------------------------------------------------------------- 1 |

New shelf

2 | 3 | <% form_for(@shelf) do |f| %> 4 | <%= f.error_messages %> 5 | 6 |

7 | <%= f.label :name %>
8 | <%= f.text_field :name %> 9 |

10 |

11 | <%= f.submit "Create" %> 12 |

13 | <% end %> 14 | 15 | <%= link_to 'Back', shelves_path %> 16 | -------------------------------------------------------------------------------- /dm-adjust/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-adjust.rb 8 | lib/dm-adjust/adapters/data_objects_adapter.rb 9 | lib/dm-adjust/collection.rb 10 | lib/dm-adjust/model.rb 11 | lib/dm-adjust/repository.rb 12 | lib/dm-adjust/version.rb 13 | spec/integration/adjust_spec.rb 14 | spec/spec.opts 15 | spec/spec_helper.rb 16 | -------------------------------------------------------------------------------- /dm-querizer/lib/dm-querizer/collection.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | class Collection 3 | def all(query = {},&block) 4 | query = DataMapper::Querizer.translate(&block) if block 5 | return self if query.kind_of?(Hash) ? query.empty? : query == self.query 6 | query = scoped_query(query) 7 | query.repository.read_many(query) 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/billable.rb: -------------------------------------------------------------------------------- 1 | module Billable 2 | include DataMapper::Resource 3 | 4 | is :remixable, 5 | :suffix => "billing_account" 6 | 7 | property :id, Integer, :key => true, :serial => true 8 | 9 | property :cc_type, Enum.new("mastercard","amex","visa") 10 | property :cc_num, String, :length => 12..20 11 | property :expiration, Date 12 | end 13 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require(File.join(File.dirname(__FILE__), 'config', 'boot')) 5 | 6 | require 'rake' 7 | require 'rake/testtask' 8 | require 'rake/rdoctask' 9 | 10 | require 'tasks/rails' 11 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/db/migrate/20080608165526_create_books.rb: -------------------------------------------------------------------------------- 1 | class CreateBooks < ActiveRecord::Migration 2 | def self.up 3 | create_table :books do |t| 4 | t.string :title 5 | t.string :author 6 | t.integer :shelf_id 7 | 8 | t.timestamps 9 | end 10 | end 11 | 12 | def self.down 13 | drop_table :books 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /dm-querizer/lib/dm-querizer.rb: -------------------------------------------------------------------------------- 1 | # Needed to import datamapper and other gems 2 | require 'rubygems' 3 | require 'pathname' 4 | 5 | # Add all external dependencies for the plugin here 6 | gem 'dm-core', '=0.9.6' 7 | require 'dm-core' 8 | 9 | dir = Pathname(__FILE__).dirname.expand_path / 'dm-querizer' 10 | 11 | require dir / 'querizer' 12 | require dir / 'model' 13 | require dir / 'collection' 14 | -------------------------------------------------------------------------------- /dm-is-nested_set/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | * Add support for more than one root, and scope/namespacing 4 | * Write docs throughout the plugin 5 | * Add support for transactions and tablelocking when reorganizing items 6 | * Add function for (re)building nested set from ordinary tree 7 | * Caching the finder-methods 8 | * Allow options to pass through finders 9 | * Handle children of destroyed objects 10 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/topic.rb: -------------------------------------------------------------------------------- 1 | require Pathname(__FILE__).dirname / "rating" 2 | 3 | class Topic 4 | include DataMapper::Resource 5 | 6 | property :id, Integer, :key => true, :serial => true 7 | 8 | property :name, String 9 | property :description, String 10 | 11 | remix n, My::Nested::Remixable::Rating, 12 | :as => :ratings_for_topic, 13 | :class_name => "Rating" 14 | 15 | end 16 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/stories/crud/delete: -------------------------------------------------------------------------------- 1 | Story: remote app wants to delete a Resource 2 | As a remote app 3 | I want to delete a Resource 4 | So that the information will no longer be available 5 | 6 | Scenario: remote app attempts to delete a Resource by ID 7 | Given a local representation of a remote Resource 8 | When I destroy the Resource 9 | Then the Resource will no longer be available 10 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/views/shelves/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing shelf

2 | 3 | <% form_for(@shelf) do |f| %> 4 | <%= f.error_messages %> 5 | 6 |

7 | <%= f.label :name %>
8 | <%= f.text_field :name %> 9 |

10 |

11 | <%= f.submit "Update" %> 12 |

13 | <% end %> 14 | 15 | <%= link_to 'Show', @shelf %> | 16 | <%= link_to 'Back', shelves_path %> 17 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | h1. dm-more 2 | 3 | h2. Extra, non-essential parts for DataMapper 4 | 5 | Including 6 | 7 | * Migrations 8 | * Validations 9 | * Serializers 10 | * A Command-Line Interface 11 | * Timestamps 12 | * Types 13 | * ActiveRecord-style finders 14 | * Adapters for your favorite repository or database type 15 | * Integration with your favorite web frameworks 16 | * Observers for watching resources. 17 | -------------------------------------------------------------------------------- /dm-adjust/lib/dm-adjust.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'pathname' 3 | 4 | require Pathname(__FILE__).dirname + 'dm-adjust/version' 5 | 6 | gem 'dm-core', DataMapper::More::Adjust::VERSION 7 | require 'dm-core' 8 | 9 | dir = Pathname(__FILE__).dirname.expand_path / 'dm-adjust' 10 | 11 | require dir / 'collection' 12 | require dir / 'model' 13 | require dir / 'repository' 14 | require dir / 'adapters' / 'data_objects_adapter' 15 | -------------------------------------------------------------------------------- /dm-is-state_machine/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | * Should skipping to a new state automatically trigger :enter Proc? 5 | * Add loopback checking (i.e. when transitioning from a state back to itself) 6 | * Add support for callbacks 7 | * Consider using DataMapper's Enum type. 8 | * Consider trying out a nested state machine. 9 | * Not real happy with spec/unit/dsl: 10 | - specs are brittle 11 | - specs don't actually test much 12 | -------------------------------------------------------------------------------- /adapters/dm-couchdb-adapter/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/couchdb_adapter.rb 8 | lib/couchdb_adapter/attachments.rb 9 | lib/couchdb_adapter/json_object.rb 10 | lib/couchdb_adapter/version.rb 11 | lib/couchdb_adapter/view.rb 12 | spec/couchdb_adapter_spec.rb 13 | spec/couchdb_attachments_spec.rb 14 | spec/couchdb_view_spec.rb 15 | spec/spec.opts 16 | spec/testfile.txt 17 | -------------------------------------------------------------------------------- /merb_datamapper/lib/generators/templates/model_migration.rb: -------------------------------------------------------------------------------- 1 | migration <%= current_migration_nr + 1 %>, :<%= migration_name %> do 2 | up do 3 | <% unless properties.empty? -%> 4 | create_table :<%= table_name %> do 5 | <% properties.each do |p| -%> 6 | column :<%= p.name -%>, <%= p.type %> 7 | <% end -%> 8 | end 9 | <% end -%> 10 | end 11 | 12 | down do 13 | drop_table :<%= table_name %> 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /dm-tags/config/requirements.rb: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | include FileUtils 3 | 4 | require 'rubygems' 5 | %w[rake hoe newgem rubigen spec dm-core].each do |req_gem| 6 | begin 7 | require req_gem 8 | rescue LoadError 9 | puts "This Rakefile requires the '#{req_gem}' RubyGem." 10 | puts "Installation: gem install #{req_gem} -y" 11 | exit 12 | end 13 | end 14 | 15 | $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib])) 16 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/integration/invalid_events_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | describe "InvalidEvents" do 5 | 6 | it "should get InvalidContext when requiring" do 7 | lambda { 8 | require File.join( File.dirname(__FILE__), "..", "examples", "invalid_events" ) 9 | }.should raise_error(DataMapper::Is::StateMachine::InvalidContext) 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/integration/invalid_states_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | describe "InvalidStates" do 5 | 6 | it "should get InvalidContext when requiring" do 7 | lambda { 8 | require File.join( File.dirname(__FILE__), "..", "examples", "invalid_states" ) 9 | }.should raise_error(DataMapper::Is::StateMachine::InvalidContext) 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/taggable.rb: -------------------------------------------------------------------------------- 1 | module Taggable 2 | def self.included(base) 3 | base.extend Taggable::ClassMethods 4 | end 5 | 6 | include DataMapper::Resource 7 | 8 | is :remixable 9 | 10 | property :id, Integer, :key => true, :serial => true 11 | property :tag_id, Integer 12 | 13 | 14 | 15 | 16 | module ClassMethods 17 | 18 | def related_tags 19 | puts "should work" 20 | end 21 | 22 | end 23 | 24 | end -------------------------------------------------------------------------------- /dm-tags/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | License.txt 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | lib/dm-tags.rb 7 | lib/dm-tags/dm_tags.rb 8 | lib/dm-tags/tag.rb 9 | lib/dm-tags/tagging.rb 10 | lib/dm-tags/version.rb 11 | setup.rb 12 | spec/classes.rb 13 | spec/dm-setup.rb 14 | spec/dm-tags/dm_tags_spec.rb 15 | spec/dm-tags/tag_spec.rb 16 | spec/dm-tags/taggable_spec.rb 17 | spec/dm-tags/tagging_spec.rb 18 | spec/spec.opts 19 | spec/spec_helper.rb 20 | tasks/rspec.rake -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/views/books/new.html.erb: -------------------------------------------------------------------------------- 1 |

New book

2 | 3 | <% form_for(@book) do |f| %> 4 | <%= f.error_messages %> 5 | 6 |

7 | <%= f.label :title %>
8 | <%= f.text_field :title %> 9 |

10 |

11 | <%= f.label :author %>
12 | <%= f.text_field :author %> 13 |

14 |

15 | <%= f.submit "Create" %> 16 |

17 | <% end %> 18 | 19 | <%= link_to 'Back', books_path %> 20 | -------------------------------------------------------------------------------- /dm-aggregates/lib/dm-aggregates.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | dir = Pathname(__FILE__).dirname.expand_path + 'dm-aggregates' 4 | 5 | require dir + 'version' 6 | gem 'dm-core', DataMapper::More::Aggregates::VERSION 7 | require 'dm-core' 8 | 9 | 10 | require dir + 'aggregate_functions' 11 | require dir + 'model' 12 | require dir + 'repository' 13 | require dir + 'collection' 14 | require dir + 'adapters' + 'data_objects_adapter' 15 | require dir + 'support' + 'symbol' 16 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/examples/invalid_events.rb: -------------------------------------------------------------------------------- 1 | # An invalid example. 2 | class InvalidEvents 3 | include DataMapper::Resource 4 | 5 | property :id, Serial 6 | 7 | is :state_machine do 8 | state :day 9 | state :night 10 | end 11 | 12 | # The next lines are intentionally incorrect. 13 | # 14 | # 'event' only makes sense in a block under 'is :state_machine' 15 | event :sunrise 16 | event :sunset 17 | 18 | end 19 | 20 | InvalidEvents.auto_migrate! 21 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/examples/invalid_states.rb: -------------------------------------------------------------------------------- 1 | # An invalid example. 2 | class InvalidStates 3 | include DataMapper::Resource 4 | 5 | property :id, Serial 6 | 7 | is :state_machine do 8 | event :sunrise 9 | event :sunset 10 | end 11 | 12 | # The next lines are intentionally incorrect. 13 | # 14 | # 'state' only makes sense in a block under 'is :state_machine' 15 | state :light 16 | state :dark 17 | 18 | end 19 | 20 | InvalidStates.auto_migrate! 21 | -------------------------------------------------------------------------------- /rails_datamapper/generators/dm_model/templates/migration.rb: -------------------------------------------------------------------------------- 1 | class <%= migration_name %> < ActiveRecord::Migration 2 | def self.up 3 | create_table :<%= table_name %> do |t| 4 | <% for attribute in attributes -%> 5 | t.<%= attribute.type %> :<%= attribute.name %> 6 | <% end -%> 7 | <% unless options[:skip_timestamps] %> 8 | t.timestamps 9 | <% end -%> 10 | end 11 | end 12 | 13 | def self.down 14 | drop_table :<%= table_name %> 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /dm-adjust/README.txt: -------------------------------------------------------------------------------- 1 | dm-adjust 2 | ============= 3 | 4 | DataMapper plugin providing methods to increment and decrement properties 5 | 6 | It provides the following function (for collections and resources): 7 | 8 | == adjust 9 | 10 | Person.adjust(:salary => 1000) # increases the salary of all people with 1000. 11 | Person.all(:age.gte => 40).adjust(:salary => 2000) # increase salary of them oldies. 12 | Children.adjust(:allowance => -100) # less money for candy and concerts 13 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/stories/helper.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/rest_adapter") 2 | require 'rubygems' 3 | require 'spec' 4 | require 'tempfile' 5 | require 'dm-core' 6 | #require 'pathname' 7 | #require Pathname(__FILE__).dirname.parent.expand_path + '../../lib/rest_adapter' 8 | require File.join(File.dirname(__FILE__), *%w[resources helpers story_helper]) 9 | require File.join(File.dirname(__FILE__), *%w[resources steps using_rest_adapter]) 10 | -------------------------------------------------------------------------------- /dm-is-versioned/lib/dm-is-versioned.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'pathname' 3 | 4 | gem 'dm-core', '=0.9.6' 5 | require 'dm-core' 6 | 7 | require Pathname(__FILE__).dirname.expand_path / 'dm-is-versioned' / 'is' / 'versioned.rb' 8 | 9 | # Include the plugin in Resource 10 | module DataMapper 11 | module Resource 12 | module ClassMethods 13 | include DataMapper::Is::Versioned 14 | end # module ClassMethods 15 | end # module Resource 16 | end # module DataMapper 17 | -------------------------------------------------------------------------------- /dm-aggregates/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-aggregates.rb 8 | lib/dm-aggregates/adapters/data_objects_adapter.rb 9 | lib/dm-aggregates/aggregate_functions.rb 10 | lib/dm-aggregates/collection.rb 11 | lib/dm-aggregates/model.rb 12 | lib/dm-aggregates/repository.rb 13 | lib/dm-aggregates/support/symbol.rb 14 | lib/dm-aggregates/version.rb 15 | spec/integration/aggregates_spec.rb 16 | spec/spec.opts 17 | spec/spec_helper.rb 18 | -------------------------------------------------------------------------------- /dm-constraints/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-constraints.rb 8 | lib/dm-constraints/data_objects_adapter.rb 9 | lib/dm-constraints/mysql_adapter.rb 10 | lib/dm-constraints/postgres_adapter.rb 11 | lib/dm-constraints/version.rb 12 | spec/integration/constraints_spec.rb 13 | spec/spec.opts 14 | spec/spec_helper.rb 15 | tasks/ci.rb 16 | tasks/dm.rb 17 | tasks/doc.rb 18 | tasks/gemspec.rb 19 | tasks/hoe.rb 20 | tasks/install.rb 21 | -------------------------------------------------------------------------------- /dm-aggregates/lib/dm-aggregates/support/symbol.rb: -------------------------------------------------------------------------------- 1 | class Symbol 2 | def count 3 | DataMapper::Query::Operator.new(self, :count) 4 | end 5 | 6 | def min 7 | DataMapper::Query::Operator.new(self, :min) 8 | end 9 | 10 | def max 11 | DataMapper::Query::Operator.new(self, :max) 12 | end 13 | 14 | def avg 15 | DataMapper::Query::Operator.new(self, :avg) 16 | end 17 | 18 | def sum 19 | DataMapper::Query::Operator.new(self, :sum) 20 | end 21 | end # class Symbol 22 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/addressable.rb: -------------------------------------------------------------------------------- 1 | module Addressable 2 | include DataMapper::Resource 3 | 4 | is :remixable, 5 | :suffix => "address" 6 | 7 | property :id, Integer, :key => true, :serial => true 8 | 9 | property :address1, String, :length => 255 10 | property :address2, String, :length => 255 11 | 12 | property :city, String, :length => 128 13 | property :state, String, :length => 2 14 | property :zip, String, :length => 5..10 15 | end 16 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/spec/ruby_forker.rb: -------------------------------------------------------------------------------- 1 | require 'rbconfig' 2 | 3 | module RubyForker 4 | # Forks a ruby interpreter with same type as ourself. 5 | # juby will fork jruby, ruby will fork ruby etc. 6 | def ruby(args, stderr=nil) 7 | config = ::Config::CONFIG 8 | interpreter = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT'] 9 | cmd = "#{interpreter} #{args}" 10 | cmd << " 2> #{stderr}" unless stderr.nil? 11 | `#{cmd}` 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /dm-tags/lib/dm-tags/tagging.rb: -------------------------------------------------------------------------------- 1 | class Tagging 2 | include DataMapper::Resource 3 | property :id, Integer, :serial => true 4 | property :tag_id, Integer, :nullable => false 5 | property :taggable_id, Integer, :nullable => false 6 | property :taggable_type, String, :nullable => false 7 | property :tag_context, String, :nullable => false 8 | 9 | belongs_to :tag 10 | 11 | def taggable 12 | eval("#{taggable_type}.get!(#{taggable_id})") if taggable_type and taggable_id 13 | end 14 | end -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/views/books/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing book

2 | 3 | <% form_for(@book) do |f| %> 4 | <%= f.error_messages %> 5 | 6 |

7 | <%= f.label :title %>
8 | <%= f.text_field :title %> 9 |

10 |

11 | <%= f.label :author %>
12 | <%= f.text_field :author %> 13 |

14 |

15 | <%= f.submit "Update" %> 16 |

17 | <% end %> 18 | 19 | <%= link_to 'Show', @book %> | 20 | <%= link_to 'Back', books_path %> 21 | -------------------------------------------------------------------------------- /dm-migrations/spec/unit/sql/column_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname + '../../spec_helper' 3 | 4 | require Pathname(__FILE__).dirname + '../../../lib/sql/column' 5 | 6 | describe SQL::Column do 7 | before do 8 | @column = SQL::Column.new 9 | end 10 | 11 | %w{name type not_null default_value primary_key unique}.each do |meth| 12 | it "should have a ##{meth} attribute" do 13 | @column.should respond_to(meth.intern) 14 | end 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /dm-serializer/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | autotest/discover.rb 8 | autotest/dmserializer_rspec.rb 9 | lib/dm-serializer.rb 10 | lib/dm-serializer/version.rb 11 | spec/fixtures/cow.rb 12 | spec/fixtures/planet.rb 13 | spec/fixtures/quatum_cat.rb 14 | spec/spec.opts 15 | spec/spec_helper.rb 16 | spec/unit/serializer_spec.rb 17 | spec/unit/to_csv_spec.rb 18 | spec/unit/to_json_spec.rb 19 | spec/unit/to_xml_spec.rb 20 | spec/unit/to_yaml_spec.rb 21 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.parent.expand_path + 'lib/rest_adapter' 3 | 4 | DataMapper.setup(:default, { 5 | :adapter => 'rest', 6 | :format => 'xml', 7 | :host => 'localhost', 8 | :port => '3001' 9 | }) 10 | 11 | class Book 12 | include DataMapper::Resource 13 | property :author, String 14 | property :created_at, DateTime 15 | property :id, Integer, :serial => true 16 | property :title, String 17 | end 18 | -------------------------------------------------------------------------------- /dm-serializer/spec/fixtures/planet.rb: -------------------------------------------------------------------------------- 1 | class Planet 2 | include DataMapper::Resource 3 | 4 | property :name, String, :key => true 5 | property :aphelion, Float 6 | 7 | def category 8 | case self.name.downcase 9 | when "mercury", "venus", "earth", "mars" then "terrestrial" 10 | when "jupiter", "saturn", "uranus", "neptune" then "gas giants" 11 | when "pluto" then "dwarf planets" 12 | end 13 | end 14 | 15 | def has_known_form_of_life? 16 | self.name.downcase == "earth" 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /dm-adjust/lib/dm-adjust/model.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Model 3 | 4 | ## 5 | # increment or decrement attributes on all objects in a resource 6 | # 7 | # @example [Usage] 8 | # * People.adjust(:salary => +1000) 9 | # * Children.adjust(:allowance => -100) 10 | # 11 | # @param attributes A hash of attributes to adjust, and their adjustment 12 | # @public 13 | def adjust!(attributes,reload=false) 14 | all.adjust!(attributes,reload) 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /dm-tags/tasks/rspec.rake: -------------------------------------------------------------------------------- 1 | begin 2 | require 'spec' 3 | rescue LoadError 4 | require 'rubygems' 5 | require 'spec' 6 | end 7 | begin 8 | require 'spec/rake/spectask' 9 | rescue LoadError 10 | puts <<-EOS 11 | To use rspec for testing you must install rspec gem: 12 | gem install rspec 13 | EOS 14 | exit(0) 15 | end 16 | 17 | desc "Run the specs under spec/models" 18 | Spec::Rake::SpecTask.new do |t| 19 | t.spec_opts = ['--options', "spec/spec.opts"] 20 | t.spec_files = FileList['spec/**/*_spec.rb'] 21 | end 22 | -------------------------------------------------------------------------------- /dm-is-state_machine/lib/dm-is-state_machine/is/data/state.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module StateMachine 4 | module Data 5 | 6 | class State 7 | 8 | attr_reader :name, :machine, :options 9 | 10 | def initialize(name, machine, options = {}) 11 | @name = name 12 | @options = options 13 | @machine = machine 14 | end 15 | 16 | end 17 | 18 | end # Data 19 | end # StateMachine 20 | end # Is 21 | end # DataMapper 22 | -------------------------------------------------------------------------------- /merb_datamapper/lib/generators/templates/views/show.html.erb: -------------------------------------------------------------------------------- 1 |

<%= class_name %> controller, show action

2 | 3 |

Edit this file in app/views/<%= file_name %>/show.html.erb

4 | 5 | <% for property in properties -%> 6 |

7 | <%= Extlib::Inflection.humanize(property.field) %>: 8 | <%%=h @<%= singular_model %>.<%= property.getter %> %> 9 |

10 | 11 | <% end -%> 12 | 13 | <%%= link_to 'Edit', url(:edit_<%= singular_model %>, @<%= singular_model %>) %> | 14 | <%%= link_to 'Back', url(:<%= plural_model %>) %> 15 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/regexp.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Types 3 | class Regexp < DataMapper::Type 4 | primitive String 5 | 6 | def self.load(value, property) 7 | ::Regexp.new(value) unless value.nil? 8 | end 9 | 10 | def self.dump(value, property) 11 | return nil if value.nil? 12 | value.source 13 | end 14 | 15 | def self.typecast(value, property) 16 | value.kind_of?(::Regexp) ? value : load(value, property) 17 | end 18 | end 19 | end 20 | end 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /adapters/dm-ferret-adapter/lib/ferret_adapter/repository_ext.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | class Repository 3 | # This accepts a ferret query string and an optional limit argument 4 | # which defaults to all. This is the proper way to perform searches more 5 | # complicated than DM's query syntax can handle (such as OR searches). 6 | # 7 | # See DataMapper::Adapters::FerretAdapter#search for information on 8 | # the return value. 9 | def search(query, limit = :all) 10 | adapter.search(query, limit) 11 | end 12 | end 13 | end -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/views/shelves/index.html.erb: -------------------------------------------------------------------------------- 1 |

Listing shelves

2 | 3 | 4 | 5 | 6 | 7 | 8 | <% for shelf in @shelves %> 9 | 10 | 11 | 12 | 13 | 14 | 15 | <% end %> 16 |
Name
<%=h shelf.name %><%= link_to 'Show', shelf %><%= link_to 'Edit', edit_shelf_path(shelf) %><%= link_to 'Destroy', shelf, :confirm => 'Are you sure?', :method => :delete %>
17 | 18 |
19 | 20 | <%= link_to 'New shelf', new_shelf_path %> 21 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/public/dispatch.rb: -------------------------------------------------------------------------------- 1 | #!c:/ruby/bin/ruby 2 | 3 | require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) 4 | 5 | # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: 6 | # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired 7 | require "dispatcher" 8 | 9 | ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun) 10 | Dispatcher.dispatch 11 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/examples/invalid_transitions_2.rb: -------------------------------------------------------------------------------- 1 | # An invalid example. 2 | class InvalidTransitions2 3 | include DataMapper::Resource 4 | 5 | property :id, Serial 6 | 7 | is :state_machine do 8 | state :happy 9 | state :sad 10 | 11 | event :toggle 12 | end 13 | 14 | # The next lines are intentionally incorrect. 15 | # 16 | # 'transition' is only valid when nested beneath 'event' 17 | transition :to => :happy, :from => :sad 18 | transition :to => :sad, :from => :happy 19 | 20 | end 21 | 22 | InvalidTransitions2.auto_migrate! 23 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/public/dispatch.cgi: -------------------------------------------------------------------------------- 1 | #!c:/ruby/bin/ruby 2 | 3 | require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) 4 | 5 | # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: 6 | # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired 7 | require "dispatcher" 8 | 9 | ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun) 10 | Dispatcher.dispatch 11 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/spec/create_spec.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH << File.dirname(__FILE__) 2 | require 'spec_helper' 3 | 4 | describe 'A REST adapter' do 5 | 6 | before do 7 | @adapter = DataMapper::Repository.adapters[:default] 8 | end 9 | 10 | describe 'when saving a resource' do 11 | 12 | before do 13 | @book = Book.new(:title => 'Hello, World!', :author => 'Anonymous') 14 | end 15 | 16 | it 'should make an HTTP Post' do 17 | @adapter.should_receive(:http_post).with('/books.xml', @book.to_xml) 18 | @book.save 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/examples/invalid_transitions_1.rb: -------------------------------------------------------------------------------- 1 | # An invalid example. 2 | class InvalidTransitions1 3 | include DataMapper::Resource 4 | 5 | property :id, Serial 6 | 7 | is :state_machine do 8 | state :happy 9 | state :sad 10 | 11 | event :toggle 12 | 13 | # The next lines are intentionally incorrect. 14 | # 15 | # 'transition' is only valid when nested beneath 'event' 16 | transition :to => :happy, :from => :sad 17 | transition :to => :sad, :from => :happy 18 | end 19 | 20 | end 21 | 22 | InvalidTransitions1.auto_migrate! 23 | -------------------------------------------------------------------------------- /dm-validations/spec/integration/validation_errors_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | describe DataMapper::Validate::ValidationErrors do 5 | 6 | before(:each) do 7 | @errors = DataMapper::Validate::ValidationErrors.new 8 | end 9 | 10 | it "should report that it is empty on first creation" do 11 | @errors.empty?.should == true 12 | end 13 | 14 | it "should continue to report that it is empty even after being checked" do 15 | @errors.on(:foo) 16 | @errors.empty?.should == true 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /dm-tags/spec/classes.rb: -------------------------------------------------------------------------------- 1 | class TaggedModel 2 | include DataMapper::Resource 3 | property :id, Integer, :serial => true 4 | 5 | has_tags_on :skills, :interests, :tags 6 | end 7 | 8 | class AnotherTaggedModel 9 | include DataMapper::Resource 10 | property :id, Integer, :serial => true 11 | 12 | has_tags_on :skills, :pets 13 | end 14 | 15 | class DefaultTaggedModel 16 | include DataMapper::Resource 17 | property :id, Integer, :serial => true 18 | 19 | has_tags 20 | end 21 | 22 | class UntaggedModel 23 | include DataMapper::Resource 24 | property :id, Integer, :serial => true 25 | end -------------------------------------------------------------------------------- /dm-tags/spec/dm-tags/tag_spec.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../spec_helper.rb' 2 | 3 | describe Tag do 4 | before(:each) do 5 | @tag = Tag.new 6 | end 7 | 8 | it "should have id and name properties" do 9 | @tag.attributes.should have_key(:id) 10 | @tag.attributes.should have_key(:name) 11 | end 12 | 13 | it "should have many Taggings" do 14 | Tag.relationships.should have_key(:taggings) 15 | end 16 | 17 | it "should validate the presence of name" do 18 | @tag.should_not be_valid 19 | @tag.name = "Meme" 20 | @tag.should be_valid 21 | end 22 | end -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/views/layouts/books.html.erb: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | Books: <%= controller.action_name %> 8 | <%= stylesheet_link_tag 'scaffold' %> 9 | 10 | 11 | 12 |

<%= flash[:notice] %>

13 | 14 | <%= yield %> 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /dm-is-example/lib/dm-is-example.rb: -------------------------------------------------------------------------------- 1 | # Needed to import datamapper and other gems 2 | require 'rubygems' 3 | require 'pathname' 4 | 5 | # Add all external dependencies for the plugin here 6 | gem 'dm-core', '=0.9.6' 7 | require 'dm-core' 8 | 9 | # Require plugin-files 10 | require Pathname(__FILE__).dirname.expand_path / 'dm-is-example' / 'is' / 'example.rb' 11 | 12 | 13 | # Include the plugin in Resource 14 | module DataMapper 15 | module Resource 16 | module ClassMethods 17 | include DataMapper::Is::Example 18 | end # module ClassMethods 19 | end # module Resource 20 | end # module DataMapper 21 | -------------------------------------------------------------------------------- /merb_datamapper/lib/generators/templates/views/new.html.erb: -------------------------------------------------------------------------------- 1 |

<%= class_name %> controller, new action

2 | 3 |

Edit this file in app/views/<%= file_name %>/new.html.erb

4 | 5 | <%%= form_for(@<%= singular_model %>, :action => url(:<%= plural_model %>) ) do %> 6 | <% for property in properties.select{|p| !p.key?} -%> 7 |

8 | <%%= text_field :<%= property %>, :label => "<%= Extlib::Inflection.humanize(property) %>" %> 9 |

10 | 11 | <% end -%> 12 |

13 | <%%= submit "Create" %> 14 |

15 | <%% end =%> 16 | 17 | <%%= link_to 'Back', url(:<%= plural_model %>) %> 18 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/views/books/index.html.erb: -------------------------------------------------------------------------------- 1 |

Listing books

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <% for book in @books %> 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <% end %> 18 |
TitleAuthor
<%=h book.title %><%=h book.author %><%= link_to 'Show', book %><%= link_to 'Edit', edit_book_path(book) %><%= link_to 'Destroy', book, :confirm => 'Are you sure?', :method => :delete %>
19 | 20 |
21 | 22 | <%= link_to 'New book', new_book_path %> 23 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/spec/delete_spec.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH << File.dirname(__FILE__) 2 | require 'spec_helper' 3 | 4 | describe 'A REST adapter' do 5 | 6 | before do 7 | @adapter = DataMapper::Repository.adapters[:default] 8 | end 9 | 10 | describe 'when deleting an existing resource' do 11 | before do 12 | @book = Book.new(:title => 'Hello, World!', :author => 'Anonymous') 13 | @book.stub!(:new_record?).and_return(false) 14 | end 15 | 16 | it 'should do an HTTP DELETE' do 17 | @adapter.should_receive(:http_delete) 18 | @book.destroy 19 | end 20 | 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /dm-is-remixable/lib/dm-is-remixable.rb: -------------------------------------------------------------------------------- 1 | # Needed to import datamapper and other gems 2 | require 'rubygems' 3 | require 'pathname' 4 | 5 | # Add all external dependencies for the plugin here 6 | gem 'dm-core', '=0.9.6' 7 | require 'dm-core' 8 | 9 | # Require plugin-files 10 | require Pathname(__FILE__).dirname.expand_path / 'dm-is-remixable' / 'is' / 'remixable.rb' 11 | 12 | # Include the plugin in Resource 13 | module DataMapper 14 | module Resource 15 | module ClassMethods 16 | include DataMapper::Is::Remixable 17 | end # module ClassMethods 18 | end # module Resource 19 | end # module DataMapper 20 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/bot.rb: -------------------------------------------------------------------------------- 1 | require Pathname(__FILE__).dirname / "viewable" 2 | require Pathname(__FILE__).dirname / "billable" 3 | require Pathname(__FILE__).dirname / "addressable" 4 | require Pathname(__FILE__).dirname / "rating" 5 | 6 | class Bot 7 | include DataMapper::Resource 8 | 9 | property :id, Integer, 10 | :key => true, 11 | :serial => true 12 | 13 | property :bot_name, String, 14 | :nullable => false, 15 | :length => 2..50 16 | 17 | property :bot_version, String, 18 | :nullable => false, 19 | :length => 2..50 20 | 21 | end -------------------------------------------------------------------------------- /dm-is-searchable/lib/dm-is-searchable.rb: -------------------------------------------------------------------------------- 1 | # Needed to import datamapper and other gems 2 | require 'rubygems' 3 | require 'pathname' 4 | 5 | # Add all external dependencies for the plugin here 6 | gem 'dm-core', '=0.9.6' 7 | require 'dm-core' 8 | 9 | # Require plugin-files 10 | require Pathname(__FILE__).dirname.expand_path / 'dm-is-searchable' / 'is' / 'searchable.rb' 11 | 12 | 13 | # Include the plugin in Resource 14 | module DataMapper 15 | module Resource 16 | module ClassMethods 17 | include DataMapper::Is::Searchable 18 | end # module ClassMethods 19 | end # module Resource 20 | end # module DataMapper 21 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/unit/data/state_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent.parent + 'spec_helper' 3 | 4 | module StateHelper 5 | def new_state(*args) 6 | DataMapper::Is::StateMachine::Data::State.new(*args) 7 | end 8 | end 9 | 10 | describe DataMapper::Is::StateMachine::Data::State do 11 | include StateHelper 12 | 13 | before(:each) do 14 | @machine = mock("machine") 15 | @state = new_state(:off, @machine) 16 | end 17 | 18 | it "#initialize should work" do 19 | @state.name.should == :off 20 | @state.machine.should == @machine 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /dm-observer/README.txt: -------------------------------------------------------------------------------- 1 | == README 2 | 3 | DataMapper::Observer allows you to add callback hooks to many models. This is 4 | similar to observers in ActiveRecord. 5 | 6 | Example: 7 | 8 | class Adam 9 | include DataMapper::Resource 10 | 11 | property :id, Integer, :serial => true 12 | property :name, String 13 | end 14 | 15 | class AdamObserver 16 | include DataMapper::Observer 17 | 18 | observe Adam 19 | 20 | before :save do 21 | # log message 22 | end 23 | 24 | before :get_drunk do 25 | # eat something 26 | end 27 | 28 | after_class_method :unite do 29 | raise "Call for help!" 30 | end 31 | 32 | end 33 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3-ruby (not necessary on OS X Leopard) 3 | development: 4 | adapter: sqlite3 5 | database: db/development.sqlite3 6 | timeout: 5000 7 | 8 | # Warning: The database defined as "test" will be erased and 9 | # re-generated from your development database when you run "rake". 10 | # Do not set this db to the same as development or production. 11 | test: 12 | adapter: sqlite3 13 | database: db/test.sqlite3 14 | timeout: 5000 15 | 16 | production: 17 | adapter: sqlite3 18 | database: db/production.sqlite3 19 | timeout: 5000 20 | -------------------------------------------------------------------------------- /adapters/dm-couchdb-adapter/lib/couchdb_adapter/json_object.rb: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | # Non-lazy objects that serialize to/from JSON, for use with couchdb 4 | module DataMapper 5 | module Types 6 | class JsonObject < DataMapper::Type 7 | primitive String 8 | size 65535 9 | 10 | def self.load(value, property) 11 | value.nil? ? nil : value 12 | end 13 | 14 | def self.dump(value, property) 15 | value.nil? ? nil : value 16 | end 17 | 18 | def self.typecast(value, property) 19 | value 20 | end 21 | end # class JsonObject 22 | end # module Types 23 | end # module DataMapper 24 | -------------------------------------------------------------------------------- /dm-is-state_machine/lib/dm-is-state_machine/is/data/event.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module StateMachine 4 | module Data 5 | 6 | class Event 7 | 8 | attr_reader :name, :machine, :transitions 9 | 10 | def initialize(name, machine) 11 | @name = name 12 | @machine = machine 13 | @transitions = [] 14 | end 15 | 16 | def add_transition(from, to) 17 | @transitions << { :from => from, :to => to } 18 | end 19 | 20 | end 21 | 22 | end # Data 23 | end # StateMachine 24 | end # Is 25 | end # DataMapper 26 | -------------------------------------------------------------------------------- /dm-constraints/tasks/doc.rb: -------------------------------------------------------------------------------- 1 | # when yard's ready, it'll have to come back, but for now... 2 | Rake::RDocTask.new("doc") do |t| 3 | t.rdoc_dir = 'doc' 4 | t.title = "DataMapper - Ruby Object Relational Mapper" 5 | t.options = ['--line-numbers', '--inline-source', '--all'] 6 | t.rdoc_files.include("README.txt", "QUICKLINKS", "FAQ", "lib/**/**/*.rb") 7 | end 8 | 9 | begin 10 | gem 'yard', '>=0.2.1' 11 | require 'yard' 12 | 13 | YARD::Rake::YardocTask.new("yardoc") do |t| 14 | t.options << '--protected' 15 | # t.options << '-q' 16 | # t.files << '...anyglobshere...' 17 | end 18 | rescue Exception 19 | # yard not installed 20 | end 21 | -------------------------------------------------------------------------------- /dm-constraints/lib/dm-constraints/postgres_adapter.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Constraints 3 | module PostgresAdapter 4 | module SQL 5 | private 6 | 7 | def constraint_exists?(storage_name, constraint_name) 8 | statement = <<-EOS.compress_lines 9 | SELECT COUNT(*) 10 | FROM "information_schema"."table_constraints" 11 | WHERE "table_schema" = current_schema() 12 | AND "table_name" = ? 13 | AND "constraint_name" = ? 14 | EOS 15 | query(statement, storage_name, constraint_name).first > 0 16 | end 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /dm-validations/spec/integration/generic_validator_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | module DataMapper 5 | module Validate 6 | describe DataMapper::Validate::GenericValidator do 7 | describe "#==" do 8 | it "should return true if types and fields are equal" do 9 | RequiredFieldValidator.new(:name).should == RequiredFieldValidator.new(:name) 10 | end 11 | it "should return false of types differ" do 12 | RequiredFieldValidator.new(:name).should_not == UniquenessValidator.new(:name) 13 | end 14 | end 15 | end 16 | end 17 | end -------------------------------------------------------------------------------- /merb_datamapper/lib/generators/data_mapper_model.rb: -------------------------------------------------------------------------------- 1 | Merb::Generators::ModelGenerator.option :migration, :as => :boolean, :desc => 'Also generate a dm-migration for the model' 2 | 3 | class Merb::Generators::ModelGenerator 4 | ## 5 | # Corrects case of common datamapper arguments. 6 | def datamapper_type(type) 7 | return 'DateTime' if type == 'datetime' 8 | return type.camel_case 9 | end 10 | end 11 | 12 | Merb::Generators::ModelGenerator.template :model_datamapper, :orm => :datamapper do |t| 13 | t.source = File.join(File.dirname(__FILE__), "templates", "model.rb") 14 | t.destination = File.join("app/models", base_path, "#{file_name}.rb") 15 | end 16 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/rest_adapter.rb 8 | lib/rest_adapter/version.rb 9 | spec/create_spec.rb 10 | spec/delete_spec.rb 11 | spec/read_spec.rb 12 | spec/ruby_forker.rb 13 | spec/spec.opts 14 | spec/spec_helper.rb 15 | spec/update_spec.rb 16 | stories/all.rb 17 | stories/crud/create 18 | stories/crud/delete 19 | stories/crud/read 20 | stories/crud/stories.rb 21 | stories/crud/update 22 | stories/helper.rb 23 | stories/resources/helpers/book.rb 24 | stories/resources/helpers/story_helper.rb 25 | stories/resources/steps/read.rb 26 | stories/resources/steps/using_rest_adapter.rb 27 | -------------------------------------------------------------------------------- /dm-tags/tasks/website.rake: -------------------------------------------------------------------------------- 1 | desc 'Generate website files' 2 | task :website_generate => :ruby_env do 3 | (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt| 4 | sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} } 5 | end 6 | end 7 | 8 | desc 'Upload website files to rubyforge' 9 | task :website_upload do 10 | host = "#{rubyforge_username}@rubyforge.org" 11 | remote_dir = "/var/www/gforge-projects/#{PATH}/" 12 | local_dir = 'website' 13 | sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}} 14 | end 15 | 16 | desc 'Generate and upload website files' 17 | task :website => [:website_generate, :website_upload, :publish_docs] 18 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/stories/crud/stories.rb: -------------------------------------------------------------------------------- 1 | require File.join(File.dirname(__FILE__), *%w[.. helper]) 2 | 3 | Dir["#{File.dirname(__FILE__)}/*"].each do |file| 4 | unless (file =~ /\.rb$/) 5 | file_name = file.split('/').last 6 | begin 7 | require File.join(File.dirname(__FILE__), "..", "resources", "steps", file_name) 8 | rescue LoadError 9 | puts "Can't find #{file_name}.rb to define story steps; assuming this is intentional" 10 | rescue Exception => e 11 | puts e.backtrace 12 | exit 1 13 | end 14 | with_steps_for :using_rest_adapter, file_name.to_sym do 15 | run file if File.file?(file) 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/epoch_time.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Types 3 | class EpochTime < DataMapper::Type 4 | primitive Integer 5 | 6 | def self.load(value, property) 7 | case value 8 | when Integer 9 | Time.at(value) 10 | else 11 | value 12 | end 13 | end 14 | 15 | def self.dump(value, property) 16 | case value 17 | when Integer 18 | value 19 | when Time 20 | value.to_i 21 | when DateTime 22 | Time.parse(value.to_s).to_i 23 | end 24 | end 25 | end # class EpochTime 26 | end # module Types 27 | end # module DataMapper 28 | -------------------------------------------------------------------------------- /dm-querizer/lib/dm-querizer/model.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Model 3 | def all(query={},&block) 4 | query = DataMapper::Querizer.translate(&block) if block 5 | query = scoped_query(query) 6 | query.repository.read_many(query) 7 | end 8 | 9 | def first(*args) 10 | query = DataMapper::Querizer.translate(args.pop) if args.last.is_a? Proc 11 | query = args.last.respond_to?(:merge) ? args.pop : {} 12 | query = scoped_query(query.merge(:limit => args.first || 1)) 13 | 14 | if args.any? 15 | query.repository.read_many(query) 16 | else 17 | query.repository.read_one(query) 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/unit/dsl/state_dsl_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent.parent + 'spec_helper' 3 | 4 | describe "StateDsl" do 5 | 6 | describe "state" do 7 | 8 | before(:each) do 9 | class Earth 10 | extend DataMapper::Is::StateMachine::StateDsl 11 | stub!(:state_machine_context?).and_return(true) 12 | end 13 | machine = mock("machine", :states => []) 14 | Earth.instance_variable_set(:@is_state_machine, { :machine => machine }) 15 | end 16 | 17 | it "declaration should succeed" do 18 | class Earth 19 | state :day 20 | end 21 | end 22 | 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /dm-validations/TODO: -------------------------------------------------------------------------------- 1 | Short TODO list 2 | =============== 3 | 4 | * Add logic_validator -- validates(“You need more money!”) { |instance| instance.money < 1_000_000 } 5 | * Allow for the translation of strings in messages 6 | * Add the canned RFC2822 email format to format_validator 7 | * Add a validates_acceptance_of validator 8 | * Add a validates_each validator 9 | * Add a validates_true validator 10 | 11 | * Validators do not accept associations except validates_uniqueness_of - fix this 12 | * Add auto validation on cardinality of associations 13 | 14 | --- 15 | TODO tickets may also be found in the DataMapper Issue Tracker: 16 | http://wm.lighthouseapp.com/projects/4819-datamapper/overview 17 | -------------------------------------------------------------------------------- /dm-types/spec/integration/json_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' 3 | 4 | describe DataMapper::Types::Json do 5 | before(:all) do 6 | class JsonTest 7 | include DataMapper::Resource 8 | 9 | property :id, Serial 10 | property :json, Json 11 | end 12 | JsonTest.auto_migrate! 13 | end 14 | 15 | it "should work" do 16 | repository(:default) do 17 | JsonTest.create(:json => '[1, 2, 3]') 18 | end 19 | 20 | JsonTest.first.json.should == [1, 2, 3] 21 | end 22 | 23 | it 'should immediately typecast supplied values' do 24 | JsonTest.new(:json => '[1, 2, 3]').json.should == [1, 2, 3] 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /merb_datamapper/lib/generators/templates/views/edit.html.erb: -------------------------------------------------------------------------------- 1 |

<%= class_name %> controller, edit action

2 | 3 |

Edit this file in app/views/<%= file_name %>/edit.html.erb

4 | 5 | <%%= form_for(@<%= singular_model %>, :action => url(:<%= singular_model %>, @<%= singular_model %>)) do %> 6 | <% for property in properties.select{|p| !p.key?} -%> 7 |

8 | <%%= text_field :<%= property %>, :label => "<%= Extlib::Inflection.humanize(property) %>" %> 9 |

10 | 11 | <% end -%> 12 |

13 | <%%= submit "Update" %> 14 |

15 | <%% end =%> 16 | 17 | <%%= link_to 'Show', url(:<%= singular_model %>, @<%= singular_model %>) %> | 18 | <%%= link_to 'Back', url(:<%= plural_model %>) %> 19 | -------------------------------------------------------------------------------- /dm-validations/lib/dm-validations/formats/url.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Validate 3 | module Format 4 | module Url 5 | 6 | def self.included(base) 7 | DataMapper::Validate::FormatValidator::FORMATS.merge!( 8 | :url => [ Url, lambda { |field, value| '%s is not a valid URL'.t(value) }] 9 | ) 10 | end 11 | 12 | Url = begin 13 | # Regex from http://www.igvita.com/2006/09/07/validating-url-in-ruby-on-rails/ 14 | /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix 15 | end 16 | 17 | end # module Url 18 | end # module Format 19 | end # module Validate 20 | end # module DataMapper 21 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/file_path.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | 3 | module DataMapper 4 | module Types 5 | class FilePath < DataMapper::Type 6 | primitive String 7 | 8 | def self.load(value, property) 9 | if value.nil? 10 | nil 11 | else 12 | Pathname.new(value) 13 | end 14 | end 15 | 16 | def self.dump(value, property) 17 | return nil if value.nil? 18 | value.to_s 19 | end 20 | 21 | def self.typecast(value, property) 22 | # Leave alone if a Pathname is given. 23 | value.kind_of?(Pathname) ? value : load(value, property) 24 | end 25 | end # class FilePath 26 | end # module Types 27 | end # module DataMapper 28 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/csv.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Types 3 | class Csv < DataMapper::Type 4 | primitive String 5 | size 65535 6 | lazy true 7 | 8 | def self.load(value, property) 9 | case value 10 | when String then FasterCSV.parse(value) 11 | when Array then value 12 | else nil 13 | end 14 | end 15 | 16 | def self.dump(value, property) 17 | case value 18 | when Array then 19 | FasterCSV.generate do |csv| 20 | value.each { |row| csv << row } 21 | end 22 | when String then value 23 | else nil 24 | end 25 | end 26 | end # class Csv 27 | end # module Types 28 | end # module DataMapper 29 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/uri.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'addressable/uri' 3 | 4 | module DataMapper 5 | module Types 6 | class URI < DataMapper::Type 7 | primitive String 8 | 9 | def self.load(value, property) 10 | Addressable::URI.parse(value) 11 | end 12 | 13 | def self.dump(value, property) 14 | return nil if value.nil? 15 | value.to_s 16 | end 17 | 18 | def self.typecast(value, property) 19 | if value.kind_of?(Addressable::URI) 20 | value 21 | elsif value.nil? 22 | load(nil, property) 23 | else 24 | load(value.to_s, property) 25 | end 26 | end 27 | end # class URI 28 | end # module Types 29 | end # module DataMapper 30 | -------------------------------------------------------------------------------- /dm-constraints/tasks/install.rb: -------------------------------------------------------------------------------- 1 | WIN32 = (RUBY_PLATFORM =~ /win32|mingw|bccwin|cygwin/) rescue nil 2 | SUDO = WIN32 ? '' : ('sudo' unless ENV['SUDOLESS']) 3 | 4 | desc "Install #{GEM_NAME}" 5 | if WIN32 6 | task :install => :gem do 7 | system %{gem install --no-rdoc --no-ri -l pkg/#{GEM_NAME}-#{GEM_VERSION}.gem} 8 | end 9 | namespace :dev do 10 | desc 'Install for development (for windows)' 11 | task :winstall => :gem do 12 | warn "You can now call 'rake install' instead of 'rake dev:winstall'." 13 | system %{gem install --no-rdoc --no-ri -l pkg/#{GEM_NAME}-#{GEM_VERSION}.gem} 14 | end 15 | end 16 | else 17 | task :install => :package do 18 | sh %{#{SUDO} gem install --local pkg/#{GEM_NAME}-#{GEM_VERSION}.gem} 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /dm-types/spec/integration/ip_address_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' 3 | 4 | describe DataMapper::Types::IPAddress do 5 | before(:all) do 6 | class IPAddressTest 7 | include DataMapper::Resource 8 | 9 | property :id, Serial 10 | property :ip, IPAddress 11 | end 12 | IPAddressTest.auto_migrate! 13 | end 14 | 15 | it "should work" do 16 | repository(:default) do 17 | IPAddressTest.create(:ip => '127.0.0.1') 18 | end 19 | 20 | IPAddressTest.first.ip.should == IPAddr.new('127.0.0.1') 21 | end 22 | 23 | it 'should immediately typecast supplied values' do 24 | IPAddressTest.new(:ip => '10.0.0.1').ip.should == IPAddr.new('10.0.0.1') 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /dm-types/spec/integration/file_path_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' 3 | 4 | describe DataMapper::Types::FilePath do 5 | before(:all) do 6 | class FilePathTest 7 | include DataMapper::Resource 8 | 9 | property :id, Integer, :serial => true 10 | property :path, FilePath 11 | end 12 | FilePathTest.auto_migrate! 13 | end 14 | 15 | it "should work" do 16 | repository(:default) do 17 | FilePathTest.create!(:path => '/usr') 18 | end 19 | 20 | FilePathTest.first.path.should == Pathname.new('/usr') 21 | end 22 | 23 | it 'should immediately typecast supplied values' do 24 | FilePathTest.new(:path => '/usr').path.should == Pathname.new('/usr') 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/integration/invalid_transitions_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | describe "InvalidTransitions1" do 5 | 6 | it "should get InvalidContext when requiring" do 7 | lambda { 8 | require File.join( File.dirname(__FILE__), "..", "examples", "invalid_transitions_1" ) 9 | }.should raise_error(DataMapper::Is::StateMachine::InvalidContext) 10 | end 11 | 12 | end 13 | 14 | describe "InvalidTransitions2" do 15 | 16 | it "should get InvalidContext when requiring" do 17 | lambda { 18 | require File.join( File.dirname(__FILE__), "..", "examples", "invalid_transitions_2" ) 19 | }.should raise_error(DataMapper::Is::StateMachine::InvalidContext) 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /dm-constraints/tasks/gemspec.rb: -------------------------------------------------------------------------------- 1 | desc "Generate gemspec" 2 | task :gemspec do |x| 3 | # Clean up extraneous files before checking manifest 4 | %x[rake clean] 5 | 6 | # Check the manifest before generating the gemspec 7 | manifest = %x[rake check_manifest] 8 | manifest.gsub!("(in /usr/local/projects/dm/dm-core)\n", "") 9 | 10 | unless manifest.empty? 11 | print "\n", "#"*68, "\n" 12 | print <<-EOS 13 | Manifest.txt is not up-to-date. Please review the changes below. 14 | If the changes are correct, run 'rake check_manifest | patch' 15 | and then run this command again. 16 | EOS 17 | print "#"*68, "\n\n" 18 | puts manifest 19 | else 20 | %x[rake debug_gem > #{GEM_NAME}.gemspec] 21 | puts "Successfully created gemspec for #{GEM_NAME}!" 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/permalink.rb: -------------------------------------------------------------------------------- 1 | require 'iconv' 2 | 3 | module DataMapper 4 | module Types 5 | class Permalink < DataMapper::Type 6 | primitive String 7 | size 65535 8 | 9 | def self.load(value, property) 10 | if value.nil? 11 | nil 12 | elsif value.is_a?(String) 13 | Iconv.new('UTF-8//TRANSLIT//IGNORE', 'UTF-8').iconv(value.gsub(/[^\w\s\-\—]/,'').gsub(/[^\w]|[\_]/,' ').split.join('-').downcase) 14 | else 15 | raise ArgumentError.new("+value+ must be nil or a String") 16 | end 17 | end 18 | 19 | def self.dump(value, property) 20 | return nil if value.nil? 21 | value.to_s 22 | end 23 | 24 | end # class Permalink 25 | end # module Types 26 | end # module DataMapper -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/config/initializers/new_rails_defaults.rb: -------------------------------------------------------------------------------- 1 | # These settings change the behavior of Rails 2 apps and will be defaults 2 | # for Rails 3. You can remove this initializer when Rails 3 is released. 3 | 4 | # Include Active Record class name as root for JSON serialized output. 5 | ActiveRecord::Base.include_root_in_json = true 6 | 7 | # Store the full class name (including module namespace) in STI type column. 8 | ActiveRecord::Base.store_full_sti_class = true 9 | 10 | # Use ISO 8601 format for JSON serialized times and dates. 11 | ActiveSupport.use_standard_json_time_format = true 12 | 13 | # Don't escape HTML entities in JSON, leave that for the #json_escape helper. 14 | # if you're including raw json in an HTML page. 15 | ActiveSupport.escape_html_entities_in_json = false 16 | -------------------------------------------------------------------------------- /dm-querizer/README.txt: -------------------------------------------------------------------------------- 1 | = dm-querizer 2 | 3 | DataMapper plugin that provides a short rubyish query-syntax. 4 | 5 | When this plugin is loaded you can supply blocks to #all and #first. Ordinary hashes 6 | still work, so you do not lose any functionality. 7 | 8 | Old: User.all( :name => 'john', :age.gt => 20 ) 9 | New: User.all{ name == 'john' && age > 20 } 10 | 11 | Old: User.all( :age.gte => 35, :name.like => 'mark%' ) 12 | New: User.all{ age >= 35 && name =~ 'mark%' } 13 | 14 | You can also use ';' instead of '&&' for even shorter queries. 15 | 16 | User.all{ name == 'john' && age > 20 } 17 | User.all{ name == 'john'; age > 20 } 18 | 19 | The plugin is still very much experimental. != is not working (and might never work). 20 | Instead you can use '~'; 21 | 22 | Old: User.all( :name.not => 'mark' ) 23 | New: User.all{ name ~ 'mark' } 24 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/app/controllers/application.rb: -------------------------------------------------------------------------------- 1 | # Filters added to this controller apply to all controllers in the application. 2 | # Likewise, all the methods added will be available for all controllers. 3 | 4 | class ApplicationController < ActionController::Base 5 | helper :all # include all helpers, all the time 6 | 7 | # See ActionController::RequestForgeryProtection for details 8 | # Uncomment the :secret if you're not using the cookie session store 9 | protect_from_forgery # :secret => 'fb23937b455a775732b021a8db838ba7' 10 | 11 | # See ActionController::Base for details 12 | # Uncomment this to filter the contents of submitted sensitive data parameters 13 | # from your application log (in this case, all fields with names like "password"). 14 | # filter_parameter_logging :password 15 | end 16 | -------------------------------------------------------------------------------- /dm-types/spec/unit/regexp_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' 3 | 4 | describe DataMapper::Types::Regexp, ".load" do 5 | it 'should make a Regexp from the value if a string is provided' do 6 | Regexp.should_receive(:new).with('regexp_string').once 7 | DataMapper::Types::Regexp.load('regexp_string', :property) 8 | end 9 | 10 | it 'should return nil otherwise' do 11 | DataMapper::Types::Regexp.load(nil, :property).should == nil 12 | end 13 | end 14 | 15 | describe DataMapper::Types::Regexp, ".dump" do 16 | it 'should dump to a string' do 17 | DataMapper::Types::Regexp.dump(/\d+/, :property).should == "\\d+" 18 | end 19 | 20 | it 'should return nil if the value is nil' do 21 | DataMapper::Types::Regexp.dump(nil, :property).should == nil 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /dm-migrations/spec/unit/sql/table_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname + '../../spec_helper' 3 | 4 | require Pathname(__FILE__).dirname + '../../../lib/sql/table' 5 | 6 | describe SQL::Table do 7 | before do 8 | @table = SQL::Table.new 9 | end 10 | 11 | %w{name columns}.each do |meth| 12 | it "should have a ##{meth} attribute" do 13 | @table.should respond_to(meth.intern) 14 | end 15 | end 16 | 17 | it 'should #to_s as the name' do 18 | @table.name = "table_name" 19 | @table.to_s.should == "table_name" 20 | end 21 | 22 | it 'should find a column by name' do 23 | column_a = mock('column', :name => 'id') 24 | column_b = mock('column', :name => 'login') 25 | @table.columns = [column_a, column_b] 26 | 27 | @table.column('id').should == column_a 28 | end 29 | 30 | 31 | end 32 | -------------------------------------------------------------------------------- /dm-constraints/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | 6 | gem 'dm-core', '>=0.9.5' 7 | require 'dm-core' 8 | 9 | def load_driver(name, default_uri) 10 | 11 | lib = "do_#{name}" 12 | begin 13 | gem lib, '>=0.9.5' 14 | require lib 15 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 16 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 17 | name 18 | rescue Gem::LoadError => e 19 | warn "Could not load #{lib}: #{e}" 20 | false 21 | end 22 | end 23 | 24 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 25 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 26 | 27 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-constraints' 28 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/unit/data/event_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent.parent + 'spec_helper' 3 | 4 | module EventHelper 5 | def new_event(*args) 6 | DataMapper::Is::StateMachine::Data::Event.new(*args) 7 | end 8 | end 9 | 10 | describe DataMapper::Is::StateMachine::Data::Event do 11 | include EventHelper 12 | 13 | before(:each) do 14 | @machine = mock("machine") 15 | @event = new_event(:ping, @machine) 16 | end 17 | 18 | it "#initialize should work" do 19 | @event.name.should == :ping 20 | @event.machine.should == @machine 21 | @event.transitions.should == [] 22 | end 23 | 24 | it "#add_transition should work" do 25 | @event.add_transition(:nothing, :pinged) 26 | @event.transitions.should == [{:from => :nothing, :to => :pinged }] 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/db/migrate/20080629143033_create_fake_books_and_shelves.rb: -------------------------------------------------------------------------------- 1 | class CreateFakeBooksAndShelves < ActiveRecord::Migration 2 | def self.up 3 | books = [] 4 | books << Book.new(:title => "The Pragmatic Programmer", :author => "Dave Thomas") 5 | books << Book.new(:title => "Agile Web Development With Rails", :author => "Dave Thomas") 6 | shelf = Shelf.new(:name => "Ruby Geekery") 7 | books.each { |book| shelf.books << book } 8 | shelf.save! 9 | 10 | books.clear 11 | books << Book.new(:title => "Kama Sutra", :author => "Who fucking knows") 12 | books << Book.new(:title => "Sex for Dummies", :author => "Some guy") 13 | shelf = Shelf.new(:name => "What geeks SHOULD be reading") 14 | books.each { |book| shelf.books << book } 15 | shelf.save! 16 | end 17 | 18 | def self.down 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | # Settings specified here will take precedence over those in config/environment.rb 2 | 3 | # In the development environment your application's code is reloaded on 4 | # every request. This slows down response time but is perfect for development 5 | # since you don't have to restart the webserver when you make code changes. 6 | config.cache_classes = false 7 | 8 | # Log error messages when you accidentally call methods on nil. 9 | config.whiny_nils = true 10 | 11 | # Show full error reports and disable caching 12 | config.action_controller.consider_all_requests_local = true 13 | config.action_view.debug_rjs = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send 17 | config.action_mailer.raise_delivery_errors = false 18 | -------------------------------------------------------------------------------- /merb_datamapper/lib/generators/templates/views/index.html.erb: -------------------------------------------------------------------------------- 1 |

<%= class_name %> controller, index action

2 | 3 |

Edit this file in app/views/<%= file_name %>/index.html.erb

4 | 5 | 6 | 7 | <% for property in properties.reject{|p| p.lazy?} -%> 8 | 9 | <% end -%> 10 | 11 | 12 | <%% for <%= singular_model %> in @<%= plural_model %> %> 13 | 14 | <% for property in properties.reject{|p| p.lazy?} -%> 15 | 16 | <% end -%> 17 | 18 | 19 | 20 | <%% end %> 21 |
<%= Extlib::Inflection.humanize(property.field) %>
<%%=h <%= singular_model %>.<%= property.getter %> %><%%= link_to 'Show', url(:<%= singular_model %>, <%= singular_model %>) %><%%= link_to 'Edit', url(:edit_<%= singular_model %>, <%= singular_model %>) %>
22 | 23 | <%%= link_to 'New', url(:new_<%= singular_model %>) %> 24 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/ip_address.rb: -------------------------------------------------------------------------------- 1 | require 'ipaddr' 2 | 3 | module DataMapper 4 | module Types 5 | class IPAddress < DataMapper::Type 6 | primitive String 7 | 8 | def self.load(value, property) 9 | if value.nil? 10 | nil 11 | elsif value.is_a?(String) && !value.empty? 12 | IPAddr.new(value) 13 | elsif value.is_a?(String) && value.empty? 14 | IPAddr.new("0.0.0.0") 15 | else 16 | raise ArgumentError.new("+value+ must be nil or a String") 17 | end 18 | end 19 | 20 | def self.dump(value, property) 21 | return nil if value.nil? 22 | value.to_s 23 | end 24 | 25 | def self.typecast(value, property) 26 | value.kind_of?(IPAddr) ? value : load(value, property) 27 | end 28 | end # class IPAddress 29 | end # module Types 30 | end # module DataMapper 31 | -------------------------------------------------------------------------------- /merb_datamapper/spec/generators/data_mapper_resource_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require File.join(File.dirname(__FILE__), 'spec_helper') 2 | describe "Merb::Generators::ResourceControllerGenerator for DataMapper" do 3 | it "complains if no name is specified" do 4 | lambda { 5 | @generator = Merb::Generators::ResourceControllerGenerator.new('/tmp', {:orm => :datamapper }) 6 | }.should raise_error(::Templater::TooFewArgumentsError) 7 | end 8 | 9 | 10 | before do 11 | @generator = Merb::Generators::ResourceControllerGenerator.new('/tmp', { :orm => :datamapper }, 'Stuff') 12 | end 13 | 14 | it_should_behave_like "namespaced generator" 15 | 16 | it "should create a model" do 17 | @generator.should create('/tmp/app/controllers/stuff.rb') 18 | end 19 | 20 | it "should render successfully" do 21 | lambda { @generator.render! }.should_not raise_error 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /dm-aggregates/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'pathname' 3 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-aggregates' 4 | 5 | def load_driver(name, default_uri) 6 | return false if ENV['ADAPTER'] != name.to_s 7 | 8 | lib = "do_#{name}" 9 | 10 | begin 11 | gem lib, '>=0.9.5' 12 | require lib 13 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 14 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 15 | true 16 | rescue Gem::LoadError => e 17 | warn "Could not load #{lib}: #{e}" 18 | false 19 | end 20 | end 21 | 22 | ENV['ADAPTER'] ||= 'sqlite3' 23 | 24 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 25 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 26 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 27 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/unit/state_machine_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | describe "StateMachine" do 5 | 6 | describe "is_state_machine" do 7 | 8 | before(:each) do 9 | class Earth 10 | extend DataMapper::Is::StateMachine 11 | 12 | stub!(:properties).and_return([]) 13 | stub!(:property) 14 | stub!(:before) 15 | 16 | stub!(:state_machine_context?).and_return(true) 17 | stub!(:push_state_machine_context) 18 | stub!(:pop_state_machine_context) 19 | end 20 | end 21 | 22 | it "declaration should succeed" do 23 | class Earth 24 | is_state_machine 25 | end 26 | end 27 | 28 | end 29 | end 30 | 31 | # is_state_machine 32 | # push_state_machine_context(label) 33 | # pop_state_machine_context 34 | # state_machine_context?(label) 35 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/bcrypt_hash.rb: -------------------------------------------------------------------------------- 1 | 2 | require 'bcrypt' 3 | 4 | module DataMapper 5 | module Types 6 | class BCryptHash < DataMapper::Type 7 | primitive String 8 | size 60 9 | 10 | def self.load(value, property) 11 | if value.nil? 12 | nil 13 | elsif value.is_a?(String) 14 | BCrypt::Password.new(value) 15 | else 16 | raise ArgumentError.new("+value+ must be nil or a String") 17 | end 18 | end 19 | 20 | def self.dump(value, property) 21 | if value.nil? 22 | nil 23 | elsif value.is_a?(String) 24 | BCrypt::Password.create(value, :cost => BCrypt::Engine::DEFAULT_COST) 25 | else 26 | raise ArgumentError.new("+value+ must be nil or a String") 27 | end 28 | end 29 | end # class BCryptHash 30 | end # module Types 31 | end # module DataMapper 32 | -------------------------------------------------------------------------------- /dm-types/spec/integration/permalink_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require 'iconv' 3 | require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' 4 | 5 | describe DataMapper::Types::Permalink do 6 | 7 | before(:all) do 8 | class PermalinkTest 9 | include DataMapper::Resource 10 | 11 | property :id, Serial 12 | property :name, Permalink 13 | 14 | end 15 | PermalinkTest.auto_migrate! 16 | end 17 | 18 | it "should create the permalink" do 19 | repository(:default) do 20 | PermalinkTest.create(:name => 'New DataMapper Type') 21 | end 22 | 23 | PermalinkTest.first.name.should == create_permalink("New DataMapper Type") 24 | end 25 | 26 | 27 | def create_permalink(word) 28 | Iconv.new('UTF-8//TRANSLIT//IGNORE', 'UTF-8').iconv(word.gsub(/[^\w\s\-\—]/,'').gsub(/[^\w]|[\_]/,' ').split.join('-').downcase) 29 | end 30 | 31 | end -------------------------------------------------------------------------------- /dm-types/lib/dm-types.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'pathname' 3 | 4 | gem 'dm-core', '=0.9.6' 5 | require 'dm-core' 6 | 7 | dir = Pathname(__FILE__).dirname.expand_path / 'dm-types' 8 | 9 | require dir / 'csv' 10 | require dir / 'enum' 11 | require dir / 'epoch_time' 12 | require dir / 'file_path' 13 | require dir / 'flag' 14 | require dir / 'ip_address' 15 | require dir / "json""" 16 | require dir / 'uri' 17 | require dir / 'uuid' 18 | require dir / 'yaml' 19 | require dir / 'serial' 20 | require dir / 'regexp' 21 | require dir / 'permalink' 22 | 23 | # this looks a little ugly, but everyone who uses dm-types shouldn't have to have ruby-bcrypt installed 24 | module DataMapper 25 | module Types 26 | autoload(:BCryptHash, File.join(Pathname(__FILE__).dirname.expand_path, 'dm-types', 'bcrypt_hash')) 27 | end 28 | end 29 | 30 | DataMapper::Adapters::PostgresAdapter.type_map.map(::DataMapper::Types::UUID).to('UUID') 31 | -------------------------------------------------------------------------------- /dm-types/spec/integration/uri_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' 3 | 4 | describe DataMapper::Types::URI do 5 | before(:all) do 6 | class URITest 7 | include DataMapper::Resource 8 | 9 | property :id, Integer, :serial => true 10 | property :uri, DM::URI 11 | end 12 | URITest.auto_migrate! 13 | end 14 | 15 | it "should work" do 16 | repository(:default) do 17 | URITest.create!(:uri => 'http://localhost') 18 | end 19 | 20 | URITest.first.uri.should == Addressable::URI.parse('http://localhost') 21 | end 22 | 23 | it 'should immediately typecast supplied values' do 24 | URITest.new(:uri => 'http://localhost').uri.should == Addressable::URI.parse('http://localhost') 25 | end 26 | 27 | it "should correctly typecast nil values" do 28 | URITest.new(:uri => nil).uri.should == nil 29 | end 30 | 31 | end 32 | -------------------------------------------------------------------------------- /dm-validations/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'spec' 3 | require 'pathname' 4 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-validations' 5 | 6 | def load_driver(name, default_uri) 7 | return false if ENV['ADAPTER'] != name.to_s 8 | 9 | lib = "do_#{name}" 10 | 11 | begin 12 | gem lib, '>=0.9.5' 13 | require lib 14 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 15 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 16 | true 17 | rescue Gem::LoadError => e 18 | warn "Could not load #{lib}: #{e}" 19 | false 20 | end 21 | end 22 | 23 | ENV['ADAPTER'] ||= 'sqlite3' 24 | 25 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 26 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 27 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 28 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/rating.rb: -------------------------------------------------------------------------------- 1 | module My 2 | module Nested 3 | module Remixable 4 | 5 | module Rating 6 | 7 | def self.included(base) 8 | base.extend ClassMethods 9 | end 10 | 11 | include DataMapper::Resource 12 | 13 | is :remixable 14 | 15 | # properties 16 | 17 | property :id, Integer, :serial => true 18 | 19 | property :user_id, Integer, :nullable => false 20 | property :rating, Integer, :nullable => false, :default => 0 21 | 22 | module ClassMethods 23 | 24 | # total rating for all rateable instances of this type 25 | def total_rating 26 | rating_sum = self.sum(:rating).to_f 27 | rating_count = self.count.to_f 28 | rating_count > 0 ? rating_sum / rating_count : 0 29 | end 30 | 31 | end 32 | 33 | end 34 | 35 | end 36 | end 37 | end -------------------------------------------------------------------------------- /dm-shorthand/README.txt: -------------------------------------------------------------------------------- 1 | = dm-shorthand 2 | 3 | DataMapper plugin providing shortcut usage of models in multiple repositories. 4 | 5 | When using this plugin, every time you define a new model M, a method with the same 6 | name as the model is defined inside the module where you defined M. 7 | 8 | == Example 9 | 10 | Let's say you have repositories :default, :one and :two. 11 | 12 | class MyModel 13 | include DataMapper::Resource 14 | 15 | property :a, String 16 | property :b, String 17 | end 18 | 19 | This will allow you to operate on those repositories like this: 20 | 21 | # create a new instance of MyModel in repository :one 22 | MyModel(:one).create(:a => "a's value!", :b => "b's value!") 23 | 24 | # fetch the MyModel instance with id == 1 from repository :two 25 | MyModel(:two)[1] 26 | 27 | # instantiate a new MyModel instance with its default repository 28 | # set to :default 29 | m = MyModel.new 30 | -------------------------------------------------------------------------------- /dm-is-list/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-is-list' 6 | 7 | def load_driver(name, default_uri) 8 | return false if ENV['ADAPTER'] != name.to_s 9 | 10 | lib = "do_#{name}" 11 | 12 | begin 13 | gem lib, '>=0.9.5' 14 | require lib 15 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 16 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 17 | true 18 | rescue Gem::LoadError => e 19 | warn "Could not load #{lib}: #{e}" 20 | false 21 | end 22 | end 23 | 24 | ENV['ADAPTER'] ||= 'sqlite3' 25 | 26 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 27 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 28 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 29 | -------------------------------------------------------------------------------- /dm-querizer/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-querizer' 6 | 7 | def load_driver(name, default_uri) 8 | return false if ENV['ADAPTER'] != name.to_s 9 | 10 | lib = "do_#{name}" 11 | 12 | begin 13 | gem lib, '>=0.9.5' 14 | require lib 15 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 16 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 17 | true 18 | rescue Gem::LoadError => e 19 | warn "Could not load #{lib}: #{e}" 20 | false 21 | end 22 | end 23 | 24 | ENV['ADAPTER'] ||= 'sqlite3' 25 | 26 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 27 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 28 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 29 | -------------------------------------------------------------------------------- /dm-is-example/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-is-example' 6 | 7 | def load_driver(name, default_uri) 8 | return false if ENV['ADAPTER'] != name.to_s 9 | 10 | lib = "do_#{name}" 11 | 12 | begin 13 | gem lib, '>=0.9.5' 14 | require lib 15 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 16 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 17 | true 18 | rescue Gem::LoadError => e 19 | warn "Could not load #{lib}: #{e}" 20 | false 21 | end 22 | end 23 | 24 | ENV['ADAPTER'] ||= 'sqlite3' 25 | 26 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 27 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 28 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 29 | -------------------------------------------------------------------------------- /dm-timestamps/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.parent.expand_path + 'lib/dm-timestamps' 6 | 7 | def load_driver(name, default_uri) 8 | return false if ENV['ADAPTER'] != name.to_s 9 | 10 | lib = "do_#{name}" 11 | 12 | begin 13 | gem lib, '>=0.9.5' 14 | require lib 15 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 16 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 17 | true 18 | rescue Gem::LoadError => e 19 | warn "Could not load #{lib}: #{e}" 20 | false 21 | end 22 | end 23 | 24 | ENV['ADAPTER'] ||= 'sqlite3' 25 | 26 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 27 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 28 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 29 | -------------------------------------------------------------------------------- /dm-is-searchable/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-is-searchable' 6 | 7 | def load_driver(name, default_uri) 8 | return false if ENV['ADAPTER'] != name.to_s 9 | 10 | lib = "do_#{name}" 11 | 12 | begin 13 | gem lib, '>=0.9.5' 14 | require lib 15 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 16 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 17 | true 18 | rescue Gem::LoadError => e 19 | warn "Could not load #{lib}: #{e}" 20 | false 21 | end 22 | end 23 | 24 | ENV['ADAPTER'] ||= 'sqlite3' 25 | 26 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 27 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 28 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 29 | -------------------------------------------------------------------------------- /dm-is-versioned/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-is-versioned' 6 | 7 | def load_driver(name, default_uri) 8 | return false if ENV['ADAPTER'] != name.to_s 9 | 10 | lib = "do_#{name}" 11 | 12 | begin 13 | gem lib, '>=0.9.5' 14 | require lib 15 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 16 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 17 | true 18 | rescue Gem::LoadError => e 19 | warn "Could not load #{lib}: #{e}" 20 | false 21 | end 22 | end 23 | 24 | ENV['ADAPTER'] ||= 'sqlite3' 25 | 26 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 27 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 28 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 29 | -------------------------------------------------------------------------------- /dm-is-state_machine/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-is-state_machine' 6 | 7 | def load_driver(name, default_uri) 8 | return false if ENV['ADAPTER'] != name.to_s 9 | 10 | lib = "do_#{name}" 11 | 12 | begin 13 | gem lib, '>=0.9.5' 14 | require lib 15 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 16 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 17 | true 18 | rescue Gem::LoadError => e 19 | warn "Could not load #{lib}: #{e}" 20 | false 21 | end 22 | end 23 | 24 | ENV['ADAPTER'] ||= 'sqlite3' 25 | 26 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 27 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 28 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 29 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/yaml.rb: -------------------------------------------------------------------------------- 1 | require 'yaml' 2 | 3 | module DataMapper 4 | module Types 5 | class Yaml < DataMapper::Type 6 | primitive String 7 | size 65535 8 | lazy true 9 | 10 | def self.load(value, property) 11 | if value.nil? 12 | nil 13 | elsif value.is_a?(String) 14 | ::YAML.load(value) 15 | else 16 | raise ArgumentError.new("+value+ must be nil or a String") 17 | end 18 | end 19 | 20 | def self.dump(value, property) 21 | if value.nil? 22 | nil 23 | elsif value.is_a?(String) && value =~ /^---/ 24 | value 25 | else 26 | ::YAML.dump(value) 27 | end 28 | end 29 | 30 | def self.typecast(value, property) 31 | # No typecasting; leave values exactly as they're provided. 32 | value 33 | end 34 | end # class Yaml 35 | end # module Types 36 | end # module DataMapper 37 | -------------------------------------------------------------------------------- /dm-constraints/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'spec' 3 | require 'spec/rake/spectask' 4 | require 'pathname' 5 | 6 | ROOT = Pathname(__FILE__).dirname.expand_path 7 | require ROOT + 'lib/dm-constraints/version' 8 | 9 | AUTHOR = "Dirkjan Bussink" 10 | EMAIL = "d.bussink@gmail.com" 11 | GEM_NAME = "dm-constraints" 12 | GEM_VERSION = DataMapper::Constraints::VERSION 13 | GEM_DEPENDENCIES = [["dm-core", GEM_VERSION]] 14 | GEM_CLEAN = ["log", "pkg", "coverage"] 15 | GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.txt LICENSE TODO ] } 16 | 17 | PROJECT_NAME = "datamapper" 18 | PROJECT_URL = "http://github.com/sam/dm-more/tree/master/dm-constraints" 19 | PROJECT_DESCRIPTION = PROJECT_SUMMARY = "DataMapper plugin for performing validations on data models" 20 | 21 | require ROOT + 'tasks/hoe' 22 | require ROOT + 'tasks/gemspec' 23 | require ROOT + 'tasks/install' 24 | require ROOT + 'tasks/dm' 25 | require ROOT + 'tasks/doc' 26 | require ROOT + 'tasks/ci' 27 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-is-remixable' 6 | require "ruby-debug" 7 | def load_driver(name, default_uri) 8 | return false if ENV['ADAPTER'] != name.to_s 9 | 10 | lib = "do_#{name}" 11 | 12 | begin 13 | gem lib, '>=0.9.5' 14 | require lib 15 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 16 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 17 | true 18 | rescue Gem::LoadError => e 19 | warn "Could not load #{lib}: #{e}" 20 | false 21 | end 22 | end 23 | 24 | ENV['ADAPTER'] ||= 'sqlite3' 25 | 26 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 27 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 28 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 29 | -------------------------------------------------------------------------------- /dm-types/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.parent.expand_path + 'lib/dm-types' 6 | 7 | ENV["SQLITE3_SPEC_URI"] ||= 'sqlite3::memory:' 8 | ENV["MYSQL_SPEC_URI"] ||= 'mysql://localhost/dm_core_test' 9 | ENV["POSTGRES_SPEC_URI"] ||= 'postgres://postgres@localhost/dm_more_test' 10 | 11 | # DataMapper::Logger.new(STDOUT, :debug) 12 | 13 | def setup_adapter(name, default_uri = nil) 14 | begin 15 | DataMapper.setup(name, ENV["#{ENV['ADAPTER'].to_s.upcase}_SPEC_URI"] || default_uri) 16 | Object.const_set('ADAPTER', ENV['ADAPTER'].to_sym) if name.to_s == ENV['ADAPTER'] 17 | true 18 | rescue Exception => e 19 | if name.to_s == ENV['ADAPTER'] 20 | Object.const_set('ADAPTER', nil) 21 | warn "Could not load #{name} adapter: #{e}" 22 | end 23 | false 24 | end 25 | end 26 | 27 | ENV['ADAPTER'] ||= 'sqlite3' 28 | 29 | setup_adapter(:default) 30 | -------------------------------------------------------------------------------- /merb_datamapper/lib/merb/orms/data_mapper/database.yml.sample: -------------------------------------------------------------------------------- 1 | --- 2 | # This is a sample database file for the DataMapper ORM 3 | development: &defaults 4 | # These are the settings for repository :default 5 | adapter: postgres 6 | database: sample_development 7 | username: the_user 8 | password: secrets 9 | host: localhost 10 | 11 | # Add more repositories 12 | # repositories: 13 | # repo1: 14 | # adapter: postgresql 15 | # database: sample_development 16 | # username: the_user 17 | # password: secrets 18 | # host: localhost 19 | # repo2: 20 | # ... 21 | 22 | test: 23 | <<: *defaults 24 | database: sample_test 25 | 26 | # repositories: 27 | # repo1: 28 | # database: sample_development 29 | 30 | production: 31 | <<: *defaults 32 | database: sample_production 33 | 34 | # repositories: 35 | # repo1: 36 | # database: sample_development 37 | 38 | rake: 39 | <<: *defaults 40 | -------------------------------------------------------------------------------- /dm-constraints/lib/dm-constraints/mysql_adapter.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Constraints 3 | module MysqlAdapter 4 | module SQL 5 | private 6 | 7 | def destroy_constraints_statement(table_name, constraint_name) 8 | <<-EOS.compress_lines 9 | ALTER TABLE #{quote_table_name(table_name)} 10 | DROP FOREIGN KEY #{quote_constraint_name(constraint_name)} 11 | EOS 12 | end 13 | 14 | def constraint_exists?(storage_name, constraint_name) 15 | statement = <<-EOS.compress_lines 16 | SELECT COUNT(*) 17 | FROM `information_schema`.`table_constraints` 18 | WHERE `constraint_type` = 'FOREIGN KEY' 19 | AND `table_schema` = ? 20 | AND `table_name` = ? 21 | AND `constraint_name` = ? 22 | EOS 23 | query(statement, db_name, storage_name, constraint_name).first > 0 24 | end 25 | end 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /dm-is-remixable/spec/data/user.rb: -------------------------------------------------------------------------------- 1 | require Pathname(__FILE__).dirname / "viewable" 2 | require Pathname(__FILE__).dirname / "billable" 3 | require Pathname(__FILE__).dirname / "addressable" 4 | require Pathname(__FILE__).dirname / "rating" 5 | 6 | class User 7 | include DataMapper::Resource 8 | 9 | property :id, Integer, 10 | :key => true, 11 | :serial => true 12 | 13 | property :first_name, String, 14 | :nullable => false, 15 | :length => 2..50 16 | 17 | property :last_name, String, 18 | :nullable => false, 19 | :length => 2..50 20 | 21 | remix n, :viewables 22 | 23 | remix n, :billables, :class_name => "Account" 24 | 25 | remix n, :addressables 26 | 27 | remix n, :commentables, :as => "comments", :for => "User", :via => "commentor" 28 | 29 | remix n, "My::Nested::Remixable::Rating" 30 | 31 | enhance :addressables do 32 | property :label, Enum.new('home','work') 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /dm-observer/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | gem "dm-core" 5 | require 'dm-core' 6 | require 'pathname' 7 | require Pathname(__FILE__).dirname.parent.expand_path + 'lib/dm-observer' 8 | 9 | def load_driver(name, default_uri) 10 | return false if ENV['ADAPTER'] != name.to_s 11 | 12 | lib = "do_#{name}" 13 | 14 | begin 15 | gem lib, '>=0.9.5' 16 | require lib 17 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 18 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 19 | true 20 | rescue Gem::LoadError => e 21 | warn "Could not load #{lib}: #{e}" 22 | false 23 | end 24 | end 25 | 26 | ENV['ADAPTER'] ||= 'sqlite3' 27 | 28 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 29 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 30 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 31 | -------------------------------------------------------------------------------- /dm-validations/spec/integration/contextual_validators_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | describe DataMapper::Validate::ContextualValidators do 5 | 6 | before :all do 7 | class Kayak 8 | include DataMapper::Resource 9 | property :id, Integer, :key => true 10 | property :salesman, String, :auto_validation => false 11 | validates_absent :salesman, :when => :sold 12 | end 13 | end 14 | 15 | it "should pass validation for a specific context" do 16 | k = Kayak.new 17 | k.valid?(:sold).should == true 18 | k.salesman = 'John Doe' 19 | k.valid?(:sold).should_not == true 20 | end 21 | 22 | it "should raise an exception if you provide an invalid context to save" do 23 | 24 | lambda { Kayak.new.save(:invalid_context) }.should raise_error 25 | lambda { Kayak.new.save(nil) }.should raise_error 26 | lambda { Kayak.new.save(false) }.should raise_error 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /dm-adjust/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'pathname' 3 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-adjust' 4 | 5 | def load_driver(name, default_uri) 6 | return false if ENV['ADAPTER'] != name.to_s 7 | 8 | lib = "do_#{name}" 9 | 10 | begin 11 | gem lib, '>=0.9.5' 12 | require lib 13 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 14 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 15 | # DataObjects::Sqlite3.logger = DataObjects::Logger.new(Pathname(__FILE__).dirname+'dm.log',0) 16 | true 17 | rescue Gem::LoadError => e 18 | warn "Could not load #{lib}: #{e}" 19 | false 20 | end 21 | end 22 | 23 | ENV['ADAPTER'] ||= 'sqlite3' 24 | 25 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 26 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 27 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 28 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/public/dispatch.fcgi: -------------------------------------------------------------------------------- 1 | #!c:/ruby/bin/ruby 2 | # 3 | # You may specify the path to the FastCGI crash log (a log of unhandled 4 | # exceptions which forced the FastCGI instance to exit, great for debugging) 5 | # and the number of requests to process before running garbage collection. 6 | # 7 | # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log 8 | # and the GC period is nil (turned off). A reasonable number of requests 9 | # could range from 10-100 depending on the memory footprint of your app. 10 | # 11 | # Example: 12 | # # Default log path, normal GC behavior. 13 | # RailsFCGIHandler.process! 14 | # 15 | # # Default log path, 50 requests between GC. 16 | # RailsFCGIHandler.process! nil, 50 17 | # 18 | # # Custom log path, normal GC behavior. 19 | # RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log' 20 | # 21 | require File.dirname(__FILE__) + "/../config/environment" 22 | require 'fcgi_handler' 23 | 24 | RailsFCGIHandler.process! 25 | -------------------------------------------------------------------------------- /dm-types/spec/integration/yaml_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' 3 | 4 | describe DataMapper::Types::Enum do 5 | before(:all) do 6 | class YamlTest 7 | include DataMapper::Resource 8 | 9 | property :id, Serial 10 | property :yaml, Yaml 11 | end 12 | YamlTest.auto_migrate! 13 | 14 | class SerializeMe 15 | attr_accessor :name 16 | end 17 | end 18 | 19 | it "should work" do 20 | obj = SerializeMe.new 21 | obj.name = 'Hello!' 22 | 23 | repository(:default) do 24 | YamlTest.create(:yaml => [1, 2, 3]) 25 | YamlTest.create(:yaml => obj) 26 | end 27 | 28 | tests = YamlTest.all 29 | tests.first.yaml.should == [1, 2, 3] 30 | tests.last.yaml.should be_kind_of(SerializeMe) 31 | tests.last.yaml.name.should == 'Hello!' 32 | end 33 | 34 | it 'should immediately typecast supplied values' do 35 | YamlTest.new(:yaml => [1, 2, 3]).yaml.should == [1, 2, 3] 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /dm-migrations/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.parent.expand_path + 'lib/dm-migrations' 6 | require Pathname(__FILE__).dirname.parent.expand_path + 'lib/migration_runner' 7 | 8 | def load_driver(name, default_uri) 9 | #return false if ENV['ADAPTER'] != name.to_s 10 | 11 | lib = "do_#{name}" 12 | 13 | begin 14 | gem lib, '>=0.9.5' 15 | require lib 16 | DataMapper.setup(name, default_uri) 17 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 18 | puts "Loaded #{name}" 19 | true 20 | rescue Gem::LoadError => e 21 | warn "Could not load #{lib}: #{e}" 22 | false 23 | end 24 | end 25 | 26 | ENV['ADAPTER'] ||= 'sqlite3' 27 | 28 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 29 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 30 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 31 | -------------------------------------------------------------------------------- /dm-validations/spec/integration/primitive_validator_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' 3 | 4 | class Monica # :nodoc: 5 | include DataMapper::Resource 6 | property :id, Integer, :serial => true 7 | property :birth_date, Date, :auto_validation => false 8 | property :happy, TrueClass 9 | validates_is_primitive :birth_date 10 | end 11 | 12 | describe DataMapper::Validate::PrimitiveValidator do 13 | it "should validate a property to check for the type" do 14 | b = Monica.new 15 | p b.valid? 16 | p b.errors 17 | b.should be_valid 18 | 19 | b.birth_date = 'ABC' 20 | b.should_not be_valid 21 | b.birth_date.should eql('ABC') 22 | b.birth_date = '2008-01-01' 23 | b.should be_valid 24 | b.birth_date.should eql(Date.civil(2008,1,1)) 25 | end 26 | it "should accept FalseClass even when the property type is TrueClass" do 27 | b = Monica.new 28 | b.happy = false 29 | b.valid?.should == true 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /dm-is-example/lib/dm-is-example/is/example.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Is 3 | module Example 4 | 5 | ## 6 | # fired when your plugin gets included into Resource 7 | # 8 | def self.included(base) 9 | 10 | end 11 | 12 | ## 13 | # Methods that should be included in DataMapper::Model. 14 | # Normally this should just be your generator, so that the namespace 15 | # does not get cluttered. ClassMethods and InstanceMethods gets added 16 | # in the specific resources when you fire is :example 17 | ## 18 | 19 | def is_example(options) 20 | 21 | # Add class-methods 22 | extend DataMapper::Is::Example::ClassMethods 23 | # Add instance-methods 24 | include DataMapper::Is::Example::InstanceMethods 25 | 26 | end 27 | 28 | module ClassMethods 29 | 30 | end # ClassMethods 31 | 32 | module InstanceMethods 33 | 34 | end # InstanceMethods 35 | 36 | end # Example 37 | end # Is 38 | end # DataMapper 39 | -------------------------------------------------------------------------------- /dm-sweatshop/lib/dm-sweatshop/model.rb: -------------------------------------------------------------------------------- 1 | module DataMapper 2 | module Model 3 | def fixture(name = default_fauxture_name, &blk) 4 | Sweatshop.add(self, name, &blk) 5 | end 6 | 7 | alias_method :fix, :fixture 8 | 9 | def generate(name = default_fauxture_name, attributes = {}) 10 | name, attributes = default_fauxture_name, name if name.is_a? Hash 11 | Sweatshop.create(self, name, attributes) 12 | end 13 | 14 | alias_method :gen, :generate 15 | 16 | def generate_attributes(name = default_fauxture_name) 17 | Sweatshop.attributes(self, name) 18 | end 19 | 20 | alias_method :gen_attrs, :generate_attributes 21 | 22 | def make(name = default_fauxture_name, attributes = {}) 23 | name, attributes = default_fauxture_name, name if name.is_a? Hash 24 | Sweatshop.make(self, name, attributes) 25 | end 26 | 27 | def pick(name = default_fauxture_name) 28 | Sweatshop.pick(self, name) 29 | end 30 | 31 | def default_fauxture_name 32 | :default 33 | end 34 | end 35 | end -------------------------------------------------------------------------------- /dm-is-nested_set/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec', '>=1.1.3' 3 | require 'spec' 4 | require 'pathname' 5 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-is-nested_set' 6 | 7 | def load_driver(name, default_uri) 8 | return false if ENV['ADAPTER'] != name.to_s 9 | 10 | lib = "do_#{name}" 11 | 12 | begin 13 | gem lib, '>=0.9.5' 14 | require lib 15 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 16 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 17 | DataObjects::Sqlite3.logger = DataObjects::Logger.new(Pathname(__FILE__).dirname+'dm.log',0) 18 | true 19 | rescue Gem::LoadError => e 20 | warn "Could not load #{lib}: #{e}" 21 | false 22 | end 23 | end 24 | 25 | ENV['ADAPTER'] ||= 'sqlite3' 26 | 27 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 28 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 29 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 30 | -------------------------------------------------------------------------------- /dm-timestamps/lib/dm-timestamps.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | gem 'dm-core', '=0.9.6' 4 | require 'dm-core' 5 | 6 | module DataMapper 7 | module Timestamp 8 | TIMESTAMP_PROPERTIES = { 9 | :updated_at => lambda { |r| r.updated_at = DateTime.now }, 10 | :updated_on => lambda { |r| r.updated_on = Date.today }, 11 | :created_at => lambda { |r| r.created_at = DateTime.now if r.new_record? && r.created_at.nil? }, 12 | :created_on => lambda { |r| r.created_on = Date.today if r.new_record? && r.created_on.nil?}, 13 | } 14 | 15 | def self.included(model) 16 | model.before :save, :set_timestamp_properties 17 | end 18 | 19 | private 20 | 21 | def set_timestamp_properties 22 | if dirty? 23 | self.class.properties.slice(*TIMESTAMP_PROPERTIES.keys).compact.each do |property| 24 | TIMESTAMP_PROPERTIES[property.name][self] unless attribute_dirty?(property.name) 25 | end 26 | end 27 | end 28 | end # module Timestamp 29 | 30 | Resource::append_inclusions Timestamp 31 | end 32 | -------------------------------------------------------------------------------- /tasks/hoe.rb: -------------------------------------------------------------------------------- 1 | require 'hoe' 2 | 3 | @config_file = "~/.rubyforge/user-config.yml" 4 | @config = nil 5 | RUBYFORGE_USERNAME = "unknown" 6 | def rubyforge_username 7 | unless @config 8 | begin 9 | @config = YAML.load(File.read(File.expand_path(@config_file))) 10 | rescue 11 | puts <<-EOS 12 | ERROR: No rubyforge config file found: #{@config_file} 13 | Run 'rubyforge setup' to prepare your env for access to Rubyforge 14 | - See http://newgem.rubyforge.org/rubyforge.html for more details 15 | EOS 16 | exit 17 | end 18 | end 19 | RUBYFORGE_USERNAME.replace @config["username"] 20 | end 21 | 22 | hoe = Hoe.new(GEM_NAME, GEM_VERSION) do |p| 23 | 24 | p.developer(AUTHOR, EMAIL) 25 | 26 | p.description = PROJECT_DESCRIPTION 27 | p.summary = PROJECT_SUMMARY 28 | p.url = PROJECT_URL 29 | 30 | p.rubyforge_name = PROJECT_NAME if PROJECT_NAME 31 | 32 | p.clean_globs |= GEM_CLEAN 33 | p.spec_extras = GEM_EXTRAS if GEM_EXTRAS 34 | 35 | GEM_DEPENDENCIES.each do |dep| 36 | p.extra_deps << dep 37 | end 38 | 39 | end 40 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | # Settings specified here will take precedence over those in config/environment.rb 2 | 3 | # The production environment is meant for finished, "live" apps. 4 | # Code is not reloaded between requests 5 | config.cache_classes = true 6 | 7 | # Use a different logger for distributed setups 8 | # config.logger = SyslogLogger.new 9 | 10 | # Full error reports are disabled and caching is turned on 11 | config.action_controller.consider_all_requests_local = false 12 | config.action_controller.perform_caching = true 13 | config.action_view.cache_template_loading = true 14 | 15 | # Use a different cache store in production 16 | # config.cache_store = :mem_cache_store 17 | 18 | # Enable serving of images, stylesheets, and javascripts from an asset server 19 | # config.action_controller.asset_host = "http://assets.example.com" 20 | 21 | # Disable delivery errors, bad email addresses will be ignored 22 | # config.action_mailer.raise_delivery_errors = false 23 | -------------------------------------------------------------------------------- /dm-constraints/lib/dm-constraints.rb: -------------------------------------------------------------------------------- 1 | # Needed to import datamapper and other gems 2 | require 'rubygems' 3 | require 'pathname' 4 | 5 | # Add all external dependencies for the plugin here 6 | gem 'dm-core', '=0.9.6' 7 | require 'dm-core' 8 | 9 | # Require plugin-files 10 | require Pathname(__FILE__).dirname.expand_path / 'dm-constraints' / 'data_objects_adapter' 11 | require Pathname(__FILE__).dirname.expand_path / 'dm-constraints' / 'postgres_adapter' 12 | require Pathname(__FILE__).dirname.expand_path / 'dm-constraints' / 'mysql_adapter' 13 | 14 | module DataMapper 15 | class AutoMigrator 16 | include Extlib::Hook 17 | include DataMapper::Constraints::DataObjectsAdapter::Migration 18 | end 19 | 20 | module Adapters 21 | class DataObjectsAdapter 22 | include DataMapper::Constraints::DataObjectsAdapter::SQL 23 | end 24 | 25 | class MysqlAdapter 26 | include DataMapper::Constraints::MysqlAdapter::SQL 27 | end 28 | 29 | class PostgresAdapter 30 | include DataMapper::Constraints::PostgresAdapter::SQL 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /adapters/dm-couchdb-adapter/spec/couchdb_view_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.parent.expand_path + 'lib/couchdb_adapter' 3 | 4 | DataMapper.setup( 5 | :couchdb, 6 | Addressable::URI.parse("couchdb://localhost:5984/test_cdb_adapter") 7 | ) 8 | 9 | class Zoo 10 | include DataMapper::Resource 11 | 12 | def self.default_repository_name 13 | :couchdb 14 | end 15 | 16 | property :id, Integer, :serial => true 17 | property :name, String 18 | property :open, TrueClass 19 | end 20 | 21 | describe DataMapper::View do 22 | it "should have a view method" do 23 | Zoo.should respond_to(:view) 24 | end 25 | 26 | it "should store a view when called" do 27 | Zoo.view :by_name 28 | Zoo.views.keys.should include(:by_name) 29 | end 30 | 31 | it "should initialize a new Procedure instance" do 32 | proc = Zoo.view :by_name_desc 33 | proc.should be_an_instance_of(DataMapper::View) 34 | end 35 | 36 | it "should create a getter method" do 37 | Zoo.view :open 38 | Zoo.should respond_to(:open) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /dm-is-state_machine/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | lib/dm-is-state_machine.rb 8 | lib/dm-is-state_machine/is/data/event.rb 9 | lib/dm-is-state_machine/is/data/machine.rb 10 | lib/dm-is-state_machine/is/data/state.rb 11 | lib/dm-is-state_machine/is/dsl/event_dsl.rb 12 | lib/dm-is-state_machine/is/dsl/state_dsl.rb 13 | lib/dm-is-state_machine/is/state_machine.rb 14 | lib/dm-is-state_machine/is/version.rb 15 | spec/examples/invalid_events.rb 16 | spec/examples/invalid_states.rb 17 | spec/examples/invalid_transitions_1.rb 18 | spec/examples/invalid_transitions_2.rb 19 | spec/examples/traffic_light.rb 20 | spec/integration/invalid_events_spec.rb 21 | spec/integration/invalid_states_spec.rb 22 | spec/integration/invalid_transitions_spec.rb 23 | spec/integration/traffic_light_spec.rb 24 | spec/spec.opts 25 | spec/spec_helper.rb 26 | spec/unit/data/event_spec.rb 27 | spec/unit/data/machine_spec.rb 28 | spec/unit/data/state_spec.rb 29 | spec/unit/dsl/event_dsl_spec.rb 30 | spec/unit/dsl/state_dsl_spec.rb 31 | spec/unit/state_machine_spec.rb 32 | -------------------------------------------------------------------------------- /dm-types/lib/dm-types/json.rb: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | module DataMapper 4 | module Types 5 | class Json < DataMapper::Type 6 | primitive String 7 | size 65535 8 | lazy true 9 | 10 | def self.load(value, property) 11 | if value.nil? 12 | nil 13 | elsif value.is_a?(String) 14 | ::JSON.load(value) 15 | else 16 | raise ArgumentError.new("+value+ must be nil or a String") 17 | end 18 | end 19 | 20 | def self.dump(value, property) 21 | if value.nil? 22 | nil 23 | elsif value.is_a?(String) 24 | value 25 | else 26 | ::JSON.dump(value) 27 | end 28 | end 29 | 30 | def self.typecast(value, property) 31 | # Arrays and hashes are left alone, while strings are parsed as JSON. 32 | if value.kind_of?(Array) || value.kind_of?(Hash) 33 | value 34 | else 35 | ::JSON.load(value.to_s) 36 | end 37 | end 38 | end # class Json 39 | end # module Types 40 | end # module DataMapper 41 | -------------------------------------------------------------------------------- /rails_datamapper/generators/dm_model/dm_model_generator.rb: -------------------------------------------------------------------------------- 1 | require 'rails_generator/generators/components/model/model_generator' 2 | 3 | class DmModelGenerator { 20 | :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}" 21 | }, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}" 22 | end 23 | end 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /dm-types/spec/integration/flag_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' 3 | 4 | describe DataMapper::Types::Flag do 5 | before(:all) do 6 | class Shirt 7 | include DataMapper::Resource 8 | property :id, Serial 9 | property :sizes, DM::Flag[:xs, :small, :medium, :large, :xl, :xxl] 10 | end 11 | Shirt.auto_migrate! 12 | end 13 | 14 | it "should save with create({:flag_field => [:flags]})" do 15 | lambda { Shirt.create(:sizes => [:medium, :large]) }.should_not raise_error 16 | repository do 17 | Shirt.get(1).sizes.should == [:medium, :large] 18 | end 19 | end 20 | 21 | it "should save with flag_field=[:flags]" do 22 | shirt = Shirt.new 23 | shirt.sizes = [:small, :xs] 24 | lambda { shirt.save }.should_not raise_error 25 | repository do 26 | Shirt.get(2).sizes.should == [:xs, :small] 27 | end 28 | end 29 | 30 | it 'should immediately typecast supplied values' do 31 | Shirt.new(:sizes => [:large, :xl]).sizes.should == [:large, :xl] 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /merb_datamapper/lib/generators/data_mapper_resource_controller.rb: -------------------------------------------------------------------------------- 1 | class Merb::Generators::ResourceControllerGenerator 2 | # TODO: fix this for Datamapper, so that it returns the primary keys for the model 3 | def params_for_get 4 | "params[:id]" 5 | end 6 | 7 | # TODO: implement this for Datamapper so that we get the model properties 8 | def properties 9 | [] 10 | end 11 | end 12 | 13 | 14 | Merb::Generators::ResourceControllerGenerator.template :controller_datamapper, :orm => :datamapper do |t| 15 | t.source = File.join(File.dirname(__FILE__), "templates/resource_controller.rb") 16 | t.destination = File.join("app/controllers", base_path, "#{file_name}.rb") 17 | end 18 | 19 | [:index, :show, :edit, :new].each do |view| 20 | Merb::Generators::ResourceControllerGenerator.template "view_#{view}_datamapper".to_sym, 21 | :orm => :datamapper, :template_engine => :erb do |t| 22 | t.source = File.join(File.dirname(__FILE__), "templates/views/#{view}.html.erb") 23 | t.destination = File.join("app/views", base_path, "#{file_name}/#{view}.html.erb") 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /dm-ar-finders/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'pathname' 3 | require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-ar-finders' 4 | 5 | def load_driver(name, default_uri) 6 | return false if ENV['ADAPTER'] != name.to_s 7 | 8 | lib = "do_#{name}" 9 | 10 | begin 11 | gem lib, '>=0.9.5' 12 | require lib 13 | DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) 14 | DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] 15 | 16 | FileUtils.touch LOG_PATH 17 | DataMapper::Logger.new(LOG_PATH, 0) 18 | at_exit { DataMapper.logger.close } 19 | true 20 | rescue Gem::LoadError => e 21 | warn "Could not load #{lib}: #{e}" 22 | false 23 | end 24 | end 25 | 26 | ENV['ADAPTER'] ||= 'sqlite3' 27 | LOG_PATH = Pathname(__FILE__).dirname.expand_path.to_s + '/sql.log' 28 | HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') 29 | HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') 30 | HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') 31 | -------------------------------------------------------------------------------- /dm-types/spec/integration/uuid_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require 'uuidtools' 3 | require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' 4 | 5 | describe DataMapper::Types::UUID do 6 | 7 | before(:all) do 8 | class UUIDTest 9 | include DataMapper::Resource 10 | 11 | property :id, Serial 12 | property :uuid, ::DataMapper::Types::UUID 13 | end 14 | 15 | UUIDTest.auto_migrate! 16 | end 17 | 18 | it "should be settable as a uuid" do 19 | u = UUIDTest.create(:uuid => UUID.parse('b0fc632e-d744-4821-afe3-4ea0701859ee')) 20 | 21 | u.uuid.should be_kind_of(UUID) 22 | u.uuid.to_s.should == 'b0fc632e-d744-4821-afe3-4ea0701859ee' 23 | end 24 | 25 | it "should be settable as a string" do 26 | u = UUIDTest.create(:uuid => 'b0fc632e-d744-4821-afe3-4ea0701859ee') 27 | 28 | u.uuid.should be_kind_of(UUID) 29 | u.uuid.to_s.should == 'b0fc632e-d744-4821-afe3-4ea0701859ee' 30 | end 31 | 32 | it "should be allowed to be null" do 33 | u = UUIDTest.create() 34 | 35 | u.uuid.should be_nil 36 | end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/public/422.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | The change you wanted was rejected (422) 9 | 21 | 22 | 23 | 24 | 25 |
26 |

The change you wanted was rejected.

27 |

Maybe you tried to change something you didn't have access to.

28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /rails_datamapper/generators/rspec_dm_model/rspec_dm_model_generator.rb: -------------------------------------------------------------------------------- 1 | require 'rails_generator/generators/components/model/model_generator' 2 | 3 | class RspecDmModelGenerator { 21 | :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}" 22 | }, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}" 23 | end 24 | 25 | end 26 | 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | # Settings specified here will take precedence over those in config/environment.rb 2 | 3 | # The test environment is used exclusively to run your application's 4 | # test suite. You never need to work with it otherwise. Remember that 5 | # your test database is "scratch space" for the test suite and is wiped 6 | # and recreated between test runs. Don't rely on the data there! 7 | config.cache_classes = true 8 | 9 | # Log error messages when you accidentally call methods on nil. 10 | config.whiny_nils = true 11 | 12 | # Show full error reports and disable caching 13 | config.action_controller.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Disable request forgery protection in test environment 17 | config.action_controller.allow_forgery_protection = false 18 | 19 | # Tell Action Mailer not to deliver emails to the real world. 20 | # The :test delivery method accumulates sent emails in the 21 | # ActionMailer::Base.deliveries array. 22 | config.action_mailer.delivery_method = :test 23 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/public/404.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | The page you were looking for doesn't exist (404) 9 | 21 | 22 | 23 | 24 | 25 |
26 |

The page you were looking for doesn't exist.

27 |

You may have mistyped the address or the page may have moved.

28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/fixtures/book_service/public/500.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | We're sorry, but something went wrong (500) 9 | 21 | 22 | 23 | 24 | 25 |
26 |

We're sorry, but something went wrong.

27 |

We've been notified about this issue and we'll take a look at it shortly.

28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /dm-migrations/Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | LICENSE 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | TODO 7 | db/migrations/1_create_people_table.rb 8 | db/migrations/2_add_dob_to_people.rb 9 | db/migrations/config.rb 10 | examples/sample_migration.rb 11 | examples/sample_migration_spec.rb 12 | lib/dm-migrations.rb 13 | lib/dm-migrations/version.rb 14 | lib/migration.rb 15 | lib/migration_runner.rb 16 | lib/spec/example/migration_example_group.rb 17 | lib/spec/matchers/migration_matchers.rb 18 | lib/sql.rb 19 | lib/sql/column.rb 20 | lib/sql/mysql.rb 21 | lib/sql/postgresql.rb 22 | lib/sql/sqlite3.rb 23 | lib/sql/table.rb 24 | lib/sql/table_creator.rb 25 | lib/sql/table_modifier.rb 26 | spec/integration/migration_runner_spec.rb 27 | spec/integration/migration_spec.rb 28 | spec/integration/sql_spec.rb 29 | spec/spec.opts 30 | spec/spec_helper.rb 31 | spec/unit/migration_spec.rb 32 | spec/unit/sql/column_spec.rb 33 | spec/unit/sql/postgresql_spec.rb 34 | spec/unit/sql/sqlite3_extensions_spec.rb 35 | spec/unit/sql/table_creator_spec.rb 36 | spec/unit/sql/table_modifier_spec.rb 37 | spec/unit/sql/table_spec.rb 38 | spec/unit/sql_spec.rb 39 | -------------------------------------------------------------------------------- /dm-types/spec/unit/epoch_time_spec.rb: -------------------------------------------------------------------------------- 1 | require 'pathname' 2 | require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' 3 | 4 | describe DataMapper::Types::EpochTime do 5 | 6 | describe ".dump" do 7 | it "should accept Time objects" do 8 | t = Time.now 9 | 10 | DataMapper::Types::EpochTime.dump(t, :property).should == t.to_i 11 | end 12 | 13 | it "should accept DateTime objects" do 14 | t = DateTime.now 15 | 16 | DataMapper::Types::EpochTime.dump(t, :property).should == Time.parse(t.to_s).to_i 17 | end 18 | 19 | it "should accept Integer objects" do 20 | t = Time.now.to_i 21 | 22 | DataMapper::Types::EpochTime.dump(t, :property).should == t 23 | end 24 | end 25 | 26 | describe ".load" do 27 | 28 | it "should load null as nil" do 29 | DataMapper::Types::EpochTime.load(nil, :property).should == nil 30 | end 31 | 32 | it "should load #{Time.now.to_i} as Time.at(#{Time.now.to_i})" do 33 | t = Time.now.to_i 34 | DataMapper::Types::EpochTime.load(Time.now.to_i, :property).should == Time.at(t) 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /dm-types/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Sam Smoot 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /merb_datamapper/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Jason Toy 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /MIT-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Sam Smoot 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /adapters/dm-rest-adapter/stories/resources/steps/read.rb: -------------------------------------------------------------------------------- 1 | steps_for :read do 2 | Given "a Resource that returns associated resources" do 3 | class Shelf 4 | include DataMapper::Resource 5 | property :id, Integer, :serial => true 6 | property :name, String 7 | has n, :books 8 | end 9 | end 10 | 11 | Given "the ID of an existing Resource that has associated Resources" do 12 | # Assuming that resource 1 is there. 13 | # @type.first would do a GET; that's what we're testing 14 | @resource_id = 1 15 | end 16 | 17 | Given "I have all of the necessary class definitions" do 18 | # NO-OP because defined above 19 | end 20 | 21 | When "I GET /" do 22 | @resource = Shelf.get(@resource_id) 23 | end 24 | 25 | Then "I should get the Resource" do 26 | @resource.should_not be_nil 27 | @resource.should be_an_instance_of(Shelf) 28 | @resource.id.should == 1 29 | end 30 | 31 | Then "the Resource will have associated Resources" do 32 | @resource.books.should_not be_empty 33 | @resource.books.first.should be_an_instance_of(Book) 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /dm-aggregates/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Foy Savas 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-cli/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Wayne E. Seguin 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-is-example/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 John Doe 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-is-tree/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Timothy Bennett 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-migrations/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Paul Sadauskas 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /dm-observer/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Mark Bates 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-shorthand/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 David Leal 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-sweatshop/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Ben Burkert 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-tags/License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Bobby Calderwood 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /dm-timestamps/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Foy Savas 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-adjust/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Sindre Aarsaether 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-ar-finders/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 John W Higgins 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-constraints/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Dirkjan Bussink 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-is-remixable/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Cory ODaniel 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-is-state_machine/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 David James 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dm-is-versioned/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Timothy Bennett 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | --------------------------------------------------------------------------------