Class: AsProject::EclipseProject
- Inherits:
-
Project
- Object
- Hash
- TemplateResolver
- PathFinder
- Project
- AsProject::EclipseProject
- Defined in:
- lib/eclipse_project.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from PathFinder
Attributes inherited from TemplateResolver
Instance Method Summary collapse
- #file_path ⇒ Object
- #file_path=(path) ⇒ Object
-
#initialize(dir = nil) ⇒ EclipseProject
constructor
A new instance of EclipseProject.
- #parse(str) ⇒ Object
Methods inherited from Project
#binary_dir, #find_project, #library_dir, #resolve_location, #source_dir, #test_dir
Methods inherited from PathFinder
#asproject_player_trust, #current_project, #current_project=, #downloads, #flash_player_config, #flash_player_config_content, #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, #lib_downloads, #mxmlc, #remote_file_task, #user, #user_asproject_home, #user_home, #user_library
Methods inherited from TemplateResolver
#b, #clean_file_name, #copy_file, #copy_files, #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_path ⇒ Object
32 33 34 |
# File 'lib/eclipse_project.rb', line 32 def file_path return @file_path end |
#file_path=(path) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/eclipse_project.rb', line 16 def file_path=(path) @file_path = path begin File.open(path, 'r') do |f| parse(f.read) end rescue @project_name = File.dirname(Dir.pwd) end end |
#parse(str) ⇒ Object
27 28 29 30 |
# File 'lib/eclipse_project.rb', line 27 def parse(str) xml = REXML::Document.new(str) @project_name = REXML::XPath.first(xml, '//projectDescription/name').text end |