Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Engine (ROM) #334

Merged
merged 82 commits into from
Nov 10, 2016
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
f7caaa2
Reworked Repository
jodosha May 17, 2016
33f8454
Use Repository.repository_name
jodosha May 18, 2016
34ee062
Simplify inner repository code. Thanks to @flash-gordon
jodosha May 18, 2016
26af58f
Use the Gist, Luke
jodosha May 18, 2016
eb0bab7
Fixed examples
jodosha May 18, 2016
0f2df19
Try to preload associations
jodosha May 18, 2016
00c0c11
Updated with latest comments from @solnic and @AMHOL
jodosha May 18, 2016
26c17eb
Use schema auto-infer
jodosha May 23, 2016
6ea119e
Implemented repository: #first, #last, #clear and tested custom finders
jodosha May 23, 2016
b4d7907
[ci skip] Added #transaction to the pending test contexts
jodosha May 23, 2016
c79ed48
Ensure to respect default schema values. Closes #237
jodosha May 23, 2016
1827a7b
Ensure booleans to be correctly dumped in database. Closes #272
jodosha May 23, 2016
eeee2e2
Enable tests for multiple adapters and database types
jodosha May 24, 2016
fce2f84
Try to use root for mysql test on CI
jodosha May 24, 2016
19f17b3
Don't use username and password on CI for JRuby build
jodosha May 24, 2016
98756d7
Enable timestamps
jodosha May 25, 2016
94535c2
Force root as user to setup MySQL database on CI for JRuby
jodosha May 25, 2016
ed973e5
Use again 'travis' user for MySQL on CI for JRuby
jodosha May 25, 2016
36e8cf3
s/mysql2/mysql/ on CI for JRuby
jodosha May 25, 2016
f97a69f
Okay, enough. Disable JRuby build on CI
jodosha May 25, 2016
3ac7c2f
Make timestamp plugin available to all the adapters
jodosha May 25, 2016
8170484
Refactor timestamps plugin
jodosha May 25, 2016
a6a46b3
Spike to make custom mapping to work with create
jodosha May 25, 2016
ab15107
Use `primary_key` over hardcoded `:id` in `by_id`
jodosha May 26, 2016
9713f7a
Make command plugins chainable
jodosha May 26, 2016
d489c9f
Allow repository to map database columns into entity attributes
jodosha May 26, 2016
8982a2f
Increase timestamps delta in testing in order to make sure that CI de…
jodosha May 26, 2016
5b2fd46
Get started with one-to-many association
jodosha May 26, 2016
4d2db84
Debug CI env
jodosha Jun 21, 2016
d25eda4
Make it to work with rom-repository 0.3 (ROM 2.0)
jodosha Aug 16, 2016
0a85c15
Added support for has_many operations: #add, #to_a, #each, #map, #cou…
jodosha Aug 19, 2016
ae85fca
Re-enabled migrations
jodosha Aug 30, 2016
ab67662
Skip repository timestamps tests for JRuby with SQLite3 /cc @lucasallan
jodosha Aug 30, 2016
c02e915
Re-enable unit tests for migrator
jodosha Aug 31, 2016
9d048bf
Make new engine tests to pass on CI
jodosha Sep 2, 2016
14b4f24
Basic support for PG types
jodosha Sep 7, 2016
ef4ccd7
Use mapping plugin to read/write data from/to database
jodosha Sep 8, 2016
e52d904
Ported tests for Migrator::Connection
jodosha Sep 8, 2016
1a53218
Re-enable SQL consoles
jodosha Sep 8, 2016
5cf7279
Started with code cleanup
jodosha Sep 8, 2016
0d3312e
Raise Hanami::Model specific exceptions for CREATE/UPDATE/DELETE comm…
jodosha Sep 9, 2016
e43361d
Updated Gemfile to use a specific development rom-sql branch
jodosha Sep 14, 2016
e7cb707
Make exceptions to work on all OSes / Rubies / Databases
jodosha Sep 16, 2016
00151bd
Dismiss support for 'mysql' gem in favor of 'mysql2'
jodosha Sep 16, 2016
a9c3c40
Inherit CRUD operations from repository and configuration DSL
jodosha Sep 16, 2016
ef1d8f3
Introduce 'schema' plugin for commands, in order to handle advanced t…
jodosha Sep 19, 2016
5c01ca2
Cleanup after engine rewriting
jodosha Sep 19, 2016
9f111a4
Rubocop isn't a Rake task
jodosha Sep 19, 2016
eedff4f
Add `rubocop` to `Gemfile`
jodosha Sep 19, 2016
6faec06
Make the build to pass with `rubocop ~> 0.43`
jodosha Sep 19, 2016
a196a4e
CHANGELOG & README [ci skip]
jodosha Sep 19, 2016
c3b25de
Ensure Hanami::Model.configure to return Hanami::Model
jodosha Sep 19, 2016
7920259
Merge branch 'master' into new-engine
jodosha Sep 19, 2016
a0702bd
Fixed message expectation for Postgres migrator test
jodosha Sep 19, 2016
ec3aeed
Entity enhancements
jodosha Sep 20, 2016
1c205eb
Implement Hanami::Entity#hash. Thanks @pascalbetz
jodosha Sep 20, 2016
480d1f4
Let `Hanami::Model::Association` to expose factory via `.build` inste…
jodosha Sep 20, 2016
ef50623
Unify MySQL database creation error message with the PostgreSQL one. …
jodosha Sep 21, 2016
cc3067b
Avoid string concatenation for console adapters. Minor refactoring.
jodosha Sep 21, 2016
db8355f
Don't let CI to fast finish in case of error
jodosha Sep 21, 2016
97a241e
Depend on dry-rb/dry-types HEAD until 0.9
jodosha Sep 21, 2016
af211f3
Move repositories list from configuration to Hanami::Model so reposit…
jodosha Sep 21, 2016
cb61437
Get rid of useless `Array#compact` in `Consoles::Abstract#concat`. Th…
jodosha Sep 22, 2016
998282e
Fix readme.
beauby Oct 17, 2016
be5ee9a
Merge pull request #336 from beauby/fix-readme
Oct 17, 2016
911bfc5
Extract Hanami::Model::Configuration#connection
jodosha Nov 2, 2016
0ddf6e6
Composite keys for SQLite can't be NULL
jodosha Nov 2, 2016
dce6111
Make the build to pass with rubocop ~> 0.45
jodosha Nov 2, 2016
7ce7620
Bump JRuby to 9.1.5.0
jodosha Nov 2, 2016
af05f69
Develop against dry-types 0.9 (stable)
jodosha Nov 2, 2016
bf4f270
Entities schema
jodosha Nov 4, 2016
3d45c41
Save memory when hold reference to a set of attributes in entity schema
jodosha Nov 5, 2016
5b62a8f
Make build to pass with rom-sql master
jodosha Nov 7, 2016
49ea150
Enable again pending tests for PG types
jodosha Nov 8, 2016
813bcc1
Make Hanami::Entity a superclass instead of a module to include
jodosha Nov 8, 2016
b5300be
CHANGELOG
jodosha Nov 8, 2016
3963306
Depend on rom-sql 0.9 (stable)
jodosha Nov 8, 2016
cb59e7e
README [ci skip]
jodosha Nov 8, 2016
c9440d4
Make Rubocop :cop: happy
jodosha Nov 8, 2016
4ad9db6
Enable HoundCI
jodosha Nov 8, 2016
9a2b3ee
README [ci skip]
jodosha Nov 8, 2016
419712c
Change project description in gemspec
jodosha Nov 8, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
ExtraDetails: false
Style/PredicateName:
Enabled: false
Lint/HandleExceptions:
Enabled: false
Lint/IneffectiveAccessModifier:
Enabled: false
Lint/AssignmentInCondition:
Enabled: false
Style/RaiseArgs:
Enabled: false
Style/MethodMissing:
Enabled: false
Style/RegexpLiteral:
Enabled: false
Style/FileName:
Enabled: false
Metrics/LineLength:
Enabled: false
Style/GuardClause:
Enabled: false
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
language: ruby
sudo: false
cache: bundler
script: 'bundle exec rake test:coverage --trace'
script: 'bundle exec rubocop && bundle exec rake test:coverage --trace'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we setup https://houndci.com/ (or similar) instead of running rubocop here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad to see we're using rubocop btw :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cllns For now I'd keep things simple and avoid yet another dep. Things may change after 1.0. 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC consensus finally shifted to using HoundCI – should this be reverted?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@beauby Not yet. I just activated HoundCI for this project. From the next PR we can revert this diff change.

