2013-10-22 43 views
5

İlk Yeoman Jeneratörümü oluşturuyorum. CMS içeren bir harici zip indirip kökünde sıkıştırmak istiyorum. this thread'a göre bu mümkün olmalıdır. Bu henüz uygulanmadı mı? Değilse jeneratörüme kopyalamak için neye ihtiyacım var?Yeoman üreticisi ile zip indirme

Jeneratör jeneratörü çalıştırdım ve temel jeneratörü çalıştırdım. Bu benim kodum şu ana kadar.

Generator.prototype.getVersion = function getVersion() { 
    var cb = this.async() 
    , self = this 

    this.log.writeln('Downloading Umbraco version 6.1.6') 
    this.download('http://our.umbraco.org/ReleaseDownload?id=92348', '.'); 
} 

Bu "modülü 'indir' bulamıyor" olduğunu söyleyip bir hata üretir. Doğru sözdizimi nedir?

+0

Merhaba. Cevabımı kabul etmeyi düşünür müsün? Teşekkürler. –

cevap

6

Sizin için biraz araştırma yaptım. bir şeyler ters giderse

There are two methods to download something with yeoman...

/** 
* Download a string or an array of files to a given destination. 
* 
* @param {String|Array} url 
* @param {String} destination 
* @param {Function} cb 
*/ 

this.fetch(url, destination, cb) 

/** 
* Fetch a string or an array of archives and extract it/them to a given 
* destination. 
* 
* @param {String|Array} archive 
* @param {String} destination 
* @param {Function} cb 
*/ 

this.extract(archive, destination, cb) 

geri arama

bir hata geçecek.

There's also a method to download packages from Github.

/** 
* Remotely fetch a package from github (or an archive), store this into a _cache 
* folder, and provide a "remote" object as a facade API to ourself (part of 
* generator API, copy, template, directory). It's possible to remove local cache, 
* and force a new remote fetch of the package. 
* 
* ### Examples: 
* 
*  this.remote('user', 'repo', function(err, remote) { 
*  remote.copy('.', 'vendors/user-repo'); 
*  }); 
* 
*  this.remote('user', 'repo', 'branch', function(err, remote) { 
*  remote.copy('.', 'vendors/user-repo'); 
*  }); 
* 
*  this.remote('http://foo.com/bar.zip', function(err, remote) { 
*  remote.copy('.', 'vendors/user-repo'); 
*  }); 
* 
* When fetching from Github 
* @param {String} username 
* @param {String} repo 
* @param {String} branch 
* @param {Function} cb 
* @param {Boolean} refresh 
* 
* @also 
* When fetching an archive 
* @param {String} url 
* @param {Function} cb 
* @param {Boolean} refresh 
*/ 
+0

Yardım gerekli !! Yeniden yapılandırma ve satıcılar/kullanıcı yanıtları neyi gösterir? Gerçek 'depo' için 'URL' yolunun tamamını repo? – Daggerhunt

+0

@Daggerhunt: remote.copy'un argümanları 'source' ve 'destination' yollarıdır (yerel), bu nedenle hedefin, dosyaların sonlanmasını istediğiniz yere değiştirdiğiniz anlamına gelir. 'repo' sadece url'yi oluşturmak için kullanılan depo adı olmalıdır: url = 'https://github.com/' + [kullanıcı adı, repo, 'arşiv', şube] .join ('/') + ' tar.gz ';' –