From c71693ff04cf2e029abd184cc7159bf49e2c70cb Mon Sep 17 00:00:00 2001
From: afrolionx <mike@mikecorp.ca>
Date: Fri, 4 Dec 2015 03:47:52 -0500
Subject: [PATCH 1/8] updated vagrant file

---
 Vagrantfile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index 211f7b0..a0c5558 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -4,7 +4,7 @@
 Vagrant.configure(2) do |config|
   config.vm.box = "ubuntu/trusty64"
   config.vm.hostname = "dev-freecodecamp"
-  config.vm.boot_timeout = 400
+  config.vm.boot_timeout = 900
   
   # Disable automatic box update checking. If you disable this, then
   # boxes will only be checked for updates when the user runs
@@ -46,8 +46,8 @@ Vagrant.configure(2) do |config|
     vb.name = "fcc-box"
     vb.gui = false
     vb.cpus = 1
-    vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
-    vb.memory = "1024"
+    vb.customize ["modifyvm", :id, "--cpuexecutioncap", "75"]
+    vb.memory = "512"
   end
 
   config.vm.provision "puppet" do |puppet|

From 3eb4462953acd663c998d1739ed63e7e5b41fa0f Mon Sep 17 00:00:00 2001
From: afrolionx <mike@mikecorp.ca>
Date: Fri, 4 Dec 2015 04:21:04 -0500
Subject: [PATCH 2/8] updated vagrantfile

---
 Vagrantfile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index a0c5558..5fa7e9d 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -5,7 +5,7 @@ Vagrant.configure(2) do |config|
   config.vm.box = "ubuntu/trusty64"
   config.vm.hostname = "dev-freecodecamp"
   config.vm.boot_timeout = 900
-  
+
   # Disable automatic box update checking. If you disable this, then
   # boxes will only be checked for updates when the user runs
   # `vagrant box outdated`. This is not recommended.
@@ -22,7 +22,7 @@ Vagrant.configure(2) do |config|
   # Rename the default user
   # config.ssh.username = "fccuser"
   # config.ssh.private_key_path = "~/.vagrant.d/insecure_private_key"
-  
+
   # Create a forwarded port mapping which allows access to a specific port
   # within the machine from a port on the host machine. In the example below,
   # accessing "localhost:8080" will access port 80 on the guest machine.
@@ -36,7 +36,7 @@ Vagrant.configure(2) do |config|
   # the path on the host to the actual folder. The second argument is
   # the path on the guest to mount the folder. And the optional third
   # argument is a set of non-required options.
-  config.vm.synced_folder "./freecodecamp", "/home/fccuser/developer/freecodecamp"
+  config.vm.synced_folder "./freecodecamp", "/home/vagrant/freecodecamp", create: true
 
   # Provider-specific configuration so you can fine-tune various
   # backing providers for Vagrant. These expose provider-specific options.

From 991554d7135d932b2a3eecb383deae4d2a0eeca6 Mon Sep 17 00:00:00 2001
From: afrolionx <mike@mikecorp.ca>
Date: Fri, 4 Dec 2015 04:22:02 -0500
Subject: [PATCH 3/8] updated gitignore

---
 .gitignore | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 700a258..eff1ffc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,4 +30,7 @@ node_modules
 typings
 
 # Vagrant directory
-.vagrant
\ No newline at end of file
+.vagrant
+
+# Working directory
+freecodecamp/
\ No newline at end of file

From e96974e5eb132ee1381706d98d8eb071f8b24352 Mon Sep 17 00:00:00 2001
From: afrolionx <mike@mikecorp.ca>
Date: Fri, 4 Dec 2015 04:22:21 -0500
Subject: [PATCH 4/8] removed legacy example data

---
 freecodecamp/coolapp.js | 6 ------
 1 file changed, 6 deletions(-)
 delete mode 100644 freecodecamp/coolapp.js

diff --git a/freecodecamp/coolapp.js b/freecodecamp/coolapp.js
deleted file mode 100644
index a2949bf..0000000
--- a/freecodecamp/coolapp.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var http = require('http');
-http.createServer(function (req, res) {
-  res.writeHead(200, {'Content-Type': 'text/plain'});
-  res.end('Hello World\n');
-}).listen(1337, '127.0.0.1');
-console.log('Server running at http://127.0.0.1:1337/');
\ No newline at end of file

From c59719ce6255c4245763c569bf7df5c3a5339a50 Mon Sep 17 00:00:00 2001
From: afrolionx <mike@mikecorp.ca>
Date: Fri, 4 Dec 2015 04:22:42 -0500
Subject: [PATCH 5/8] added nodejs module

---
 provision/puppet/modules/nodejs/manifests/init.pp | 52 +++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 provision/puppet/modules/nodejs/manifests/init.pp

