 colors = require 'colors'
 
 module.exports = (env) ->
-	(repo_url, cwd) ->
-		launchInstall = (repo_url, cwd) ->
+	(url, cwd) ->
+		launchInstall = (url, cwd) ->
 			defer = Q.defer()
-			if not repo_url?
+			if not url?
 				return env.debug 'Please provide a repository address for the plugin to install'
 			temp_location = cwd + '/plugins/cloned'
-			cloneTheRepository repo_url, temp_location, (err) ->
+			cloneTheRepository url, temp_location, (err) ->
 				return defer.reject err if err
 				getPluginDetails temp_location, (err, plugin_data) ->
 					return defer.reject err if err
 					moveCloneInPluginsFolder plugin_data.name, cwd, (err) ->
 						return defer.reject err if err
-						addToPluginList plugin_data.name, cwd, (err) ->
+						addToPluginList plugin_data.name, url, cwd, (err) ->
 							return defer.reject err if err
 							defer.resolve()
 			defer.promise
 
-		getRepositoryTagNameIfExist = (url, callback) ->
+		getRepositoryTagNameIfExist = (full_url, callback) ->
 			tag_name = null
-			tmpArray = url.split("^")
+			tmpArray = full_url.split("^")
 			repo_url = tmpArray[0]
 			if tmpArray.length > 1
 				tag_name = tmpArray[1]
 			return callback repo_url, tag_name
 
-		cloneTheRepository = (repo_url, temp_location, callback) ->
+		cloneTheRepository = (url, temp_location, callback) ->
 			rimraf temp_location, (err) ->
 				return callback err if err
-				getRepositoryTagNameIfExist repo_url, (repo_url, tag_name) ->
+				getRepositoryTagNameIfExist url, (repo_url, tag_name) ->
 					command = 'cd ' + temp_location + '; git clone ' + repo_url + ' ' + temp_location
 					if tag_name 
 						command += '; git checkout tags/' + tag_name
 					fs.mkdirSync temp_location
-					env.debug "Cloning " + repo_url.red + "."
+					env.debug "Cloning " + url.red + "."
 					exec command, (error, stdout, stderr) ->
 						return callback error if error
 						return callback null

					env.debug 'Plugin "' + plugin_name + '" successfully installed in "'+ folder_name + '".'
					return callback null

		addToPluginList = (plugin_name, cwd, callback) ->
			file =  cwd + '/plugins.json'
			jf.spaces = 4
			jf.readFile file, (err, obj) ->

				else
					return callback null
		
		launchInstall(url, cwd)

