Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Update to avoid using .remote() #26

Closed
sayedihashimi opened this issue Dec 29, 2014 · 7 comments
Closed

Update to avoid using .remote() #26

sayedihashimi opened this issue Dec 29, 2014 · 7 comments

Comments

@sayedihashimi
Copy link
Member

Migrated issue from ligershark/generator-aspnet#9. See that for full comments.

@shirhatti in the current implementation we are using .remote() in index.js to retrieve the template content. What I've noticed is that when calling .remote() if the git repo exists on the client cache then it will not be refreshed. There is a refresh parameter on remote(). If we specify true for refresh then the git repo will be cloned each time when the generator is invoked. On my box in order to get rid of yeoman cache I had to remove yo.

Is using .remote() the right approach here? I looked at the generator-angular and they include the files directly inside the npm package then use .template() and .copy() to write the files.

The code to always update when using remote is below.

    retrieveContent: function () {
        var done = this.async();

        this.remote('ligershark', 'aspnet_vnext_samples', 'master', function(err, remote) {
            done();
        },true);
    }

cc @jchannon

@spboyer
Copy link
Contributor

spboyer commented Dec 30, 2014

We have all of the templates local to the generator for subgenerators, what is everyone's thought?

@peterblazejewicz
Copy link
Member

If possible I think generator-asponet should use built-in copy feature of Yo's.

There is two level built-in solution in Yeoman to update generators AFAIK and keep users up-to-date with released, most recent versions:

#1
if user run yo she will be presented with option to update installed generators:

  Mocha 
  ──────────────
❯ Update your generators 
  Install a generator 

update:
generator-aspnet update is presented that way:

? 'Allo Piotr! What would you like to do? 
  ──────────────
  Run a generator
  Angular 
❯ Aspnet ♥ Update Available! 
  Bootstrap 
  Bootstrap Examples 
  Generator 
(Move up and down to reveal more choices)

#2
if generator-aspnet adds Yeoman's update plugin dependency the status of generator-aspnet will be checked on each run by Yeoman's itself:
https://github.com/yeoman/update-notifier

There is additional benefit of moving to use copy feature instead of fetching from git directly. During generator development that is not possible to work with locally updated content - samples are always fetched from remote upstream master - not from local repository used for development.

@sayedihashimi
Copy link
Member Author

Yes I agree we should stop using .remote(). I think having all the files in the npm package is better so that offline works and so that you don't have to push to github to test template changes.

Update plugin sounds good as well.

@peterblazejewicz
Copy link
Member

The implementation for local templates/files can be as simple as:
https://gist.github.com/peterblazejewicz/9ae54b300b862b4e5320
I'd also think about bringing back tests for templ/files creation process.

@spboyer
Copy link
Contributor

spboyer commented Feb 3, 2015

@peterblazejewicz have you done this locally and tested?

@peterblazejewicz
Copy link
Member

@spboyer Yes, this is from my local branch. Can I bring back default Yeoman's testing structure to project? (by default yeoman-generator scaffolds tests for generator projects). I could investigate this.
I would not add local copy features yet unless covered by tests

@spboyer
Copy link
Contributor

spboyer commented Feb 5, 2015

.remote() removed and test coverage added for entire repo in latest PR -> #59

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants