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

	@stopIfExists filepath

	write = =>
		if 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"

		@echo()
		@template 'html.html', filepath
		fs.unlinkSync bowerJson  unless @localJquery
		done()

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

	@openInEditor filepath

# Creates new HTML file.
#
# Options:
#   --no-js: Do not create links to jQuery and scripts file.

'use strict'

