genesis_rails 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +154 -12
- data/lib/generators/genesis_rails/{copy_templates → install}/USAGE +1 -1
- data/lib/generators/genesis_rails/install/files/spec/support/genesis_rails.rb +33 -0
- data/lib/{genesis_rails → generators/genesis_rails/install/files}/templates/active_record/model/model.rb +0 -0
- data/lib/{genesis_rails → generators/genesis_rails/install/files}/templates/coffee/assets/javascript.coffee +0 -0
- data/lib/{genesis_rails → generators/genesis_rails/install/files}/templates/erb/scaffold/_form.html.erb +0 -0
- data/lib/{genesis_rails → generators/genesis_rails/install/files}/templates/erb/scaffold/edit.html.erb +0 -0
- data/lib/{genesis_rails → generators/genesis_rails/install/files}/templates/erb/scaffold/index.html.erb +0 -0
- data/lib/{genesis_rails → generators/genesis_rails/install/files}/templates/erb/scaffold/new.html.erb +0 -0
- data/lib/{genesis_rails → generators/genesis_rails/install/files}/templates/erb/scaffold/show.html.erb +0 -0
- data/lib/generators/genesis_rails/install/files/templates/rspec/scaffold/controller_spec.rb +163 -0
- data/lib/generators/genesis_rails/install/install_generator.rb +22 -0
- data/lib/genesis_rails/version.rb +1 -1
- data/lib/genesis_rails.rb +0 -2
- metadata +14 -74
- data/lib/generators/genesis_rails/copy_templates/copy_templates_generator.rb +0 -17
- data/lib/generators/genesis_rails/service/USAGE +0 -12
- data/lib/generators/genesis_rails/service/service_generator.rb +0 -11
- data/lib/generators/genesis_rails/service/templates/service.rb +0 -17
- data/lib/genesis_rails/services/base.rb +0 -10
- data/lib/genesis_rails/services/crud.rb +0 -21
- data/lib/genesis_rails/templates/rails/scaffold_controller/controller.rb +0 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fb1fafeec13dac54a08b4eb6849dba8de99c5e4
|
4
|
+
data.tar.gz: 6b12741f096b061baa3da1f039375ac492d364d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7fd2e722fc1beb69d831d462535846f16397f4cb6ef7d4d14479814b1c175cfaf6687ff3f0bf6200fecc50581df71423bd6cd54126ea7149d759881e457aae0
|
7
|
+
data.tar.gz: f2b26ba579155f875b1f8cbccb84258280e339639cda97b8d54464250d5f13f5c071c8f32f03215cf4c9304f1051821936cee20ff2df56dd863960cfc49a8870
|
data/README.md
CHANGED
@@ -4,20 +4,22 @@ GenesisRails is a warehouse for templates and initial configurations for
|
|
4
4
|
brand new rails project with the minimum needed for a quick development
|
5
5
|
environment.
|
6
6
|
|
7
|
-
##
|
7
|
+
## Pre requisites
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
So, there is no explicit pre requisite to install this gem and use it in your
|
10
|
+
rails project. But I actually recommend to be running with `rails ~> 4.2`,
|
11
|
+
`ruby ~> 2.2`, `postgres` (any version) aaaaaaand, if you are creating your
|
12
|
+
project now, to create it with the following command:
|
11
13
|
|
12
|
-
|
13
|
-
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
```bash
|
15
|
+
rails new my_project -T -d postgresql
|
16
|
+
```
|
17
|
+
|
18
|
+
That's it!
|
19
|
+
|
20
|
+
## Install
|
17
21
|
|
18
|
-
|
19
|
-
make sure you have all these gems on your Gemfile. Here is an example that
|
20
|
-
should work:
|
22
|
+
To intall this project, first, you need to add the following to your Gemfile:
|
21
23
|
|
22
24
|
```ruby
|
23
25
|
gem 'genesis_rails'
|
@@ -37,5 +39,145 @@ source 'https://rails-assets.org' do
|
|
37
39
|
end
|
38
40
|
```
|
39
41
|
|
40
|
-
|
42
|
+
Then:
|
43
|
+
|
44
|
+
```bash
|
45
|
+
bundle install
|
46
|
+
```
|
47
|
+
|
48
|
+
The other gems are not hard dependencies, but we have some templates defined
|
49
|
+
that need them to work correctly, please check their installation guides
|
50
|
+
individually. If you are not so interested in reading everyone, here comes a
|
51
|
+
list of commands you'll probably need to execute:
|
52
|
+
|
53
|
+
```bash
|
54
|
+
rails g responders:install
|
55
|
+
rails g simple_form:install --bootstrap
|
56
|
+
rails g rspec:install
|
57
|
+
```
|
58
|
+
|
59
|
+
And finally:
|
60
|
+
|
61
|
+
```bash
|
62
|
+
rails g genesis_rails:install
|
63
|
+
```
|
64
|
+
|
65
|
+
This will copy all the default templates into your rails project, and may have
|
66
|
+
conflicts with other gems. If so, just diff them and choose which one you
|
67
|
+
prefer.
|
68
|
+
|
69
|
+
It's important to remember that this needs to be recopied everytime there is a
|
70
|
+
update on them.
|
71
|
+
|
72
|
+
## How to update
|
73
|
+
|
74
|
+
Well, that's a long story. Depends of course on how many things are you updating
|
75
|
+
at once, but I would recommend update all of them separetedly. So:
|
76
|
+
|
77
|
+
```bash
|
78
|
+
bundle update genesis_rails
|
79
|
+
```
|
80
|
+
|
81
|
+
After that, you'll be able to just:
|
82
|
+
|
83
|
+
|
84
|
+
```bash
|
85
|
+
rails g genesis_rails:install
|
86
|
+
```
|
87
|
+
|
88
|
+
This, of course, can have changes dependeding on which is the update and take
|
89
|
+
attention to your changes to the templates you've copied. Choose wisely if you
|
90
|
+
want or not the new version. :stuck_out_and_tongue:
|
91
|
+
|
92
|
+
## Recommended configuration
|
93
|
+
|
94
|
+
Follows some recommended configuration for your application if you are using
|
95
|
+
genesis:
|
96
|
+
|
97
|
+
```
|
98
|
+
<app/assets/stylesheets/application.css>
|
99
|
+
# add the following lines to ignore the scaffolds file and import the needed
|
100
|
+
# bootstrap
|
101
|
+
*= stub scaffolds
|
102
|
+
*= require bootstrap
|
103
|
+
|
104
|
+
<app/assets/javascripts/applicationjs>
|
105
|
+
# add the following lines to import the needed bootstrap
|
106
|
+
//= require bootstrap
|
107
|
+
//= require magic_view
|
108
|
+
|
109
|
+
# then, at the end of file, add the following line to init the magic_view code
|
110
|
+
//= require magic_view/init
|
111
|
+
|
112
|
+
<config/application.rb>
|
113
|
+
# add the following lines to configure the generators properly
|
114
|
+
config.generators do |g|
|
115
|
+
g.test_framework :rspec,
|
116
|
+
fixtures: true,
|
117
|
+
model_specs: false,
|
118
|
+
helper_specs: false
|
119
|
+
g.fixture_replacement :factory_girl
|
120
|
+
g.factory_girl dir: "spec/factories"
|
121
|
+
end
|
122
|
+
|
123
|
+
<spec/rails_helper.rb>
|
124
|
+
# uncomment the following line to require the needed support files (one of them
|
125
|
+
# is copied on the genesis_rails installations)
|
126
|
+
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
127
|
+
|
128
|
+
# then change the value of the following config to false (the raise of the code below
|
129
|
+
# is granting this will be always that way and explaining why it's needed, but
|
130
|
+
# I'm warning you one more tim: DO THIS AND DON'T REMOVE THAT RAISE!!!!!!)
|
131
|
+
config.use_transactional_fixtures = false
|
132
|
+
|
133
|
+
# and finally add the following lines to configure the database cleaner for your
|
134
|
+
# rspec tests (put them inside the
|
135
|
+
config.before(:suite) do
|
136
|
+
# don't remove this raise for the sake of God!!!
|
137
|
+
if config.use_transactional_fixtures?
|
138
|
+
raise(<<-MSG)
|
139
|
+
Delete line `config.use_transactional_fixtures = true` from rails_helper.rb
|
140
|
+
(or set it to false) to prevent uncommitted transactions being used in
|
141
|
+
JavaScript-dependent specs.
|
142
|
+
|
143
|
+
During testing, the app-under-test that the browser driver connects to
|
144
|
+
uses a different database connection to the database connection used by
|
145
|
+
the spec. The app's database connection would not be able to access
|
146
|
+
uncommitted transaction data setup over the spec's database connection.
|
147
|
+
MSG
|
148
|
+
end
|
149
|
+
DatabaseCleaner.clean_with(:truncation)
|
150
|
+
end
|
151
|
+
|
152
|
+
config.before(:each) do
|
153
|
+
DatabaseCleaner.strategy = :transaction
|
154
|
+
end
|
155
|
+
|
156
|
+
config.before(:each, type: :feature) do
|
157
|
+
# :rack_test driver's Rack app under test shares database connection
|
158
|
+
# with the specs, so continue to use transaction strategy for speed.
|
159
|
+
driver_shares_db_connection_with_specs = Capybara.current_driver == :rack_test
|
160
|
+
|
161
|
+
unless driver_shares_db_connection_with_specs
|
162
|
+
# Driver is probably for an external browser with an app
|
163
|
+
# under test that does *not* share a database connection with the
|
164
|
+
# specs, so use truncation strategy.
|
165
|
+
DatabaseCleaner.strategy = :truncation
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
config.before(:each) do
|
170
|
+
DatabaseCleaner.start
|
171
|
+
end
|
172
|
+
|
173
|
+
config.append_after(:each) do
|
174
|
+
DatabaseCleaner.clean
|
175
|
+
end
|
176
|
+
```
|
177
|
+
|
178
|
+
## TODO
|
179
|
+
|
180
|
+
- [ ] Make that generator become a rake task
|
181
|
+
- [ ] Create a template.rb file to use with `rails new -m template.rb`
|
182
|
+
- [ ] Make an install generator to install everything that's needed
|
41
183
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
class Base
|
3
|
+
# this method returns the attributes to use on controller tests
|
4
|
+
def test_attributes
|
5
|
+
attributes.delete_if do |key, value|
|
6
|
+
["id", "created_at", "updated_at"].include? key
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_session(user = nil)
|
13
|
+
# You'll probably need to do something like this:
|
14
|
+
#
|
15
|
+
# controller.sign_in(user || FactoryGirl.create(:user))
|
16
|
+
#
|
17
|
+
# Or if you are using devise:
|
18
|
+
#
|
19
|
+
# sign_in(user || FactoryGirl.create(:user))
|
20
|
+
#
|
21
|
+
# If you don't need a user logged in, just leave this method as it is now
|
22
|
+
end
|
23
|
+
|
24
|
+
def valid_session_hash(user = nil)
|
25
|
+
# You'll probably need to do something like this:
|
26
|
+
#
|
27
|
+
# user ||= FactoryGirl.create(:user)
|
28
|
+
# {user_id: user.id}
|
29
|
+
#
|
30
|
+
# If you don't need a user logged in, just leave this method as it is now
|
31
|
+
{}
|
32
|
+
end
|
33
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,163 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
4
|
+
# It demonstrates how one might use RSpec to specify the controller code that
|
5
|
+
# was generated by Rails when you ran the scaffold generator.
|
6
|
+
#
|
7
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
8
|
+
# generator. If you are using any extension libraries to generate different
|
9
|
+
# controller code, this generated spec may or may not pass.
|
10
|
+
#
|
11
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
12
|
+
# of tools you can use to make these specs even more expressive, but we're
|
13
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
14
|
+
#
|
15
|
+
# Compared to earlier versions of this generator, there is very limited use of
|
16
|
+
# stubs and message expectations in this spec. Stubs are only used when there
|
17
|
+
# is no simpler way to get a handle on the object needed for the example.
|
18
|
+
# Message expectations are only used when there is no simpler way to specify
|
19
|
+
# that an instance is receiving a specific message.
|
20
|
+
|
21
|
+
<% module_namespacing do -%>
|
22
|
+
RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:controller) %> do
|
23
|
+
|
24
|
+
# This should return the minimal set of attributes required to create a valid
|
25
|
+
# <%= class_name %>. As you add validations to <%= class_name %>, be sure to
|
26
|
+
# adjust the attributes here as well.
|
27
|
+
let(:valid_attributes) {
|
28
|
+
FactoryGirl.build(:<%= file_name %>).test_attributes
|
29
|
+
}
|
30
|
+
|
31
|
+
let(:invalid_attributes) {
|
32
|
+
FactoryGirl.build(:<%= file_name %>, :invalid).test_attributes
|
33
|
+
}
|
34
|
+
|
35
|
+
# This should return the minimal set of values that should be in the session
|
36
|
+
# in order to pass any filters (e.g. authentication) defined in
|
37
|
+
# <%= controller_class_name %>Controller. Be sure to keep this updated too.
|
38
|
+
let(:valid_session) { valid_session_hash }
|
39
|
+
|
40
|
+
<% unless options[:singleton] -%>
|
41
|
+
describe "GET #index" do
|
42
|
+
it "assigns all <%= table_name.pluralize %> as @<%= table_name.pluralize %>" do
|
43
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
44
|
+
get :index, {}, valid_session
|
45
|
+
expect(assigns(:<%= table_name %>)).to eq([<%= file_name %>])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
<% end -%>
|
50
|
+
describe "GET #show" do
|
51
|
+
it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
|
52
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
53
|
+
get :show, {:id => <%= file_name %>.to_param}, valid_session
|
54
|
+
expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "GET #new" do
|
59
|
+
it "assigns a new <%= ns_file_name %> as @<%= ns_file_name %>" do
|
60
|
+
get :new, {}, valid_session
|
61
|
+
expect(assigns(:<%= ns_file_name %>)).to be_a_new(<%= class_name %>)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "GET #edit" do
|
66
|
+
it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
|
67
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
68
|
+
get :edit, {:id => <%= file_name %>.to_param}, valid_session
|
69
|
+
expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "POST #create" do
|
74
|
+
context "with valid params" do
|
75
|
+
it "creates a new <%= class_name %>" do
|
76
|
+
expect {
|
77
|
+
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
|
78
|
+
}.to change(<%= class_name %>, :count).by(1)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "assigns a newly created <%= ns_file_name %> as @<%= ns_file_name %>" do
|
82
|
+
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
|
83
|
+
expect(assigns(:<%= ns_file_name %>)).to be_a(<%= class_name %>)
|
84
|
+
expect(assigns(:<%= ns_file_name %>)).to be_persisted
|
85
|
+
end
|
86
|
+
|
87
|
+
it "redirects to the created <%= ns_file_name %>" do
|
88
|
+
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
|
89
|
+
expect(response).to redirect_to(<%= class_name %>.last)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context "with invalid params" do
|
94
|
+
it "assigns a newly created but unsaved <%= ns_file_name %> as @<%= ns_file_name %>" do
|
95
|
+
post :create, {:<%= ns_file_name %> => invalid_attributes}, valid_session
|
96
|
+
expect(assigns(:<%= ns_file_name %>)).to be_a_new(<%= class_name %>)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "re-renders the 'new' template" do
|
100
|
+
post :create, {:<%= ns_file_name %> => invalid_attributes}, valid_session
|
101
|
+
expect(response).to render_template("new")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "PUT #update" do
|
107
|
+
context "with valid params" do
|
108
|
+
let(:new_attributes) {
|
109
|
+
FactoryGirl.build(:<%= file_name %>, :another).test_attributes
|
110
|
+
}
|
111
|
+
|
112
|
+
it "updates the requested <%= ns_file_name %>" do
|
113
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
114
|
+
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => new_attributes}, valid_session
|
115
|
+
<%= file_name %>.reload
|
116
|
+
expect(<%= file_name %>.test_attributes).to eq(new_attributes)
|
117
|
+
end
|
118
|
+
|
119
|
+
it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
|
120
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
121
|
+
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session
|
122
|
+
expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>)
|
123
|
+
end
|
124
|
+
|
125
|
+
it "redirects to the <%= ns_file_name %>" do
|
126
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
127
|
+
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session
|
128
|
+
expect(response).to redirect_to(<%= file_name %>)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context "with invalid params" do
|
133
|
+
it "assigns the <%= ns_file_name %> as @<%= ns_file_name %>" do
|
134
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
135
|
+
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => invalid_attributes}, valid_session
|
136
|
+
expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>)
|
137
|
+
end
|
138
|
+
|
139
|
+
it "re-renders the 'edit' template" do
|
140
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
141
|
+
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => invalid_attributes}, valid_session
|
142
|
+
expect(response).to render_template("edit")
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
describe "DELETE #destroy" do
|
148
|
+
it "destroys the requested <%= ns_file_name %>" do
|
149
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
150
|
+
expect {
|
151
|
+
delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
|
152
|
+
}.to change(<%= class_name %>, :count).by(-1)
|
153
|
+
end
|
154
|
+
|
155
|
+
it "redirects to the <%= table_name %> list" do
|
156
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
157
|
+
delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
|
158
|
+
expect(response).to redirect_to(<%= index_helper %>_url)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
<% end -%>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
module GenesisRails
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
def self.source_root
|
5
|
+
@source_root ||= GenesisRails::Engine.root.join "lib/generators/genesis_rails/install/files"
|
6
|
+
end
|
7
|
+
|
8
|
+
def install_files
|
9
|
+
templates = self.class.source_root.join "templates"
|
10
|
+
Dir[templates.join "**/*.*"].each do |file|
|
11
|
+
copy_file file, "lib/templates/#{file.gsub(templates.to_s, "")}"
|
12
|
+
end
|
13
|
+
|
14
|
+
spec_support = self.class.source_root.join "spec/support"
|
15
|
+
Dir[spec_support.join "**/*.*"].each do |file|
|
16
|
+
copy_file file, "spec/support/#{file.gsub(spec_support.to_s, "")}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
data/lib/genesis_rails.rb
CHANGED
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kelvinst
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,62 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: coffee-rails
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '4.1'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '4.1'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec-rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.4'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.4'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: simple_form
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.2'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.2'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: responders
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.1'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.1'
|
83
27
|
- !ruby/object:Gem::Dependency
|
84
28
|
name: pry
|
85
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,25 +55,21 @@ files:
|
|
111
55
|
- app/assets/javascripts/magic_view/init.coffee
|
112
56
|
- app/assets/stylesheets/scaffold.css
|
113
57
|
- config/routes.rb
|
114
|
-
- lib/generators/genesis_rails/
|
115
|
-
- lib/generators/genesis_rails/
|
116
|
-
- lib/generators/genesis_rails/
|
117
|
-
- lib/generators/genesis_rails/
|
118
|
-
- lib/generators/genesis_rails/
|
58
|
+
- lib/generators/genesis_rails/install/USAGE
|
59
|
+
- lib/generators/genesis_rails/install/files/spec/support/genesis_rails.rb
|
60
|
+
- lib/generators/genesis_rails/install/files/templates/active_record/model/model.rb
|
61
|
+
- lib/generators/genesis_rails/install/files/templates/coffee/assets/javascript.coffee
|
62
|
+
- lib/generators/genesis_rails/install/files/templates/erb/scaffold/_form.html.erb
|
63
|
+
- lib/generators/genesis_rails/install/files/templates/erb/scaffold/edit.html.erb
|
64
|
+
- lib/generators/genesis_rails/install/files/templates/erb/scaffold/index.html.erb
|
65
|
+
- lib/generators/genesis_rails/install/files/templates/erb/scaffold/new.html.erb
|
66
|
+
- lib/generators/genesis_rails/install/files/templates/erb/scaffold/show.html.erb
|
67
|
+
- lib/generators/genesis_rails/install/files/templates/rspec/scaffold/controller_spec.rb
|
68
|
+
- lib/generators/genesis_rails/install/install_generator.rb
|
119
69
|
- lib/genesis_rails.rb
|
120
70
|
- lib/genesis_rails/auto_include_magic_view.rb
|
121
71
|
- lib/genesis_rails/engine.rb
|
122
72
|
- lib/genesis_rails/railtie.rb
|
123
|
-
- lib/genesis_rails/services/base.rb
|
124
|
-
- lib/genesis_rails/services/crud.rb
|
125
|
-
- lib/genesis_rails/templates/active_record/model/model.rb
|
126
|
-
- lib/genesis_rails/templates/coffee/assets/javascript.coffee
|
127
|
-
- lib/genesis_rails/templates/erb/scaffold/_form.html.erb
|
128
|
-
- lib/genesis_rails/templates/erb/scaffold/edit.html.erb
|
129
|
-
- lib/genesis_rails/templates/erb/scaffold/index.html.erb
|
130
|
-
- lib/genesis_rails/templates/erb/scaffold/new.html.erb
|
131
|
-
- lib/genesis_rails/templates/erb/scaffold/show.html.erb
|
132
|
-
- lib/genesis_rails/templates/rails/scaffold_controller/controller.rb
|
133
73
|
- lib/genesis_rails/version.rb
|
134
74
|
- lib/tasks/genesis_rails_tasks.rake
|
135
75
|
- test/dummy/README.rdoc
|
@@ -189,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
129
|
version: '0'
|
190
130
|
requirements: []
|
191
131
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.5.1
|
193
133
|
signing_key:
|
194
134
|
specification_version: 4
|
195
135
|
summary: A complete set of tools for building rails applications
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
module GenesisRails
|
3
|
-
class CopyTemplatesGenerator < Rails::Generators::Base
|
4
|
-
def self.source_root
|
5
|
-
@source_root ||= GenesisRails::Engine.root.join "lib/genesis_rails/templates"
|
6
|
-
end
|
7
|
-
|
8
|
-
def copy_template_files
|
9
|
-
root = self.class.source_root
|
10
|
-
Dir[root.join "**/*.*"].each do |file|
|
11
|
-
copy_file file, "lib/templates/#{file.gsub(root.to_s, "")}"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
|
@@ -1,12 +0,0 @@
|
|
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
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
module GenesisRails
|
3
|
-
class ServiceGenerator < Rails::Generators::NamedBase
|
4
|
-
source_root File.expand_path('../templates', __FILE__)
|
5
|
-
|
6
|
-
def create_services_files
|
7
|
-
template "service.rb", "app/services/#{file_name.pluralize}_service.rb"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<% module_namespacing do -%>
|
2
|
-
class <%= class_name.pluralize %>Service < GenesisRails::Services::CRUD
|
3
|
-
# you can overwrite these methods if you want to do something more when you
|
4
|
-
# are dealing with the <%= class_name %> model
|
5
|
-
# def create
|
6
|
-
# super # just don't forget to call super
|
7
|
-
# end
|
8
|
-
#
|
9
|
-
# def update
|
10
|
-
# super # just don't forget to call super
|
11
|
-
# end
|
12
|
-
#
|
13
|
-
# def delete
|
14
|
-
# super # just don't forget to call super
|
15
|
-
# end
|
16
|
-
end
|
17
|
-
<% end -%>
|
@@ -1,62 +0,0 @@
|
|
1
|
-
<% if namespaced? -%>
|
2
|
-
require_dependency "<%= namespaced_path %>/application_controller"
|
3
|
-
|
4
|
-
<% end -%>
|
5
|
-
<% module_namespacing do -%>
|
6
|
-
class <%= controller_class_name %>Controller < ApplicationController
|
7
|
-
respond_to :html
|
8
|
-
|
9
|
-
def index
|
10
|
-
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>
|
11
|
-
end
|
12
|
-
|
13
|
-
def show
|
14
|
-
load_<%= singular_table_name %>
|
15
|
-
end
|
16
|
-
|
17
|
-
def new
|
18
|
-
@<%= singular_table_name %> = <%= orm_class.build(class_name) %>
|
19
|
-
end
|
20
|
-
|
21
|
-
def edit
|
22
|
-
load_<%= singular_table_name %>
|
23
|
-
end
|
24
|
-
|
25
|
-
def create
|
26
|
-
@<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
|
27
|
-
<%= controller_class_name %>Service.new(@<%= singular_table_name %>).create
|
28
|
-
|
29
|
-
respond_with @<%= singular_table_name %>
|
30
|
-
end
|
31
|
-
|
32
|
-
def update
|
33
|
-
load_<%= singular_table_name %>
|
34
|
-
@<%= singular_table_name %>.attributes = <%= singular_table_name %>_params
|
35
|
-
<%= controller_class_name %>Service.new(@<%= singular_table_name %>).update
|
36
|
-
|
37
|
-
respond_with @<%= singular_table_name %>
|
38
|
-
end
|
39
|
-
|
40
|
-
def destroy
|
41
|
-
load_<%= singular_table_name %>
|
42
|
-
<%= controller_class_name %>Service.new(@<%= singular_table_name %>).delete
|
43
|
-
|
44
|
-
respond_with @<%= singular_table_name %>
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def load_<%= singular_table_name %>
|
50
|
-
@<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
51
|
-
end
|
52
|
-
|
53
|
-
def <%= "#{singular_table_name}_params" %>
|
54
|
-
<%- if attributes_names.empty? -%>
|
55
|
-
params.fetch(:<%= singular_table_name %>, {})
|
56
|
-
<%- else -%>
|
57
|
-
params.require(:<%= singular_table_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
|
58
|
-
<%- end -%>
|
59
|
-
end
|
60
|
-
end
|
61
|
-
<% end -%>
|
62
|
-
|