Class: Ruber::Project
- Inherits:
-
AbstractProject
- Object
- Qt::Object
- AbstractProject
- Ruber::Project
- Includes:
- Activable
- Defined in:
- lib/ruber/project.rb,
lib/ruber/project.rb,
lib/ruber/project.rb
Overview
Class representing a global project (one which should be managed by ProjectList).
It uses ProjectBackend as backend and includes the Activable module.
=Signals ===activated() Signal emitted when the project is activated
=deactivated() Signal emitted when the project is deactivated
===Slots
- activate()
- deactivate()
Defined Under Namespace
Classes: InvalidProjectFileName
Instance Attribute Summary
Attributes inherited from AbstractProject
Attributes included from SettingsContainer
Instance Method Summary (collapse)
-
- (Object) add_option(opt)
Override of SettingsContainer#add_option which sets the type of opt to :global if opt.type returns nil.
-
- (Object) close(save = true)
Override of AbstractProject#close which deactivates the project before closing it and disposes of it after closing.
- - (Boolean) file_in_project?(file)
-
- (Object) files
(also: #project_files)
Override of AbstractProject#files which actually returns the list of files belonging to the project.
-
- (Project) initialize(file, name = nil)
constructor
Creates a new Project.
-
- (Object) scope
Reimplementation of AbstractProject#scope which returns :global.
Methods included from Activable
#activate, #active=, #active?, #deactivate, #do_activation, #do_deactivation
Methods inherited from AbstractProject
#[]=, #add_extension, #each_extension, #extension, #extensions, #finalize, #has_extension?, #match_rule?, #method_missing, #project_directory, #query_close, #remove_extension, #save, #write
Methods included from SettingsContainer
#[], #[]=, #add_setting, #add_widget, #collect_options, #default, #delete_dialog, #dialog, #has_setting?, #relative_path?, #remove_setting, #remove_widget, #setup_container, #write
Signal Summary
Constructor Details
- (Project) initialize(file, name = nil)
Creates a new Project. file is the name of the project file, while name is the project name. You must specify both arguments if the file file doesn’t exist, while you must not pass the name parameter if the file file already exists (in this case, the project name is written in the project file and there’s no need to specify it). Note that this method takes care of creating the backend, so you don’t need to do that yourself (unlike with AbstractProject).
If file is a relative path, it’s considered relative to the current directory.
If the project file file already exists but it’s not a valid project file, AbstractProject::InvalidProjectFile will be raised.
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
# File 'lib/ruber/project.rb', line 374 def initialize file, name = nil file = File.join(Dir.pwd, file) unless file.start_with? '/' back = begin ProjectBackend.new file rescue YamlSettingsBackend::InvalidSettingsFile => e raise Ruber::AbstractProject::InvalidProjectFile, e. end super Ruber[:world], back, name finalize @dir_scanner = ProjectDirScanner.new self @dir_scanner.connect(SIGNAL('file_added(QString)')) do |f| @files << f if @files end @dir_scanner.connect(SIGNAL('file_removed(QString)')) do |f| @files.delete f if @files end @dir_scanner.connect(SIGNAL(:rules_changed)){@files = nil} @files = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Ruber::AbstractProject
Instance Method Details
- (Object) add_option(opt)
Override of SettingsContainer#add_option which sets the type of opt to :global if opt.type returns nil.
This is necessary because AbstractProject.new adds the :project_name option without specifying its type.
408 409 410 411 |
# File 'lib/ruber/project.rb', line 408 def add_option opt opt.type ||= :global super end |
- (Object) close(save = true)
Override of AbstractProject#close which deactivates the project before closing it and disposes of it after closing. Aside from this, it works as the base class version.
387 388 389 390 391 392 |
# File 'lib/ruber/project.rb', line 387 def close save = true deactivate res = super dispose res end |
- (Boolean) file_in_project?(file)
451 452 453 |
# File 'lib/ruber/project.rb', line 451 def file_in_project? file @dir_scanner.file_in_project? file end |
- (Object) files Also known as: project_files
Override of AbstractProject#files which actually returns the list of files belonging to the project.
Note: this method uses the project_files extension
419 420 421 422 |
# File 'lib/ruber/project.rb', line 419 def files @files ||= @dir_scanner.project_files ProjectFiles.new project_directory, @files end |
- (Object) scope
Reimplementation of AbstractProject#scope which returns :global
397 398 399 |
# File 'lib/ruber/project.rb', line 397 def scope :global end |
Signal Details
- activated
- deactivated