Skip to content

Instantly share code, notes, and snippets.

@roykolak
Created September 1, 2011 02:12
Show Gist options
  • Save roykolak/1185275 to your computer and use it in GitHub Desktop.
Save roykolak/1185275 to your computer and use it in GitHub Desktop.
task :seed do
content = ''
File.open('extension/history.html', 'r') do |file|
file.each do |line|
content += line
end
end
fixtures = '';
Dir["spec/javascripts/fixtures/*.html"].each do |file_name|
File.open(file_name, 'r') do |file|
file.each do |line|
fixtures += " #{line}"
end
fixtures += "\n"
end
end
File.open('extension/history.html', 'w') {|f| f.write(content.gsub(/<!-- Templates Start -->(.*)<!-- Templates End -->/m, "<!-- Templates Start -->\n\n\n#{fixtures}\n <!-- Templates End -->"))}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment