Method: Ruber::Project#initialize
- Defined in:
- lib/ruber/project.rb
permalink #initialize(file, name = nil) ⇒ Project
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.
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/ruber/project.rb', line 390 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 |