bullet_train-super_scaffolding 1.6.11 → 1.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bullet_train/super_scaffolding/version.rb +1 -1
- data/lib/generators/super_scaffold/USAGE +36 -0
- data/lib/generators/super_scaffold/field/USAGE +15 -0
- data/lib/generators/super_scaffold/field/field_generator.rb +27 -0
- data/lib/generators/super_scaffold/incoming_webhooks/USAGE +16 -0
- data/lib/generators/super_scaffold/incoming_webhooks/incoming_webhooks_generator.rb +18 -0
- data/lib/generators/super_scaffold/join_model/USAGE +28 -0
- data/lib/generators/super_scaffold/join_model/join_model_generator.rb +28 -0
- data/lib/generators/super_scaffold/oauth_provider/USAGE +50 -0
- data/lib/generators/super_scaffold/oauth_provider/oauth_provider_generator.rb +24 -0
- data/lib/generators/super_scaffold/super_scaffold_base.rb +41 -0
- data/lib/generators/super_scaffold/super_scaffold_generator.rb +34 -0
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5a15e9fcfe1268219c9bf057521179f25cfeeaa5c0a9411bcdcbd8cbe270152
|
4
|
+
data.tar.gz: 613a44877e831dd2c1e3715666d4059a623716a2450c2bd7ceff0aa304371e0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b076a56ddd441d854d649ba0dd5dd2e4f4494747bf1fde9b0b239eb32a82fbc04b2437186383da1fc90e2c025b446ed21899e5c5ef7c8e7b8f8ec9db2a0a4de
|
7
|
+
data.tar.gz: 713d83c5c6bc8d09653267cd7725548ffe7cad57d8000cf421e5ecf88c9373cab7048f4e8b4d39ca54bdfefcd2c84b841c63b39a756ca3d01ec55c2874944439
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Description:
|
2
|
+
Generate a production ready CRUD interface for a model. See the docs for more details:
|
3
|
+
https://bullettrain.co/docs/super-scaffolding
|
4
|
+
|
5
|
+
E.g. a Team has many Sites with some attributes:
|
6
|
+
rails g super_scaffold Site Team name:text_field url:text_area
|
7
|
+
|
8
|
+
E.g. a Section belongs to a Page, which belongs to a Site, which belongs to a Team:
|
9
|
+
rails g super_scaffold Section Page,Site,Team title:text_field body:text_area
|
10
|
+
|
11
|
+
E.g. an Image belongs to either a Page or a Site:
|
12
|
+
Doable! See https://bit.ly/2NvO8El for a step by step guide.
|
13
|
+
|
14
|
+
E.g. Pages belong to a Site and are sortable via drag-and-drop:
|
15
|
+
rails g super_scaffold Page Site,Team name:text_field path:text_area --sortable
|
16
|
+
|
17
|
+
Example:
|
18
|
+
E.g. a Team has many Projects each having a name:
|
19
|
+
bin/rails generate super_scaffold Project Team name:text_field
|
20
|
+
|
21
|
+
This will create:
|
22
|
+
app/controllers/account/projects_controller.rb
|
23
|
+
app/controllers/api/v1/projects_controller.rb
|
24
|
+
app/models/project.rb
|
25
|
+
app/views/account/projects/
|
26
|
+
app/views/api/v1/projects/
|
27
|
+
config/locales/en/projects.en.yml
|
28
|
+
db/migrate/20231004190209_create_projects.rb
|
29
|
+
test/controllers/api/v1/projects_controller_test.rb
|
30
|
+
test/factories/projects.rb
|
31
|
+
test/models/project_test.rb
|
32
|
+
|
33
|
+
🏆 Protip: Commit your other changes before running Super Scaffolding so it's easy to undo if you (or we) make any mistakes.
|
34
|
+
If you do that, you can reset to your last commit state by using `git checkout .` and `git clean -d -f`.
|
35
|
+
|
36
|
+
Give it a shot! Let us know if you have any trouble with it! ✌️
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Description:
|
2
|
+
Add a new field to an existing Super Scaffold. See the docs for more details:
|
3
|
+
https://bullettrain.co/docs/super-scaffolding
|
4
|
+
|
5
|
+
Example:
|
6
|
+
bin/rails generate super_scaffold:field Project description:trix_editor
|
7
|
+
|
8
|
+
This will update:
|
9
|
+
app/models/project.rb
|
10
|
+
app/views/account/projects/_form.html.erb
|
11
|
+
app/views/account/projects/show.html.erb
|
12
|
+
config/locales/en/projects.en.yml
|
13
|
+
config/locales/en/projects.en.yml
|
14
|
+
app/controllers/account/projects_controller.rb
|
15
|
+
app/controllers/api/v1/projects_controller.rb
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative "../super_scaffold_base"
|
2
|
+
|
3
|
+
class FieldGenerator < Rails::Generators::Base
|
4
|
+
include SuperScaffoldBase
|
5
|
+
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
namespace "super_scaffold:field"
|
9
|
+
|
10
|
+
argument :model, type: :string
|
11
|
+
argument :attributes, type: :array, default: [], banner: "attribute:type attribute:type"
|
12
|
+
|
13
|
+
class_option :skip_migration_generation, type: :boolean, default: false, desc: "Don't generate the model migration"
|
14
|
+
class_option :skip_form, type: :boolean, default: false, desc: "Don't alter the new/edit form"
|
15
|
+
class_option :skip_show, type: :boolean, default: false, desc: "Don't alter the show view"
|
16
|
+
class_option :skip_table, type: :boolean, default: false, desc: "Only add to the new/edit form and show view."
|
17
|
+
class_option :skip_locales, type: :boolean, default: false, desc: "Don't alter locale files"
|
18
|
+
class_option :skip_api, type: :boolean, default: false, desc: "Don't alter the api payloads"
|
19
|
+
class_option :skip_model, type: :boolean, default: false, desc: "Don't alter the model file"
|
20
|
+
|
21
|
+
def generate
|
22
|
+
# We add the name of the specific super_scaffolding command that we want to
|
23
|
+
# invoke to the beginning of the argument string.
|
24
|
+
ARGV.unshift "crud-field"
|
25
|
+
BulletTrain::SuperScaffolding::Runner.new.run
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Description:
|
2
|
+
Generate a handler for incoming webhooks from an outside source.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
E.g. prepare to receive system-level webhooks from ClickFunnels
|
6
|
+
rails g bullet_train:incoming_webhooks ClickFunnels
|
7
|
+
|
8
|
+
This will create:
|
9
|
+
app/models/webhooks/incoming/click_funnel_webhook.rb
|
10
|
+
app/controllers/webhooks/incoming/click_funnel_webhooks_controller.rb
|
11
|
+
test/controllers/webhooks/incoming/click_funnel_webhooks_controller_test.rb
|
12
|
+
And update:
|
13
|
+
config/routes.rb
|
14
|
+
|
15
|
+
🏆 Protip: Commit your other changes before running Super Scaffolding so it's easy to undo if you (or we) make any mistakes.
|
16
|
+
If you do that, you can reset to your last commit state by using `git checkout .` and `git clean -d -f`.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative "super_scaffold_base"
|
2
|
+
|
3
|
+
class IncomingWebhooksGenerator < Rails::Generators::Base
|
4
|
+
include SuperScaffoldBase
|
5
|
+
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
namespace "super_scaffold:incoming_webhooks"
|
9
|
+
|
10
|
+
argument :provider_name
|
11
|
+
|
12
|
+
def generate
|
13
|
+
# We add the name of the specific super_scaffolding command that we want to
|
14
|
+
# invoke to the beginning of the argument string.
|
15
|
+
ARGV.unshift "incoming-webhooks"
|
16
|
+
BulletTrain::SuperScaffolding::Runner.new.run
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Description:
|
2
|
+
Generate a Bullet Train Join Model.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
E.g. Add project-specific tags to a project:
|
6
|
+
|
7
|
+
Given the following example models:
|
8
|
+
|
9
|
+
rails g super_scaffold Project Team name:text_field description:trix_editor
|
10
|
+
rails g super_scaffold Projects::Tag Team name:text_field
|
11
|
+
|
12
|
+
1️⃣ Use the standard Rails model generator to generate the join model:
|
13
|
+
|
14
|
+
rails g model Projects::AppliedTag project:references tag:references
|
15
|
+
|
16
|
+
👋 Don't run migrations yet! Sometimes Super Scaffolding updates them for you.
|
17
|
+
|
18
|
+
2️⃣ Use `join-model` scaffolding to prepare the join model for use in `crud-field` scaffolding:
|
19
|
+
|
20
|
+
rails g bullet_train:join_model Projects::AppliedTag project_id{class_name=Project} tag_id{class_name=Projects::Tag}
|
21
|
+
|
22
|
+
3️⃣ Now you can use `crud-field` scaffolding to actually add the field to the form of the parent model:
|
23
|
+
|
24
|
+
rails g super_scaffold:field Project tag_ids:super_select{class_name=Projects::Tag}
|
25
|
+
|
26
|
+
👋 Heads up! There will be one follow-up step output by this command that you need to take action on.
|
27
|
+
|
28
|
+
4️⃣ Now you can run your migrations.
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative "super_scaffold_base"
|
2
|
+
|
3
|
+
class JoinModelGenerator < Rails::Generators::Base
|
4
|
+
include SuperScaffoldBase
|
5
|
+
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
namespace "super_scaffold:join_model"
|
9
|
+
|
10
|
+
argument :join_model
|
11
|
+
argument :left_association
|
12
|
+
argument :right_association
|
13
|
+
|
14
|
+
class_option :skip_migration_generation, type: :boolean, default: false, desc: "Don't generate the model migration"
|
15
|
+
class_option :skip_form, type: :boolean, default: false, desc: "Don't alter the new/edit form"
|
16
|
+
class_option :skip_show, type: :boolean, default: false, desc: "Don't alter the show view"
|
17
|
+
class_option :skip_table, type: :boolean, default: false, desc: "Only add to the new/edit form and show view."
|
18
|
+
class_option :skip_locales, type: :boolean, default: false, desc: "Don't alter locale files"
|
19
|
+
class_option :skip_api, type: :boolean, default: false, desc: "Don't alter the api payloads"
|
20
|
+
class_option :skip_model, type: :boolean, default: false, desc: "Don't alter the model file"
|
21
|
+
|
22
|
+
def generate
|
23
|
+
# We add the name of the specific super_scaffolding command that we want to
|
24
|
+
# invoke to the beginning of the argument string.
|
25
|
+
ARGV.unshift "join-model"
|
26
|
+
BulletTrain::SuperScaffolding::Runner.new.run
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
Description:
|
2
|
+
Generate the setup and configuration for using an external OAuth Provider.
|
3
|
+
|
4
|
+
For a list of readily available provider strategies, see https://github.com/omniauth/omniauth/wiki/List-of-Strategies
|
5
|
+
|
6
|
+
Example:
|
7
|
+
E.g. what we actually did to start Shopify off:
|
8
|
+
bin/rails generate bullet_train:oauth_provider omniauth-shopify-oauth2 shopify Oauth::ShopifyAccount SHOPIFY_API_KEY SHOPIFY_API_SECRET_KEY --icon=ti-shopping-cart
|
9
|
+
(Please note here that the SHOPIFY_API_KEY and SHOPIFY_API_SECRET_KEY strings are not the actual values, just the names we give to the environment variables.)
|
10
|
+
|
11
|
+
This will create:
|
12
|
+
app/models/oauth/shopify_account.rb
|
13
|
+
app/models/concerns/oauth/shopify_accounts/base.rb
|
14
|
+
app/models/webhooks/incoming/oauth/shopify_account_webhook.rb
|
15
|
+
app/models/concerns/webhooks/incoming/oauth/shopify_account_webhooks/base.rb
|
16
|
+
app/controllers/account/oauth/shopify_accounts_controller.rb
|
17
|
+
app/controllers/webhooks/incoming/oauth/shopify_account_webhooks_controller.rb
|
18
|
+
app/views/account/oauth/shopify_accounts/index.html.erb
|
19
|
+
app/views/account/oauth/shopify_accounts/_menu_item.html.erb
|
20
|
+
app/views/account/oauth/shopify_accounts/_index.html.erb
|
21
|
+
app/views/account/oauth/shopify_accounts/edit.html.erb
|
22
|
+
app/views/account/oauth/shopify_accounts/show.html.erb
|
23
|
+
app/views/account/oauth/shopify_accounts/_form.html.erb
|
24
|
+
app/views/account/oauth/shopify_accounts/_breadcrumbs.html.erb
|
25
|
+
test/models/oauth/shopify_account_test.rb
|
26
|
+
test/factories/oauth/shopify_accounts.rb
|
27
|
+
config/locales/en/oauth/shopify_accounts.en.yml
|
28
|
+
app/views/devise/shared/oauth/_shopify.html.erb
|
29
|
+
app/models/integrations/shopify_installation.rb
|
30
|
+
app/models/concerns/integrations/shopify_installations/base.rb
|
31
|
+
app/controllers/account/integrations/shopify_installations_controller.rb
|
32
|
+
app/views/account/integrations/shopify_installations/index.html.erb
|
33
|
+
app/views/account/integrations/shopify_installations/_menu_item.html.erb
|
34
|
+
app/views/account/integrations/shopify_installations/_index.html.erb
|
35
|
+
app/views/account/integrations/shopify_installations/_list.html.erb
|
36
|
+
app/views/account/integrations/shopify_installations/edit.html.erb
|
37
|
+
app/views/account/integrations/shopify_installations/show.html.erb
|
38
|
+
app/views/account/integrations/shopify_installations/_form.html.erb
|
39
|
+
app/views/account/integrations/shopify_installations/new.html.erb
|
40
|
+
app/views/account/integrations/shopify_installations/_breadcrumbs.html.erb
|
41
|
+
test/models/integrations/shopify_installation_test.rb
|
42
|
+
test/factories/integrations/shopify_installations.rb
|
43
|
+
config/locales/en/integrations/shopify_installations.en.yml
|
44
|
+
app/models/webhooks/incoming/oauth/shopify_account_webhook.rb
|
45
|
+
app/controllers/webhooks/incoming/oauth/shopify_account_webhooks_controller.rb
|
46
|
+
|
47
|
+
🏆 Protip: Commit your other changes before running Super Scaffolding so it's easy to undo if you (or we) make any mistakes.
|
48
|
+
If you do that, you can reset to your last commit state by using `git checkout .` and `git clean -d -f`.
|
49
|
+
|
50
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative "super_scaffold_base"
|
2
|
+
|
3
|
+
class OauthProviderGenerator < Rails::Generators::Base
|
4
|
+
include SuperScaffoldBase
|
5
|
+
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
namespace "super_scaffold:oauth_provider"
|
9
|
+
|
10
|
+
argument :omniauth_gem
|
11
|
+
argument :gems_provider_name
|
12
|
+
argument :our_provider_name
|
13
|
+
argument :PROVIDER_API_KEY_ENV_VAR_NAME
|
14
|
+
argument :PROVIDER_API_SECRET_ENV_VAR_NAME
|
15
|
+
|
16
|
+
class_option :icon, type: :string, desc: "Specify an icon."
|
17
|
+
|
18
|
+
def generate
|
19
|
+
# We add the name of the specific super_scaffolding command that we want to
|
20
|
+
# invoke to the beginning of the argument string.
|
21
|
+
ARGV.unshift "oauth-provider"
|
22
|
+
BulletTrain::SuperScaffolding::Runner.new.run
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module SuperScaffoldBase
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
# ##############################
|
6
|
+
#
|
7
|
+
# TODO: Should we retain some of these class options?
|
8
|
+
#
|
9
|
+
# By default we inherit a bunch of options that _would_ automatically be used if we
|
10
|
+
# were writing a normal Rails generator that used normal methods of generating files.
|
11
|
+
# So if you invoke this generator without passing any arguments (and without these
|
12
|
+
# remove_class_option lines) then at the top of the help text you'd see info about all
|
13
|
+
# of these options:
|
14
|
+
#
|
15
|
+
# ##############################
|
16
|
+
#
|
17
|
+
# rails g super_scaffold
|
18
|
+
#
|
19
|
+
# Options:
|
20
|
+
# [--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated engines)
|
21
|
+
# [--skip-collision-check], [--no-skip-collision-check] # Skip collision check
|
22
|
+
#
|
23
|
+
# Runtime options:
|
24
|
+
# -f, [--force] # Overwrite files that already exist
|
25
|
+
# -p, [--pretend], [--no-pretend] # Run but do not make any changes
|
26
|
+
# -q, [--quiet], [--no-quiet] # Suppress status output
|
27
|
+
# -s, [--skip], [--no-skip] # Skip files that already exist
|
28
|
+
#
|
29
|
+
# ##############################
|
30
|
+
#
|
31
|
+
# Maye we have comparable options for some of these and should retain them and
|
32
|
+
# pass them through to the rake task?
|
33
|
+
|
34
|
+
remove_class_option :skip_namespace
|
35
|
+
remove_class_option :skip_collision_check
|
36
|
+
remove_class_option :force
|
37
|
+
remove_class_option :pretend
|
38
|
+
remove_class_option :quiet
|
39
|
+
remove_class_option :skip
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative "super_scaffold_base"
|
2
|
+
|
3
|
+
class SuperScaffoldGenerator < Rails::Generators::Base
|
4
|
+
include SuperScaffoldBase
|
5
|
+
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
namespace "super_scaffold"
|
9
|
+
|
10
|
+
argument :model, type: :string
|
11
|
+
argument :parent_models, type: :string
|
12
|
+
argument :attributes, type: :array, default: [], banner: "attribute:type attribute:type"
|
13
|
+
|
14
|
+
class_option :skip_migration_generation, type: :boolean, default: false, desc: "Don't generate the model migration"
|
15
|
+
class_option :sortable, type: :boolean, default: false, desc: "https://bullettrain.co/docs/super-scaffolding/sortable"
|
16
|
+
class_option :namespace, type: :string, desc: "https://bullettrain.co/docs/namespacing"
|
17
|
+
class_option :sidebar, type: :string, desc: "Pass the Themify icon or Font Awesome icon to automatically add it to the navbar"
|
18
|
+
class_option :only_index, type: :boolean, default: false, desc: "Only scaffold the index view for a model"
|
19
|
+
class_option :skip_views, type: :boolean, default: false, desc: "Don't generate views"
|
20
|
+
class_option :skip_form, type: :boolean, default: false, desc: "Don't generate a new/edit form"
|
21
|
+
class_option :skip_locales, type: :boolean, default: false, desc: "Don't generate locale files"
|
22
|
+
class_option :skip_api, type: :boolean, default: false, desc: "Don't generate api files"
|
23
|
+
class_option :skip_model, type: :boolean, default: false, desc: "Don't generate a model file"
|
24
|
+
class_option :skip_controller, type: :boolean, default: false, desc: "Don't generate a controller file"
|
25
|
+
class_option :skip_routes, type: :boolean, default: false, desc: "Don't generate any routes"
|
26
|
+
class_option :skip_parent, type: :boolean, default: false, desc: "Don't add child models to the show page of their parent"
|
27
|
+
|
28
|
+
def generate
|
29
|
+
# We add the name of the specific super_scaffolding command that we want to
|
30
|
+
# invoke to the beginning of the argument string.
|
31
|
+
ARGV.unshift "crud"
|
32
|
+
BulletTrain::SuperScaffolding::Runner.new.run
|
33
|
+
end
|
34
|
+
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.6.
|
4
|
+
version: 1.6.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|
@@ -163,6 +163,17 @@ files:
|
|
163
163
|
- lib/bullet_train/super_scaffolding/scaffolders/oauth_provider_scaffolder.rb
|
164
164
|
- lib/bullet_train/super_scaffolding/version.rb
|
165
165
|
- lib/bullet_train/terminal_commands.rb
|
166
|
+
- lib/generators/super_scaffold/USAGE
|
167
|
+
- lib/generators/super_scaffold/field/USAGE
|
168
|
+
- lib/generators/super_scaffold/field/field_generator.rb
|
169
|
+
- lib/generators/super_scaffold/incoming_webhooks/USAGE
|
170
|
+
- lib/generators/super_scaffold/incoming_webhooks/incoming_webhooks_generator.rb
|
171
|
+
- lib/generators/super_scaffold/join_model/USAGE
|
172
|
+
- lib/generators/super_scaffold/join_model/join_model_generator.rb
|
173
|
+
- lib/generators/super_scaffold/oauth_provider/USAGE
|
174
|
+
- lib/generators/super_scaffold/oauth_provider/oauth_provider_generator.rb
|
175
|
+
- lib/generators/super_scaffold/super_scaffold_base.rb
|
176
|
+
- lib/generators/super_scaffold/super_scaffold_generator.rb
|
166
177
|
- lib/scaffolding.rb
|
167
178
|
- lib/scaffolding/attribute.rb
|
168
179
|
- lib/scaffolding/block_manipulator.rb
|