From 667bcac439f2bf0bdd072cf9dc28658aedde5e93 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Sat, 27 Nov 2010 21:40:42 +1100 Subject: Application templates should work with HTTPS too --- railties/lib/rails/generators/app_base.rb | 2 +- railties/test/generators/shared_generator_tests.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index f5c626553c..a560888edd 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -102,7 +102,7 @@ module Rails def set_default_accessors! self.rails_template = case options[:template] - when /^http:\/\// + when /^https:\/\// options[:template] when String File.expand_path(options[:template], Dir.pwd) diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index d117656fbd..9e6169721b 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -113,6 +113,15 @@ module SharedGeneratorTests assert_match /It works!/, silence(:stdout){ generator.invoke_all } end + def test_template_is_executed_when_supplied_an_https_path + path = "https://gist.github.com/103208.txt" + template = %{ say "It works!" } + template.instance_eval "def read; self; end" # Make the string respond to read + + generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) + assert_match /It works!/, silence(:stdout){ generator.invoke_all } + end + def test_dev_option generator([destination_root], :dev => true).expects(:run).with("#{@bundle_command} install") silence(:stdout){ generator.invoke_all } -- cgit v1.2.3