ruby - How do I copy files from a gem to the local directory -


I am authoring a gem and I would like to copy the template files that are packaged in my gem in the local directory Which gem is being installed in it.

Create an established script (place it in the 'bin' directory of your gem), which is the template file The user will copy into the specified directory

To get your path to copy the file, from the comments below:

  File.expand_path (File.dirname (__ FILE__)) # '__FILE__' consists of two underscores  

will show you the path to your installation script (this is your gem 'bin directive "There will be).

  Dir.pwd  

is the path to the directory where the user runs your script.


Comments