Sha256: 1f309f571bf2bd99775994e4a50ac212c52bab09b5e347095b31c0d5e05c0d53

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

module Subtrac
  module Commands
    class Create
      def initialize(args, options)
        options.project = ask("What is the name of the project you would like to create? ") if options.project.nil?
        options.client = ask("Which client is this project for? ") if options.client.nil?
        use_custom_template = agree("Would you like to use a custom template for this project? [y/n]") if options.template.nil?
        if use_custom_template then
          Subtrac.load_config()
          list_of_templates = Dir.entries(File.join(Config.svn_dir,"templates"))
          
          # The new and improved choose()...
          #choices = %{#{list_of_templates}} # %w{ruby python perl}
          say("\nThis is the new mode (default)...")
          choose do |menu|
            menu.prompt = "Which template would you like to use for this project?  "
            list_of_templates.each do |t|
              unless File.directory?(t)
                menu.choice t do options.template = t end
              end
            end
          end

          Subtrac.create_project(options.project,options.client,options.template)
        else
          Subtrac.create_project(options.project,options.client)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ktec-subtrac-0.1.47 lib/subtrac/commands/create.rb
ktec-subtrac-0.1.48 lib/subtrac/commands/create.rb
ktec-subtrac-0.1.49 lib/subtrac/commands/create.rb
ktec-subtrac-0.1.50 lib/subtrac/commands/create.rb
ktec-subtrac-0.1.51 lib/subtrac/commands/create.rb
ktec-subtrac-0.1.52 lib/subtrac/commands/create.rb