outbacker 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d4106a11fe016a7b8362914af3220b7158bc88a
4
- data.tar.gz: cbce1db7f97cedf15b12fd7241ca9999f9a4ca75
3
+ metadata.gz: 75b6426d3f64c62516541550bd341193474249e7
4
+ data.tar.gz: 57a542ea46bf9c35e4b6e2a353640f78a74f6aea
5
5
  SHA512:
6
- metadata.gz: 9fde43700e7d224b2ddaaf0da6903a9435c4854e0a8524208c3ef1dac899c6218f613bce926b282b25069ad24052f65eda530e2986919eb9e6c2f41feffea5de
7
- data.tar.gz: ecf23c5a8b829e813370bdcfbc34e0500f20be1b66c89fc4c9c4df09966ea3f9dc54f9a5e341ab615a5000f7ae206f8ad4d28daa4c38cc96a1b01c52d2dd4122
6
+ metadata.gz: f6c04602dee484578e756c6c8f6c663af69fddd4f398b73a4e386b42ea6ad983405b7e479f492c5c713dd85f3ddd1e73932f7eacaa02f367e226a3d178a238f6
7
+ data.tar.gz: 71ee9b9aef806fed79fc4f81e1bc37368125f37d877277387e310e731a678fe5c0dfb50616e4e67c0ea88932eeb2d813fcd0b2b40dfd51900eb4e912eaff5fc3
@@ -2,6 +2,9 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## 0.1.1 2015-07-27
6
+ [changed] Updated README and examples.
7
+
5
8
  ## 0.1.0 2015-07-27
6
9
  Initial release.
7
10
 
