Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » parsing a configuration file that is expressed in ruby dsl
parsing a configuration file that is expressed in ruby dsl [message #966297] Wed, 31 October 2012 22:39 Go to next message
Tom H is currently offline Tom HFriend
Messages: 139
Registered: July 2009
Senior Member
Hi,

I have an eclipse plugin for the opscode chef configuration management system, which would benefit from being able to interrogate a ruby configuration file "knife.rb", that looks like something like this;

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                "#{ENV['node_name']}"
client_key               "#{ENV['client_key']}"
validation_client_name   "#{ENV['validation_client_name']}"
validation_key           "#{ENV['validation_key']}"
chef_server_url          "#{ENV['chef_server_url']}"
cache_type               'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )

cookbook_path            ["#{ENV['chef_cookbook_path']}"]
ssl_verify_mode :verify_none

knife[:openstack_access_key_id]     = "#{ENV['EC2_ACCESS_KEY']}"
knife[:openstack_secret_access_key] = "#{ENV['EC2_SECRET_KEY']}"
knife[:openstack_api_endpoint]      = "#{ENV['EC2_URL']}"


Is there an appropriate method to get a java object representation of that file using dltk?

I have investigated the code from the point of view of the dltk model, but it is not populated with the instance vars;

IScriptProject scriptProject = DLTKCore.create(project);
IProjectFragment fragment : scriptProject#getAllProjectFragments()
IModelElement element : fragment.getChildren()


However if I search for method references, such as "validation_client_name", they are found by the dltk search plugin, so clearly the indexer is finding the method calls, even if the outline view and the DLTKCore.create(project)#getModel() has only a limited view of the code.

Thanks
Tom
Re: parsing a configuration file that is expressed in ruby dsl [message #968536 is a reply to message #966297] Fri, 02 November 2012 14:32 Go to previous message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
Hi Tom,

org.eclipse.dltk.ruby.internal.parser.JRubySourceParser.parse(String)

Which returns AST, and that code is represented as sequence of
CallExpressions.

Regards,
Alex
Previous Topic:OSX code completion for jruby/ruby not complete
Next Topic:Want to get ruby working in Eclipse for the first time? (DLTK 2.0)
Goto Forum:
  


Current Time: Fri Apr 19 10:02:49 GMT 2024

Powered by FUDForum. Page generated in 0.02005 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top