Class: MelissaData::Command::CompileCommand

Inherits:
Base
  • Object
show all
Defined in:
lib/melissadata/command/compile.rb

Instance Attribute Summary

Attributes inherited from Base

#env

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

register

Methods included from Helpers

#initialize_environment

Class Method Details

.source_rootObject



6
7
8
# File 'lib/melissadata/command/compile.rb', line 6

def self.source_root
  Dir['/Volumes/*'].detect{ |path| path =~ /DVD-\d{4}-\d{2}$/ }
end

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/melissadata/command/compile.rb', line 10

def execute
  source_dir = Dir['/Volumes/*'].detect{ |path| path =~ /DVD-\d{4}-\d{2}$/ }
  raise Errors::DiscNotFound if source_dir.blank?

  dest_dir = "/tmp"

  possible_objects = %w[ address email name phone ]
  # objects = Dir.entries(source_dir).select{ |path| possible_objects.include?(path) }
  objects = %w[ email name ]

  objects.each do |obj|
    Dir["#{source_dir}/#{obj}/linux/gcc34_64bit/*.h"].each do |filename|
      copy_file filename, "/opt/melissadata/src/#{File.basename(filename)}"
    end

    filename = "#{source_dir}/#{obj}/linux/gcc34_64bit/libmd#{obj.capitalize}.so"
    copy_file filename, "/opt/melissadata/lib/#{File.basename(filename)}"

    filename = "#{source_dir}/#{obj}/linux/interfaces/ruby/md#{obj.capitalize}RubyWrapper.cpp"
    copy_file filename, "/opt/melissadata/lib/#{File.basename(filename)}"
  end

  template "Makefile", "/opt/melissadata/src/Makefile"
end