Permalink
Browse files

comment for pre commit hook, still trying to sort out the npm issues …

…in the default recipe
  • Loading branch information...
1 parent 4ac84b0 commit 4ba3c8e3ecbb00a436ac3a19e724f50c59ba34ce @johnbender committed May 27, 2011
Showing with 29 additions and 14 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 Vagrantfile
  3. +26 −13 cookbooks/jshint-service/recipes/default.rb
  4. +1 −1 pre-commit.sh
View
@@ -1 +1,2 @@
node_modules
+npm-debug.log
View
@@ -13,5 +13,6 @@ Vagrant::Config.run do |config|
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks"]
chef.add_recipe "jshint-service"
+ chef.json.merge!(:deploy => { :dir => "/vagrant", :user => "vagrant"})
end
end
@@ -5,7 +5,14 @@
package "libssl-dev"
package "curl"
-execute "get and build node" do
+user node[:deploy][:user] do
+ shell "/bin/bash"
+ home "/home/#{node[:deploy][:user]}"
+ system true
+end
+
+log "cloning and building node"
+execute "clone and build node" do
command <<-CODE
git clone --depth 1 https://github.com/joyent/node.git
git checkout v0.4.8
@@ -14,28 +21,34 @@
make
CODE
- user "vagrant"
+ cwd "/tmp"
+ user node[:deploy][:user]
end
+log "installing node"
execute "install node" do
command "make install"
cwd "/tmp/node"
- user "root"
end
+log "installing npm"
execute "install npm" do
- command <<-CODE
- curl http://npmjs.org/install.sh | sudo clean=yes sh
- CODE
+ command "curl http://npmjs.org/install.sh | clean=yes sh"
+ not_if "which npm"
+end
- user "vagrant"
+# setup deploy directory
+directory node[:deploy][:dir] do
+ owner node[:deploy][:user]
+ recursive true
+ not_if "test -e #{node[:deploy][:dir]}"
end
+# TODO explodes despite running normally otherwise
+log "installing express and deps to deployment directory"
execute "install express" do
- command <<-CODE
- npm install express
- CODE
-
- cwd "/vagrant"
- user "vagrant"
+ command "npm install express"
+ cwd node[:deploy][:dir]
+ user node[:deploy][:user]
+ creates "#{node[:deploy][:dir]}/node_modules"
end
View
@@ -38,7 +38,7 @@ for file in $(git diff --cached --name-only --diff-filter=ACM | grep "\.js$"); d
contents=$(cat "$file")
# push the current file's contents to the jshint service
- hints=$(curl -s --connect-timeout 2 -f -H "Content-Type: text/javascript" -X POST -d "$contents" "$jshint_uri")
+ hints=$(curl -s -f -m 2 -H "Content-Type: text/javascript" -X POST -d "$contents" "$jshint_uri")
on_error "couldn't connect to $jshint_uri"
# if there's at least one line of output from the curl reponse

0 comments on commit 4ba3c8e

Please sign in to comment.