Class: SphinxModule
- Inherits:
-
Object
- Object
- SphinxModule
- Defined in:
- lib/modules/sphinx_module.rb
Instance Method Summary collapse
- #check(quiet = false) ⇒ Object
- #configure ⇒ Object
- #download ⇒ Object
-
#initialize ⇒ SphinxModule
constructor
A new instance of SphinxModule.
- #install ⇒ Object
- #load_configuration ⇒ Object
- #save_configuration ⇒ Object
- #setup ⇒ Object
- #uninstall ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize ⇒ SphinxModule
Returns a new instance of SphinxModule.
2 3 4 5 6 |
# File 'lib/modules/sphinx_module.rb', line 2 def initialize @config = { :version => SphinxTv::VERSION } end |
Instance Method Details
#check(quiet = false) ⇒ Object
27 28 29 |
# File 'lib/modules/sphinx_module.rb', line 27 def check(quiet = false) return true end |
#configure ⇒ Object
36 37 38 39 |
# File 'lib/modules/sphinx_module.rb', line 36 def configure puts "#{self.class.to_s} does not have a configuration menu.".red return false end |
#download ⇒ Object
41 42 |
# File 'lib/modules/sphinx_module.rb', line 41 def download end |
#install ⇒ Object
44 45 46 |
# File 'lib/modules/sphinx_module.rb', line 44 def install puts "#{self.class.to_s} does not have an install function.".red end |
#load_configuration ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/modules/sphinx_module.rb', line 8 def load_configuration config_file = File.join(SphinxTv::CONFIG_DIRECTORY, "#{self.class.to_s.downcase}.yml") unless File.exists? config_file return false end c = YAML::load_file config_file @config.merge! c return true end |
#save_configuration ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/modules/sphinx_module.rb', line 18 def save_configuration def save_configuration Dir.mkdir(SphinxTv::CONFIG_DIRECTORY) unless File.exists? SphinxTv::CONFIG_DIRECTORY File.open(File.join(SphinxTv::CONFIG_DIRECTORY, "#{self.class.to_s.downcase}.yml"), "w") do |file| file.write @config.to_yaml end end end |
#setup ⇒ Object
31 32 33 34 |
# File 'lib/modules/sphinx_module.rb', line 31 def setup puts "#{self.class.to_s} does not have a setup menu.".red return false end |
#uninstall ⇒ Object
48 49 50 |
# File 'lib/modules/sphinx_module.rb', line 48 def uninstall puts "#{self.class.to_s} does not have an uninstall function.".red end |
#update ⇒ Object
52 53 54 |
# File 'lib/modules/sphinx_module.rb', line 52 def update puts "#{self.class.to_s} does not have an update function.".red end |