 fs = require 'fs'
 
 module.exports = class Generator extends base
+
+Generator::options = ->
+	@js = @options.js ? true
 
 Generator::askFor = ->
 	done = @async()

# Creates new HTML file.

'use strict'


	@stopIfExists filepath

	write = =>
		if @js and bowerJson
			bower = @readJsonFile bowerJson
			jqueryVer = bower.version
			if @lang is 'ru'
				@jqueryPath = "http://yandex.st/jquery/#{jqueryVer}/jquery.min.js"
			else
				@jqueryPath = "http://ajax.googleapis.com/ajax/libs/jquery/#{jqueryVer}/jquery.min.js"
			@delete bowerJsonDir  if bowerJsonDir

		@templateAndOpen 'html.html', filepath
		done()

	if @js
		bowerJson = 'bower_components/jquery/bower.json'
		if fs.existsSync bowerJson
			@localJquery = true
			write()
		else
			@localJquery = false
			bowerJsonDir = '__bwr'
			bowerJson = "#{bowerJsonDir}/bower.json"
			remoteBowerJson = 'https://raw.github.com/components/jquery/master/bower.json'
			@fetch remoteBowerJson, bowerJsonDir, (err) =>
				@stop "Cannot download #{remoteBowerJson}"  if err
				write()
	else
		write()
