Sha256: 519cac5d62a8e910bc69bd048f7836d6e7e21b639baed37148464c4f2b21ab6c

Contents?: true

Size: 800 Bytes

Versions: 2

Compression:

Stored size: 800 Bytes

Contents

module Dubious
  module CLI
    class Generator < Thor
      include Thor::Actions
      source_root File.dirname(__FILE__)+"/../templates/generator"
      argument :name
      
      
      desc "model NAME", "creates model file" 
      def model#(name)
        template "model.mirah.tt", "app/models/#{name.underscore}.mirah"
      end
      
      desc "controller NAME", "creates controller file"
      def controller#(name)
        template "controller.mirah.tt", "app/controllers/#{name.underscore}_controller.mirah"
        empty_directory "app/views/#{name.underscore}"
        inject_into_file "WEB-INF/app.yaml", "  - url: /#{name.underscore}/*\n    servlet: controllers.#{name.classify}Controller\n    name: #{name.underscore}\n",:after => "handlers:\n"
      end
      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dubious-0.0.2-java lib/dubious/cli/generator.rb
dubious-0.0.1-java lib/dubious/cli/generator.rb