Permalink
Browse files

Rewrite Leiningen cookbook for 1.7.0

  • Loading branch information...
1 parent 4ef530d commit 96e7c9b7d82af3254119324464b4bfc65a79b845 @michaelklishin michaelklishin committed Feb 27, 2012
Showing with 34 additions and 18 deletions.
  1. +1 −4 ci_environment/leiningen/attributes/default.rb
  2. +33 −14 ci_environment/leiningen/recipes/default.rb
@@ -1,5 +1,2 @@
-default[:leiningen][:version] = "1.6.2"
+default[:leiningen][:version] = "1.7.0"
default[:leiningen][:install_script] = "https://github.com/technomancy/leiningen/raw/#{leiningen[:version]}/bin/lein"
-default[:leiningen][:jar_url] = "http://github.com/downloads/technomancy/leiningen/leiningen-#{leiningen[:version]}-standalone.jar"
-default[:leiningen][:jar_checksum] = "9bc52854d878e69a761273f240d5cef2"
-default[:leiningen][:jar_dir] = "/usr/share/java"
@@ -3,6 +3,7 @@
# Recipe:: default
#
# Copyright 2010, Opscode, Inc.
+# Copyright 2011-2012, Travis CI Development Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,15 +19,17 @@
include_recipe "java"
-jar_file ="#{node[:leiningen][:jar_dir]}/leiningen-#{node[:leiningen][:version]}-standalone.jar"
+jar_dir = File.join(node.travis_build_environment.home, ".lein")
+jar_file = File.join(jar_dir, "self-installs", "#{jar_dir}/leiningen-#{node[:leiningen][:version]}-standalone.jar")
-remote_file "/usr/local/bin/lein" do
- source node[:leiningen][:install_script]
- owner "root"
- group "root"
- mode 0755
- notifies :create, "ruby_block[lein-system-wide]", :immediately
- not_if "grep -qx 'export LEIN_VERSION=\"#{node[:leiningen][:version]}\"' /usr/local/bin/lein"
+[jar_dir, File.join(jar_dir, "self-installs")].each do |dir|
+ directory dir do
+ owner node.travis_build_environment.user
+ group node.travis_build_environment.group
+ recursive true
+
+ action :create
+ end
end
ruby_block "lein-system-wide" do
@@ -38,10 +41,26 @@
action :nothing
end
-remote_file jar_file do
- source node[:leiningen][:jar_url]
- owner "root"
- group "root"
- mode 0644
- checksum node[:leiningen][:jar_checksum]
+script "run lein self-install" do
+ interpreter "bash"
+ code "/usr/local/bin/lein self-install"
+
+ cwd node.travis_build_environment.home
+ user node.travis_build_environment.user
+ environment({ "HOME" => node.travis_build_environment.home, "USER" => node.travis_build_environment.user })
+
+ action :nothing
+end
+
+remote_file "/usr/local/bin/lein" do
+ source node[:leiningen][:install_script]
+ owner node.travis_build_environment.user
+ group node.travis_build_environment.group
+ mode 0755
+
+
+ notifies :create, resources(:ruby_block => "lein-system-wide"), :immediately
+ notifies :run, resources(:script => "run lein self-install")
+
+ not_if "grep -qx 'export LEIN_VERSION=\"#{node[:leiningen][:version]}\"' /usr/local/bin/lein"
end

0 comments on commit 96e7c9b

Please sign in to comment.