Sha256: 84845fd32f276826978dd215167ef71fde9020e94765369f0d7da310ddbee5d8

Contents?: true

Size: 1.07 KB

Versions: 68

Compression:

Stored size: 1.07 KB

Contents

require 'optparse'
require 'fileutils'
require 'bundler'

options = {}

opt_parser = OptionParser.new do |opts|
  opts.banner = 'Usage: origen extract FILE [options]'
end
opt_parser.parse! ARGV

archive = ARGV.first

unless File.exist?(archive)
  Origen.log.error "File not found: #{archive}"
  exit 1
end

dirname = Pathname.new(archive).basename('.origen').to_s

if File.exist?(dirname)
  Origen.log.error "The application directory already exists (#{dirname}), delete it and then try again if you want to overwrite it"
  exit 1
end

passed = system "tar -xvzf #{archive}"
unless passed
  Origen.log.error 'A problem was encountered extracting the tarball, extraction aborted!'
  exit 1
end

Dir.chdir dirname do
  Bundler.with_clean_env do
    Origen.log.info 'Trying to boot the application...'

    passed = system "#{File.join('lbin', 'origen')} -v"
    if passed
      Origen.log.success 'Your application has been extracted and can boot up'
    else
      Origen.log.error 'Something went wrong at the final hurdle, your application has been extracted but cannot boot'
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
origen-0.60.18 lib/origen/commands/extract.rb
origen-0.60.17 lib/origen/commands/extract.rb
origen-0.60.16 lib/origen/commands/extract.rb
origen-0.60.14 lib/origen/commands/extract.rb
origen-0.60.13 lib/origen/commands/extract.rb
origen-0.60.12 lib/origen/commands/extract.rb
origen-0.60.11 lib/origen/commands/extract.rb
origen-0.60.10 lib/origen/commands/extract.rb
origen-0.60.9 lib/origen/commands/extract.rb
origen-0.60.8 lib/origen/commands/extract.rb
origen-0.60.7 lib/origen/commands/extract.rb
origen-0.60.6 lib/origen/commands/extract.rb
origen-0.60.5 lib/origen/commands/extract.rb
origen-0.60.4 lib/origen/commands/extract.rb
origen-0.60.3 lib/origen/commands/extract.rb
origen-0.60.2 lib/origen/commands/extract.rb
origen-0.60.1 lib/origen/commands/extract.rb
origen-0.60.0 lib/origen/commands/extract.rb
origen-0.59.8 lib/origen/commands/extract.rb
origen-0.59.7 lib/origen/commands/extract.rb