faat 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzA0NzY2ODdlMDE3ZGIwNzFkNjllYWJhZjQwNTMxMTFhMTBiYWEyNg==
4
+ YmE4OTU4OTVhYmQ3N2RmYjRjMzQ5OGMzY2QyYTFkYzY2MzZjMDQ4MA==
5
5
  data.tar.gz: !binary |-
6
- YzZmMmNjZGU1ODljMWVhOTYwNGI3NGMwNjliNmVhNGYzNjNhY2U4Mg==
6
+ ZDUyODUxMGVjZTI1ZGRmOTlkYTllODlmNjFlMThjNjQ3ODlkOGMyZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OGM4NjI5YTI1ZDJhNDQwMGNiNTgwY2RiMDFiMzUyNjdlNDY3MjAzMjM5YjNl
10
- ODQ5M2JkMDJlNWViNmUzZWM1MmQyMTYzNzNhMjA1MDVhMmYzMWIzYjM0YWIx
11
- ZDFiYTYwNDc5YjIwMDE1Njk3MjFkOGRjNzc4M2YyNzk2MDA1Yjg=
9
+ ODBmMmU4Y2M3ZjVkY2RhZjU0MTllOGE4ZDEyNWZhMzVjYTE2NTY2N2Q4ZDI2
10
+ ZDZhMjA1YjRmNzQwMjYxYzAyOTk0MjEzMGVkZDY5YzgwNDZlOTA1YjkyOTFi
11
+ NjM5YWNhOGEwN2FhNjllOTI1ZDJiOWQyNjc0NTVmMGY1MWUwMTc=
12
12
  data.tar.gz: !binary |-
13
- ZWUxNmY1NzkwMmUxY2NjODUzNGFmYzM5M2ZmOTQ3M2FiZDEwYjA1ODg0NjY0
14
- ZDUyMGEzNzQ0NTZiOTYyZGY2Y2E2OThiODE4ZjFiMzJiM2ZiMmQ3ZWRlZGQ2
15
- YzA4NDNmNTg0ZGNhNDg2YjFlYmM3MjViMWUxZDJlZjBkYjRkZjU=
13
+ YjQ3NmU2NTc0MTI4NzNhZDg3MzVhYmRiZGNhOGY2NjFkNWZhYmNhYmE0ZGUz
14
+ NGRjZWQxY2M0MDgyODg5YTgwMjZlODdkYzA4YzE5NGQyODRjZTI0NTQ5NDFm
15
+ OGJlYTM1NWYxMmU0MTA3NDQxNjJjNDhmNDEzMDA4OThkOTQ2MjQ=
@@ -5,7 +5,6 @@ rvm:
5
5
  - 2.2.0
6
6
  - 2.2.4
7
7
  - 2.3.0
8
- - ruby-head
9
8
  script:
10
9
  - bundle exec rake
11
10
  deploy:
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Faat
2
2
 
3
- [![Join the chat at https://gitter.im/xo8bit/faat](https://badges.gitter.im/xo8bit/faat.svg)](https://gitter.im/xo8bit/faat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Gem Version](https://badge.fury.io/rb/faat.svg)](https://badge.fury.io/rb/faat) [![Code Climate](https://codeclimate.com/repos/5683d90ecbc0bf2f17002347/badges/275483f4f40ccd7c48af/gpa.svg)](https://codeclimate.com/repos/5683d90ecbc0bf2f17002347/feed) [![Test Coverage](https://codeclimate.com/repos/5683d90ecbc0bf2f17002347/badges/275483f4f40ccd7c48af/coverage.svg)](https://codeclimate.com/repos/5683d90ecbc0bf2f17002347/coverage) [![Build Status](https://travis-ci.org/xo8bit/faat.svg?branch=develop)](https://travis-ci.org/xo8bit/faat)
3
+ [![Join the chat at https://gitter.im/xo8bit/faat](https://badges.gitter.im/xo8bit/faat.svg)](https://gitter.im/xo8bit/faat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Gem Version](https://badge.fury.io/rb/faat.svg)](https://badge.fury.io/rb/faat) [![Code Climate](https://codeclimate.com/repos/5683d90ecbc0bf2f17002347/badges/275483f4f40ccd7c48af/gpa.svg)](https://codeclimate.com/repos/5683d90ecbc0bf2f17002347/feed) [![Test Coverage](https://codeclimate.com/repos/5683d90ecbc0bf2f17002347/badges/275483f4f40ccd7c48af/coverage.svg)](https://codeclimate.com/repos/5683d90ecbc0bf2f17002347/coverage) [![Build Status](https://travis-ci.org/xo8bit/faat.svg?branch=develop)](https://travis-ci.org/xo8bit/faat)
4
4
 
5
5
  Welcome to `faat` gem!
6
6
 
@@ -22,8 +22,8 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- Run ```rails generate faat:resources {model_name}```,
26
- generator will create folder ```resource``` in ```app``` directory, and file ```{model_name}_resource.rb```
25
+ Run ```rails generate faat:services {service_name}```,
26
+ generator will create folder ```services``` in ```app``` directory, and file ```{service_name}_service.rb```
27
27
 
28
28
  Run ```rails generate faat:forms {form_name} {attribute_name}:{attribute_type}```,
29
29
  generator will create folder ```forms``` in ```app``` directory, and file ```{form_name}_form.rb```
@@ -31,35 +31,34 @@ generator will create folder ```forms``` in ```app``` directory, and file ```{fo
31
31
  ###Initialize:
32
32
  ```ruby
33
33
  @post = Post.new
34
- @post_resource = PostResource.new(@post)
34
+ @post_service = PostService.new(@post)
35
35
 
36
36
  @post_form = PostForm.new(post_form_params)
37
37
  ```
38
38
 
39
39
  ###Usage:
40
40
  ```ruby
41
- @post_resource.destroy => destroy @post
42
- @post_resource.update => update @post
41
+ @post_service.destroy => destroy @post
42
+ @post_service.update => update @post
43
43
 
44
- PostResource.last => Post.last
45
- PostResource.all => Post.all
46
- PostResource.where(title: "First Test Title") => Post.where(...)
44
+ PostService.last => Post.last
45
+ PostService.all => Post.all
46
+ PostService.where(title: "First Test Title") => Post.where(...)
47
47
  ```
48
48
 
49
49
  ###Examples:
50
50
 
51
-
52
- In ```post_resource.rb```
51
+ In ```post_services.rb```
53
52
  ```ruby
54
- class PostResource < Faat::Resources::Base
53
+ class PostService < Faat::Services::Base
55
54
  ...
56
-
55
+
57
56
  def initialize(post_form)
58
57
  @author = Author.create!(name: post_form.author_name, email: post_form.author_email)
59
58
  @post = Post.create!(text: post_form.text, title: post_form.title)
60
59
  send_confirmation_email(@author)
61
60
  end
62
-
61
+
63
62
  ...
64
63
  end
65
64
  ```
@@ -70,7 +69,7 @@ In```post_controller.rb```
70
69
  def create
71
70
  @post_form = PostForm.new(post_form_params)
72
71
  if @post_form.valid?
73
- @post_resource = PostResource.new(@post_form) => create @author and @post
72
+ @post_service = PostService.new(@post_form) => create @author and @post
74
73
  end
75
74
  end
76
75
  ```
@@ -96,4 +95,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/xo8bit
96
95
  ## License
97
96
 
98
97
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
99
-
@@ -29,7 +29,6 @@ require 'active_support/inflector'
29
29
 
30
30
  # root gem module
31
31
  module Faat
32
- autoload :Resources, 'faat/resources/base'
33
32
  autoload :Forms, 'faat/forms/base'
34
33
  autoload :Services, 'faat/services/base'
35
34
  end
@@ -1,4 +1,4 @@
1
1
  # root gem module with version constant
2
2
  module Faat
3
- VERSION = '0.1.5'
3
+ VERSION = '0.1.6'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nazarii Sheremet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -143,14 +143,11 @@ files:
143
143
  - lib/faat/faat_object/faat_object.rb
144
144
  - lib/faat/forms/base.rb
145
145
  - lib/faat/helpers/string.rb
146
- - lib/faat/resources/base.rb
147
146
  - lib/faat/services/base.rb
148
147
  - lib/faat/version.rb
149
148
  - lib/generators/faat.rb
150
149
  - lib/generators/faat/forms/forms_generator.rb
151
150
  - lib/generators/faat/forms/templates/form_template.rb
152
- - lib/generators/faat/resources/resources_generator.rb
153
- - lib/generators/faat/resources/templates/resource_template.rb
154
151
  - lib/generators/faat/services/services_generator.rb
155
152
  - lib/generators/faat/services/templates/service_template.rb
156
153
  homepage: https://github.com/xo8bit/faat
@@ -1,15 +0,0 @@
1
- # root module Faat
2
- module Faat
3
- # Faat::Resources resources module
4
- module Resources
5
- # Faat::Resources::Base default resource class
6
- class Base < Faat::FaatObject
7
- # Your classes must inherited from this Base class
8
- # for removing all business logic from models classes,
9
- # and controllers
10
- # Right now you can use one resources for one model,
11
-
12
- # TODO: implement resources logic for working with coup of models
13
- end
14
- end
15
- end
@@ -1,24 +0,0 @@
1
- require 'generators/faat'
2
- require 'rails/generators/base'
3
-
4
- module Faat
5
- module Generators
6
- class ResourcesGenerator < Base
7
- argument :resource_name, type: :string, default: 'app', banner: 'resource_name'
8
-
9
- def create_resources
10
- template "resource_template.rb", "app/resources/#{file_name}_resources.rb"
11
- end
12
-
13
- private
14
-
15
- def file_name
16
- resource_name.underscore
17
- end
18
-
19
- def class_name
20
- resource_name.downcase.capitalize
21
- end
22
- end
23
- end
24
- end
@@ -1,11 +0,0 @@
1
- <%= '# default generated template' %>
2
-
3
- <%= "# for using with model resource, initialize #{resource_name}Resource" %>
4
- <%= "# #{resource_name}Resource.new( ModelClassName.new )" %>
5
- <%= "# or with instance variable #{resource_name}Resource.new(@model_class_name)" %>
6
-
7
- class <%= resource_name %>Resource < Faat::Resources::Base
8
-
9
- # add your business logic here
10
-
11
- end