Sha256: 6e8aac1712242918437099020f162cd614d463cc24461604666d4a16ad0ea6d3

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

module Vx
  module Builder
    class Script

      class Scala < Base

        DEFAULT_SCALA = '2.10.3'

        def call(env)
          if enabled?(env)
            do_cache_key(env) do |i|
              i << "scala-#{scala env}"
            end

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

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

            do_script(env) do |i|
              i << "if [[ -d project || -f build.sbt ]] ; then #{trace_sh_command "sbt ++#{scala env} test"} ; fi"
            end

            do_cached_directories(env) do |i|
              i << "~/.sbt"
              i << "~/.ivy2"
            end
          end

          app.call(env)
        end

        private

          def enabled?(env)
            env.source.scala.first || env.source.language == 'scala'
          end

          def scala(env)
            env.source.scala.first || DEFAULT_SCALA
          end


      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vx-builder-0.3.3 lib/vx/builder/script_builder/scala.rb-e
vx-builder-0.3.2 lib/vx/builder/script_builder/scala.rb-e
vx-builder-0.3.1 lib/vx/builder/script_builder/scala.rb-e
vx-builder-0.3.0 lib/vx/builder/script_builder/scala.rb-e
vx-builder-0.2.2 lib/vx/builder/script/scala.rb
vx-builder-0.2.1 lib/vx/builder/script/scala.rb
vx-builder-0.2.0 lib/vx/builder/script/scala.rb