data/README.md CHANGED
@@ -3,16 +3,17 @@
3
3
  [![Build Status](https://travis-ci.org/polypressure/outbacker.svg?branch=master)](https://travis-ci.org/polypressure/outbacker)
4
4
  [![Code Climate](https://codeclimate.com/github/polypressure/outbacker/badges/gpa.svg)](https://codeclimate.com/github/polypressure/outbacker)
5
5
  [![Test Coverage](https://codeclimate.com/github/polypressure/outbacker/badges/coverage.svg)](https://codeclimate.com/github/polypressure/outbacker/coverage)
6
+ [![Gem Version](https://badge.fury.io/rb/outbacker.svg)](http://badge.fury.io/rb/outbacker)
6
7
 
7
8
  Rails developers have long known how important it is to keep controllers "skinny" and free of business logic. Our controllers are supposed to be dumb dispatchers that take results from the model layer and turn them into redirects, flash messages, form re-renderings, session state updates, JSON responses, HTTP status codes, and so on.
8
9
 
9
- But far too often, the conditional logic in typical Rails controllers to act on results from models and decide what to do next attracts business logic and spirals out of control. Complicated logic sneaks into our controllers as we add code to handle new features, stories, and special cases. And the cultural and process controls we put in place to enforce good code hygiene chronically break down in the face of schedule pressure, growing teams, emergency fixes, etc.
10
+ But far too often, the conditional logic in typical Rails controllers—the logic to act on results from models and decide what to do next—spirals out of control, attracting and trapping business logic, and making testing and reuse difficult. Complexity sneaks into our controllers as we add code to handle new features, stories, and special cases. And the cultural and process controls we put in place to enforce good code hygiene chronically break down in the face of schedule pressure, growing teams, emergency fixes, etc.
10
11
 
11
- **Outbacker** ("outcome callbacks") is a very simple micro library that makes it easy to keep controllers free of this conditional logic. Controllers become simple, declarative mappings of business logic results to the redirects, flash messages, session state updates, HTTP status codes, and other actions that deliver results to the user.
12
+ **Outbacker** ("outcome callbacks") is a very simple micro library that makes it easy to keep controllers free of this conditional logic. Controllers become simple, declarative mappings of business logic results to the redirects, flash messages, session state updates, HTTP status codes, and other actions that deliver results to the user. Conditional controller logic can't grow into complicated business logic—because our controllers no longer have conditional logic in the first place.
12
13
 
13
14
  It turns out that not only is Outbacker a prophylaxis against fat, complicated controllers, it more generally supports a very simple, low-ceremony way to write intention-revealing Rails code with both skinny controllers _and_ skinny models. If you feel these are worthwhile aims for your Ruby/Rails code—but you've found many approaches to accomplish this ineffective or not worth the trouble—then you might find Outbacker valuable.
14
15
 
15
- **Note:** The README that follows has a lot of motivation, rationale, and explanation—maybe excessively so for such a simple library. If you're impatient, you can go straight to some [code examples](https://github.com/polypressure/outbacker/tree/master/examples). Hopefully, these examples are sufficient for you to get an understanding of what Outbacker provides, and how to use it. If not, you can always come back to this readme.
16
+ **Note:** The README that follows has a lot of explanation about rationale and motivation—maybe excessively, logorrheically so for such a simple library. If you're impatient, you can go straight to some [code examples](https://github.com/polypressure/outbacker/tree/master/examples/README.md). Hopefully, these examples are sufficient for you to get an understanding of what Outbacker provides, and how to use it. If not, you can always come back to this readme.
16
17
 
17
18
  ## A Typical Rails Controller
18
19
 
@@ -0,0 +1,10 @@
1
+ # Outbacker Examples
2
+
3
+ Quick examples of how to use Outbacker. Please look at them in this order:
4
+
5
+ 1. A [controller](https://github.com/polypressure/outbacker/blob/master/examples/app/controllers/appointments_controller.rb) that uses Outbacker.
6
+ 1. A [business logic PORO](https://github.com/polypressure/outbacker/blob/master/examples/app/domain/appointment_calendar.rb) that uses Outbacker.
7
+ 1. A [controller test using OutbackerStub](https://github.com/polypressure/outbacker/blob/master/examples/test/controllers/appointments_controller_test.rb) to "stub" outcomes.
8
+ 1. The Outbacker [gem initializer file](https://github.com/polypressure/outbacker/blob/master/examples/config/initializers/outbacker.rb), to configure your policy specifying where the Outbacker module can be included.
9
+
10
+ If you need more details, you can go back to the main [ README](https://github.com/polypressure/outbacker/blob/master/README.md) file.
@@ -1,14 +1,11 @@
1
1
  #
2
- # Start here, then look at:
3
- # * examples/app/domain/appointment_calendar.rb
4
- # * examples/app/config/outbacker.rb
5
- # * examples/test/controllers/appointments_controller_test.rb
6
- # * examples/test/test_helper.rb
2
+ # Conventional Rails controller, with the create method
3
+ # implemented twice: before and after using Outbacker.
7
4
  #
8
5
  class AppointmentsController < ApplicationController
9
6
 
10
7
  #
11
- # A conventional controller method:
8
+ # A conventional controller method, before using Outbacker:
12
9
  #
13
10
  def create
14
11
  @appointment = Appointment.new(appointment_params)
@@ -8,7 +8,11 @@ class AppointmentCalendar
8
8
 
9
9
  #
10
10
  # Include the Outbacker module. See config/initializers/outbacker.rb
11
- # for the restrictions on where you can include this.
11
+ # for the restrictions on where you can include this. By default,
12
+ # if you try to include Outbacker in an ActiveRecord or ActionController
13
+ # subclass, an exception will be raised.
14
+ #
15
+ # This helps to ensure both your models (and controllers) are skinny.
12
16
  #
13
17
  include Outbacker
14
18
 
@@ -1,4 +1,8 @@
1
1
 
2
+ #
3
+ # Gem initializer file, within a rails app this file would
4
+ # go in config/initializrs.
5
+ #
2
6
  #
3
7
  # Specify where the Outbacker module cannot be included.
4
8
  # If you try to include Outbacker within subclasses of
@@ -6,6 +6,12 @@ require 'outbacker'
6
6
  require 'test_support/outbacker_stub'
7
7
 
8
8
 
9
+ #
10
+ # A controller test for the AppointmentsController.
11
+ # This shows how to use Outbacker::OutbackerStub to "stub"
12
+ # outcomes, since standard mocking/stubbing libraries
13
+ # can't provide this.
14
+ #
9
15
  class AppointmentsControllerTest < ActionController::TestCase
10
16
 
11
17
 
@@ -1,3 +1,3 @@
1
1
  module Outbacker
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outbacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Garcia
@@ -125,6 +125,7 @@ files:
125
125
  - LICENSE.txt
126
126
  - README.md
127
127
  - Rakefile
128
+ - examples/README.md
128
129
  - examples/app/controllers/appointments_controller.rb
129
130
  - examples/app/domain/appointment_calendar.rb
130
131
  - examples/config/initializers/outbacker.rb