var generators = require('yeoman-generator');

module.exports = generators.Base.extend({

	html: function() {
		this.mkdir('public');

		this.copy('index.html', 'public/index.html');
	},

	app: function() {
		this.mkdir('src/js/actions');
		this.mkdir('src/js/constants');
		this.mkdir('src/js/components');
		this.mkdir('src/js/dispatcher');
		this.mkdir('src/js/stores');
		this.mkdir('src/js/routes');
		this.mkdir('src/js/utils');

		this.copy('js/actions/AppActionCreator.jsx', 'src/js/actions/AppActionCreator.jsx');
		this.copy('js/components/AddItem.jsx', 'src/js/components/AddItem.jsx');
		this.copy('js/components/App.jsx', 'src/js/components/App.jsx');
		this.copy('js/components/Header.jsx', 'src/js/components/Header.jsx');
		this.copy('js/components/ItemDisplay.jsx', 'src/js/components/ItemDisplay.jsx');
		this.copy('js/components/ListItems.jsx', 'src/js/components/ListItems.jsx');
		this.copy('js/constants/AppConstants.jsx', 'src/js/constants/AppConstants.jsx');
		this.copy('js/dispatcher/AppDispatcher.jsx', 'src/js/dispatcher/AppDispatcher.jsx');
		this.copy('js/index.jsx', 'src/js/index.jsx');
		this.copy('js/routes/AppRoutes.jsx', 'src/js/routes/AppRoutes.jsx');
		this.copy('js/stores/AppStore.jsx', 'src/js/stores/AppStore.jsx');
		this.copy('js/utils/AppWebAPIUtils.jsx', 'src/js/utils/AppWebAPIUtils.jsx');
	},

	grunt: function() {
		this.copy('Gruntfile.js', 'Gruntfile.js');
	},

	packages: function() {
		this.copy('package.json', 'package.json');

		this.npmInstall([
			'react',
			'react-router',
			'flux',
			'keymirror',
			'object-assign',
			'reactify',
			'grunt-browserify',
			'browserify',
			'grunt',
			'jquery'
		], {
			save: true
		});
	}
});

