Skip to content

Instantly share code, notes, and snippets.

@hiroki-uchida
Created October 19, 2017 09:45
Show Gist options
  • Save hiroki-uchida/6cf227d9b703697afebb73e51ae5bb88 to your computer and use it in GitHub Desktop.
Save hiroki-uchida/6cf227d9b703697afebb73e51ae5bb88 to your computer and use it in GitHub Desktop.
itame cookbook. ruby install by xbuild.
# cookbooks/ruby/default.rb
# xbuildに必要なパッケージインストール
package 'git'
package 'gcc'
package 'openssl-devel'
package 'libyaml-devel'
package 'libffi-devel'
package 'readline-devel'
package 'zlib-devel'
package 'gdbm-devel'
package 'ncurses-devel'
# xbuildのインストール
git '/usr/local/xbuild' do
repository 'https://github.com/tagomoris/xbuild.git'
end
# rubyのインストール
execute "/usr/local/xbuild/ruby-install #{node[:ruby][:version]} /usr/local/ruby-#{node[:ruby][:version]}" do
not_if "test -e /usr/local/ruby-#{node[:ruby][:version]}"
end
# パスを通す
execute "echo 'export PATH=/usr/local/ruby-#{node[:ruby][:version]}/bin:$PATH' >> /root/.bashrc" do
not_if "grep 'export PATH=/usr/local/ruby-#{node[:ruby][:version]}/bin:$PATH' /root/.bashrc"
end
# パスを通す
execute "echo 'export PATH=/usr/local/ruby-#{node[:ruby][:version]}/bin:$PATH' >> /home/vagrant/.bashrc" do
not_if "grep 'export PATH=/usr/local/ruby-#{node[:ruby][:version]}/bin:$PATH' /home/vagrant/.bashrc"
end
# node.yml
ruby:
version: 2.4.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment