bullet_train-super_scaffolding 1.6.33 → 1.6.35

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: 61c74946dc400abc7c914c7cebd2d79def49125cf0561da2429428c381e6fc56
4
- data.tar.gz: 703d825338c9660fae3acc86599fc867c3828972cf73bf7ec61549f9e4d18094
3
+ metadata.gz: 044dbfb0828cf00ca12e975d7b49769c555636666e64a16ac4d0fc05db19c4d7
4
+ data.tar.gz: e77bce7fdde5eb6fd3e5a3598bab8520bcf8c37b21a78de734aed69692d7f132
5
5
  SHA512:
6
- metadata.gz: b0f17cfb5260980835bcbe0fe726a104c8daf8113f73e7e190a3c7529199a91e15d8637f42d683c7ec4c1ddb299eee74bb1730d5fc7a14150ea55cc07d64f379
7
- data.tar.gz: 9c6d53e92e968671a69e94be218a9e02dfa6ebbd227843de9eac7f6320f8fdbb2d3682d6073db79abdb080c6593da813527f4e3d4f0a84a74ef32a88c587fda8
6
+ metadata.gz: 5aa17cc571a64107afc56007743dc5c14b5192dc021dee371684fcd21fcd50a3b302fef4e73261979769df0bb652a2fb0b9a9750adc21e219330483e7161b4d1
7
+ data.tar.gz: 9b4e70dcb0af3243235372a36cd42acd9ea655246829fd927af7ecad450fbd195a64a1b453724d08464e65ec251c694fcf09371f0545e66f27c4bc308c5a873b
@@ -40,7 +40,7 @@
40
40
 
41
41
  <%# 🚅 super scaffolding will insert new targets one parent action model buttons above this line. %>
42
42
  <%# 🚅 super scaffolding will insert new bulk action model buttons above this line. %>
43
- <%= render "shared/bulk_action_select" if creative_concepts.many? %>
43
+ <%= render "shared/bulk_action_select" if creative_concepts.any? %>
44
44
 
45
45
  <%= link_to t('global.buttons.back'), [:account, context], class: "#{first_button_primary(:absolutely_abstract_creative_concept)} back" unless hide_back %>
46
46
  <% end %>
@@ -51,7 +51,7 @@
51
51
 
52
52
  <%# 🚅 super scaffolding will insert new targets one parent action model buttons above this line. %>
53
53
  <%# 🚅 super scaffolding will insert new bulk action model buttons above this line. %>
54
- <%= render "shared/bulk_action_select" if tangible_things.many? %>
54
+ <%= render "shared/bulk_action_select" if tangible_things.any? %>
55
55
 
56
56
  <% unless hide_back %>
57
57
  <%= link_to t('global.buttons.back'), [:account, context], class: "#{first_button_primary(:completely_concrete_tangible_thing)} back" %>
@@ -45,16 +45,41 @@ module BulletTrain
45
45
  unless File.exist?(oauth_transform_string("./app/models/oauth/stripe_account.rb", options)) &&
46
46
  File.exist?(oauth_transform_string("./app/models/integrations/stripe_installation.rb", options)) &&
47
47
  File.exist?(oauth_transform_string("./app/models/webhooks/incoming/oauth/stripe_account_webhook.rb", options))
48
- puts ""
49
- puts oauth_transform_string("🚨 Before doing the actual Super Scaffolding, you'll need to generate the models like so:", options).red
50
- puts ""
51
- puts oauth_transform_string(" rails g model Oauth::StripeAccount uid:string data:jsonb user:references", options).red
52
- puts oauth_transform_string(" rails g model Integrations::StripeInstallation team:references oauth_stripe_account:references name:string", options).red
53
- puts oauth_transform_string(" rails g model Webhooks::Incoming::Oauth::StripeAccountWebhook data:jsonb processed_at:datetime verified_at:datetime oauth_stripe_account:references", options).red
54
- puts ""
55
- puts "However, don't do the `rake db:migrate` until after you re-run Super Scaffolding, as it will need to update some settings in those migrations.".red
56
- puts ""
57
- return
48
+
49
+ oauth_model_data = {
50
+ "Oauth::StripeAccount": "rails generate model Oauth::StripeAccount uid:string data:jsonb user:references",
51
+ "Integrations::StripeInstallation": "rails generate model Integrations::StripeInstallation team:references oauth_stripe_account:references name:string",
52
+ "Webhooks::Incoming::Oauth::StripeAccountWebhook": "rails generate model Webhooks::Incoming::Oauth::StripeAccountWebhook data:jsonb processed_at:datetime verified_at:datetime oauth_stripe_account:references"
53
+ }
54
+
55
+ # Transform class names and model migrations.
56
+ transformed_data = {}
57
+ oauth_model_data.each do |key, value|
58
+ transformed_data[oauth_transform_string(key.to_s, options)] = oauth_transform_string(value, options)
59
+ end
60
+
61
+ if @options["skip-migration-generation"]
62
+ undefined_models = transformed_data.keys.each { |key| key.safe_constantize.nil? }
63
+ if undefined_models.any?
64
+ puts ""
65
+ puts "We could not find the following models:".red
66
+ undefined_models.each { |model| puts " #{model}".red }
67
+ puts ""
68
+ puts "🚨 Before doing the actual Super Scaffolding, you'll need to generate the models like so:".red
69
+ puts ""
70
+ transformed_data.each { |_, migration| puts " #{migration}".red }
71
+ puts ""
72
+ puts "However, don't do the `rake db:migrate` until after you re-run Super Scaffolding, as it will need to update some settings in those migrations.".red
73
+ puts ""
74
+ return
75
+ end
76
+ else
77
+ transformed_data.each do |klass, generation_command|
78
+ puts "Generating #{klass} model with '#{generation_command}'".green
79
+ generation_thread = Thread.new { `#{generation_command}` }
80
+ generation_thread.join # Wait for the process to finish.
81
+ end
82
+ end
58
83
  end
59
84
 
60
85
  icon_name = nil
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperScaffolding
3
- VERSION = "1.6.33"
3
+ VERSION = "1.6.35"
4
4
  end
5
5
  end
@@ -37,6 +37,19 @@ class Scaffolding::ClassNamesTransformer
37
37
  parts.last
38
38
  end
39
39
 
40
+ # "In context" here means all of the parts in a namespace
41
+ # without reference to the parts that overlap.
42
+ #
43
+ # For example:
44
+ # Returns everything because there is no overlap.
45
+ # Parent: Team
46
+ # Child: Projects::Site
47
+ # Return value: [["Projects", "Site"], ["Team"]]
48
+ #
49
+ # Returns the namespaces/classes without the parts that overlap.
50
+ # Parent: Projects::Site
51
+ # Child: Projects::Sites::Url
52
+ # Return value: [["Url"], ["Site"]]
40
53
  def all_parts_in_context
41
54
  working_parts = parts
42
55
  working_parent_parts = parent_parts
@@ -174,7 +174,8 @@ def check_required_options_for_attributes(scaffolding_type, attributes, child, p
174
174
  # Generate the models/migrations with the attributes passed.
175
175
  if attributes_to_generate.any?
176
176
  case scaffolding_type
177
- # "join-model" is not here because the `rails g` command is written inline in its own scaffolder.
177
+ # "join-model" and "oauth-provider" are not here because the
178
+ # `rails g` command is written inline in their own respective scaffolders.
178
179
  when "crud"
179
180
  puts "Generating #{child} model with '#{generation_command}'".green
180
181
  when "crud-field"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-super_scaffolding
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.33
4
+ version: 1.6.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-26 00:00:00.000000000 Z
11
+ date: 2024-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard