<commit_before># Export Plugin
tinylr = require('tiny-lr')

module.exports = (BasePlugin) ->
	# Define Plugin
	class TinyLiveReload extends BasePlugin
		# Plugin name
		name: 'tinylivereload'
		lrServer: null
		lastGenerateTime: null

		config:
			port: 35729

		serverAfter: (opts) ->
			config = @config
			port = config.port
			docpad.log('info','Starting TinyLiveReload')

			@lrServer = tinylr()

			@lrServer.removeAllListeners('error')
			@lrServer.on('error',((err)->
				docpad.log('error','TinyLiveReload error:',err)
			))
			@lrServer.listen(port,((err)->
				console.error(err) if err
				docpad.log('info','TinyLiveReload is listerning on port '+port)
			))

			@lrServer.changed({body:{files:['']}}); #reload page on docpad restart

			@lastGenerateTime = new Date()

			@

		generateAfter: (opts) ->
			return @ if !@lrServer
			files = []
			collection = docpad.getDatabase().findAll({
				mtime: {
					$gte: @lastGenerateTime
				}
			})

			if collection.models.length>0
				for model in collection.models
					do (model) ->
						files.push(model.attributes.url)


			@lastGenerateTime = new Date()

			files=[''] if files.length==0

			@lrServer.changed({body:{files:files}});
			docpad.log('info','changed files are sent')

			@<commit_msg>Fixed my issue :)<commit_after># Export Plugin
tinylr = require('tiny-lr')

module.exports = (BasePlugin) ->
	# Define Plugin
	class TinyLiveReload extends BasePlugin
		# Plugin name
		name: 'tinylivereload'
		lrServer: null
		lastGenerateTime: null

		config:
			port: 35729

		serverAfter: (opts) ->
			config = @config
			docpad = @docpad
			port = config.port
			docpad.log('info','Starting TinyLiveReload')

			@lrServer = tinylr()

			@lrServer.removeAllListeners('error')
			@lrServer.on('error',((err)->
				docpad.log('error','TinyLiveReload error:',err)
			))
			@lrServer.listen(port,((err)->
				console.error(err) if err
				docpad.log('info','TinyLiveReload is listerning on port '+port)
			))

			@lrServer.changed({body:{files:['']}}); #reload page on docpad restart

			@lastGenerateTime = new Date()

			@

		generateAfter: (opts) ->
			return @ if !@lrServer
			docpad = @docpad
			files = []
			collection = docpad.getDatabase().findAll({
				mtime: {
					$gte: @lastGenerateTime
				}
			})

			if collection.models.length>0
				for model in collection.models
					do (model) ->
						files.push(model.attributes.url)


			@lastGenerateTime = new Date()

			files=[''] if files.length==0

			@lrServer.changed({body:{files:files}});
			docpad.log('info','changed files are sent')

			@

{'fraction_non_alphanumeric': 0.1501361338000778, 'fraction_numerical': 0.0054453520031116295, 'mean_word_length': 3.4730434782608697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7227306', 'n_tokens_mistral': 1075, 'n_tokens_neox': 852, 'n_words': 183}