effective_developer 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: a98431485d3aaaaa800ff0ce881b3846fbc154f6
4
- data.tar.gz: c7fd087d4e38a3859c85f92099fdb7210f7af038
3
+ metadata.gz: ce1975bd0775294de65297b619248e266ab88a87
4
+ data.tar.gz: 34efafaa3dce62af63bcb3571e72383dbb8fd065
5
5
  SHA512:
6
- metadata.gz: 2150d74a7c45702968db18947d68b5d6a7eceed6c2fbae6f8801fcbc6b96afcfede8ce052bf7882f85e8d43468ff3762deed4dea09e5f320cf9904e8644c952a
7
- data.tar.gz: d5f63dded7cf53a851dd397bbdd56250dc0b30c61eeaa1bc6094bf3605fc5ce628944ca472d76e4a30c7ab9859315bd3b35a6a1b7d2167ed7e4cf0feb0129a78
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. with --attributes. like effective:scaffold_controller
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
@@ -1,3 +1,3 @@
1
1
  module EffectiveDeveloper
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end
@@ -1,3 +1,4 @@
1
+ require 'effective_resources'
1
2
  require 'generators/effective/helpers'
2
3
  require 'effective_developer/engine'
3
4
  require 'effective_developer/version'
@@ -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 %>, :desc
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 %>
@@ -7,7 +7,7 @@ module CsvImporters
7
7
  end
8
8
 
9
9
  def process_row
10
- # assign_columns(<%= klass %>.new).save!
10
+ # assign_columns(<%= klass.singularize %>.new).save!
11
11
  raise 'todo'
12
12
  end
13
13
  end
@@ -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?(&:password_digest?) -%>
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.1
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-26 00:00:00.000000000 Z
11
+ date: 2017-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails