Module: OrigenSim::Commands::Pack

Defined in:
lib/origen_sim/commands/pack.rb

Class Method Summary collapse

Class Method Details

.list(options = {}) ⇒ Object



33
34
# File 'lib/origen_sim/commands/pack.rb', line 33

def self.list(options = {})
end

.pack(options = {}) ⇒ Object

Note, making this a module instead of straight code so it can be called programatically to auto-unpack a snapshot.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/origen_sim/commands/pack.rb', line 7

def self.pack(options = {})
  testbench = "#{Origen.app.root}/simulation"
  unless Dir.exist?(testbench)
    fail "Could not find path #{testbench}/#{ARGV[0]}"
  end

  FileUtils.mkdir("#{Origen.app.root}/simulation/static") unless Dir.exist?("#{Origen.app.root}/simulation/static")

  output = "#{Origen.app.root}/simulation/static/#{ARGV[0]}.tar.gz"
  puts "Packing #{testbench} into #{output}..."
  system "tar vczf #{output} -C #{testbench} #{Origen.target.name}"
end

.unpack(options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/origen_sim/commands/pack.rb', line 20

def self.unpack(options = {})
  testbench = "#{Origen.app.root}/simulation/static/#{ARGV[0]}.tar.gz"
  unless File.exist?(testbench)
    fail "Could not find #{testbench}"
  end

  output = "#{Origen.app.root}/simulation"
  FileUtils.mkdir(output) unless Dir.exist?(output)

  puts "Unpakcing Testbench into #{output}"
  system "tar vxzf #{testbench} -C #{output} #{ARGV[0]}"
end