Sha256: ca5d500d6e0939a97ef1203566f45522bb0f5fe291df62fafe956e0a4005c4f2
Contents?: true
Size: 1.86 KB
Versions: 2
Compression:
Stored size: 1.86 KB
Contents
module Padrino module Generators class App < Thor::Group # Add this generator to our padrino-gen Padrino::Generators.add_generator(:app, self) # Define the source template root def self.source_root; File.expand_path(File.dirname(__FILE__)); end def self.banner; "padrino-gen project [name]"; end # Include related modules include Thor::Actions include Padrino::Generators::Actions desc "Description:\n\n\tpadrino-gen app generates a new Padrino application" argument :name, :desc => "The name of your padrino application" class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string class_option :destroy, :aliases => '-d', :default => false, :type => :boolean # Show help if no argv given require_arguments! # Copies over the Padrino base admin application def create_app self.destination_root = options[:root] @class_name = name.gsub(/\W/, "_").underscore.classify if in_app_root? directory("app/", destination_root(name)) append_file destination_root("config/apps.rb"), "\nPadrino.mount(\"#{@class_name}\").to(\"/#{name.underscore}\")" return if self.behavior == :revoke say (<<-TEXT).gsub(/ {10}/,'') ================================================================= Your #{@class_name} application has been installed. This application has been mounted to /#{name.underscore} You can configure a different path by editing 'config/apps.rb' ================================================================= TEXT else say "You are not at the root of a Padrino application! (config/boot.rb not found)" and exit unless in_app_root? end end end # App end # Generators end # Padrino
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
padrino-gen-0.9.10 | lib/padrino-gen/generators/app.rb |
padrino-gen-0.9.9 | lib/padrino-gen/generators/app.rb |