How to access the path where the Vagrantfile resides

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to access the path where the Vagrantfile resides

Florian Rampp
Hi,

how can I access from within the Vagrantfile where the file resides in the file system? The Environment class has a method root_path (according to the rubydoc) but I do not know how to retrieve an instance of the Environment class from within the config block in the Vagrantfile.

Thanks a lot!

FLorian

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to access the path where the Vagrantfile resides

Mitchell Hashimoto
Florian,

You can use Ruby itself to do this:

path_to_this_file = File.expand_path("../", __FILE__)


On Mon, Feb 18, 2013 at 2:25 AM, Florian Rampp <[hidden email]> wrote:
Hi,

how can I access from within the Vagrantfile where the file resides in the file system? The Environment class has a method root_path (according to the rubydoc) but I do not know how to retrieve an instance of the Environment class from within the config block in the Vagrantfile.

Thanks a lot!

FLorian

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to access the path where the Vagrantfile resides

Florian Rampp
That worked for me. Thanks!
I need to get into Ruby more.

On Monday, February 18, 2013 6:05:41 PM UTC+1, Mitchell Hashimoto wrote:
Florian,

You can use Ruby itself to do this:

path_to_this_file = File.expand_path("../", __FILE__)


On Mon, Feb 18, 2013 at 2:25 AM, Florian Rampp <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="udidqOi4P2sJ">floria...@...> wrote:
Hi,

how can I access from within the Vagrantfile where the file resides in the file system? The Environment class has a method root_path (according to the rubydoc) but I do not know how to retrieve an instance of the Environment class from within the config block in the Vagrantfile.

Thanks a lot!

FLorian

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="udidqOi4P2sJ">vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.