Sha256: a77de276f1a7d37cb17c939c27059df262ac04a1a71c208fdc94d46e661cceac

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

namespace :go do
  desc <<-DESC
    Compile the go application locally

    You can override any of these defaults by setting the variables shown below.

    set :go_input,  'api.go'
    set :go_output, 'api'
    set :go_os,     'linux'
    set :go_arch,   'amd64'
    set :go_roles,  :app
    set :go_target, -> { release_path.join(fetch(:go_output)) }
  DESC
  task :build do
    on roles(fetch(:go_roles)) do
      run_locally do
        go_flags = {
          'GOOS'   => fetch(:go_os),
          'GOARCH' => fetch(:go_arch)
        }

        with(go_flags) do
          execute :go, 'build', '-o', fetch(:go_output), fetch(:go_input)
        end
      end
    end
  end

  desc 'Upload compiled application to the server'
  task :upload do
    on roles(fetch(:go_roles)) do
      upload! fetch(:go_output), fetch(:go_target)
    end
  end
end

namespace :load do
  task :defaults do
    set :go_input,  'api.go'
    set :go_output, 'api'
    set :go_os,     'linux'
    set :go_arch,   'amd64'
    set :go_roles,  :app
    set :go_target, -> { release_path.join(fetch(:go_output)) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mascherano-1.1.0 lib/mascherano/tasks/go.cap
mascherano-1.0.4 lib/mascherano/tasks/go.cap
mascherano-1.0.3 lib/mascherano/tasks/go.cap
mascherano-1.0.2 lib/mascherano/tasks/go.cap