module Ripl::Profiles

Constants

VERSION

Attributes

loaded[R]

Public Class Methods

available() click to toggle source
# File lib/ripl/profiles.rb, line 11
def available
  Dir[ File.expand_path( File.join( Ripl.config[:profiles_prefix], '*' ) )].map{ |path|
    File.basename( path ).sub( /#{File.extname(path)}$/,'' )
  }
end
load( names ) click to toggle source
# File lib/ripl/profiles.rb, line 17
def load( names )
  Array(names).each{ |name|
    profile_path = File.expand_path( File.join( Ripl.config[:profiles_prefix], "#{ name }.rb" ) )
    if File.exists? profile_path
      Ripl::Runner.load_rc profile_path
      puts "Loaded profile: #{ name }" if Ripl.config[:profiles_verbose]
      @loaded << name
    else
      warn "ripl: Couldn't load the profile #{ name } at: #{ profile_path }"
    end
  }
end
load_from_config() click to toggle source
# File lib/ripl/profiles.rb, line 30
def load_from_config
  if Ripl.config[:profiles_default] && Ripl::Profiles.loaded.empty?
    Ripl::Profiles.load Ripl.config[:profiles_default]
  end

  if Ripl.config[:profiles_base]
    Ripl::Profiles.load Ripl.config[:profiles_base]
  end
end