Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[BUG] [PATCH] Allow https URIs to be supplied for rails templates

#5926

This fails:

$ rails new testrails -O -T -J -m https://github.com/xaviershay/sandbox/raw/master/rails/template.rb

The template [/private/tmp/https:/github.com/xaviershay/sandbox/raw/master/rails/template.rb] could not be loaded. Error: Could not find "/private/tmp/https:/github.com/xaviershay/sandbox/raw/master/rails/template.rb" in any of your source paths. Your current source paths are: 
/Users/xavier/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/generators/rails/app/templates

I have attached a fix with test, just needed to change the regex. I also performed the following test to confirm it worked (after temporarily adding 'i18n' gem to the Gemfile):

bundle exec ruby bin/rails new /tmp/bogus -m https://github.com/xaviershay/sandbox/raw/master/rails/template.rb

Reported by Xavier Shay · November 7th, 2010 @ 06:49 AM

State: committed
Milestone: 3.0.5
Assigned to: Santiago Pastorino Santiago Pastorino
Importance: Low

Activity

  1. Ryan Bigg
    Ryan Bigg
    • Importance changed from to Low

    There is no patch on this ticket. Please attach it!

    Thanks for trying this mate.

    November 7th, 2010 @ 06:58 AM

  2. Xavier Shay
    Xavier Shay

    hmm, can't seem to get lighthouse to take it.

    Here it is as a gist:
    https://gist.github.com/63d1660cb8c706dee4f7

    November 7th, 2010 @ 07:35 AM

  3. Andrew White
    Andrew White

    The url in the test points to an actual gist - the expects on :open will prevent the request but it should be an fake url so that it's obviously irrelevant.

    November 7th, 2010 @ 09:28 AM

  4. Xavier Shay
    Xavier Shay

    I agree. My patch test is copied from another test in that file. They should both be changed (along with any others). Out of scope for this ticket.

    November 7th, 2010 @ 10:12 AM

  5. Daniel Kehoe
    Daniel Kehoe

    The priority on this should be "HIGH" and it really should be included in 3.0.4.

    It's a tiny fix but without it, any application generator template hosted on GitHub is inaccessible.

    GitHub recently changed all URIs from http to https to increase security (subsequent to awareness of the Firesheep exploit). Many projects that offer an application generator template put them on GitHub.

    For an example of the consequences of this failure, see the GitHub support ticket:
    http://support.github.com/discussions/site/2213-github-https-redire...

    I've got two apps that use application generator templates on GitHub and I've had requests for help from people who were relying on the templates to get started.

    -- Daniel

    November 23rd, 2010 @ 01:15 AM

  6. Rohit Arondekar
  7. Xavier Shay
    Xavier Shay

    To help speed things up, please review the patch by applying it and ensuring it works as advertised, then add a +1 to this ticket.

    November 26th, 2010 @ 07:58 PM

  8. Jan
  9. Jan
    Jan

    Well, without the "?" from your regexp it now supports https only... :(

    November 27th, 2010 @ 03:52 PM

  10. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open
    • Milestone cleared.
    • Assigned user set to Santiago Pastorino

    Xavier, can you provide a patch again with the ? and with a test for http.
    Thanks.

    November 27th, 2010 @ 10:05 PM

  11. Xavier Shay
    Xavier Shay

    There is already a test for http, that is currently failing on master.

    ruby -Itest test/generators/app_generator_test.rb                                                                        ~/Code/ex/rails/railties master
    Loaded suite test/generators/app_generator_test
    Started
    ............................E..........
    Finished in 1.668626 seconds.
    
      1) Error:
    test_template_is_executed_when_supplied(AppGeneratorTest):
    Rails::Generators::Error: The template [/Users/xavier/Code/ex/rails/railties/http:/gist.github.com/103208.txt] could not be loaded. Error: Could not find "/Users/xavier/Code/ex/rails/railties/http:/gist.github.com/103208.txt" in any of your source paths. Your current source paths are:
    

    As such, only the code needs to change. Here is a new fix, I have confirmed it fixes the test:
    https://gist.github.com/raw/718394/de680f23fdc4004bca34fc6a89ee54a8...

    November 27th, 2010 @ 11:42 PM

  12. Repository
  13. James OKelly
    James OKelly

    I just updated to rails 3.0.3 to get around this issue and whenever I try a

    rails new temp -m https://github.com/dreamr/Rails3-Greenfield-Template/raw/master/mai...

    I get "Could not find "/Users/james/development/https:/github.com/dreamr/Rails3-Greenfield-Template/raw/master/main.rb" in any of your source paths"

    So the request is not going through the web. I am updating the tests locally for rails and seeing whats up.

    OS X SL Ruby 1.8.7-head

    November 29th, 2010 @ 03:19 AM

  14. James OKelly
    James OKelly

    Also when I installed 3.0.3 it said at the end:

    File not found: lib

    just an fyi, ill get to that after I get these tests up and running to look into the http/https issue.

    November 29th, 2010 @ 03:21 AM

  15. Xavier Shay
    Xavier Shay

    This fix has not been released yet, it is scheduled for 3.0.4

    November 29th, 2010 @ 03:29 AM

  16. Santiago Pastorino