Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is wrong with this rails template?
    primarykey
    data
    text
    <p>I am attempting to take a whack at creating my first Rails application template and I am running into a slight issue with the <code>copy_file</code> method.</p> <p>First some background.... Apparently the Ruby OpenSSL package does not ship with a CA store, so any attempt to connect to an HTTPS service will fail out of the box. The way around this(for Rails 3 apps) is to add the line <code>OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE</code> to the top of your <code>config/environment.rb</code> file. I need to do this on the fly in my template so I can install jQuery. </p> <p>So I have that all figured out, my general thought is to: </p> <ol> <li>Make a backup of my <code>config/environment.rb</code> file.</li> <li>Prepend the data to original</li> <li>Run the <code>jquery:install --ui</code> task</li> <li>Restore the original <code>config/environment.rb</code> file.</li> </ol> <p>See <a href="https://gist.github.com/876122/" rel="nofollow">my template Gist</a>, Lines 25..34 is the relevant section.</p> <p>So all of that works until step #4 which fails with <code>Error: Could not find "env.orig" in any of your source paths</code> on line #31.<br> This is VERY perplexing to me because line #28 works, I can see the <code>env.orig</code> file on disk, so why won't the reverse work? </p> <p>What am I doing wrong?</p> <h3>Update 1:</h3> <p>After looking at the Thor source <code>thor\actions.rb</code> it became clear that Thor uses different paths (not your current project path) for the source and destination. Furthermore my copy was actually <em>not</em> working, it was actually coping the ERB template file, not the already generated file.</p> <p>After a breather it occurred to me <em>use the right tool for the job</em> so now I have: <code>run 'cp environment.rb environment.~'</code> and <code>run 'mv environment.~ environment.rb'</code> which works just fine. I am fairly certain this would not work on a windows box without the unix tools installed, but I can live with that. Does anyone have a <em>better</em> way?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload