Permalink
Please sign in to comment.
Browse files
Merge branch 'nvm-config'
# Conflicts: # README.md # TODOLIST.md # Vagrantfile # provision/puppet/manifests/main.pp # provision/puppet/modules/nodejs/manifests/init.pp
- Loading branch information...
Showing
with
114 additions
and 53 deletions.
- +4 −1 .gitignore
- +18 −26 README.md
- +13 −0 TODO.md
- +6 −6 Vagrantfile
- +27 −5 provision/puppet/manifests/main.pp
- +46 −15 provision/puppet/modules/nodejs/manifests/init.pp
5
.gitignore
44
README.md
@@ -1,29 +1,21 @@ | ||
-# README | ||
+#README | ||
- This repo is currently incomplete (Updated: 2015-06-05) | ||
+ | ||
+##Pre-req | ||
+ - 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` | ||
-## Pre-req | ||
- - Vagrant installed | ||
- - hostmanager vagrant plugin installed | ||
- | ||
-## Vagrant Flow | ||
-- Vagrant will spin up Ubuntu 14.04 (trusty64) | ||
-- Vagrant will create sync folder | ||
- - Sync:: ./freecodecamp -> /home/vagrant/developer/freecodecamp | ||
+##Repo Flow | ||
- Vagrantfile for FreeCodeCamp | ||
- - Puppet:: apt-get update | ||
- - Puppet:: othertools | ||
- - Puppet:: nodejs | ||
- - Puppet:: mongodb | ||
- - Puppet:: corefcc | ||
- - Puppet:: git clone fcc | ||
- - Puppet:: ownership node/npm | ||
- - Puppet:: limit npm jobs | ||
- - Puppet:: npm install -g babel@5.8.29 | ||
- - Puppet:: npm install --loglevel silent | ||
- - Puppet:: npm install -g gulp | ||
- - Puppet:: npm install -g bower | ||
- - Puppet:: bower install | ||
- - Puppet:: env-file -> developer/freecodecamp | ||
- - Puppet:: run seeding | ||
- | ||
-npm config jobs | ||
+ - Vagrant will spin up Ubuntu 14.04 (Trusty) | ||
+ - Machine will be provisioned by puppet | ||
+ - Puppet:: Node.js | ||
+ - Puppet:: MongoDB | ||
+ - Puppet:: Tools (Git, Vim, Curl, HTOP) | ||
+ - Puppet:: Ruby, G++, Build-Essentials | ||
+ - Vagrant will create sync folder | ||
+ - Sync:: ./freecodecamp -> /home/fccuser/developer/freecodecamp |
13
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) |
12
Vagrantfile
32
provision/puppet/manifests/main.pp
61
provision/puppet/modules/nodejs/manifests/init.pp
@@ -1,21 +1,52 @@ | ||
class nodejs { | ||
- exec { "git_clone_n": | ||
- command => "git clone https://github.com/visionmedia/n.git /home/vagrant/n", | ||
- path => ["/bin", "/usr/bin"], | ||
- onlyif => ['test ! -d /home/vagrant/n'], | ||
- require => [Exec["aptGetUpdate"], Package["git"], Package["curl"], Package["g++"]] | ||
+ 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']] | ||
} | ||
- exec { "install_n": | ||
- command => "make install", | ||
- path => ["/bin", "/usr/bin"], | ||
- cwd => "/home/vagrant/n", | ||
- require => Exec["git_clone_n"] | ||
+ # 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']] | ||
} | ||
- exec { "install_node": | ||
- command => "n 4.2.1", | ||
- path => ["/bin", "/usr/bin", "/usr/local/bin"], | ||
- require => [Exec["git_clone_n"], Exec["install_n"]] | ||
+ # 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' | ||
} | ||
-} | ||
+} |
0 comments on commit
ec95cde