lib/origen/application.rb in origen-0.5.5 vs lib/origen/application.rb in origen-0.5.6

- old
+ new

@@ -155,10 +155,22 @@ # the application is installed within the imports directory def root @root end + # Returns a path to the imports directory (e.g. used by the remotes and similar features) for the + # application. e.g. if the app live at /home/thao/my_app, then the imports directory will typically + # be /home/thao/.my_app_imports_DO_NOT_HAND_MODIFY + # + # Origen will ensure that this directory is outside of the scope of the current application's revision + # control system. This prevents conflicts with the revision control system for the application and those + # used to import 3rd party dependencies + def imports_directory + workspace_manager.imports_directory + end + alias_method :imports_dir, :imports_directory + # Returns the namespace used by the application as a string def namespace @namespace ||= self.class.to_s.split('::').first.gsub('_', '').sub('Application', '') end @@ -466,11 +478,20 @@ def db @db ||= Database::KeyValueStores.new(self) end def session(reload = false) - @session = nil if reload - @session ||= Database::KeyValueStores.new(self, persist: false) + if current? + @session = nil if reload + @session ||= Database::KeyValueStores.new(self, persist: false) + else + puts "All plugins should use the top-level application's session store, i.e. use:" + puts " Origen.app.session.#{name}" + puts 'instead of:' + puts ' Origen.app!.session' + puts + exit 1 + end end def versions version_tracker.versions end