effective_developer 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -2
- data/lib/effective_developer/version.rb +1 -1
- data/lib/effective_developer.rb +1 -0
- data/lib/generators/effective/ability_generator.rb +5 -0
- data/lib/scaffolds/datatables/datatable.rb +1 -1
- data/lib/scaffolds/importers/csv_importer.rb +1 -1
- data/lib/scaffolds/models/model.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce1975bd0775294de65297b619248e266ab88a87
|
4
|
+
data.tar.gz: 34efafaa3dce62af63bcb3571e72383dbb8fd065
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dd047b0be47a0266fc26d71ae6b127dc4e56d363303eb1a0426e36d1a2c69f65018c119f904a3c5525454adddc2df5e417ec6056f0c86ad617688cc280227c6
|
7
|
+
data.tar.gz: 4ad38f81ea47ee63c013932cb6fd23e4d730839b11357d27b9a218ee8fc1a7658a15275635dd97df33f337cacead0dfa13619a48ac63f1a599bed8ef2726f998
|
data/README.md
CHANGED
@@ -158,6 +158,15 @@ rake pg:clone
|
|
158
158
|
rake pg:clone[origin,staging]
|
159
159
|
```
|
160
160
|
|
161
|
+
## validate
|
162
|
+
|
163
|
+
Loads every ActiveRecord object and calls `.valid?` on it.
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
rake validate
|
167
|
+
rake validate[post]
|
168
|
+
```
|
169
|
+
|
161
170
|
# Rails Helpers
|
162
171
|
|
163
172
|
## CSV Importer
|
@@ -253,6 +262,7 @@ Or to skip the model & migration:
|
|
253
262
|
```ruby
|
254
263
|
rails generate effective:scaffold_controller thing
|
255
264
|
rails generate effective:scaffold_controller thing index show
|
265
|
+
rails generate effective:scaffold_controller thing index show --attributes name description
|
256
266
|
rails generate effective:scaffold_controller admin/thing crud mark_as_paid
|
257
267
|
rails generate effective:scaffold_controller admin/thing crud-show
|
258
268
|
```
|
@@ -288,7 +298,7 @@ class Post < ApplicationRecord
|
|
288
298
|
end
|
289
299
|
```
|
290
300
|
|
291
|
-
and then run
|
301
|
+
and then run
|
292
302
|
```console
|
293
303
|
rails generate effective:scaffold post
|
294
304
|
rails generate effective:scaffold_controller admin/post
|
@@ -305,7 +315,7 @@ You can call scaffolds one at a time:
|
|
305
315
|
rails generate effective:model thing name:string description:text
|
306
316
|
rails generate effective:migration thing name:string description:text
|
307
317
|
|
308
|
-
# Thes accept actions on the command line.
|
318
|
+
# Thes accept actions on the command line. Pass --attributes as an option. like effective:scaffold_controller
|
309
319
|
rails generate effective:controller thing # /admin/thing
|
310
320
|
rails generate effective:route thing
|
311
321
|
rails generate effective:ability thing # CanCanCan
|
data/lib/effective_developer.rb
CHANGED
@@ -20,6 +20,11 @@ module Effective
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def create_ability
|
23
|
+
unless File.exists?('app/models/ability.rb')
|
24
|
+
say_status :skipped, :ability, :yellow
|
25
|
+
return
|
26
|
+
end
|
27
|
+
|
23
28
|
Effective::CodeWriter.new('app/models/ability.rb') do |w|
|
24
29
|
if resource.namespaces.blank?
|
25
30
|
if w.find { |line, depth| depth == 2 && line == ability }
|
@@ -7,7 +7,7 @@ class <%= resource.namespaced_class_name.pluralize %>Datatable < Effective::Data
|
|
7
7
|
|
8
8
|
<% end -%>
|
9
9
|
datatable do
|
10
|
-
default_order :<%= attributes.find { |att| att.name == 'updated_at' } || attributes.first
|
10
|
+
default_order :<%= (attributes.find { |att| att.name == 'updated_at' } || attributes.first).name -%>, :desc
|
11
11
|
|
12
12
|
<% resource.belong_tos.each do |reference| -%>
|
13
13
|
table_column :<%= reference.name %>
|
@@ -8,7 +8,7 @@ class <%= resource.class_name %> < <%= parent_class_name.classify %>
|
|
8
8
|
has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %>
|
9
9
|
<% end -%>
|
10
10
|
<% end -%>
|
11
|
-
<% if attributes.any?(
|
11
|
+
<% if attributes.any? { |att| att.respond_to?(:password_digest?) && att.password_digest? } -%>
|
12
12
|
has_secure_password
|
13
13
|
<% end -%>
|
14
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_developer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|