Sha256: 5fc98e6744985c731bd5eda790f78e5d92d516d15eb0f1a56de9af0b7889d045

Contents?: true

Size: 1.65 KB

Versions: 27

Compression:

Stored size: 1.65 KB

Contents

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

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

    source_root File.expand_path("templates", __dir__)

    namespace "super_scaffold:action_models:performs_import"

    argument :action_model
    argument :model_to_process
    argument :target_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:performs-import"
        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

27 entries across 27 versions & 1 rubygems

Version Path
bullet_train-super_scaffolding-1.14.0 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.13.0 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.12.3 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.12.2 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.12.1 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.12.0 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.11.0 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.10.0 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.9.0 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.8.5 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.8.4 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.8.3 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.8.2 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.8.1 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.8.0 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.7.23 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.7.22 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.7.21 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.7.20 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb
bullet_train-super_scaffolding-1.7.19 lib/generators/super_scaffold/action_models/performs_import/performs_import_generator.rb