after_script: 'echo `env`'
rvm:
- 2.2.5
- 2.3.1
- jruby-9.0.5.0
- ruby-head
- jruby-head
env:
- DB=sqlite
- DB=postgresql
- DB=mysql

addons:
postgresql: '9.4'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, we could add 9.5, if we want to use Travis's trusty build (which is is beta). precise is the default and doesn't support 9.5 yet though
https://docs.travis-ci.com/user/database-setup/#PostgreSQL

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cllns I prefer to avoid beta Travis CI features for now. Too moving parts.

Expand Down
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,32 @@
A persistence layer for Hanami

## v0.7.0 - (unreleased)
### Added
- [Luca Guidi] Experimental support for One-To-Many association (aka `has_many`)
- [Luca Guidi] Native support for PostgreSQL types like UUID, Array, JSON(B) and Money
- [Luca Guidi] Repositories instances can access all the relations (eg. `BookRepository` can access `users` relation via `#users`)
- [Luca Guidi] Automapping for SQL databases
- [Luca Guidi] Added `Hanami::Model::DatabaseError`

### Changed
– [Luca Guidi] Drop support for Ruby 2.0 and 2.1
- [Luca Guidi] Removed `.attributes` from entity
- [Luca Guidi] Removed `#fetch`, `#execute` and `#transaction` from repository
- [Luca Guidi] Removed `mapping` block from `Hanami::Model.configure`
- [Luca Guidi] Changed `adapter` signature in `Hanami::Model.configure` (use `adapter :sql, ENV['DATABASE_URL']`)
- [Luca Guidi] Repositories must inherit from `Hanami::Repository` instead of including it
- [Pascal Betz] Repositories use instance level interface (eg. `BookRepository.new.find` instead of `BookRepository.find`)
- [Luca Guidi] Repositories now work can accept hash for CRUD operations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Repositories now accept hashes for CRUD operations"