diff --git a/provision/puppet/modules/nodejs/manifests/init.pp b/provision/puppet/modules/nodejs/manifests/init.pp
new file mode 100644
index 0000000..70da159
--- /dev/null
+++ b/provision/puppet/modules/nodejs/manifests/init.pp
@@ -0,0 +1,52 @@
+class nodejs {
+  include stdlib
+
+  $bin = '/usr/local/bin:/usr/bin:/bin'
+  $user = 'vagrant'
+
+  # Get nvm and pipe to bash shell to run script
+  # INFO: Will install as root
+  # INFO: install dir is /.nvm
+  exec { 'nodejs::install_nvm':
+    user    => $user,
+    command => 'curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | NVM_DIR=/home/vagrant/.nvm bash',
+    path    => $bin,
+    require => [Package['git'], Package['curl']]
+  }
+
+  # Use nvm to install node
+  exec { 'nodejs::nvm_install_node':
+    user      => $user,
+    command   => "bash -c 'source /home/vagrant/.nvm/nvm.sh ; nvm install 4.2.2'",
+    path      => $bin,
+    # unless    => "bash -c 'source /home/vagrant/.nvm/nvm.sh ; nvm list | grep node | grep v4.2.2'",
+    logoutput => on_failure,
+    require   => [Exec['nodejs::install_nvm']]
+  }
+
+  # use nvm node version
+  exec { 'nodejs::nvm_use_node':
+    user      => $user,
+    command   => "bash -c 'source /home/vagrant/.nvm/nvm.sh ; nvm use v4.2.2'",
+    path      => $bin,
+    # unless    => "bash -c 'source /home/vagrant/.nvm/nvm.sh ; nvm list | grep node | grep v4.2.2'",
+    logoutput => on_failure,
+    require   => [Exec['nodejs::nvm_install_node']]
+  }
+
+  # Add nvm to .bashrc
+  file_line { 'nodejs::nvm_profile_config_env':
+    path    => '/home/vagrant/.bashrc',
+    # line    => 'export NVM_DIR="$NVM_DIR"',
+    line    => 'export NVM_DIR="/home/vagrant/.nvm"',
+    require => [Exec['nodejs::nvm_install_node']]
+  }->
+  file_line { 'nodejs::nvm_profile_config_path':
+    path    => '/home/vagrant/.bashrc',
+    line    => '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm'
+  }->
+  file_line { 'nodejs::nvm_profile_config_path_node':
+    path    => '/home/vagrant/.bashrc',
+    line    => 'export PATH=$PATH:/home/vagrant/.nvm/versions/node/v4.2.2/bin'
+  }
+}
\ No newline at end of file

From be82c5e7bfad3d946354ef772b2878de069e1600 Mon Sep 17 00:00:00 2001
From: afrolionx <mike@mikecorp.ca>
Date: Fri, 4 Dec 2015 04:23:03 -0500
Subject: [PATCH 6/8] reworked main puppet flow

---
 provision/puppet/manifests/main.pp | 84 ++++++++++++++++++++------------------
 1 file changed, 44 insertions(+), 40 deletions(-)

diff --git a/provision/puppet/manifests/main.pp b/provision/puppet/manifests/main.pp
index a4f8f82..d5902f0 100644
--- a/provision/puppet/manifests/main.pp
+++ b/provision/puppet/manifests/main.pp
@@ -1,20 +1,20 @@
-class user_creation {
-  $pass = "password"
-  $salt = "somesalt"
-  
-  user { "fccuser":
-    name => 'fccuser', # redundant
-    ensure => 'present',
-    # uid => '', # auto generated
-    shell => '/bin/bash',
-    home => '/home/fccuser',
-    comment => 'safe user',
-    password => inline_template("<%= '$pass'.crypt('\$6$$salt') %>"),
-    managehome => true,
-    gid => 'vagrant',
-    groups => [],
-  }
-}
+# class user_creation {
+#   $pass = "password"
+#   $salt = "somesalt"
+
+#   user { "fccuser":
+#     name => 'fccuser', # redundant
+#     ensure => 'present',
+#     # uid => '', # auto generated
+#     shell => '/bin/bash',
+#     home => '/home/fccuser',
+#     comment => 'safe user',
+#     password => inline_template("<%= '$pass'.crypt('\$6$$salt') %>"),
+#     managehome => true,
+#     gid => 'vagrant',
+#     groups => [],
+#   }
+# }
 
 class apt_update {
   exec { "aptGetUpdate":
@@ -23,27 +23,6 @@
   }
 }
 
