scaffold_pico 1.1.0 → 1.1.1

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: adabe54ded80e5976a75d4d65aa7ce6dc8a41b07
4
- data.tar.gz: bb86d680ce7e83d132d36df32eb9494a94b52e17
3
+ metadata.gz: df0411ec77af7a5a9029ab4d415d93d7dff531db
4
+ data.tar.gz: 2e490e8d45236a2556117e3c0d97dccfc22b83dd
5
5
  SHA512:
6
- metadata.gz: a0997f57d71aef0078b86c9e4539a7ba2ec25dc3b1931f1829ff1752bbebb971d51a527678515b7fce1d5b8347650551b474d93e916c5b06503a1bf9908956a4
7
- data.tar.gz: bb46f812cf2eebdf80817bef01bc95267189616b219fc9ac95502757ce1ea53f41e9f23d21824491a4ec3d77ef6d5cc4c39edeca14ce9cc654635fa518395f95
6
+ metadata.gz: 698ca572ec89af25554caa8c40929172ef7ffb8752db0213e4c96fa7c94e9e07a77679426070e315b5fcfd30f77efa4636618ead2c8dc97962ec8997639effd1
7
+ data.tar.gz: 2a14f3e834ad40d8f88a48c7727b65504df845722cca4e1f3b4f292805279ccc1877bac82c783d4e7e452786e29466439f6fee88fd68a1a8548f468094959ce4
data/README.md CHANGED
@@ -1,10 +1,5 @@
1
- # scaffold_pico
2
- ## Scaffolding done right
3
- With this gem you can create your own pretty administration with a seconds.
4
-
5
- No learning curve - clean Ruby on Rails.
6
-
7
- No need to learn DSLs or support 3rd party gems.
1
+ # Scaffolding done right
2
+ No learning curve - replace Ruby on Rails scaffold, no DSLs or 3rd party gems.
8
3
 
9
4
  * Support namespaces for the model and the controllers
10
5
  * You can generate scaffolds for nested resources
@@ -15,12 +10,10 @@ No need to learn DSLs or support 3rd party gems.
15
10
  * You can specify includes/joins for the #index action
16
11
  * Implement basic search
17
12
 
18
- ![alt tag](https://raw.githubusercontent.com/gudata/scaffold_pico/master/doc/screenshot_index.jpg)
19
-
20
13
 
21
14
  # SYNOPSIS
22
15
 
23
- scaffold_pico.rb \
16
+ scaffold_pico \
24
17
  -m Admin::Vector -n administration -b AdminController \
25
18
  --nested_in_resources Assets::VectorFrame \
26
19
  --fields name: description:text featured:boolean license:belongs_to group_id:integer svg:file \
@@ -28,7 +21,12 @@ No need to learn DSLs or support 3rd party gems.
28
21
  --search-fields name aspect_ratio license created_at \
29
22
  --fabrication \
30
23
  --services_folder=services \
31
- --debug --css_framework=materialize
24
+ --debug --css_framework=materialize \
25
+ --custom_inflection vector vectors
26
+
27
+
28
+ ![alt tag](https://raw.githubusercontent.com/gudata/scaffold_pico/master/doc/screenshot_index.jpg)
29
+
32
30
 
33
31
 
34
32
  # Install
@@ -93,4 +91,4 @@ You can't generate scaffolds for a mounted named engines. I don't know if we nee
93
91
 
94
92
  ## Copyright
95
93
 
96
- Copyright (c) 2017 gudata. See LICENSE.txt for further details.
94
+ Copyright (c) 2017 gudata. See LICENSE.txt for further details.
@@ -84,6 +84,10 @@ module Scaffold
84
84
  desc 'Fields on which the search will be done. Example: --search-fields title body published amount tracking_id'
85
85
  end
86
86
 
87
+ option :custom_inflection do
88
+ long '--custom_inflection *FIELDS'
89
+ desc 'Custom singular and plural form. Example: --custom_inflection campus campuses'
90
+ end
87
91
 
88
92
  separator ''
89
93
  separator 'Defaults: '
@@ -111,7 +115,6 @@ module Scaffold
111
115
  desc 'Where to put the search model. Example: --services=actions'
112
116
  end
113
117
 
114
-
115
118
  separator ''
116
119
  separator 'Common options: '
117
120
 
@@ -122,16 +125,24 @@ module Scaffold
122
125
 
123
126
  end
124
127
 
125
-
126
128
  end
127
129
 
128
130
  def run
129
131
  if Choice[:model]
132
+ add_custom_inflection(Choice.choices[:custom_inflection])
130
133
  scaffold = Scaffold::Main.new(Choice.choices)
131
134
  scaffold.run
132
135
  else
133
136
  puts "try #{$0} --help"
134
137
  end
135
138
  end
139
+
140
+ private
141
+
142
+ def add_custom_inflection(inflection)
143
+ ActiveSupport::Inflector.inflections do |inflect|
144
+ inflect.irregular inflection.first, inflection.last
145
+ end
146
+ end
136
147
  end
137
- end
148
+ end
@@ -66,6 +66,7 @@ module Scaffold
66
66
  # content = ::ERB.new(content, nil, '-').result(@params.instance_eval{ binding })#.gsub(/\s+\n$/, "")
67
67
 
68
68
  # content = ::ERB.new(content, 0, '>').result(ErbContext.new(context_hash).get_binding)
69
+ # https://github.com/jeremyevans/erubi
69
70
  content = ::ERB.new(content, 0, '-').result(ErbContext.new(context_hash).get_binding)
70
71
  end
71
72
 
@@ -26,6 +26,9 @@ module Scaffold
26
26
 
27
27
  # CompanyOwnership
28
28
  def class_name
29
+ puts "----"
30
+ puts @class_name
31
+ puts @class_name.singularize
29
32
  @class_name.singularize
30
33
  end
31
34
 
@@ -11,21 +11,27 @@ module Scaffold
11
11
  def model_name
12
12
  @resource.model_name
13
13
  end
14
+
14
15
  def modules
15
16
  @resource.modules
16
17
  end
18
+
17
19
  def modules?
18
20
  @resource.modules?
19
21
  end
22
+
20
23
  def name
21
24
  @resource.name
22
25
  end
26
+
23
27
  def class_name
24
28
  @resource.class_name
25
29
  end
30
+
26
31
  def collection_name
27
32
  @resource.collection_name
28
33
  end
34
+
29
35
  def class_name_with_modules
30
36
  @resource.class_name_with_modules
31
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scaffold_pico
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - gudata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-07 00:00:00.000000000 Z
11
+ date: 2017-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -153,4 +153,3 @@ signing_key:
153
153
  specification_version: 4
154
154
  summary: Scaffold should be simple
155
155
  test_files: []
156
- has_rdoc: