Skip to content

Commit

Permalink
Generator Plugin rename fix
Browse files Browse the repository at this point in the history
Fixes for issue romainberger#53
  • Loading branch information
borisaguilar committed Apr 30, 2014
1 parent c8a4871 commit b9d251d
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions plugin/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

'use strict';

var util = require('util')
Expand Down Expand Up @@ -69,11 +68,8 @@ Generator.prototype.createPlugin = function createPlugin() {
Generator.prototype.editFiles = function editFiles() {
var cb = this.async()
, self = this

fs.rename('app/wp-content/plugins/plugin-name', 'app/wp-content/plugins/'+self.safeName, function() {
fs.rename('app/wp-content/plugins/'+self.safeName+'/plugin-name.php', 'app/wp-content/plugins/'+self.safeName+'/'+self.safeName+'.php', function() {
var pluginFile = 'app/wp-content/plugins/'+self.safeName+'/'+self.safeName+'.php'

fs.readFile(pluginFile, 'utf8', function(err, data) {
if (err) throw err

Expand All @@ -82,8 +78,7 @@ Generator.prototype.editFiles = function editFiles() {

fs.writeFile(pluginFile, data)
fs.unlink('app/wp-content/plugins/README.md', function() {
cb()
})
cb()
})
})
})
Expand Down

0 comments on commit b9d251d

Please sign in to comment.