Sha256: 0b172e98a50405a618e30ba4eba937a0361819e229e078fbdf8b7e7bd1f7dcc2
Contents?: true
Size: 1.91 KB
Versions: 1
Compression:
Stored size: 1.91 KB
Contents
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may not # use this file except in compliance with the License. A copy of the License is # located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. This file is distributed on # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express # or implied. See the License for the specific language governing permissions # and limitations under the License. require "rails/generators/rails/scaffold/scaffold_generator" require "generators/aws_record/resource/resource_generator" module AwsRecord module Generators class ScaffoldGenerator < ResourceGenerator source_root File.expand_path('../../model/templates', __FILE__) remove_class_option :orm remove_class_option :actions class_option :api, type: :boolean class_option :stylesheets, type: :boolean, desc: "Generate Stylesheets" class_option :stylesheet_engine, desc: "Engine for Stylesheets" class_option :assets, type: :boolean class_option :resource_route, type: :boolean class_option :scaffold_stylesheet, type: :boolean def handle_skip @options = @options.merge(stylesheets: false) unless options[:assets] @options = @options.merge(stylesheet_engine: false) unless options[:stylesheets] && options[:scaffold_stylesheet] end hook_for :scaffold_controller, in: :aws_record, required: true hook_for :assets, in: :rails do |assets| invoke assets, [controller_name] end hook_for :stylesheet_engine, in: :rails do |stylesheet_engine| if behavior == :invoke invoke stylesheet_engine, [controller_name] end end private def initialize(args, *options) options[0] << "--scaffold" super end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aws-record-generator-1.0.0.pre.2 | lib/generators/aws_record/scaffold/scaffold_generator.rb |