bullet_train-super_scaffolding 1.6.34 → 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: 348e2d1c3d553ea106a60c2e600a3f886f2a851f12b1e7c628325e290af9ac6f
4
- data.tar.gz: fdae29e7f29e70a45dca618d0caeb6c6d2b3d90aecd4130918fe758f349e47cc
3
+ metadata.gz: 044dbfb0828cf00ca12e975d7b49769c555636666e64a16ac4d0fc05db19c4d7
4
+ data.tar.gz: e77bce7fdde5eb6fd3e5a3598bab8520bcf8c37b21a78de734aed69692d7f132
5
5
  SHA512:
6
- metadata.gz: 50231140243f71280e6dfc7ce8388d1e892d83c79a791b3b6b0a20d31d55fd33bb768c0613eefb02e5c82af623b1e79d0a6f0d7ca4fbb6bf7b65555c66aba2c3
7
- data.tar.gz: f2f991e16c416add60d8c0571ec45dce46aa28303f176b1e5fd9dde1fd8950cc63010c65bbcc313a84d236ab202bf517a175e216b06b84c2547d6bed66aff8e6
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.34"
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.34
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-27 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