Skip to content
This repository has been archived by the owner on Feb 7, 2018. It is now read-only.

Commit

Permalink
Merge 8fc3288 into 2c2029a
Browse files Browse the repository at this point in the history
  • Loading branch information
marten committed Jul 27, 2013
2 parents 2c2029a + 8fc3288 commit 8eb8116
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 138 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Pavlov Changelog

## HEAD
## 0.3.0

#### Removed

* Removed `Pavlov::Interactor`, `Pavlov::Command` and `Pavlov::Query` in favor of generated classes inside your own
application. Run `rails generate pavlov:install` and then find-and-replace `\n\s+include Pavlov::` for ` < ` to
rewrite your operations so that they inherit from the generated classes.

## 0.2.0

This release brings forth lots and lots of incompatibilities. Where possible, we've tried to keep a backwards-compatible API available. You can activate this by requiring `pavlov/alpha_compatibility'.

Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ Then generate some initial files with:
## Usage

```ruby
class Commands::CreateBlogPost
include Pavlov::Command
class Commands::CreateBlogPost < Command

attribute :id, Integer
attribute :title, String
Expand All @@ -40,8 +39,7 @@ class Commands::CreateBlogPost
end
end

class Queries::AvailableId
include Pavlov::Query
class Queries::AvailableId < Query

private

Expand All @@ -54,8 +52,7 @@ class Queries::AvailableId
end
end

class Interactors::CreateBlogPost
include Pavlov::Interactor
class Interactors::CreateBlogPost < Interactor

attribute :title, String
attribute :body, String
Expand Down Expand Up @@ -117,8 +114,7 @@ Interactors must define a method `authorized?` that determines if the interactio
To help you determine whether operations are allowed, you can set up a global [interaction context](#context), which you can then access from your interactors:

```ruby
class Interactors::CreateBlogPost
include Pavlov::Interactor
class Interactors::CreateBlogPost < Interactor

def authorized?
context.current_user.is_admin?
Expand Down
3 changes: 0 additions & 3 deletions lib/pavlov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,5 @@ def self.query command_name, *args
require_relative 'pavlov/validation_error'
require_relative 'pavlov/validations'
require_relative 'pavlov/operation'
require_relative 'pavlov/command'
require_relative 'pavlov/query'
require_relative 'pavlov/interactor'
require_relative 'pavlov/version'
require_relative 'pavlov/alpha_compatibility'
9 changes: 0 additions & 9 deletions lib/pavlov/command.rb

This file was deleted.

25 changes: 0 additions & 25 deletions lib/pavlov/interactor.rb

This file was deleted.

9 changes: 0 additions & 9 deletions lib/pavlov/query.rb

This file was deleted.

13 changes: 7 additions & 6 deletions spec/integration/alpha_compatibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
require 'pavlov'
require 'pavlov/alpha_compatibility'

require 'generators/pavlov/templates/backend/command'
require 'generators/pavlov/templates/backend/query'
require 'generators/pavlov/templates/backend/interactor'

describe "Pavlov Alpha Compatibility" do
include Pavlov::Helpers

describe 'retains .arguments' do
before do
stub_const "Interactors", Module.new

class Interactors::OldStyleInteractor
include Pavlov::Interactor
class Interactors::OldStyleInteractor < Interactor
arguments :title, :published

def authorized?
Expand Down Expand Up @@ -38,8 +41,7 @@ def pavlov_options
before do
stub_const "Queries", Module.new
stub_const "Interactors", Module.new
class Queries::FindUppercaseName
include Pavlov::Query
class Queries::FindUppercaseName < Query

attribute :pavlov_options, Hash, default: {}

Expand All @@ -48,8 +50,7 @@ def execute
end
end

class Interactors::ShoutyGreeting
include Pavlov::Interactor
class Interactors::ShoutyGreeting < Interactor

attribute :pavlov_options, Hash, default: {}

Expand Down
7 changes: 5 additions & 2 deletions spec/integration/attributes_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
require_relative '../spec_helper'
require 'pavlov'

require 'generators/pavlov/templates/backend/command'
require 'generators/pavlov/templates/backend/query'
require 'generators/pavlov/templates/backend/interactor'

describe "Pavlov attributes" do
before do
stub_const "Interactors", Module.new
module Interactors
class CreateBlogPost
include Pavlov::Interactor
class CreateBlogPost < Interactor

attribute :title, String
attribute :published, Boolean, default: true
Expand Down
21 changes: 0 additions & 21 deletions spec/pavlov/command_spec.rb

This file was deleted.

33 changes: 0 additions & 33 deletions spec/pavlov/interactor_spec.rb

This file was deleted.

21 changes: 0 additions & 21 deletions spec/pavlov/query_spec.rb

This file was deleted.

0 comments on commit 8eb8116

Please sign in to comment.