Sha256: 5b9347f9bb224b34532c1ab52673824bc0efca15bfdf1e916d352d6c9f0eefb0

Contents?: true

Size: 1.63 KB

Versions: 41

Compression:

Stored size: 1.63 KB

Contents

require_relative "../../super_scaffold_base"
require "scaffolding/routes_file_manipulator"

module ActionModels
  class TargetsManyGenerator < Rails::Generators::Base
    include SuperScaffoldBase

    source_root File.expand_path("templates", __dir__)

    namespace "super_scaffold:action_models:targets_many"

    argument :action_model
    argument :target_model
    argument :parent_model

    class_option :skip_migration_generation, type: :boolean, default: false, desc: "Don't generate the model migration"
    class_option :skip_form, type: :boolean, default: false, desc: "Don't alter the new/edit form"
    class_option :skip_show, type: :boolean, default: false, desc: "Don't alter the show view"
    class_option :skip_table, type: :boolean, default: false, desc: "Only add to the new/edit form and show view."
    class_option :skip_locales, type: :boolean, default: false, desc: "Don't alter locale files"
    class_option :skip_api, type: :boolean, default: false, desc: "Don't alter the api payloads"
    class_option :skip_model, type: :boolean, default: false, desc: "Don't alter the model file"

    def generate
      if defined?(BulletTrain::ActionModels)
        # We add the name of the specific super_scaffolding command that we want to
        # invoke to the beginning of the argument string.
        ARGV.unshift "action-models:targets-many"
        BulletTrain::SuperScaffolding::Runner.new.run
      else
        puts "You must have Action Models installed if you want to use this generator.".red
        puts "Please refer to the documentation for more information: https://bullettrain.co/docs/action-models"
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
bullet_train-super_scaffolding-1.7.11 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.7.10 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.7.9 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.7.3 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.7.2 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.7.1 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.7.0 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.38 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.37 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.36 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.35 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.34 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.33 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.32 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.31 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.30 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.29 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.28 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.27 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb
bullet_train-super_scaffolding-1.6.26 lib/generators/super_scaffold/action_models/targets_many/targets_many_generator.rb