]>
git.r.bdr.sh - rbdr/lyricli.rb/blob - lib/lyricli/source_manager.rb
0e41ead5e6ad2b66638c91345b896124f6ac4c23
8 @config = Configuration
.instance
9 @config["enabled_sources"].each
do |source
|
10 if klass
= parse_class(camelize(source
))
11 current_source
= klass
.new
12 @enabled_sources << current_source
14 raise StartSourceException
19 def enable(source_name
)
20 if klass
= parse_class(camelize(source_name
))
22 @config["enabled_sources"] << klass
.name
23 @config["enabled_sources"].uniq!
25 raise EnableSourceException
29 def disable(source_name
)
30 if klass
= parse_class(camelize(source_name
))
31 @config["enabled_sources"].delete(klass
.name
)
33 raise DisableSourceException
37 def reset(source_name
)
38 if klass
= parse_class(camelize(source_name
))
42 raise ResetSourceException
48 @enabled_sources.each
do |source
|
50 track
||= source
.current_track
52 fail
"Source #{source.name} has failed to start. Please reset the source by running `#{$0} source reset #{source.name}.`"