Sha256: 2dd339667797880815d9db5eb1b03e561967cac390c0210c40d01495239c3188

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require "generators/gomicroservice/version"

require 'minke/generators/register'
require 'minke/generators/config'

module Minke
  module Generators
    module GoMicroservice
      # Register the template with minke
      config = Minke::Generators::Config.new
      config.name = 'minke-generator-go'
      config.template_location = File.expand_path(File.dirname(__FILE__)) + '/gomicroservice/scaffold'

      config.build_settings = Minke::Generators::BuildSettings.new

      config.build_settings.build_commands = Minke::Generators::BuildCommands.new.tap do |bc|
        bc.fetch = [['/bin/sh', '-c', 'glide update']]
        bc.build = [['/bin/sh', '-c', 'go build -a -installsuffix cgo -ldflags \'-s\' -o <%= application_name %>']]
        bc.test = [['/bin/sh', '-c', 'go test $(go list ./... | grep -v /vendor/)']]
      end

      config.build_settings.docker_settings = Minke::Generators::DockerSettings.new.tap do |bs|
        bs.image = 'nicholasjackson/minke-generator-go'
        bs.env = ['CGO_ENABLED=0']
        bs.binds = [
          "<%= src_root %>:/go/src/<%= namespace %>/<%= application_name %>"
        ]
        bs.working_directory = '/go/src/<%= namespace %>/<%= application_name %>'
      end

      Minke::Generators.register config
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
minke-generator-go-0.8.3 lib/generators/gomicroservice.rb