Sha256: a6acda94cdde6806e71d74d373b5c2673d48ded5d29d746b1b8aa2fbe1d5ff77

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 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_servers,  -> { release_roles(fetch(:go_roles)) }
    set :go_target,   -> { release_path.join(fetch(:go_output)) }
  DESC
  task :build do
    on fetch(:go_servers) 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 fetch(:go_servers) 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_servers,  -> { release_roles(fetch(:go_roles)) }
    set :go_target,   -> { release_path.join(fetch(:go_output)) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mascherano-1.2.0 lib/mascherano/tasks/go.cap