#!/usr/bin/env ruby # # This file was generated by Origen. # require 'rubygems' origen_lib = File.expand_path('../../lib/origen', Gem.bin_path('origen', 'origen')) boot = File.join(origen_lib, 'boot.rb') ORIGEN_ROOT = File.expand_path('..', __dir__) origen_root = ORIGEN_ROOT # If the Origen version supports the new boot system then use it if File.exist?(boot) load boot # Otherwise fall back to an (improved) old-style invocation via Bundler else require 'pathname' require 'fileutils' $_origen_invocation_pwd = Pathname.pwd require File.join(origen_lib, 'site_config') if Origen.site_config.gem_manage_bundler FileUtils.mkdir_p(File.join(origen_root, '.bundle')) File.open(File.join(origen_root, '.bundle', 'config'), 'w') do |f| f.puts '# Origen is managing this file, any local edits will be overwritten' f.puts '# IT SHOULD NOT BE CHECKED INTO REVISION CONTROL!' f.puts '---' f.puts 'BUNDLE_BIN: false' # If gems have been installed to the app, always use them bundle_path = File.join(origen_root, 'vendor', 'gems') if File.exist?(bundle_path) # Only keep the gems we actually need when installing to the application, but # don't do this when installing outside since other apps might use them f.puts 'BUNDLE_CLEAN: true' else bundle_path = File.expand_path(Origen.site_config.gem_install_dir) end f.puts "BUNDLE_PATH: \"#{bundle_path}\"" Array(Origen.site_config.gem_build_switches).each do |build_switches| switches = build_switches.strip.split(' ') gem = switches.shift f.puts "BUNDLE_BUILD__#{gem.upcase}: \"#{switches.join(' ')}\"" end end end bundle_binstub = File.expand_path('../bundle', __FILE__) if File.file?(bundle_binstub) if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ load(bundle_binstub) else abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") end end require 'bundler/setup' load Gem.bin_path('origen', 'origen') end