public static function version($plugin = null) {
		if (empty($plugin)) {
			try {
				$plugin = self::plugin(self::path(true));
			} catch (Exception $e) {}
		}

		if (empty($plugin)) {
			throw new Exception();
		}

		$name = $plugin . '.version';

		if (!Configure::check($name)) {
			$versionPath = CakePlugin::path($plugin) . 'VERSION';
			if (!file_exists($versionPath)) {
				throw new Exception();
			}
			$content = file($versionPath);
			Configure::write($name, trim(array_pop($content)));
		}

		return Configure::read($name);
	}