-
Notifications
You must be signed in to change notification settings - Fork 431
/
Copy pathclojure.rb
65 lines (54 loc) · 1.66 KB
/
clojure.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require 'travis/build/script/shared/jdk'
module Travis
module Build
class Script
class Clojure < Script
include Jdk
DEFAULTS = {
lein: 'lein',
jdk: 'default'
}
LEIN_VERSION = '2.6.1'
VERSION2_AND_UP = /\A[2-9][0-9]*(\.\d+)*\z/
def configure
super
if config[:lein].to_s =~ VERSION2_AND_UP
update_lein config[:lein].to_s
end
end
def announce
super
sh.cmd "#{lein} version"
end
def install
sh.cmd "#{lein} deps", fold: 'install', retry: true
end
def script
sh.cmd "#{lein} test"
end
def cache_slug
super << '--lein-' << lein
end
private
def lein
if config[:lein] =~ VERSION2_AND_UP
'lein'
else
config[:lein].to_s
end
end
def update_lein(version)
sh.if "! -f ${TRAVIS_HOME}/.lein/self-installs/home/travis/.lein/leiningen-#{version}-standalone.jar" do
sh.fold "leiningen.update" do
sh.echo "Updating leiningen to #{version}", ansi: :yellow
sh.cmd "env LEIN_ROOT=true curl -L -o /usr/local/bin/lein https://raw.githubusercontent.com/technomancy/leiningen/#{version}/bin/lein", echo: true, assert: true, sudo: true
sh.cmd "rm -rf ${TRAVIS_HOME}/.lein", echo: false
sh.chmod "+x", "/usr/local/bin/lein", sudo: true
sh.cmd "lein self-install", echo: true, assert: true
end
end
end
end
end
end
end