creed 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: a8c24e8b350f8d12b8f4ec1c4f32b8d916a9ec6326b03d2c3cb98b79fae4eadf
4
- data.tar.gz: 3a281613ab1f01ae4e05c94f0f29377a0fc86c174c4ed55d821417ede06daa3d
3
+ metadata.gz: 71ec85575cece4defb4fb57ca8521494d4c350aef99730269747872e17aa66c1
4
+ data.tar.gz: 8c15a9cfd8f219140efec5a0d0b82ca6d92dd89020898f065f29ef1ed9ce7365
5
5
  SHA512:
6
- metadata.gz: 1ebfd0d3cd1c8e4306e8f3040666dd913d9abf811031979156636208a185f7470feb459b6a8bf4e32e2eb718fcb97b19522666fdb52f8608423aafd04587a4b3
7
- data.tar.gz: 4f9c513412ce5e8f55a6c56f4d93074c4563b34982281bca881562f9240a1c772f06db1a7567e37cc042ce97f9fc04bb5fd66a6d4d2da9db07678f3b6104a08d
6
+ metadata.gz: '085d2028e4f104d642cda0490d94b6d91d100bd02f1f179fb9124592529a426c593b200d144c945bea4bb7c109b2650e6e822f486bbb5f75d9c78af37472876b'
7
+ data.tar.gz: bd7c1d695f8f63cd5db1b1e7e586bdc35f56a9fa6983448ab8b67669e8ae33b1201fa1ac4a778fc1843ffc201c065c76b99488980ca5ab91a9bc29722ebeb221
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # Creed
1
+ # Creed - Stupid Simple Commands for Rails
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/creed`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Creed provides a stupid simple way to introduce the [Command Pattern](https://en.wikipedia.org/wiki/Command_pattern) to your Rails app.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,28 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ Create your Command classes in `app/commands`, extending `Creed::Command`, and implementing a `perform` method:
24
+
25
+ ```ruby
26
+ class CreateUser < Creed::Command
27
+ # Define types and/or validations.
28
+ param :user_params, Creed::Types.Instance(ActionController::Parameters)
29
+
30
+ def perform
31
+ # Do something here...
32
+ end
33
+ end
34
+ ```
35
+
36
+ Then in your controller (or anywhere):
37
+
38
+ ```ruby
39
+ class UserController < ApplicationController
40
+ def create
41
+ CreateUser.perform(user_params)
42
+ end
43
+ end
44
+ ```
26
45
 
27
46
  ## Development
28
47
 
@@ -34,7 +53,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
34
53
 
35
54
  Bug reports and pull requests are welcome on GitHub at https://github.com/joelmoss/creed. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/joelmoss/creed/blob/master/CODE_OF_CONDUCT.md).
36
55
 
37
-
38
56
  ## License
39
57
 
40
58
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -3,7 +3,7 @@
3
3
  module Creed
4
4
  class Railtie < Rails::Railtie
5
5
  config.before_configuration do |app|
6
- app.config.paths.add 'app/controllers/commands', eager_load: true
6
+ app.config.paths.add 'app/commands', eager_load: true
7
7
  end
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Creed
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Moss
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-26 00:00:00.000000000 Z
11
+ date: 2020-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack