<commit_before>#!/usr/bin/env node

var fs        = require('fs'),
    url       = require('url'),
    http      = require('http'),
    prompt    = require('prompt'),
    download  = require('download'),
    pecanApp  = require('commander'),
    pecanInfo = require('./package.json');

var pypRepo = 'https://github.com/jdf/processing.py/archive/master.zip',
    dir = './processing.py-master';

pecanApp
  .parse(process.argv);

var setupPecanProject = function () {
  console.log('Let\'s get some details.');

  // Setup `run.sh` file
  // get app entry point
  prompt.message   = "";
  prompt.delimiter = "";
  prompt.start();
  var appInfo = {
    properties: {
      projectEntrypoint: {
        message: 'Application Entrypoint: ',
        pattern: /\w*.py$/,
        default: 'main.py',
        required: true
      },
      contributors: {
        message: 'Contributor(s): ',
        required: false
      }
    }
  };

  prompt.get(appInfo, function (err, result){
    // Creat Pecan run file
    // result.projectEntrypoint
    // result.contributors
  });
};

// Check it project already exists
if (fs.existsSync('./run.pecan')) {
  console.log('Pecan project already exists!');
  process.exit(1);
} else {
  // Begin Setup
  console.log('Lets get your directory setup.');
  console.log('Downloading PyProcessing lib');

  // Check if PyProcessing libs are already installed
  if (!fs.existsSync(dir)){
    // Download PyProcessing Repo
    new download({mode: '755', extract: true})
      .get(pypRepo)
      .dest('./')<commit_msg>Major updates<commit_after>#!/usr/bin/env node

var fs        = require('fs'),
    url       = require('url'),
    http      = require('http'),
    shjs      = require('shelljs'),
    prompt    = require('prompt'),
    download  = require('download'),
    pecanApp  = require('commander');

// PyProcessing Repo and destination
var pypRepo       = 'https://github.com/jdf/processing.py/archive/master.zip',
    pecanLib      = process.env.HOME + '/.pecan',
    pypFolder     = '/processing.py-master',
    pecanConfig   = './config.pecan';

pecanApp
  .parse(process.argv);

var setupPecanProject = function () {
  console.log('Let\'s get some details.');

  // Setup config file
  prompt.message   = '';
  prompt.delimiter = '';
  prompt.start();
  var appInfo = {
    properties: {
      projectName: {
        message: 'Project Name:',
        required: false
      },
      projectEntrypoint: {
        message: 'Project Entrypoint:',
        pattern: /\w*.py$/,
        default: 'main.py',
        required: true,
        description: 'Define the projects entry point. (This would be your .pde in s sketch project.). This allows PyProcessing.'
      },
      author: {
        message: 'Author:',
        required: false
      },
      contributors: {
        message: 'Contributor(s):',
        required: false
      }
    }
  };

  prompt.get(appInfo, function (err, result){
    // Creat Pecan run file
    console.log('');
    console.log('Your Pecan project has been created!');
    console.log(JSON.stringify(result, null, 2));

    var wstream = fs.createWriteStream(pecanConfig);
    wstream.write(JSON.stringify(result, null, 2));
    wstream.end(function () { console.log(pecanConfig, 'file saved.'); });
  });
};

// Check if project already exists
if (fs.existsSync(pecanConfig)) {
  console.log('Pecan project already exists!');
  process.exit(1);
} else {
  // Begin Setup
  console.log('Lets get your Project setup.');
  console.log('Cecking if PyProcessing lib is installed');

  // Check if PyProcessing libs are already installed
  if (!fs.existsSync(pecanLib + pypFolder)){
    // Lib not installed
    // Create directory
    shjs.mkdir('-p', pecanLib + pypFolder);
    // Download PyProcessing Repo
    new download({mode: '755', extract: true})
      .get(pypRepo)
      .dest(pecanLib + pypFolder)
{'fraction_non_alphanumeric': 0.15090439276485787, 'fraction_numerical': 0.002583979328165375, 'mean_word_length': 2.6245318352059925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7006087', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1182, 'n_words': 287}