Sha256: fe1f2f4f9573d51e25733aeb07dd32cb2300e89a9c74a1c509e598fe8a3f8575

Contents?: true

Size: 762 Bytes

Versions: 2

Compression:

Stored size: 762 Bytes

Contents

require 'neutron'

module Neutron
  def self.install(*files, dir)
    prefix = if ENV['PREFIX'] then ENV['PREFIX'] else '/usr' end
    dir = File.expand_path(File.join(prefix, dir))
    sudo = if ENV['USE_SUDO'] then 'sudo ' else '' end
    unless File.exist? dir
      Neutron.execute(
        "#{sudo}mkdir --parents --mode=755 #{dir}",
        must_success: true
      )
    end
    files.each do |file|
      p file
      dn = File.join(dir, File.dirname(file))
      p dn
      #file = File.expand_path(file)
      unless File.exist?(dn)
        Neutron.execute("#{sudo}mkdir --parents --mode=755 #{dn}")
      end
      Neutron.execute(
        "#{sudo}rsync -a --relative --chmod=755 #{file} #{dir}/",
        must_success: true
      )
    end 
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
neutron-0.2.1 lib/neutron/install.rb
neutron-0.2.0 lib/neutron/install.rb