Sha256: 0e1cacaaf8fbc90693db943013ac31697d7b5c7c477b20d52d120f4be4ea7685
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'highline/import' class CapistranoDeployGenerator < Rails::Generators::NamedBase private # See http://stackoverflow.com/questions/2903200/watir-changes-highlines-ask-method def ask(*p, &b) HighLine.new.ask(*p, &b) end def ask_default propmt, default, &b ask(propmt) { |q| q.default = default; q.readline = true } end def agree_default quest, default=nil agree(quest) { |q| q.default = default } end ## # Menu with default element and add own item. def menu_with_default header, items, default idx = items.index default items[idx] = "=> [ #{default} ]" if idx choose do |menu| menu.header = header menu.prompt =%Q{ > Type 1 to add, number or name or Enter to accept default. > Default is specified by '=>' mark. : } menu.choice ('*** Other ***') { return ask "Enter new item: " } menu.choices *(items) menu.readline = true menu.hidden("") { puts default; return default } if default end end def recipe file "load File.expand_path(\"deploy/recipes/#{file}.rb\")" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
capistrano_deploy_generator-0.0.2 | lib/generators/capistrano_deploy/lib/helpers.rb |
capistrano_deploy_generator-0.0.1 | lib/generators/capistrano_deploy/lib/helpers.rb |