Sha256: aba1b140e45adb549e48eede1d2414441c52ac4aa495fbe6f7e489343d7c6e23

Contents?: true

Size: 1.73 KB

Versions: 4

Compression:

Stored size: 1.73 KB

Contents

require 'spiderfw/create'

class CreateCommand < CmdParse::Command


    def initialize
        super( 'create', true, true )
        @short_desc = _("Create a working dir for development or installation")
#        @description = _("")

        app = CmdParse::Command.new( 'app', false )
        app.short_desc = _("Create a new application")
        app.options = CmdParse::OptionParserWrapper.new do |opt|
            opt.on("--path", 
                   _("The path where to create the app (defaults to the app folder under the current path)"),
                   "-p"){ |path|
                @path = path
            }
            opt.on("--module", _("The module name; by default, the app name will be camelized"), "-m"){ |module_name|
                @module_name = module_name
            }
        end
        app.set_execution_block do |names|
            @path ||= Dir.pwd+'/apps'
            names.each do |name|
                Spider::Create.app(name, @path, @module_name)
                puts "Created app #{name} at #{@path}/#{name}" if ($verbose)
            end
        end
        self.add_command(app, false)
        
        install = CmdParse::Command.new('home', false)
        install.short_desc = _("Create an installation")
        install.options = CmdParse::OptionParserWrapper.new do |opt|
            opt.on("--path", 
                   _("The path where to create the installation (defaults to the path)"),
                   "-p"){ |path|
                @path = path
            }
        end
        install.set_execution_block do |installs|
            @path ||= Dir.pwd
            installs.each do |inst|
                Spider::Create.home(inst, @path)
            end
        end
        self.add_command(install, false)


    end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spiderfw-0.5.13 lib/spiderfw/cmd/commands/create.rb
spiderfw-0.5.12 lib/spiderfw/cmd/commands/create.rb
spiderfw-0.5.11 lib/spiderfw/cmd/commands/create.rb
spiderfw-0.5.10 lib/spiderfw/cmd/commands/create.rb