Class: AsProject::EclipseProject

Inherits:
Project show all
Defined in:
lib/eclipse_project.rb

Direct Known Subclasses

AsClassProject

Instance Attribute Summary

Attributes inherited from PathFinder

#execution_dir

Attributes inherited from TemplateResolver

#ignore_all, #replace_all

Instance Method Summary collapse

Methods inherited from Project

#binary_dir, #find_project, #library_dir, #resolve_location, #source_dir, #test_dir

Methods inherited from PathFinder

#current_project, #current_project=, #flash_player_config, #flash_player_config_content, #flash_player_debug, #flash_player_home, #flash_player_log, #flash_player_trust, #gem_asproject_home, #get_available_templates, #get_children, #get_gem_template, #get_project_template, #get_template, #get_user_template, #remote_file_task, #user_asproject_home, #user_home, #user_library

Methods inherited from TemplateResolver

#clean_file_name, #copy_file, #copy_files, #file_is_binary?, #project_name, #render_file, #should_render?, #write_file?

Constructor Details

#initialize(dir = nil) ⇒ EclipseProject

Returns a new instance of EclipseProject.



7
8
9
10
11
12
13
14
# File 'lib/eclipse_project.rb', line 7

def initialize(dir=nil)
  super(dir)
  @project_name = ''
  @file_path = nil
  if(!dir.nil?)
    self.file_path = File.join(dir, '.project')
  end
end

Instance Method Details

#file_pathObject



28
29
30
# File 'lib/eclipse_project.rb', line 28

def file_path
  return @file_path
end

#file_path=(path) ⇒ Object



16
17
18
19
20
21
# File 'lib/eclipse_project.rb', line 16

def file_path=(path)
  @file_path = path
  file = File.open(path, 'r')
  parse(file.read)
  file.close
end

#parse(str) ⇒ Object



23
24
25
26
# File 'lib/eclipse_project.rb', line 23

def parse(str)
  xml = REXML::Document.new(str)
  @project_name = REXML::XPath.first(xml, '//projectDescription/name').text
end