Class: Vx::Builder::Script::Scala

Inherits:
Struct
  • Object
show all
Includes:
Helper::TraceShCommand
Defined in:
lib/vx/builder/script/scala.rb

Constant Summary collapse

DEFAULT_SCALA =
'2.10.3'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper::TraceShCommand

#trace_sh_command

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app



5
6
7
# File 'lib/vx/builder/script/scala.rb', line 5

def app
  @app
end

Instance Method Details

#call(env) ⇒ Object



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
# File 'lib/vx/builder/script/scala.rb', line 11

def call(env)
  if enabled?(env)
    env.cache_key << "scala-#{scala env}"

    env.announce.tap do |i|
      i << trace_sh_command("export SCALA_VERSION=#{scala env}")
    end

    env.install.tap do |i|
      i << "if [[ -d project || -f build.sbt ]] ; then #{trace_sh_command "sbt ++#{scala env} update"} ; fi"
    end

    if env.source.script.empty?
      env.script.tap do |i|
        i << "if [[ -d project || -f build.sbt ]] ; then #{trace_sh_command "sbt ++#{scala env} test"} ; fi"
      end
    end

    if env.source.cached_directories != false
      env.cached_directories.push "~/.sbt"
      env.cached_directories.push "~/.ivy2"
    end
  end

  app.call(env)
end