-class nodejs {
-  exec { "git_clone_n":
-    command => "git clone https://github.com/visionmedia/n.git /home/vagrant/n",
-    path => ["/bin", "/usr/bin"],
-    require => [Exec["aptGetUpdate"], Package["git"], Package["curl"], Package["g++"]]
-  }
-
-  exec { "install_n":
-    command => "make install",
-    path => ["/bin", "/usr/bin"],
-    cwd => "/home/vagrant/n",
-    require => Exec["git_clone_n"]
-  }
-
-  exec { "install_node":
-    command => "n stable",
-    path => ["/bin", "/usr/bin", "/usr/local/bin"],  
-    require => [Exec["git_clone_n"], Exec["install_n"]]
-  }
-}
-
 class mongodb {
   class {'::mongodb::globals':
     manage_package_repo => true,
@@ -57,8 +36,33 @@
   class {'::mongodb::client': }
 }
 
-include user_creation
+# List out provisioning stages
+stage { 'pre':
+  before => Stage['main']
+}
+stage { 'post': }
+Stage['main'] -> Stage['post']
+
+# List classes in stages
+class { 'apt_update':
+  stage => pre
+}
+class { 'othertools':
+  stage => pre
+}
+class { 'nodejs':
+  stage => main
+}
+class { 'mongodb':
+  stage => main
+}
+class { 'freecodecamp':
+  stage => post
+}
+
 include apt_update
 include othertools
 include nodejs
-include mongodb
\ No newline at end of file
+include mongodb
+include freecodecamp
+#include user_creation
\ No newline at end of file

From 61e6a82d88595b3c56b97e899310c7f09673a39d Mon Sep 17 00:00:00 2001
From: afrolionx <mike@mikecorp.ca>
Date: Fri, 4 Dec 2015 04:26:28 -0500
Subject: [PATCH 7/8] renamed todo file; updated file

---
 TODO.md     | 13 +++++++++++++
 TODOLIST.md | 37 -------------------------------------
 2 files changed, 13 insertions(+), 37 deletions(-)
 create mode 100644 TODO.md
 delete mode 100644 TODOLIST.md

diff --git a/TODO.md b/TODO.md
new file mode 100644
index 0000000..058cc9b
--- /dev/null
+++ b/TODO.md
@@ -0,0 +1,13 @@
+#LIST OF THINGS
+
+###Short Term
+- update README.md
+ - update repo flow list
+ - create 'how to use' section
+
+###Mid Term
+
+###Long Term
+
+####NOTES
+- must have hostmanager vagrant plugin installed (add to readme)
\ No newline at end of file
diff --git a/TODOLIST.md b/TODOLIST.md
deleted file mode 100644
index f3eb33a..0000000
--- a/TODOLIST.md
+++ /dev/null
@@ -1,37 +0,0 @@
-#LIST OF THINGS
-
-###Short Term
-- Update the README.md
- - Add link for Vagrant
-  - Instructions for installing Vagrant
- - Add link for host manager plugin
-  - Instructions for installing plugin
-- Create 'fccuser' 
- - Add to 'vagrant' group
- - Add to sudoers group
-
-###Mid Term
-- Install linuxbrew under 'fccuser'
- - run command to install linuxbrew
- - edit the PATH variable
-  - custom .bashrc file (?)
-- Install node as 'fccuser'
-
-###Long Term
-- Clone FCC repo to /home/fccuser/developer/freecodecamp
-- Set the share/swap directory as easily configurable by the user (if they have a local fork to keep the vagrant freecodecamp pointed at their local file system)
- - Not really sure what this means? (-afro)
-- Profit?
-
-###BONUS
-- Set up mongo to listen to an ip other than localhost on a port other than 27017.
-
-####NOTES
-- must have hostmanager vagrant plugin installed (add to readme)
-
-```
-useradd -s /bin/bash -m -d /home/safeuser -c "safe user” fccuser
-passwd safeuser
-webdev
-usermod -aG sudo fccuser
-```
\ No newline at end of file

From 42ce3ca97fc18ef5fb51751bb2339032a16c633e Mon Sep 17 00:00:00 2001
From: afrolionx <mike@mikecorp.ca>
Date: Fri, 4 Dec 2015 04:26:40 -0500
Subject: [PATCH 8/8] updated readme

---
 README.md | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 21a4aa9..1661589 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,12 @@
  - This repo is currently incomplete (Updated: 2015-06-05)
  
 ##Pre-req
- - Vagrant installed
- - hostmanager vagrant plugin installed
+ - Install [Vagrant](https://www.vagrantup.com/downloads.html)
+  - Select the OS that you're working with
+  - Download and run the installer
+ - Install [hostmanager](https://github.com/smdahlen/vagrant-hostmanager) vagrant plugin
+  - Open a terminal window in which ever OS you're working in
+  - Enter the command `vagrant plugin install vagrant-hostmanager`
 
 ##Repo Flow
 - Vagrantfile for FreeCodeCamp
