bullet_train-super_scaffolding 1.8.3 → 1.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bullet_train/super_scaffolding/version.rb +1 -1
- data/lib/bullet_train/super_scaffolding.rb +2 -1
- data/lib/generators/super_scaffold/audit_logs/USAGE +22 -0
- data/lib/generators/super_scaffold/audit_logs/audit_logs_generator.rb +26 -0
- data/lib/scaffolding/transformer.rb +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d13e2ca8acbd4f74a92b812cf24cfd0a0fdfa2f4e8372f519d35d96060f982a
|
4
|
+
data.tar.gz: b4952136c4d0da1849b42acd1db9d656fcbdf9a2d1570af87a7c56a5c2184f9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54e7d5bbf8e2883b09ed3491522323fe1454ad70fa61151565b35e075baa0a995cf498be368303762b2938d9ecab1ec79563ea0b6ce6384475524b0026cf2446
|
7
|
+
data.tar.gz: c53225806490e8fa42924568b4b11edf8d0277803e1afea86f6dc5fe849cf84099c5749d90235c684021aaeb20b582b0fa20c8f7732c8bda31cf99fdfd05a1be
|
@@ -22,7 +22,8 @@ module BulletTrain
|
|
22
22
|
"action-models:targets-one" => "BulletTrain::ActionModels::Scaffolders::TargetsOneScaffolder",
|
23
23
|
"action-models:targets-one-parent" => "BulletTrain::ActionModels::Scaffolders::TargetsOneParentScaffolder",
|
24
24
|
"action-models:performs-export" => "BulletTrain::ActionModels::Scaffolders::PerformsExportScaffolder",
|
25
|
-
"action-models:performs-import" => "BulletTrain::ActionModels::Scaffolders::PerformsImportScaffolder"
|
25
|
+
"action-models:performs-import" => "BulletTrain::ActionModels::Scaffolders::PerformsImportScaffolder",
|
26
|
+
"audit-logs" => "BulletTrain::AuditLogs::Scaffolders::AuditLogScaffolder"
|
26
27
|
}
|
27
28
|
|
28
29
|
class Runner
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Description:
|
2
|
+
Generate files needed to add an audit log to a model.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
E.g. Add audit logs to Posts from a Team.
|
6
|
+
rails generate super_scaffold:audit_logs Post Team name:text_field
|
7
|
+
|
8
|
+
The attributes you specify will be added to the _version partial and used to show different versions of the model.
|
9
|
+
|
10
|
+
This will create:
|
11
|
+
db/migrate/20241115152914_add_project_to_activity_versions.rb
|
12
|
+
app/views/account/projects/_version.html.erb'.
|
13
|
+
And update:
|
14
|
+
app/models/project.rb
|
15
|
+
app/models/activity/version.rb
|
16
|
+
app/views/account/projects/show.html.erb
|
17
|
+
app/models/activity/version.rb
|
18
|
+
config/routes.rb
|
19
|
+
app/controllers/account/projects_controller.rb
|
20
|
+
|
21
|
+
🏆 Protip: Commit your other changes before running Super Scaffolding so it's easy to undo if you (or we) make any mistakes.
|
22
|
+
If you do that, you can reset to your last commit state by using `git checkout .` and `git clean -d -f`.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative "../super_scaffold_base"
|
2
|
+
require "scaffolding/routes_file_manipulator"
|
3
|
+
|
4
|
+
class AuditLogsGenerator < Rails::Generators::Base
|
5
|
+
include SuperScaffoldBase
|
6
|
+
|
7
|
+
source_root File.expand_path("templates", __dir__)
|
8
|
+
|
9
|
+
namespace "super_scaffold:audit_logs"
|
10
|
+
|
11
|
+
argument :target_model, type: :string
|
12
|
+
argument :parent_model, type: :string
|
13
|
+
argument :attributes, type: :array, banner: "attribute:type attribute:type"
|
14
|
+
|
15
|
+
def generate
|
16
|
+
if defined?(BulletTrain::AuditLogs)
|
17
|
+
# We add the name of the specific super_scaffolding command that we want to
|
18
|
+
# invoke to the beginning of the argument string.
|
19
|
+
ARGV.unshift "audit-logs"
|
20
|
+
BulletTrain::SuperScaffolding::Runner.new.run
|
21
|
+
else
|
22
|
+
puts "You must have AuditLogs installed if you want to use this generator.".red
|
23
|
+
puts "Please refer to the documentation for more information: https://bullettrain.co/docs/audit-logs"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1519,7 +1519,7 @@ class Scaffolding::Transformer
|
|
1519
1519
|
routes_manipulator.apply([routes_namespace])
|
1520
1520
|
Scaffolding::FileManipulator.write(routes_path, routes_manipulator.lines)
|
1521
1521
|
rescue => _
|
1522
|
-
add_additional_step :red, "We weren't able to automatically add your `#{routes_namespace}` routes for you. In theory this should be very rare, so if you could reach out on
|
1522
|
+
add_additional_step :red, "We weren't able to automatically add your `#{routes_namespace}` routes for you. In theory this should be very rare, so if you could reach out on Discord, you could probably provide context that will help us fix whatever the problem was. In the meantime, to add the routes manually, we've got a guide at https://blog.bullettrain.co/nested-namespaced-rails-routing-examples/ ."
|
1523
1523
|
end
|
1524
1524
|
|
1525
1525
|
# If we're using a custom namespace, we have to make sure the newly
|
@@ -1552,7 +1552,7 @@ class Scaffolding::Transformer
|
|
1552
1552
|
api_routes_manipulator.apply([BulletTrain::Api.current_version.to_sym])
|
1553
1553
|
Scaffolding::FileManipulator.write("config/routes/api/#{BulletTrain::Api.current_version}.rb", api_routes_manipulator.lines)
|
1554
1554
|
rescue => _
|
1555
|
-
add_additional_step :red, "We weren't able to automatically add your `api/#{BulletTrain::Api.current_version}` routes for you. In theory this should be very rare, so if you could reach out on
|
1555
|
+
add_additional_step :red, "We weren't able to automatically add your `api/#{BulletTrain::Api.current_version}` routes for you. In theory this should be very rare, so if you could reach out on Discord, you could probably provide context that will help us fix whatever the problem was. In the meantime, to add the routes manually, we've got a guide at https://blog.bullettrain.co/nested-namespaced-rails-routing-examples/ ."
|
1556
1556
|
end
|
1557
1557
|
end
|
1558
1558
|
end
|
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.8.
|
4
|
+
version: 1.8.5
|
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-11-
|
11
|
+
date: 2024-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|
@@ -174,6 +174,8 @@ files:
|
|
174
174
|
- lib/generators/super_scaffold/action_models/targets_one/targets_one_generator.rb
|
175
175
|
- lib/generators/super_scaffold/action_models/targets_one_parent/USAGE
|
176
176
|
- lib/generators/super_scaffold/action_models/targets_one_parent/targets_one_parent_generator.rb
|
177
|
+
- lib/generators/super_scaffold/audit_logs/USAGE
|
178
|
+
- lib/generators/super_scaffold/audit_logs/audit_logs_generator.rb
|
177
179
|
- lib/generators/super_scaffold/conversations/USAGE
|
178
180
|
- lib/generators/super_scaffold/conversations/conversations_generator.rb
|
179
181
|
- lib/generators/super_scaffold/field/USAGE
|