Sha256: 5a7d5cd203a64ec06b40bee69415e6fa8cd151e77e03c82c18f0b5e2c6b9c22d

Contents?: true

Size: 1.22 KB

Versions: 14

Compression:

Stored size: 1.22 KB

Contents

module Vx
  module Builder
    class Script

      Scala = Struct.new(:app) do

        include Helper::TraceShCommand

        DEFAULT_SCALA = '2.10.3'

        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

        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

14 entries across 14 versions & 1 rubygems

Version Path
vx-builder-0.1.8 lib/vx/builder/script/scala.rb
vx-builder-0.1.7 lib/vx/builder/script/scala.rb
vx-builder-0.1.6 lib/vx/builder/script/scala.rb
vx-builder-0.1.5 lib/vx/builder/script/scala.rb
vx-builder-0.1.4 lib/vx/builder/script/scala.rb
vx-builder-0.1.3 lib/vx/builder/script/scala.rb
vx-builder-0.1.2 lib/vx/builder/script/scala.rb
vx-builder-0.1.1 lib/vx/builder/script/scala.rb
vx-builder-0.1.0 lib/vx/builder/script/scala.rb
vx-builder-0.0.29 lib/vx/builder/script/scala.rb
vx-builder-0.0.28 lib/vx/builder/script/scala.rb
vx-builder-0.0.27 lib/vx/builder/script/scala.rb
vx-builder-0.0.26 lib/vx/builder/script/scala.rb
vx-builder-0.0.25 lib/vx/builder/script/scala.rb