Created
August 11, 2011 11:35
-
-
Save stengland/1139443 to your computer and use it in GitHub Desktop.
test_template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "\n=========================================================" | |
puts " Noodall TEMPLATE" | |
puts "\n=========================================================" | |
require "rails" | |
require "net/http" | |
require "net/https" | |
# Copy a static file from the template into the new application | |
def copy_static_file(path) | |
# puts "Installing #{path}..." | |
remove_file path | |
file path, File.read(File.join(@static_files, path)) | |
# puts "\n" | |
end | |
# From "Suspenders" by thoughtbot | |
def download_file(uri_string, destination) | |
uri = URI.parse(uri_string) | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true if uri_string =~ /^https/ | |
request = Net::HTTP::Get.new(uri.path) | |
contents = http.request(request).body | |
path = File.join(destination_root, destination) | |
File.open(path, "w") { |file| file.write(contents) } | |
end | |
download_file('https://raw.github.com/stengland/beefplate/noodallplate/Site/javascripts/application.js','public/javascripts/applications.js') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment