<commit_before>'use strict';

var fs = require('fs');

var BOOT2DOCKER = 'Boot2Docker';

module.exports = function(kbox) {

  var sysProfiler = kbox.install.sysProfiler;

  // Boot2docker installed?
  kbox.install.registerStep(function(step) {
    step.name = 'boot2docker-installed';
    step.description = 'Check if boot2docker is installed.';
    step.deps = [];
    step.all = function(state, done) {
      sysProfiler.isAppInstalled(BOOT2DOCKER, function(err, isInstalled) {
        if (err) {
          done(err);
        } else {
          state.isBoot2DockerInstalled = isInstalled;
          state.log(BOOT2DOCKER + ' is installed?: ' + isInstalled);
          done();
        }
      });
    };
  });

  // Boot2docker profile exists?
  kbox.install.registerStep(function(step) {
    step.name = 'boot2docker-profile-exists';
    step.description = 'Check if boot2docker profile exists.';
    step.deps = [];
    step.all.darwin = function(state, done) {
      var filepath = path.join(config.sysProviderRoot, 'profile');
      fs.exists(filepath, function(exists) {
        state.boot2dockerProfileExists = exists;
        done();
      });
    };
  });

};<commit_msg>Added almost complete docker dependency download install step.<commit_after>'use strict';

var fs = require('fs');

var BOOT2DOCKER = 'Boot2Docker';

var PROVIDER_URL_PROFILE =
  'https://raw.githubusercontent.com/' +
  'kalabox/kalabox-boot2docker/master/profile';

module.exports = function(kbox) {

  var sysProfiler = kbox.install.sysProfiler;

  // Boot2docker installed?
  kbox.install.registerStep(function(step) {
    step.name = 'is-boot2docker-installed';
    step.description = 'Check if boot2docker is installed.';
    step.deps = [];
    step.all = function(state, done) {
      sysProfiler.isAppInstalled(BOOT2DOCKER, function(err, isInstalled) {
        if (err) {
          done(err);
        } else {
          state.isBoot2DockerInstalled = isInstalled;
          state.log(BOOT2DOCKER + ' is installed?: ' + isInstalled);
          done();
        }
      });
    };
  });

  // Boot2docker profile set?
  kbox.install.registerStep(function(step) {
    step.name = 'is-boot2docker-profile-set';
    step.description = 'Check if boot2docker profile is set.';
    step.deps = [];
    step.all.darwin = function(state, done) {
      var filepath = path.join(config.sysProviderRoot, 'profile');
      fs.exists(filepath, function(exists) {
        state.isBoot2dockerProfileSet = exists;
        done();
      });
    };
  });

  // Download docker dependencies
  kbox.install.registerStep(function(step) {
    step.name = 'download-docker-dependencies';
    step.description = 'Download docker dependencies';
    step.deps = ['internet'];
    step.all.darwin = function(state, done) {

      // Init.
      if (!state.downloadDir) {
        state.downloaDir = kbox.util.disk.getTempDir();
      }
      state.dockerDependencyDownloads = [];

      // Boot2docker profile.
      if (!state.isBoot2dockerProfileSet) {
        state.dockerDependencyDownloads.push(PROVIDER_URL_PROFILE);
      }

      // Download dependencies/
      var urls = state.dockerDependencyDownloads;
      if (urls.length > 0) {
        kbox.util.download.downloadFiles(urls, state.downloadDir, function() {
          done();          
        });
      } else {
        done();
      }

    };
  });

};
{'fraction_non_alphanumeric': 0.13392592592592592, 'fraction_numerical': 0.008296296296296296, 'mean_word_length': 2.681570338058888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1392992', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1062, 'n_words': 186}