lib/eucalypt/eucalypt-generate/namespaces/generate/cli/generate-scaffold.rb in eucalypt-0.1.3 vs lib/eucalypt/eucalypt-generate/namespaces/generate/cli/generate-scaffold.rb in eucalypt-0.2.0

- old
+ new

@@ -8,10 +8,11 @@ using Colorize option :no, aliases: '-n', type: :array, default: [], enum: %w[m ms c cs h hs], desc: "Omit specified scaffold files" option :rest, aliases: '-r', type: :boolean, default: false, desc: "Generate REST routes for the controller" option :policy, aliases: '-p', type: :boolean, default: false, desc: "Generate a policy with the scaffold" + option :headless, type: :boolean, aliases: '-H', default: false, desc: "Policy with no associated model" option :table, type: :boolean, default: true, desc: "Generate a table migration" desc "scaffold [NAME] *[COLUMN∶TYPE]", "Generates a scaffold".colorize(:grey) def scaffold(name, *columns) directory = File.expand_path('.') if Eucalypt.app? directory @@ -38,20 +39,23 @@ if controller controller = Eucalypt::Generators::Controller.new controller.destination_root = directory policy = options[:rest] && options[:policy] + headless = options[:policy] && options[:headless] controller.generate( name: name, spec: controller_spec, rest: options[:rest], - policy: policy + policy: policy, + headless: headless ) end if options[:policy] args = ['security', 'policy', 'generate', name] - args << %w[-p create edit delete] if options[:rest] + args << '--headless' if options[:headless] + args << %w[-p add edit delete] if options[:rest] args.flatten! Eucalypt::CLI.start(args) end else Eucalypt::Error.wrong_directory \ No newline at end of file