CFID-228: chef change to install maven 3 in dev_setup

Change-Id: I3def500755e20539cd10eec35a7630eb64007cc0
This commit is contained in:
Dave Syer 2012-03-30 16:45:50 +01:00
Родитель ffb4d65f43
Коммит 488f5aa76a
6 изменённых файлов: 36 добавлений и 6 удалений

Просмотреть файл

@ -53,8 +53,9 @@ unless File.exists?(File.join(deployment_info["cloudfoundry_path"], "bin", "vcap
end
ruby_bin_dir = deployment_info["ruby_bin_dir"]
maven_bin_dir = deployment_info["maven_bin_dir"]
gemdir = `#{File.join(ruby_bin_dir, "gem")} environment gemdir`.split("\n")[0]
ENV["PATH"] = "#{ruby_bin_dir}:#{File.join(gemdir, "bin")}:#{ENV["PATH"]}"
ENV["PATH"] = "#{ruby_bin_dir}:#{File.join(gemdir, "bin")}:#{maven_bin_dir}:#{ENV["PATH"]}"
if vcap_components["components"].include?("cloud_controller")
puts "Setting up cloud controller environment"

Просмотреть файл

@ -47,6 +47,7 @@ template node[:deployment][:info_file] do
variables({
:name => node[:deployment][:name],
:ruby_bin_dir => File.join(node[:ruby][:path], "bin"),
:maven_bin_dir => File.join(node[:maven][:path], "bin"),
:cloudfoundry_path => node[:cloudfoundry][:path],
:deployment_log_path => node[:deployment][:log_path]
})
@ -56,7 +57,7 @@ file node[:deployment][:local_run_profile] do
owner node[:deployment][:user]
group node[:deployment][:group]
content <<-EOH
export PATH=#{node[:ruby][:path]}/bin:`#{node[:ruby][:path]}/bin/gem env gempath`/bin:$PATH
export PATH=#{node[:ruby][:path]}/bin:`#{node[:ruby][:path]}/bin/gem env gempath`/bin:#{node[:maven][:path]}/bin:$PATH
export CLOUD_FOUNDRY_CONFIG_PATH=#{node[:deployment][:config_path]}
EOH
end

Просмотреть файл

@ -1,6 +1,7 @@
{
"name": "<%= @name %>",
"ruby_bin_dir": "<%= @ruby_bin_dir %>",
"maven_bin_dir": "<%= @maven_bin_dir %>",
"cloudfoundry_path": "<%= @cloudfoundry_path %>",
"deployment_log_path": "<%= @deployment_log_path %>"
}

Просмотреть файл

@ -0,0 +1,5 @@
include_attribute "deployment"
default[:maven][:version] = "3.0.4"
default[:maven][:source] = "http://mirror.lividpenguin.com/pub/apache/maven/binaries/apache-maven-#{maven[:version]}-bin.tar.gz"
default[:maven][:base] = File.join(node[:deployment][:home], "deploy", "maven")
default[:maven][:path] = File.join(node[:maven][:base], "apache-maven-#{maven[:version]}")

Просмотреть файл

@ -24,6 +24,28 @@ when "redhat", "centos", "fedora"
include_recipe "jpackage"
end
package "maven2" do
action :install
end
remote_file File.join("", "tmp", "apache-maven-#{node[:maven][:version]}.tar.gz") do
owner node[:deployment][:user]
source node[:maven][:source]
not_if { ::File.exists?(File.join("", "tmp", "apache-maven-#{node[:maven][:version]}.tar.gz")) }
end
directory node[:maven][:base] do
owner node[:deployment][:user]
group node[:deployment][:group]
mode "0755"
recursive true
action :create
end
bash "Install Maven #{node[:maven][:path]}" do
cwd node[:maven][:base]
user node[:deployment][:user]
tarball = File.join("", "tmp", "apache-maven-#{node[:maven][:version]}.tar.gz")
code <<-EOH
tar xzf #{tarball}
EOH
not_if do
::File.exists?(File.join(node[:maven][:path], "bin", "mvn"))
end
end

Просмотреть файл

@ -17,5 +17,5 @@ bash "Grab dependencies for UAA" do
user node[:deployment][:user]
not_if "[ -d ~/.m2/repository/org/cloudfoundry/runtime ]"
cwd "#{node[:cloudfoundry][:path]}/uaa"
code "mvn install -U -DskipTests=true"
code "#{node[:maven][:path]}/bin/mvn install -U -DskipTests=true"
end