<commit_before>module Travis
  module Build
    class Script
      class Go < Script
        DEFAULTS = {
          gobuild_args: '-v',
          go: '1.4.1'
        }

        def export
          super
          sh.export 'TRAVIS_GO_VERSION', go_version, echo: false
        end

        def prepare
          super
          # TODO: remove this bit once we're shipping gimme via chef (?)
          sh.cmd 'unset gvm', echo: false
          sh.mv "#{HOME_DIR}/.gvm", "#{HOME_DIR}/.gvm.disabled", echo: false
          sh.if "! -x '#{HOME_DIR}/bin/gimme' && ! -x '/usr/local/bin/gimme'" do
            sh.mkdir "#{HOME_DIR}/bin", echo: false
            sh.cmd "curl -sL -o #{HOME_DIR}/bin/gimme '#{gimme_url}'", echo: false
            sh.cmd "chmod +x #{HOME_DIR}/bin/gimme", echo: false
            sh.export 'PATH', "#{HOME_DIR}/bin:$PATH", retry: false, echo: false
            # install bootstrap version so that tip/master/whatever can be used immediately
            sh.cmd %Q'gimme 1.4.1 >/dev/null 2>&1'
          end
        end

        def announce
          super
          sh.cmd 'gimme version'
          sh.cmd 'go version'
          sh.cmd 'go env', fold: 'go.env'
        end

        def setup
          super
          sh.cmd %Q'eval "$(gimme #{go_version})"'

          sh.export 'GOPATH', "#{HOME_DIR}/gopath:", echo: true
          sh.export 'PATH', "#{HOME_DIR}/gopath/bin:$PATH", echo: true

          sh.mkdir "#{HOME_DIR}/gopath/src/#{data.source_host}/#{data.slug}", recursive: true, assert: false, timing: false
          sh.cmd "rsync -az ${TRAVIS_BUILD_DIR}/ #{HOME_DIR}/gopath/src/#{data.source_host}/#{data.slug}/", assert: false, timing: false
<commit_msg>Only move ~/.gvm if it exists<commit_after>module Travis
  module Build
    class Script
      class Go < Script
        DEFAULTS = {
          gobuild_args: '-v',
          go: '1.4.1'
        }

        def export
          super
          sh.export 'TRAVIS_GO_VERSION', go_version, echo: false
        end

        def prepare
          super
          # TODO: remove this bit once we're shipping gimme via chef (?)
          sh.cmd 'unset gvm', echo: false
          sh.if "-d #{HOME_DIR}/.gvm" do
            sh.mv "#{HOME_DIR}/.gvm", "#{HOME_DIR}/.gvm.disabled", echo: false
          end
          sh.if "! -x '#{HOME_DIR}/bin/gimme' && ! -x '/usr/local/bin/gimme'" do
            sh.mkdir "#{HOME_DIR}/bin", echo: false
            sh.cmd "curl -sL -o #{HOME_DIR}/bin/gimme '#{gimme_url}'", echo: false
            sh.cmd "chmod +x #{HOME_DIR}/bin/gimme", echo: false
            sh.export 'PATH', "#{HOME_DIR}/bin:$PATH", retry: false, echo: false
            # install bootstrap version so that tip/master/whatever can be used immediately
            sh.cmd %Q'gimme 1.4.1 >/dev/null 2>&1'
          end
        end

        def announce
          super
          sh.cmd 'gimme version'
          sh.cmd 'go version'
          sh.cmd 'go env', fold: 'go.env'
        end

        def setup
          super
          sh.cmd %Q'eval "$(gimme #{go_version})"'

          sh.export 'GOPATH', "#{HOME_DIR}/gopath:", echo: true
          sh.export 'PATH', "#{HOME_DIR}/gopath/bin:$PATH", echo: true

          sh.mkdir "#{HOME_DIR}/gopath/src/#{data.source_host}/#{data.slug}", recursive: true, assert: false, timing: false
          sh.cmd "rsync -az ${TRAVIS_BUILD_DIR}/ #{HOME_DIR}/gopath/src/#{data.source_host}/#{data.slug}/", assert: false, timing: false

{'fraction_non_alphanumeric': 0.1469482210008678, 'fraction_numerical': 0.0046282904252241824, 'mean_word_length': 1.8792672772689425, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6619786', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1114, 'n_words': 302}