apostrophecms / apostrophe-sandbox

This sandbox site is the basis for our live demo. For your own projects, you can use apostrophe-boilerplate as a more streamlined, cleaner point of departure via the apostrophe-cli tool.
MIT License
112 stars 41 forks source link

Why not issue a node app.js apostrophe:reset when db is empty #25

Closed mannyvergel closed 10 years ago

mannyvergel commented 10 years ago

Hi,

I noticed that I can start node app.js even without calling apostrophe:reset however the features are not complete. So I included node app.js apostrophe:reset and it resolved the issue.

My suggestion is to automatically issue node app.js apostrophe:reset when the db is empty. Currently I'm having issue with openshift with this because I can't issue this command directly in my remote.

Regards

boutell commented 10 years ago

Are you sure openshift gives you no way to run non-interactive tasks? There are always going to be time-consuming tasks that aren't an awesome choice to run via a web interface.

On Fri, Jan 17, 2014 at 4:43 AM, Manny notifications@github.com wrote:

Hi,

I noticed that I can start node app.js even without calling apostrophe:reset however the features are not complete. So I included node app.js apostrophe:reset and it resolved the issue.

My suggestion is to automatically issue node app.js apostrophe:reset when the db is empty. Currently I'm having issue with openshift with this because I can't issue this command directly in my remote.

Regards

— Reply to this email directly or view it on GitHubhttps://github.com/punkave/apostrophe-sandbox/issues/25 .

Tom Boutell Lead Developer P'unk Avenue 215 755 1330 punkave.com window.punkave.com

mannyvergel commented 10 years ago

I just added the ff after declaration of site so program will do it on its own:

setTimeout(function() {
      site.db.collection('sysParams', function(err, collection) {

        collection.findOne({name:'INIT_DB'}, function(err, sysParam) {
            if (!sysParam) {
                var initDbSysPar = {
                  name: 'INIT_DB',
                  value: 'Y'
                };
                collection.insert(initDbSysPar, function(err, sysParam){});
                console.log("Initializing DB for the first time..");
                site.apos.tasks.reset();
            }

        })

      });
    }, 5000)