genesis_rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +22 -0
- data/README.md +2 -0
- data/lib/generators/genesis_rails/USAGE +12 -0
- data/lib/generators/genesis_rails/services_generator.rb +14 -0
- data/lib/generators/genesis_rails/templates/create.rb +19 -0
- data/lib/generators/genesis_rails/templates/destroy.rb +19 -0
- data/lib/generators/genesis_rails/templates/helper.rb +11 -0
- data/lib/generators/genesis_rails/templates/update.rb +19 -0
- data/lib/genesis_rails.rb +3 -0
- data/lib/genesis_rails/services/create.rb +17 -0
- data/lib/genesis_rails/services/destroy.rb +14 -0
- data/lib/genesis_rails/services/update.rb +18 -0
- data/lib/genesis_rails/templates/rails/scaffold_controller/controller.rb +3 -3
- data/lib/genesis_rails/version.rb +1 -1
- data/test/dummy/log/development.log +0 -0
- metadata +57 -4
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c6a52ad95f44f638a8900c12e1522cd772a5ef3
|
4
|
+
data.tar.gz: 6035616871d06603a75e37fbb7dec85ab0b2e64f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eca53f90c2b8e0ee1fbeba06954340f7957e79f78b99358facd08980d7901936296809c0b5b9e5688f44d25cb51928ee4729f1862b8cd443438806c59641c1da
|
7
|
+
data.tar.gz: 2ee3a2194ae9fee0022637480495adb343868d03a0096568839fe13586d765972526c001dc93f239696743d6d8d062b5757ec8b493e295635a32fb946a4a13cb
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Kelvin Stinghen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Description:
|
2
|
+
Create empty service classes inheriting from the basic services.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate services Thing
|
6
|
+
|
7
|
+
This will create:
|
8
|
+
Create service: app/services/thing_services/create.rb
|
9
|
+
Update service: app/services/thing_services/update.rb
|
10
|
+
Destroy service: app/services/thing_services/destroy.rb
|
11
|
+
Service helper: app/services/thing_services/helper.rb
|
12
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
module GenesisRails
|
3
|
+
class ServicesGenerator < Rails::Generators::NamedBase
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def create_services_files
|
7
|
+
template "create.rb", "app/services/#{file_name}_services/create.rb"
|
8
|
+
template "update.rb", "app/services/#{file_name}_services/update.rb"
|
9
|
+
template "destroy.rb", "app/services/#{file_name}_services/destroy.rb"
|
10
|
+
template "helper.rb", "app/services/#{file_name}_services/helper.rb"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% module_namespacing do -%>
|
2
|
+
module <%= class_name %>Services
|
3
|
+
class Create < GenesisRails::Services::Create
|
4
|
+
# overwrite this method if you want to do something more when you are
|
5
|
+
# creating a <%= human_name %>
|
6
|
+
# def execute
|
7
|
+
# # put shared methods between services on the helper class
|
8
|
+
# # behind the path /app/services/<%= file_name %>_services/helper.rb
|
9
|
+
# Helper.handle_values(@model)
|
10
|
+
#
|
11
|
+
# # then you can call `super` to invoke the creation itself
|
12
|
+
# super
|
13
|
+
#
|
14
|
+
# # and of course, you can do anything you want after doing it too
|
15
|
+
# Helper.create_something_else(@model)
|
16
|
+
# end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
<% end -%>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% module_namespacing do -%>
|
2
|
+
module <%= class_name %>Services
|
3
|
+
class Destroy < GenesisRails::Services::Destroy
|
4
|
+
# overwrite this method if you want to do something more when you are
|
5
|
+
# destroying a <%= human_name %>
|
6
|
+
# def execute
|
7
|
+
# # put shared methods between services on the helper class
|
8
|
+
# # behind the path /app/services/<%= file_name %>_services/helper.rb
|
9
|
+
# Helper.handle_values(@model)
|
10
|
+
#
|
11
|
+
# # then you can call `super` to invoke the destruction itself
|
12
|
+
# super
|
13
|
+
#
|
14
|
+
# # and of course, you can do anything you want after doing it too
|
15
|
+
# Helper.destroy_something_else(@model)
|
16
|
+
# end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
<% end -%>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% module_namespacing do -%>
|
2
|
+
module <%= class_name %>Services
|
3
|
+
class Helper
|
4
|
+
# create the useful routines as static methods here and share them between
|
5
|
+
# the services
|
6
|
+
# def self.handle_values(model)
|
7
|
+
# model.password = encrypt(model.password)
|
8
|
+
# end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
<% end -%>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% module_namespacing do -%>
|
2
|
+
module <%= class_name %>Services
|
3
|
+
class Update < GenesisRails::Services::Update
|
4
|
+
# overwrite this method if you want to do something more when you are
|
5
|
+
# updating a <%= human_name %>
|
6
|
+
# def execute
|
7
|
+
# # put shared methods between services on the helper class
|
8
|
+
# # behind the path /app/services/<%= file_name %>_services/helper.rb
|
9
|
+
# Helper.handle_values(@model)
|
10
|
+
#
|
11
|
+
# # then you can call `super` to invoke the update itself
|
12
|
+
# super
|
13
|
+
#
|
14
|
+
# # and of course, you can do anything you want after doing it too
|
15
|
+
# Helper.update_something_else(@model)
|
16
|
+
# end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
<% end -%>
|
data/lib/genesis_rails.rb
CHANGED
@@ -24,7 +24,7 @@ class <%= controller_class_name %>Controller < AuthenticatedController
|
|
24
24
|
|
25
25
|
def create
|
26
26
|
@<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
|
27
|
-
|
27
|
+
<%= class_name %>Services::Create.new(@<%= singular_table_name %>).execute
|
28
28
|
|
29
29
|
respond_with @<%= singular_table_name %>
|
30
30
|
end
|
@@ -32,14 +32,14 @@ class <%= controller_class_name %>Controller < AuthenticatedController
|
|
32
32
|
def update
|
33
33
|
load_<%= singular_table_name %>
|
34
34
|
@<%= singular_table_name %>.attributes = <%= singular_table_name %>_params
|
35
|
-
|
35
|
+
<%= class_name %>Services::Update.new(@<%= singular_table_name %>).execute
|
36
36
|
|
37
37
|
respond_with @<%= singular_table_name %>
|
38
38
|
end
|
39
39
|
|
40
40
|
def destroy
|
41
41
|
load_<%= singular_table_name %>
|
42
|
-
|
42
|
+
<%= class_name %>Services::Destroy.new(@<%= singular_table_name %>).execute
|
43
43
|
|
44
44
|
respond_with @<%= singular_table_name %>
|
45
45
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genesis_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kelvinst
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,48 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simple_form
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: responders
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.1'
|
27
69
|
description: |-
|
28
70
|
This gem is a set of generators, templates and helpers to
|
29
71
|
start a brand new rails project without too many code to
|
@@ -34,13 +76,22 @@ executables: []
|
|
34
76
|
extensions: []
|
35
77
|
extra_rdoc_files: []
|
36
78
|
files:
|
37
|
-
-
|
38
|
-
- README.
|
79
|
+
- LICENSE
|
80
|
+
- README.md
|
39
81
|
- Rakefile
|
40
82
|
- config/routes.rb
|
83
|
+
- lib/generators/genesis_rails/USAGE
|
84
|
+
- lib/generators/genesis_rails/services_generator.rb
|
85
|
+
- lib/generators/genesis_rails/templates/create.rb
|
86
|
+
- lib/generators/genesis_rails/templates/destroy.rb
|
87
|
+
- lib/generators/genesis_rails/templates/helper.rb
|
88
|
+
- lib/generators/genesis_rails/templates/update.rb
|
41
89
|
- lib/genesis_rails.rb
|
42
90
|
- lib/genesis_rails/engine.rb
|
43
91
|
- lib/genesis_rails/railtie.rb
|
92
|
+
- lib/genesis_rails/services/create.rb
|
93
|
+
- lib/genesis_rails/services/destroy.rb
|
94
|
+
- lib/genesis_rails/services/update.rb
|
44
95
|
- lib/genesis_rails/templates/active_record/model/model.rb
|
45
96
|
- lib/genesis_rails/templates/erb/scaffold/_form.html.erb
|
46
97
|
- lib/genesis_rails/templates/erb/scaffold/edit.html.erb
|
@@ -81,6 +132,7 @@ files:
|
|
81
132
|
- test/dummy/config/locales/en.yml
|
82
133
|
- test/dummy/config/routes.rb
|
83
134
|
- test/dummy/config/secrets.yml
|
135
|
+
- test/dummy/log/development.log
|
84
136
|
- test/dummy/public/404.html
|
85
137
|
- test/dummy/public/422.html
|
86
138
|
- test/dummy/public/500.html
|
@@ -141,6 +193,7 @@ test_files:
|
|
141
193
|
- test/dummy/config/routes.rb
|
142
194
|
- test/dummy/config/secrets.yml
|
143
195
|
- test/dummy/config.ru
|
196
|
+
- test/dummy/log/development.log
|
144
197
|
- test/dummy/public/404.html
|
145
198
|
- test/dummy/public/422.html
|
146
199
|
- test/dummy/public/500.html
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2016 kelvinst
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
DELETED