Method: Ruber::ProjectFilesList#initialize

Defined in:
lib/ruber/projects/project_files_list.rb

#initialize(prj) ⇒ ProjectFilesList

Creates a new ProjectFilesList for the Project prj.

The new object will read the general/project_files option from the project and immediately scan the project directory to find the all the project files. Besides, it will start monitoring the directory for changes, so as to be able to update the list of project files when a new file is created or a file is deleted.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/ruber/projects/project_files_list.rb', line 115

def initialize prj
  super
  @lock = Mutex.new
  @project = prj
  @project_files = nil
  @watcher = KDE::DirWatch.new self
  @watcher.add_dir @project.project_dir, KDE::DirWatch::WatchSubDirs
  @up_to_date = false
  make_rules
  @project_files = []
  @watcher.connect(SIGNAL('dirty(QString)')) do
    @up_to_date = false
    @watcher.stop_scan
  end
  @project.connect(SIGNAL('option_changed(QString, QString)')) do |g, n|
    if g == 'general' and n == 'project_files'
      if @project[:general, :project_files] != @rules
        @up_to_date = false
        make_rules
        scan_project
      end
    end
  end
  @watcher.start_scan false
end