- [Luca Guidi] `Hanami::Repository#create` now accepts: and data (or entity)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"data hash" instead of "and data"?

- [Luca Guidi] `Hanami::Repository#update` now accepts two arguments: primary key (`id`) and data (or entity)
- [Luca Guidi] `Hanami::Repository#delete` now accepts: primary key (`id`)
- [Luca Guidi] Drop `Hanami::Model::NonPersistedEntityError`, `Hanami::Model::InvalidMappingError`, `Hanami::Model::InvalidCommandError`, `Hanami::Model::InvalidQueryError`
- [Luca Guidi] Official support for Ruby 2.3 and JRuby 9.0.5.0
- [Luca Guidi] Drop support for Ruby 2.0, 2.1, 2.2, and JRuby 9.0.0.0
- [Luca Guidi] Drop support for `mysql` gem in favor of `mysql2`

### Fixed
- [Luca Guidi] Ensure booleans to be correctly dumped in database
- [Luca Guidi] Ensure to respect default schema values

## v0.6.2 - 2016-06-01
### Changed
Expand Down
213 changes: 0 additions & 213 deletions EXAMPLE.md

This file was deleted.

16 changes: 9 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ unless ENV['TRAVIS']
gem 'yard', require: false
end

gem 'hanami-utils', '~> 0.8', require: false, github: 'hanami/utils', branch: '0.8.x'
gem 'hanami-validations', '~> 0.6', require: false, github: 'hanami/validations', branch: '0.6.x'
gem 'dry-types', require: false, github: 'dry-rb/dry-types' # FIXME: this is needed until they release 0.9

gem 'hanami-utils', '~> 0.8', require: false, github: 'hanami/utils', branch: 'master'
gem 'rom-sql', '~> 0.8', require: false, github: 'jodosha/rom-sql', branch: 'hanami-model-integration'

platforms :ruby do
gem 'sqlite3', require: false
gem 'pg'
gem 'mysql2'
gem 'mysql'
gem 'pg', require: false
gem 'mysql2', require: false
end

platforms :jruby do
Expand All @@ -22,5 +23,6 @@ platforms :jruby do
gem 'jdbc-mysql', require: false
end

gem 'simplecov', require: false
gem 'coveralls', require: false
gem 'simplecov', require: false
gem 'coveralls', require: false
gem 'rubocop', '~> 0.43', require: false
Loading