Skip to content
Browse files

Add (standalone) Leiningen cookbook

  • Loading branch information...
1 parent f03c12e commit 98c9ee34f606b9ca5672f7d28c3f4273b6d2253d @michaelklishin michaelklishin committed Jul 31, 2011
View
5 vagrant_base/leiningen/README.rdoc
@@ -0,0 +1,5 @@
+= DESCRIPTION:
+
+Installs Leiningen for building Clojure projects.
+
+Retrieve shell script, install jar files.
View
5 vagrant_base/leiningen/attributes/default.rb
@@ -0,0 +1,5 @@
+default[:leiningen][:version] = "1.4.2"
+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] = "61b247aeb5"
+default[:leiningen][:jar_dir] = "/usr/share/java"
View
32 vagrant_base/leiningen/metadata.json
@@ -0,0 +1,32 @@
+{
+ "recipes": {
+ },
+ "conflicting": {
+ },
+ "license": "Apache 2.0",
+ "long_description": "= DESCRIPTION:\n\nInstalls Leiningen for building Clojure projects.\n\nRetrieve shell script, install jar files.\n",
+ "providing": {
+ },
+ "platforms": {
+ },
+ "maintainer": "Opscode + Sonian!",
+ "replacing": {
+ },
+ "attributes": {
+ },
+ "maintainer_email": "phil@sonian.net",
+ "description": "Installs Leiningen for building Clojure projects.",
+ "groupings": {
+ },
+ "version": "0.2.0",
+ "recommendations": {
+ },
+ "name": "leiningen",
+ "dependencies": {
+ "java": [
+
+ ]
+ },
+ "suggestions": {
+ }
+}
View
8 vagrant_base/leiningen/metadata.rb
@@ -0,0 +1,8 @@
+maintainer "Opscode + Sonian!"
+maintainer_email "phil@sonian.net"
+license "Apache 2.0"
+description "Installs Leiningen for building Clojure projects."
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.2.0"
+platforms
+depends "java"
View
47 vagrant_base/leiningen/recipes/default.rb
@@ -0,0 +1,47 @@
+#
+# Cookbook Name:: leiningen
+# Recipe:: default
+#
+# Copyright 2010, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+include_recipe "java"
+
+jar_file ="#{node[:leiningen][: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"
+end
+
+ruby_block "lein-system-wide" do
+ block do
+ rc = Chef::Util::FileEdit.new("/usr/local/bin/lein")
+ rc.search_file_replace_line(/^LEIN_JAR=.*/, "LEIN_JAR=#{jar_file}")
+ rc.write_file
+ end
+ action :nothing
+end
+
+remote_file jar_file do
+ source node[:leiningen][:jar_url]
+ owner "root"
+ group "root"
+ mode 0644
+ checksum node[:leiningen][:jar_checksum]
+end

0 comments on commit 98c9ee3

Please sign in to comment.
Something went wrong with that request. Please try again.