Class: Cpan
- Inherits:
-
Object
- Object
- Cpan
- Defined in:
- lib/sphinx_tv/cpan.rb
Class Method Summary collapse
Class Method Details
.create_config_file ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/sphinx_tv/cpan.rb', line 17 def self.create_config_file unless File.exists? SphinxTv::cache_path("MyConfig.pm") puts "Creating cpan config...".cyan @cache_dir = SphinxTv::cache_path SphinxTv::copy_template(SphinxTv::resources_path("MyConfig.pm.erb"), SphinxTv::cache_path("MyConfig.pm"), binding) end end |
.install(modules) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/sphinx_tv/cpan.rb', line 5 def self.install modules modules.each do |m| result = %x[perl -M#{m} -e 1 2>&1].strip if result.empty? puts "Module '#{m}' is installed".green else puts "Installing perl module: #{m}".cyan system("sudo #{SphinxTv::SUDO_PROMPT} cpan -j #{SphinxTv::cache_path("MyConfig.pm")} -f -i #{m}") end end end |