common_core_js 0.4.1 → 0.4.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
  SHA256:
3
- metadata.gz: 5b509c4f6a9d3e9948e5a49a3ea649cb693e75ac47ff43f40cc7bf90e3c96590
4
- data.tar.gz: d8336db5c37a0db6d82cd7c926d9d6bd9f1b5cdd97c46e18d35ce30a0126dc77
3
+ metadata.gz: e57dda2081a4472872145ebd8cdd9fdf28be5014488ee5080224d15c51f6e14f
4
+ data.tar.gz: 18440eefe37cb6eae705870efc0c37fba1caefdb9e2fef30e72575238dafcfd8
5
5
  SHA512:
6
- metadata.gz: a49c509c20a0e82c30dbadd3ea700a8eb341e943f6d3347898d09ff3bd0ca29e656302265d9c02784ef0948e7a10bf9a1fd0e31b35dfec52704ea73325bfa30e
7
- data.tar.gz: 2d882167e819535280cc20a4bb7ba47c3c35c2a179f4e2ac0170f36f8547a78b364d3cccb8a303a72b117ddc3ee4d06d4f0f08a17eb59b3009917035b4e0dbf8
6
+ metadata.gz: cae68e3566b0546c0d03f9a4061a9a357c33f925fc87957525ac94fe0f62fb3882227f824f2031260b7e23a827140d3f13bf7341926ff96a169c175783b68fdb
7
+ data.tar.gz: 258050b8e32b576e2ec0ad8b60ce01809a59f9107897ab7f92e160a4ab1073f7212784180954437728c54a9a1cefde2834d9a5f6973f0644d084801f76da9abe
@@ -0,0 +1,2 @@
1
+ github: [jasonfb]
2
+ custom: ["https://jfb.teachable.com"]
data/LICENSE CHANGED
@@ -1,8 +1,11 @@
1
1
  Permission is hereby granted to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2
2
 
3
- Any users of this software agree to work to dismantle systemic racism, seek justice for black, brown, transgender people, women, and LTBQIAA+ representation and inclusion.
3
+ Any users of this software agree to work to
4
+ 1) dismantle systemic racism;
5
+ 2) seek justice for black, brown, transgender people, women, and
6
+ 3) work towards LGBTQIAA+ representation and inclusion.
4
7
 
5
- Organizations using this software agree to center the narratives of black, brown, and transgender people people.
8
+ Organizations using this software agree to center the narratives of black, brown, transgender, and non-advantaged people in the world.
6
9
 
7
10
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
11
 
data/README.md CHANGED
@@ -50,7 +50,7 @@ rails generate common_core:scaffold Thing
50
50
 
51
51
  Note that the arguments are not preceeded by dashes and are followed by equal sign and the input you are giving.
52
52
 
