Created
February 3, 2012 15:43
-
-
Save amaltson/1730793 to your computer and use it in GitHub Desktop.
Using not_if block, but still continues to download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include_recipe "nodejs::npm" | |
hubot_user = "#{node['hubot']['user']}" | |
hubot_group = "#{node['hubot']['group']}" | |
install_dir = "#{node['hubot']['install_dir']}" | |
install_dir_parent = "#{node['hubot']['install_dir_parent']}" | |
version = "#{node['hubot']['version']}" | |
# Create the hubot user to run hubot | |
group hubot_group do | |
end | |
user hubot_user do | |
comment "Runs hubot" | |
gid hubot_group | |
home install_dir | |
shell "/bin/bash" | |
end | |
directory install_dir do | |
owner hubot_user | |
group hubot_group | |
mode "0775" | |
action :create | |
end | |
# required os packages | |
%w{ libexpat1 libexpat1-dev }.each do |pkg| | |
package pkg do | |
action :install | |
end | |
end | |
bash "install hubot" do | |
user hubot_user | |
group hubot_group | |
environment ({'HOME' => "#{install_dir}" }) | |
cwd install_dir_parent | |
code <<-EOH | |
wget -P /tmp https://github.com/downloads/github/hubot/hubot-#{version}.tar.gz && \ | |
tar xzf /tmp/hubot-#{version}.tar.gz && \ | |
cd hubot && \ | |
npm install | |
EOH | |
not_if "#{install_dir}/bin/hubot -v 2>&1 | grep '#{version}'" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment