Sha256: 03cb1dbead0969a0592ff319ddb4f64463523b310bf4e49725542de8cdbae04e

Contents?: true

Size: 780 Bytes

Versions: 3

Compression:

Stored size: 780 Bytes

Contents

# == Profiles
# Useful for starting a profile, but your mileage may vary.
#
module Capitate::Plugins::Profiles
  
  ProfileDir = File.dirname(__FILE__) + "/../../profiles"
  
  # Load all profiles with prefix.
  #
  # ==== Options
  # +prefix+:: Prefix to filter/search on
  #  
  def list(prefix = "")
    Dir[ProfileDir + "/#{prefix}*.rb"].collect { |file| File.basename(file).gsub(File.extname(file), "") }
  end
  
  # Choose a profile (via command line).
  # 
  # ==== Options
  # +prefix+:: Prefix to filter/search on
  #
  def choose(prefix = "")
    profile = HighLine.new.choose(*list(prefix)) do |menu|
      menu.header = "Choose recipe profile"
    end
    
    "#{ProfileDir}/#{profile}.rb"
  end

end
    
    
Capistrano.plugin :profile, Capitate::Plugins::Profiles

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capitate-0.1.7 lib/capitate/plugins/profiles.rb
capitate-0.1.9 lib/capitate/plugins/profiles.rb
capitate-0.1.8 lib/capitate/plugins/profiles.rb