desc “Explaining what the task does” namespace :template do

task :import do
  if ENV['HTML'].nil?
    puts "Cannot stat ENV['HTML']. Please run rake template:usage for usage."
    exit
  end
  template = Template2rails::Parser.new(ENV['HTML'])
  template.to_rails
  puts "Done importing HTML."
  puts "You can check the file by starting your webserver and browsing http://localhost:3000"
  puts "You might also want to put the following lines into config/application.rb:  \n" +
  <<-EOF

  config.assets.precompile += %w( pre-application.js post-application.js )
  config.assets.precompile += %w( *.png *.jpg *.gif *.jpeg )

EOF

end
task :usage do

puts <<-EOF

Usage:

rake template:import \\
  HTML=/path/to/html/to/read.html \\
  MENU=#css-selector-for-menu \\
  CONTENT=#css-selector-for-content

EXAMPLE:

rake template:import \\
  HTML=~/Development/wwwroot/scale/index.html \\
  MENU=.nav-main \\
  CONTENT=#content

EOF

end

end