From: Christopher Dicely Date: 2008-02-19T01:58:36+09:00 Subject: Re: Write a copy of the current script Is there a particular reason you are having the "operations people" modify the script directly rather than having them modify a configuration file of some kind that the script reads? If there is a fixed set of parameters that need changed, reading them from a file is cleaner (YAML would be a good choice, here) than modifying the script, and then you can just copy the config file to an archive location when you load it. Other than that, the only thing I can think of off the top of my head is having the script that is being edited not be the main script, but instead be required by a wrapper script that uses SCRIPT_LINES__ to capture the contents of the required file, and then archives it somewhere. On Feb 18, 2008 6:49 AM, dkmd_nielsen wrote: > I would like to write a copy of the current script being executed. > I've attempted to use __FILE__ and $0, but neither is returning the > full path name of script. I get the file name, but not the path in > which it resides. Anyone have a quick solution? > > def initialize > @script = $0 # Save where the script is from > puts "[#{@script}]" > end > > returns "[AAN_StandardSetup.rb]" > > > The script being run is a process setup, where the operations people > fill in script parameters. The script then creates folder structures > and performs particular functions. I want to save a copy of the > script after the operations people have completed filling everything > in. It would be saved in one of the folders created by the execution > of the script. That's my dilemma...I want to save it somewhere after > it has started executing. > > Tips and suggestions are appreciated. > dvn > >