Module: Ripl::Profiles
- Defined in:
- lib/ripl/profiles.rb
Defined Under Namespace
Modules: Commands, Runner
Constant Summary
collapse
- VERSION =
'0.2.1'
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.loaded ⇒ Object
Returns the value of attribute loaded.
9
10
11
|
# File 'lib/ripl/profiles.rb', line 9
def loaded
@loaded
end
|
Class Method Details
.available ⇒ Object
11
12
13
14
15
|
# 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) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
|
# 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 ⇒ Object
30
31
32
33
34
35
36
37
38
|
# 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
|