53
- Flags take two dashes (--) and do not take any value.
53
+ Flags take two dashes (--) and do not take any value. Always pass options first, followed by the flags (or else your options won't work!)
54
54
 
55
55
  ### First Argument
56
56
 
@@ -58,7 +58,7 @@ TitleCase class name of the thing you want to build a scaffoling for.
58
58
 
59
59
  ### `namespace=`
60
60
 
61
- pass `namespace=` as a flag to denote a namespace to apply to the Rails path helpers
61
+ pass `namespace=` as an option to denote a namespace to apply to the Rails path helpers
62
62
 
63
63
 
64
64
  `rails generate common_core:scaffold Thing namespace=dashboard`
@@ -82,7 +82,7 @@ end
82
82
 
83
83
  ### `nest=`
84
84
 
85
- pass `nest=` as a flag to denote a nested resources
85
+ pass `nest=` to denote a nested resources
86
86
 
87
87
 
88
88
  `rails generate common_core:scaffold Line nest=invoice`
@@ -139,7 +139,7 @@ When you display anything built with the scaffolding, we assume the `current_use
139
139
 
140
140
  If you use Devise, you probably already have a `current_user` method available in your controllers. If you don't use Devise, you can implement it in your ApplicationController.
141
141
 
142
- If you use a different object other than "User" for authentication, override using the `auth` flag.
142
+ If you use a different object other than "User" for authentication, override using the `auth` option.
143
143
 
144
144
  `rails generate common_core:scaffold Thing auth=current_account`
145
145
 
@@ -209,7 +209,7 @@ You don't need this if the pluralized version is just + "s" of the singular vers
209
209
 
210
210
  Use this flag to create controllers with no root authentication. You can still use an auth_identifier, which can be useful for a meta-leval authentication to the controoler.
211
211
 
212
- For example, FOR ADMIN CONTROLLERS ONLY, supply a auth_identifier and use --god flag
212
+ For example, FOR ADMIN CONTROLLERS ONLY, supply a auth_identifier and use `--god` flag
213
213
 
214
214
  In God mode, the objects are loaded directly from the base class (these controllers have full access)
215
215
  ```
@@ -293,3 +293,10 @@ environment.plugins.prepend('Provide',
293
293
  module.exports = environment
294
294
 
295
295
  ```
296
+
297
+
298
+ # ACKNOWLEDGEMENTS
299
+
300
+ ### "POOR MAN"
301
+
302
+ I hope one day I will leave this Earth a poor man (like my code) owning only the most simple structure for the simple form of my existence. Thanks for having educated me in this wisdom goes to my former mentor [@trak3r](https://github.com/trak3r)!
@@ -8,12 +8,15 @@ Gem::Specification.new do |spec|
8
8
  spec.name = "common_core_js"
9
9
  spec.version = CommonCoreJs::VERSION
10
10
  spec.license = 'MIT'
11
- spec.date = '2020-06-28'
11
+ spec.date = '2020-10-29'
12
12
  spec.summary = "A gem build scaffolding."
13
13
  spec.description = "Simple, plug & play Rails scaffolding with really simple Javascript"
14
14
  spec.authors = ["Jason Fleetwood-Boldt"]
15
15
  spec.email = 'jason.fb@datatravels.com'
16
16
 
17
+ spec.homepage = 'https://blog.jasonfleetwoodboldt.com/common-core-js/'
18
+ spec.metadata = { "source_code_uri" => "https://github.com/jasonfb/common_core_js",
19
+ "course_material_uri" => "https://jfb.teachable.com/p/jason-s-open-source-work/"}
17
20
 
18
21
 
19
22
 
@@ -1,3 +1,3 @@
1
1
  module CommonCoreJs
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -68,6 +68,7 @@ module CommonCore
68
68
 
69
69
  args[1..-1].each do |a|
70
70
  var_name, var_value = a.split("=")
71
+ puts var_name
71
72
  case (var_name)
72
73
 
73
74
  when "plural"
@@ -137,21 +138,39 @@ module CommonCore
137
138
  @object_owner_sym = @auth.gsub("current_", "").to_sym
138
139
  @object_owner_eval = @auth
139
140
  else
140
- @object_owner_sym = @nested_args.last.to_sym
141
- @object_owner_eval = "@#{@nested_args.last}"
141
+
142
+ if @nested_args.any?
143
+ @object_owner_sym = @nested_args.last.to_sym
144
+ @object_owner_eval = "@#{@nested_args.last}"
145
+ else
146
+ @object_owner_sym = ""
147
+ @object_owner_eval = ""
148
+ end
142
149
  end
143
150
 
144
151
 
145
152
 
146
153
  # create the columns
147
- auth_assoc_field = auth_assoc + "_id"
148
-
149
- ownership_field = eval("#{singular_class}.reflect_on_association(:#{@object_owner_sym})").name.to_s + "_id"
154
+ if !@object_owner_sym.empty?
155
+ auth_assoc_field = auth_assoc + "_id"
156
+ assoc = eval("#{singular_class}.reflect_on_association(:#{@object_owner_sym})")
157
+ if assoc
158
+ ownership_field = assoc.name.to_s + "_id"
159
+ else
160
+ puts "Ooops... it looks like is no association for #{@object_owner_sym} on #{singular_class} "
161
+ exit
162
+ end
163
+ end
150
164
 
151
165
 
152
- exclude_fields = [auth_assoc_field.to_sym, ownership_field.to_sym, :id, :created_at, :updated_at, :encrypted_password, :reset_password_token,
166
+ exclude_fields = [ :id, :created_at, :updated_at, :encrypted_password, :reset_password_token,
153
167
  :reset_password_sent_at, :remember_created_at, :confirmation_token, :confirmed_at,
154
168
  :confirmation_sent_at, :unconfirmed_email]
169
+
170
+ exclude_fields << auth_assoc_field.to_sym if !auth_assoc_field.nil?
171
+ exclude_fields << ownership_field.to_sym if !ownership_field.nil?
172
+
173
+
155
174
  begin
156
175
  @columns = object.columns.map(&:name).map(&:to_sym).reject{|field| exclude_fields.include?(field) }
157
176
  rescue StandardError => e
@@ -266,7 +285,7 @@ module CommonCore
266
285
  end
267
286
 
268
287
  def path_helper_args
269
- [(@nested_args if @nested_args.any?).collect{|a| "@#{a}"} , singular].join(",")
288
+ [(@nested_args if @nested_args.any? || []).collect{|a| "@#{a}"} , singular].join(",")
270
289
  end
271
290
 
272
291
  def path_helper_singular
@@ -10,7 +10,7 @@ describe <%= controller_class_name %> do
10
10
  before(:each) do
11
11
  @request.env["devise.mapping"] = Devise.mappings[:account]
12
12
 
13
- sign_in <%= @auth %>, scope: :<%= @auth_identifier %>
13
+ sign_in <%= @auth %>, scope: :<%= @auth %>
14
14
  end
15
15
 
16
16
  describe "index" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: common_core_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Fleetwood-Boldt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-28 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -129,6 +129,7 @@ extensions: []
129
129
  extra_rdoc_files: []
130
130
  files:
131
131
  - ".generators"
132
+ - ".github/FUNDING.yml"
132
133
  - ".gitignore"
133
134
  - ".rakeTasks"
134
135
  - FUNDING.yml
@@ -229,8 +230,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
230
  - !ruby/object:Gem::Version
230
231
  version: '0'
231
232
  requirements: []
232
- rubygems_version: 3.0.3
233
- signing_key:
233
+ rubygems_version: 3.0.8
234
+ signing_key:
234
235
  specification_version: 4
235
236
  summary: A gem build scaffolding.
236
237
  test_files: []