Sha256: 789d74466038a1d49115303b8bc403ea2e7de4b76b3c704f1728882f0cea5956

Contents?: true

Size: 715 Bytes

Versions: 4

Compression:

Stored size: 715 Bytes

Contents

require 'expect'
require 'pty'

class Cpan
  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

  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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sphinx_tv-0.9.5 lib/sphinx_tv/cpan.rb
sphinx_tv-0.9.4 lib/sphinx_tv/cpan.rb
sphinx_tv-0.9.3 lib/sphinx_tv/cpan.rb
sphinx_tv-0.9.2 lib/sphinx_tv/cpan.rb