minke-generator-go 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +14 -0
  7. data/CODE_OF_CONDUCT.md +49 -0
  8. data/Gemfile +9 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +54 -0
  11. data/Rakefile +7 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/lib/generators/gomicroservice/scaffold/.gitignore.erb +1 -0
  15. data/lib/generators/gomicroservice/scaffold/_build/.gitignore +1 -0
  16. data/lib/generators/gomicroservice/scaffold/_build/.ruby-gemset.erb +1 -0
  17. data/lib/generators/gomicroservice/scaffold/_build/.ruby-version +1 -0
  18. data/lib/generators/gomicroservice/scaffold/_build/Gemfile +11 -0
  19. data/lib/generators/gomicroservice/scaffold/_build/Rakefile +4 -0
  20. data/lib/generators/gomicroservice/scaffold/_build/config.yml.erb +46 -0
  21. data/lib/generators/gomicroservice/scaffold/_build/consul_keys.yml.erb +13 -0
  22. data/lib/generators/gomicroservice/scaffold/_build/dockercompose/<%= application_name %>/docker-compose.yml.erb +32 -0
  23. data/lib/generators/gomicroservice/scaffold/_build/dockercompose/<%= application_name %>/docker-no-server.yml.erb +25 -0
  24. data/lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/Dockerfile.erb +23 -0
  25. data/lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/config.ctmpl.erb +3 -0
  26. data/lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/.s6-svscan/crash +1 -0
  27. data/lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/.s6-svscan/finish +1 -0
  28. data/lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/app/finish +1 -0
  29. data/lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/app/run.erb +3 -0
  30. data/lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/consul-template/finish +1 -0
  31. data/lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/consul-template/run.erb +3 -0
  32. data/lib/generators/gomicroservice/scaffold/_build/features/health.feature +14 -0
  33. data/lib/generators/gomicroservice/scaffold/_build/features/steps/http.rb +5 -0
  34. data/lib/generators/gomicroservice/scaffold/_build/features/support/env.rb.erb +13 -0
  35. data/lib/generators/gomicroservice/scaffold/_build/swagger_spec/swagger.yml.erb +34 -0
  36. data/lib/generators/gomicroservice/scaffold/global/global.go +32 -0
  37. data/lib/generators/gomicroservice/scaffold/handlers/const.go.erb +12 -0
  38. data/lib/generators/gomicroservice/scaffold/handlers/echo.go.erb +35 -0
  39. data/lib/generators/gomicroservice/scaffold/handlers/echo_test.go.erb +77 -0
  40. data/lib/generators/gomicroservice/scaffold/handlers/health.go.erb +54 -0
  41. data/lib/generators/gomicroservice/scaffold/handlers/health_test.go.erb +63 -0
  42. data/lib/generators/gomicroservice/scaffold/handlers/middleware_requestvalidation.go.erb +42 -0
  43. data/lib/generators/gomicroservice/scaffold/handlers/middleware_requestvalidation_test.go.erb +85 -0
  44. data/lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb +34 -0
  45. data/lib/generators/gomicroservice/scaffold/logging/StatsD.go +6 -0
  46. data/lib/generators/gomicroservice/scaffold/main.go.erb +58 -0
  47. data/lib/generators/gomicroservice/scaffold/mocks/mocks.go +23 -0
  48. data/lib/generators/gomicroservice/version.rb +7 -0
  49. data/lib/generators/gomicroservice.rb +39 -0
  50. data/minke-generator-go.gemspec +28 -0
  51. metadata +139 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e44687462591b411096667b256f5a6a967e180bb
4
+ data.tar.gz: 626f70ea6aea969c00d05843eb4046544c764253
5
+ SHA512:
6
+ metadata.gz: ac815ffe9b0ceaa97e06c66747e220b9b1eb7763f6286bbbbae94cb25d41967f87948956a78c0b7b7825987c184f7c04f62dff27ab6deba36b5fcbfa8235b004
7
+ data.tar.gz: fbab9123fea841605fb665ef1e6ee4cd6ff4ef133ad0857e2269ccd99e81fed539c7d4283d6c085fd4af32f7b591e3cf656a0aa70cfe95f6bffb08c4eef9e391
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ minke-generator-go
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.1
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.1
4
+ install: bundle
5
+ script:
6
+ - rake test
7
+ - rake build
8
+ deploy:
9
+ provider: rubygems
10
+ gem: minke-generator-go
11
+ on:
12
+ repo: nicholasjackson/minke-generator-go
13
+ api_key:
14
+ secure: NfDL67sdeJ0FOSYns+VKjPPk/ZAhJa/wpffw5RiXG94gst5XUtZauik1nVIrTpWYhw5e34hqHPH9mE+v8AkXQRmGyUkYbW+0ePFuqBHidsSFGUOzg3h0+wYrOkvA60REJAg1EM97IDx7PmhcxfO3NFsDvr6RKOXaNc3cLxmiIdD9PVktm75hk2BvoiuO3d12ph2Wr9RjSuidX/0z2H8oOdDs8e14x9QPqX3LuRiTe+A3h+hjZ1OhH9aT5blJ2ZI65iDMY1K6hzcDuUY7CzCbKZF2pPEkDgtT5FgRX1klu28Ehxebef/vvAFmOt5ztuXyE6nEdoI8NACE7XXQQC+6H5PzE6hWoHKk7/vMn5u2pdMRUykArAJ6++JxRSitaKSXn0xZfRKvszp00WhHiG4kPtQXgNKiJiuOKX9huy+gHssYfP3sxcd0LNrslnxaGRAn0igRHuBeaIi8kxL+03q1tCSjOcc6OV9qPIgZAiGUdeeolefrXFTovptcG5PiDzq6jJoQSO51kRMhG/XGfuf2T+vpl5ouT2dsYSz8qDchX5LEjcjuBXb3J1/Xz5s1oQjGI1w+bSrZ1OAFv0d5v8jcD9IyF4C7iVuqCtlc0bNkm9ZgwG+iHHj/SxezFPCttVFBS2or6YizA2xAONXkuy2g+yUDZplcX56fe0oIQsOJOjc=
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at TODO: Write your email address. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in minke-generator-template.gemspec
4
+ gemspec
5
+
6
+ #gem 'minke', :path => '/Users/nicj/Developer/gems/minke'
7
+ gem 'minke'
8
+ gem 'cucumber-api', '~> 0.3'
9
+ gem 'nokogiri'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Minke::Generators::GoMicroservice
2
+
3
+ [![Build Status](https://travis-ci.org/nicholasjackson/minke-generator-go.svg?branch=master)](https://travis-ci.org/nicholasjackson/minke-generator-go)
4
+
5
+ This generator creates a REST API microservice in Golang.
6
+
7
+ ## Available variables for template (erb style)
8
+ - <%= application_name %>: The name of the application executable
9
+ - <%= namespace %>: Namespace of the application
10
+
11
+ ## Testing your template
12
+ ```
13
+ $ bundle
14
+ ```
15
+
16
+ Test your generator by running ...
17
+ ```
18
+ $ bundle exec minke -g minke-generator-template -o ../temp -a tester -n mynamespace
19
+ ```
20
+
21
+ ## Installation
22
+
23
+ Add this line to your application's Gemfile:
24
+
25
+ ```ruby
26
+ gem 'minke-generator-template'
27
+ ```
28
+
29
+ And then execute:
30
+
31
+ $ bundle
32
+
33
+ Or install it yourself as:
34
+
35
+ $ gem install minke-generator-template
36
+
37
+ ## Usage
38
+
39
+ TODO: Write usage instructions here
40
+
41
+ ## Development
42
+
43
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
44
+
45
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
46
+
47
+ ## Contributing
48
+
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/minke-generator-template. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
50
+
51
+
52
+ ## License
53
+
54
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+ task :test => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "minke/generator/template"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1 @@
1
+ /<%= application_name %>
@@ -0,0 +1 @@
1
+ <%= application_name %>
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rake"
4
+ gem 'cucumber-api', '~> 0.3'
5
+ gem 'nokogiri'
6
+
7
+ #gem 'minke'
8
+ #gem 'minke-generator-go'
9
+
10
+ gem 'minke', :path => '/Users/nicj/Developer/gems/minke'
11
+ gem 'minke-generator-go', :path => '/Users/nicj/Developer/gems/minke-generator-go'
@@ -0,0 +1,4 @@
1
+ require 'minke'
2
+
3
+ spec = Gem::Specification.find_by_name 'minke'
4
+ Rake.add_rakelib "#{spec.gem_dir}/lib/minke/rake"
@@ -0,0 +1,46 @@
1
+ ---
2
+ application_name: '<%= application_name %>'
3
+ namespace: '<%= namespace %>'
4
+ generator_name: minke-generator-go
5
+ docker_registry:
6
+ url: <%= ENV['DOCKER_REGISTRY_URL'] %>
7
+ user: <%= ENV['DOCKER_REGISTRY_USER'] %>
8
+ password: <%= ENV['DOCKER_REGISTRY_PASS'] %>
9
+ email: <%= ENV['DOCKER_REGISTRY_EMAIL'] %>
10
+ namespace: <%= ENV['DOCKER_NAMESPACE'] %>
11
+ docker:
12
+ build_image: 'golang:latest'
13
+ application_docker_file: './dockerfile/<%= application_name %>/'
14
+ application_compose_file: './dockercompose/<%= application_name %>/docker-compose.yml'
15
+ fetch:
16
+ build:
17
+ post:
18
+ copy:
19
+ -
20
+ from: '../<%= application_name %>'
21
+ to: './dockerfile/<%= application_name %>'
22
+ -
23
+ from: './swagger_spec/swagger.yml'
24
+ to: './dockerfile/<%= application_name %>/swagger_spec'
25
+ run:
26
+ pre:
27
+ consul_loader:
28
+ config_file: './consul_keys.yml'
29
+ url:
30
+ address: consul
31
+ port: 8500
32
+ type: private
33
+ test:
34
+ cucumber:
35
+ pre:
36
+ consul_loader:
37
+ config_file: './consul_keys.yml'
38
+ url:
39
+ address: consul
40
+ port: 8500
41
+ type: private
42
+ health_check:
43
+ address: <%= application_name %>
44
+ port: 8001
45
+ path: /v1/health
46
+ type: private
@@ -0,0 +1,13 @@
1
+ ---
2
+ <%= application_name %>:
3
+ Credentials:
4
+ mysql:
5
+ username: root
6
+ password: my-secret-pw
7
+ Settings:
8
+ environment: dev
9
+ mysql:
10
+ db_name: <%= application_name %>
11
+ statsd:
12
+ host: statsd
13
+ port: 8125
@@ -0,0 +1,32 @@
1
+ version: '2'
2
+ services:
3
+ <%= application_name %>:
4
+ image: <%= application_name %>
5
+ ports:
6
+ - "::8001"
7
+ environment:
8
+ - "CONSUL=consul:8500"
9
+ links:
10
+ - consul:consul
11
+ - statsd:statsd
12
+ consul:
13
+ image: progrium/consul
14
+ ports:
15
+ - "::8500"
16
+ hostname: node1
17
+ command: "-server -bootstrap -ui-dir /ui"
18
+ statsd:
19
+ image: 'hopsoft/graphite-statsd:latest'
20
+ ports:
21
+ - "::80"
22
+ expose:
23
+ - "8125/udp"
24
+ environment:
25
+ - "SERVICE_NAME=statsd"
26
+ registrator:
27
+ image: 'gliderlabs/registrator:latest'
28
+ links:
29
+ - consul:consul
30
+ command: '-internal -tags=dev consul://consul:8500'
31
+ volumes:
32
+ - '/var/run/docker.sock:/tmp/docker.sock'
@@ -0,0 +1,25 @@
1
+ version: '2'
2
+ services:
3
+ consul:
4
+ image: progrium/consul
5
+ ports:
6
+ - "::8500"
7
+ hostname: node1
8
+ command: "-server -bootstrap -ui-dir /ui"
9
+ statsd:
10
+ image: 'hopsoft/graphite-statsd:latest'
11
+ ports:
12
+ - "::80"
13
+ expose:
14
+ - "8125/udp"
15
+ environment:
16
+ - "SERVICE_NAME=statsd"
17
+ registrator:
18
+ image: 'gliderlabs/registrator:latest'
19
+ links:
20
+ - consul:consul
21
+ environment:
22
+ - "SERVICE_NAME=statsd"
23
+ command: '-internal -tags=dev consul://consul:8500'
24
+ volumes:
25
+ - '/var/run/docker.sock:/tmp/docker.sock'
@@ -0,0 +1,23 @@
1
+ FROM nicholasjackson/microservice-basebox
2
+
3
+ EXPOSE 8001
4
+
5
+ # Create directory for server files
6
+ RUN mkdir /<%= application_name %>
7
+
8
+ # Add s6 config
9
+ ADD s6-etc /etc/s6
10
+ RUN chmod -R 755 /etc/s6; \
11
+ chmod -R 755 /etc/s6
12
+
13
+ # Add consul template
14
+ ADD config.ctmpl /<%= application_name %>/config.ctmpl
15
+
16
+ # Add server files
17
+ ADD swagger_spec /swagger
18
+ ADD <%= application_name %> /<%= application_name %>/<%= application_name %>
19
+
20
+ RUN chmod 755 /<%= application_name %>/<%= application_name %>
21
+
22
+ ENTRYPOINT ["/usr/bin/s6-svscan","/etc/s6"]
23
+ CMD []
@@ -0,0 +1,3 @@
1
+ {
2
+ "stats_d_server": "{{key "<%= application_name %>/Settings/statsd/host"}}:{{key "<%= application_name %>/Settings/statsd/port"}}"
3
+ }
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ exec /<%= application_name %>/<%= application_name %> /<%= application_name %>/config.json /<%= application_name %>
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ exec /usr/bin/consul-template -consul=$CONSUL -template "/<%= application_name %>/config.ctmpl:/<%= application_name %>/config.json:killall <%= application_name %>"
@@ -0,0 +1,14 @@
1
+ @healthcheck
2
+ Feature: Health check
3
+ In order to ensure quality
4
+ As a user
5
+ I want to be able to test functionality of my API
6
+
7
+ Background:
8
+
9
+
10
+ Scenario: Health check returns ok
11
+ Given I send and accept JSON
12
+ When I send a GET request to the api endpoint "/v1/health"
13
+ Then the response status should be "200"
14
+ And the JSON response should have key "status_message"
@@ -0,0 +1,5 @@
1
+ When(/^I send a GET request to the api endpoint "([^"]*)"$/) do |endpoint|
2
+ steps %Q{
3
+ When I send a GET request to "#{$SERVER_PATH}#{endpoint}"
4
+ }
5
+ end
@@ -0,0 +1,13 @@
1
+ require 'cucumber-api'
2
+ require 'minke'
3
+
4
+ discovery = Minke::Docker::ServiceDiscovery.new 'config.yml'
5
+ $SERVER_PATH = "http://#{discovery.public_address_for '<%= application_name %>', '8001', :cucumber}"
6
+
7
+ Before do |scenario|
8
+
9
+ end
10
+
11
+ After do |scenario|
12
+
13
+ end
@@ -0,0 +1,34 @@
1
+ swagger: '2.0'
2
+ info:
3
+ title: <%= application_name %>
4
+ description: <%= application_name %> Description
5
+ version: 1.0.0
6
+ host: api.test.com
7
+ schemes:
8
+ - http
9
+ basePath: /v1
10
+ produces:
11
+ - application/json
12
+ paths:
13
+ /health:
14
+ get:
15
+ summary: Health Check
16
+ description: |
17
+ The Health Check endpoint is used to determine the current status for the health of the api.
18
+ This endpoint will be used by other systems such as Consul and other service discovery systems.
19
+ tags:
20
+ - Health
21
+ responses:
22
+ '200':
23
+ description: Status message from server describing current health
24
+ schema:
25
+ type: array
26
+ items:
27
+ $ref: '#/definitions/HealthResponse'
28
+ definitions:
29
+ HealthResponse:
30
+ type: object
31
+ properties:
32
+ status_message:
33
+ type: string
34
+ description: 'Plain text readable response corresponding to current health status'
@@ -0,0 +1,32 @@
1
+ package global
2
+
3
+ import (
4
+ "encoding/json"
5
+ "fmt"
6
+ "os"
7
+ )
8
+
9
+ type ConfigStruct struct {
10
+ StatsDServerIP string `json:"stats_d_server"`
11
+ RootFolder string
12
+ }
13
+
14
+ var Config ConfigStruct
15
+
16
+ func LoadConfig(config string, rootfolder string) error {
17
+ fmt.Println("Loading Config: ", config)
18
+
19
+ file, err := os.Open(config)
20
+ if err != nil {
21
+ return fmt.Errorf("Unable to open config")
22
+ }
23
+
24
+ decoder := json.NewDecoder(file)
25
+ Config = ConfigStruct{}
26
+ err = decoder.Decode(&Config)
27
+ Config.RootFolder = rootfolder
28
+
29
+ fmt.Println(Config)
30
+
31
+ return nil
32
+ }
@@ -0,0 +1,12 @@
1
+ package handlers
2
+
3
+ const GET = ".get"
4
+ const POST = ".post"
5
+ const CALLED = ".called"
6
+ const SUCCESS = ".success"
7
+ const BAD_REQUEST = ".bad_request"
8
+ const INVALID_REQUEST = ".invalid_request"
9
+ const VALID_REQUEST = ".valid_request"
10
+
11
+ const HEALTH_HANDLER = "<%= application_name %>.health_handler"
12
+ const ECHO_HANDLER = "<%= application_name %>.echo_handler"
@@ -0,0 +1,35 @@
1
+ package handlers
2
+
3
+ import (
4
+ "encoding/json"
5
+ "fmt"
6
+ "net/http"
7
+
8
+ "github.com/gorilla/context"
9
+ "<%= namespace %>/<%= application_name %>/logging"
10
+ )
11
+
12
+ type EchoDependenciesContainer struct {
13
+ StatsD logging.StatsD `inject:"statsd"`
14
+ }
15
+
16
+ var EchoDependencies *EchoDependenciesContainer = &EchoDependenciesContainer{}
17
+
18
+ // use the validation middleware to automatically validate input
19
+ // github.com/asaskevich/govalidator
20
+ type Echo struct {
21
+ Echo string `json:"echo" valid:"stringlength(1|255),required"`
22
+ }
23
+
24
+ func EchoHandler(rw http.ResponseWriter, r *http.Request) {
25
+ EchoDependencies.StatsD.Increment(ECHO_HANDLER + POST + CALLED)
26
+
27
+ // request is set into the context from the middleware
28
+ request := context.Get(r, "request").(*Echo)
29
+ fmt.Println("r: ", request)
30
+
31
+ encoder := json.NewEncoder(rw)
32
+ encoder.Encode(request)
33
+
34
+ EchoDependencies.StatsD.Increment(ECHO_HANDLER + POST + SUCCESS)
35
+ }
@@ -0,0 +1,77 @@
1
+ package handlers
2
+
3
+ import (
4
+ "encoding/json"
5
+ "fmt"
6
+ "net/http"
7
+ "net/http/httptest"
8
+ "testing"
9
+
10
+ "github.com/facebookgo/inject"
11
+ "github.com/gorilla/context"
12
+ "github.com/stretchr/testify/assert"
13
+ "github.com/stretchr/testify/mock"
14
+ "<%= namespace %>/<%= application_name %>/mocks"
15
+ )
16
+
17
+ var echoStatsDMock *mocks.MockStatsD
18
+
19
+ func echoTestSetup(t *testing.T) {
20
+ // create an injection graph containing the mocked elements we wish to replace
21
+
22
+ var g inject.Graph
23
+
24
+ echoStatsDMock = &mocks.MockStatsD{}
25
+ EchoDependencies = &EchoDependenciesContainer{}
26
+
27
+ err := g.Provide(
28
+ &inject.Object{Value: EchoDependencies},
29
+ &inject.Object{Value: echoStatsDMock, Name: "statsd"},
30
+ )
31
+
32
+ if err != nil {
33
+ fmt.Println(err)
34
+ }
35
+
36
+ if err := g.Populate(); err != nil {
37
+ fmt.Println(err)
38
+ }
39
+
40
+ echoStatsDMock.Mock.On("Increment", mock.Anything).Return()
41
+ }
42
+
43
+ func TestEchoHandlerSetStats(t *testing.T) {
44
+ echoTestSetup(t)
45
+
46
+ var responseRecorder httptest.ResponseRecorder
47
+ var request http.Request
48
+
49
+ echo := Echo{Echo: "Hello World"}
50
+ context.Set(&request, "request", &echo)
51
+
52
+ EchoHandler(&responseRecorder, &request)
53
+
54
+ echoStatsDMock.Mock.AssertCalled(t, "Increment", ECHO_HANDLER+POST+CALLED)
55
+ echoStatsDMock.Mock.AssertCalled(t, "Increment", ECHO_HANDLER+POST+SUCCESS)
56
+ }
57
+
58
+ func TestEchoHandlerCorrectlyEchosResponse(t *testing.T) {
59
+ echoTestSetup(t)
60
+
61
+ var responseRecorder *httptest.ResponseRecorder
62
+ var request http.Request
63
+
64
+ responseRecorder = httptest.NewRecorder()
65
+
66
+ echo := Echo{Echo: "Hello World"}
67
+ context.Set(&request, "request", &echo)
68
+
69
+ EchoHandler(responseRecorder, &request)
70
+
71
+ body := responseRecorder.Body.Bytes()
72
+ response := Echo{}
73
+ json.Unmarshal(body, &response)
74
+
75
+ assert.Equal(t, 200, responseRecorder.Code)
76
+ assert.Equal(t, response.Echo, "Hello World")
77
+ }
@@ -0,0 +1,54 @@
1
+ package handlers
2
+
3
+ import (
4
+ "encoding/json"
5
+ "net/http"
6
+
7
+ "<%= namespace %>/<%= application_name %>/logging"
8
+ )
9
+
10
+ // This is not particularlly a real world example it mearly shows how a builder or a factory could be injected
11
+ // into the HealthHandler
12
+ type HealthResponseBuilder struct {
13
+ statusMessage string
14
+ }
15
+
16
+ func (b *HealthResponseBuilder) SetStatusMessage(message string) *HealthResponseBuilder {
17
+ b.statusMessage = message
18
+ return b
19
+ }
20
+
21
+ func (b *HealthResponseBuilder) Build() HealthResponse {
22
+ var hr HealthResponse
23
+ hr.StatusMessage = b.statusMessage
24
+ return hr
25
+ }
26
+
27
+ type HealthDependenciesContainer struct {
28
+ // if not specified will create singleton
29
+ SingletonBuilder *HealthResponseBuilder `inject:""`
30
+
31
+ // statsD interface must use a name type as injection cannot infer ducktypes
32
+ Stats logging.StatsD `inject:"statsd"`
33
+
34
+ // if not specified in the graph will automatically create private instance
35
+ PrivateBuilder *HealthResponseBuilder `inject:"private"`
36
+ }
37
+
38
+ type HealthResponse struct {
39
+ StatusMessage string `json:"status_message"`
40
+ }
41
+
42
+ var HealthDependencies *HealthDependenciesContainer = &HealthDependenciesContainer{}
43
+
44
+ func HealthHandler(rw http.ResponseWriter, r *http.Request) {
45
+ // all HealthHandlerDependencies are automatically created by injection process
46
+ HealthDependencies.Stats.Increment(HEALTH_HANDLER + GET + CALLED)
47
+
48
+ response := HealthDependencies.SingletonBuilder.SetStatusMessage("OK").Build()
49
+
50
+ encoder := json.NewEncoder(rw)
51
+ encoder.Encode(&response)
52
+
53
+ HealthDependencies.Stats.Increment(HEALTH_HANDLER + GET + SUCCESS)
54
+ }
@@ -0,0 +1,63 @@
1
+ package handlers
2
+
3
+ import (
4
+ "fmt"
5
+ "net/http"
6
+ "net/http/httptest"
7
+ "testing"
8
+
9
+ "github.com/facebookgo/inject"
10
+ "github.com/stretchr/testify/assert"
11
+ "github.com/stretchr/testify/mock"
12
+ "<%= namespace %>/<%= application_name %>/mocks"
13
+ )
14
+
15
+ var healthStatsDMock *mocks.MockStatsD
16
+
17
+ func healthTestSetup(t *testing.T) {
18
+ // create an injection graph containing the mocked elements we wish to replace
19
+
20
+ var g inject.Graph
21
+
22
+ healthStatsDMock = &mocks.MockStatsD{}
23
+ HealthDependencies = &HealthDependenciesContainer{}
24
+
25
+ err := g.Provide(
26
+ &inject.Object{Value: HealthDependencies},
27
+ &inject.Object{Value: healthStatsDMock, Name: "statsd"},
28
+ )
29
+
30
+ if err != nil {
31
+ fmt.Println(err)
32
+ }
33
+
34
+ if err := g.Populate(); err != nil {
35
+ fmt.Println(err)
36
+ }
37
+
38
+ healthStatsDMock.Mock.On("Increment", mock.Anything).Return()
39
+ }
40
+
41
+ // Simple test to show how we can use the ResponseRecorder to test our HTTP handlers
42
+ func TestHealthHandler(t *testing.T) {
43
+ healthTestSetup(t)
44
+
45
+ var responseRecorder httptest.ResponseRecorder
46
+ var request http.Request
47
+
48
+ HealthHandler(&responseRecorder, &request)
49
+
50
+ assert.Equal(t, 200, responseRecorder.Code)
51
+ }
52
+
53
+ func TestHealthHandlerSetStats(t *testing.T) {
54
+ healthTestSetup(t)
55
+
56
+ var responseRecorder httptest.ResponseRecorder
57
+ var request http.Request
58
+
59
+ HealthHandler(&responseRecorder, &request)
60
+
61
+ healthStatsDMock.Mock.AssertCalled(t, "Increment", HEALTH_HANDLER+GET+CALLED)
62
+ healthStatsDMock.Mock.AssertCalled(t, "Increment", HEALTH_HANDLER+GET+SUCCESS)
63
+ }
@@ -0,0 +1,42 @@
1
+ package handlers
2
+
3
+ import (
4
+ "encoding/json"
5
+ "fmt"
6
+ "io/ioutil"
7
+ "net/http"
8
+ "reflect"
9
+
10
+ "github.com/asaskevich/govalidator"
11
+ "github.com/gorilla/context"
12
+ "<%= namespace %>/<%= application_name %>/logging"
13
+ )
14
+
15
+ func requestValidationHandler(mainHandlerRef string, t reflect.Type, statsD logging.StatsD, next http.Handler) http.Handler {
16
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
17
+
18
+ request := reflect.New(t).Interface()
19
+
20
+ defer r.Body.Close()
21
+ data, _ := ioutil.ReadAll(r.Body)
22
+
23
+ err := json.Unmarshal(data, &request)
24
+ if err != nil {
25
+ http.Error(w, "Invalid Request", http.StatusBadRequest)
26
+ statsD.Increment(mainHandlerRef + BAD_REQUEST)
27
+ return
28
+ }
29
+
30
+ _, err = govalidator.ValidateStruct(request)
31
+ if err != nil {
32
+ fmt.Println("Validation Error:", err)
33
+ http.Error(w, "Invalid Request", http.StatusBadRequest)
34
+ statsD.Increment(mainHandlerRef + INVALID_REQUEST)
35
+ return
36
+ }
37
+
38
+ context.Set(r, "request", request)
39
+ statsD.Increment(mainHandlerRef + VALID_REQUEST)
40
+ next.ServeHTTP(w, r)
41
+ })
42
+ }
@@ -0,0 +1,85 @@
1
+ package handlers
2
+
3
+ import (
4
+ "bytes"
5
+ "io/ioutil"
6
+ "net/http"
7
+ "net/http/httptest"
8
+ "reflect"
9
+ "testing"
10
+
11
+ "github.com/gorilla/context"
12
+ "github.com/stretchr/testify/assert"
13
+ "github.com/stretchr/testify/mock"
14
+ "<%= namespace %>/<%= application_name %>/mocks"
15
+ )
16
+
17
+ type mockType struct {
18
+ FirstName string `json:"first_name" valid:"alphanum,stringlength(1|255),required"`
19
+ }
20
+
21
+ var mockHandler *mocks.MockHandler
22
+ var mockRequestStatsD *mocks.MockStatsD
23
+
24
+ func setupRequestValidationTests(t *testing.T) {
25
+ mockHandler = &mocks.MockHandler{}
26
+ mockRequestStatsD = &mocks.MockStatsD{}
27
+
28
+ mockRequestStatsD.Mock.On("Increment", mock.Anything)
29
+ mockHandler.Mock.On("ServeHTTP", mock.Anything, mock.Anything)
30
+ }
31
+
32
+ func TestCallsNextOnSuccessfulValidation(t *testing.T) {
33
+ setupRequestValidationTests(t)
34
+ var responseRecorder httptest.ResponseRecorder
35
+ var request http.Request
36
+ request.Body = ioutil.NopCloser(bytes.NewBufferString(`{"first_name": "Nic"}`))
37
+
38
+ handlerFunc := requestValidationHandler(HEALTH_HANDLER, reflect.TypeOf(mockType{}), mockRequestStatsD, mockHandler)
39
+
40
+ handlerFunc.ServeHTTP(&responseRecorder, &request)
41
+
42
+ mockHandler.Mock.AssertCalled(t, "ServeHTTP", mock.Anything, mock.Anything)
43
+ mockRequestStatsD.Mock.AssertCalled(t, "Increment", HEALTH_HANDLER+VALID_REQUEST)
44
+ }
45
+
46
+ func TestSetsContextSuccessfully(t *testing.T) {
47
+ setupRequestValidationTests(t)
48
+ var responseRecorder httptest.ResponseRecorder
49
+ var request http.Request
50
+ request.Body = ioutil.NopCloser(bytes.NewBufferString(`{"first_name": "Nic"}`))
51
+
52
+ handlerFunc := requestValidationHandler(HEALTH_HANDLER, reflect.TypeOf(mockType{}), mockRequestStatsD, mockHandler)
53
+
54
+ handlerFunc.ServeHTTP(&responseRecorder, &request)
55
+ requestObj := context.Get(&request, "request").(*mockType)
56
+ assert.Equal(t, "Nic", requestObj.FirstName)
57
+ }
58
+
59
+ func TestReturnsBadRequestWhenNoObject(t *testing.T) {
60
+ setupRequestValidationTests(t)
61
+ var responseRecorder httptest.ResponseRecorder
62
+ var request http.Request
63
+ request.Body = ioutil.NopCloser(bytes.NewBufferString(``))
64
+
65
+ handlerFunc := requestValidationHandler(HEALTH_HANDLER, reflect.TypeOf(mockType{}), mockRequestStatsD, mockHandler)
66
+
67
+ handlerFunc.ServeHTTP(&responseRecorder, &request)
68
+
69
+ assert.Equal(t, http.StatusBadRequest, responseRecorder.Code)
70
+ mockRequestStatsD.Mock.AssertCalled(t, "Increment", HEALTH_HANDLER+BAD_REQUEST)
71
+ }
72
+
73
+ func TestReturnsBadRequestWhenRequestInvalid(t *testing.T) {
74
+ setupRequestValidationTests(t)
75
+ var responseRecorder httptest.ResponseRecorder
76
+ var request http.Request
77
+ request.Body = ioutil.NopCloser(bytes.NewBufferString(`{"first_name": ""}`))
78
+
79
+ handlerFunc := requestValidationHandler(HEALTH_HANDLER, reflect.TypeOf(mockType{}), mockRequestStatsD, mockHandler)
80
+
81
+ handlerFunc.ServeHTTP(&responseRecorder, &request)
82
+
83
+ assert.Equal(t, http.StatusBadRequest, responseRecorder.Code)
84
+ mockRequestStatsD.Mock.AssertCalled(t, "Increment", HEALTH_HANDLER+INVALID_REQUEST)
85
+ }
@@ -0,0 +1,34 @@
1
+ package handlers
2
+
3
+ import (
4
+ "net/http"
5
+ "reflect"
6
+
7
+ "github.com/gorilla/pat"
8
+ "<%= namespace %>/<%= application_name %>/logging"
9
+ )
10
+
11
+ type RouterDependenciesContainer struct {
12
+ StatsD logging.StatsD `inject:"statsd"`
13
+ }
14
+
15
+ var RouterDependencies *RouterDependenciesContainer = &RouterDependenciesContainer{}
16
+
17
+ func GetRouter() *pat.Router {
18
+ r := pat.New()
19
+
20
+ r.Get("/v1/health", HealthHandler)
21
+
22
+ r.Add("POST", "/v1/echo", requestValidationHandler(
23
+ ECHO_HANDLER+POST,
24
+ reflect.TypeOf(Echo{}),
25
+ RouterDependencies.StatsD,
26
+ http.HandlerFunc(EchoHandler),
27
+ ))
28
+
29
+ //Add routing for static routes
30
+ s := http.StripPrefix("/swagger/", http.FileServer(http.Dir("/swagger")))
31
+ r.PathPrefix("/swagger/").Handler(s)
32
+
33
+ return r
34
+ }
@@ -0,0 +1,6 @@
1
+ package logging
2
+
3
+ // StatsD interface is to allow the class .. to be injected as a DuckType
4
+ type StatsD interface {
5
+ Increment(string)
6
+ }
@@ -0,0 +1,58 @@
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "net/http"
6
+ "os"
7
+ "<%= namespace %>/<%= application_name %>/global"
8
+ "<%= namespace %>/<%= application_name %>/handlers"
9
+
10
+ "github.com/facebookgo/inject"
11
+ "github.com/alexcesaro/statsd"
12
+ )
13
+
14
+ func main() {
15
+ config := os.Args[1]
16
+ rootfolder := os.Args[2]
17
+
18
+ global.LoadConfig(config, rootfolder)
19
+
20
+ setupInjection()
21
+ setupHandlers()
22
+ }
23
+
24
+ func setupHandlers() {
25
+ http.Handle("/", handlers.GetRouter())
26
+
27
+ fmt.Println("Listening for connections on port", 8001)
28
+ http.ListenAndServe(fmt.Sprintf(":%v", 8001), nil)
29
+ }
30
+
31
+ func setupInjection() {
32
+ var g inject.Graph
33
+
34
+ var err error
35
+
36
+ statsdClient, err := statsd.New(statsd.Address(global.Config.StatsDServerIP)) // reference to a statsd client
37
+ if err != nil {
38
+ panic(fmt.Sprintln("Unable to create StatsD Client: ", err))
39
+ }
40
+
41
+ err = g.Provide(
42
+ &inject.Object{Value: handlers.RouterDependencies},
43
+ &inject.Object{Value: handlers.HealthDependencies},
44
+ &inject.Object{Value: handlers.EchoDependencies},
45
+ &inject.Object{Value: statsdClient, Name: "statsd"},
46
+ )
47
+
48
+ if err != nil {
49
+ fmt.Println(err)
50
+ }
51
+
52
+ // Here the Populate call is creating instances of NameAPI &
53
+ // PlanetAPI, and setting the HTTPTransport on both to the
54
+ // http.DefaultTransport provided above:
55
+ if err := g.Populate(); err != nil {
56
+ fmt.Println(err)
57
+ }
58
+ }
@@ -0,0 +1,23 @@
1
+ package mocks
2
+
3
+ import (
4
+ "net/http"
5
+
6
+ "github.com/stretchr/testify/mock"
7
+ )
8
+
9
+ type MockStatsD struct {
10
+ mock.Mock
11
+ }
12
+
13
+ func (m *MockStatsD) Increment(label string) {
14
+ _ = m.Mock.Called(label)
15
+ }
16
+
17
+ type MockHandler struct {
18
+ mock.Mock
19
+ }
20
+
21
+ func (m *MockHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
22
+ _ = m.Mock.Called(w, r)
23
+ }
@@ -0,0 +1,7 @@
1
+ module Minke
2
+ module Generators
3
+ module GoMicroservice
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,39 @@
1
+ require "generators/gomicroservice/version"
2
+
3
+ require 'minke/generators/register'
4
+ require 'minke/generators/config'
5
+
6
+ module Minke
7
+ module Generators
8
+ module GoMicroservice
9
+ # Register the template with minke
10
+ config = Minke::Generators::Config.new
11
+ config.name = 'minke-generator-go'
12
+ config.template_location = File.expand_path(File.dirname(__FILE__)) + '/gomicroservice/scaffold'
13
+
14
+ config.build_settings = Minke::Generators::BuildSettings.new
15
+ config.build_settings.build_commands = Minke::Generators::BuildCommands.new.tap do |bc|
16
+ bc.fetch = [['/bin/bash', '-c', 'go get -t -v -d ./... && echo Downloaded packages']]
17
+ bc.build = [['/bin/bash', '-c', 'go build -a -installsuffix cgo -ldflags \'-s\' -o <%= application_name %>']]
18
+ bc.test = [['/bin/bash', '-c', 'go test ./...']]
19
+ end
20
+ config.build_settings.docker_settings = Minke::Generators::DockerSettings.new.tap do |bs|
21
+ bs.image = 'golang:latest'
22
+ bs.env = ['CGO_ENABLED=0']
23
+ bs.binds = ["#{ENV['GOPATH']}/src:/go/src"]
24
+ #bs.working_directory = 'sdsds'#{}"#{self.working_directory}"
25
+ end
26
+
27
+ # we need lazy evaluation of this property
28
+ class << config.build_settings.docker_settings
29
+ def working_directory
30
+ dir = File.expand_path('../.')
31
+ gopath = "#{ENV['GOPATH']}"
32
+ "/go" + dir.gsub(gopath,'')
33
+ end
34
+ end
35
+
36
+ Minke::Generators.register config
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'generators/gomicroservice/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'minke-generator-go'
8
+ spec.version = Minke::Generators::GoMicroservice::VERSION
9
+ spec.authors = ['Nic Jackson']
10
+ spec.email = ['jackson.nic@gmail.com']
11
+
12
+ spec.summary = 'Go microservice template for Minke'
13
+ spec.description = 'Go microservice for Minke, please see https://github.com/nicholasjackson/minkie for further details'
14
+ spec.homepage = 'https://github.com/nicholasjackson/minkie-generator-go'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ # required so minke knows to load the gem which then registers itself
23
+ spec.metadata = { 'entrypoint' => 'generators/gomicroservice' }
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.11'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.0'
28
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minke-generator-go
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nic Jackson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Go microservice for Minke, please see https://github.com/nicholasjackson/minkie
56
+ for further details
57
+ email:
58
+ - jackson.nic@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".ruby-gemset"
66
+ - ".ruby-version"
67
+ - ".travis.yml"
68
+ - CODE_OF_CONDUCT.md
69
+ - Gemfile
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - bin/console
74
+ - bin/setup
75
+ - lib/generators/gomicroservice.rb
76
+ - lib/generators/gomicroservice/scaffold/.gitignore.erb
77
+ - lib/generators/gomicroservice/scaffold/_build/.gitignore
78
+ - lib/generators/gomicroservice/scaffold/_build/.ruby-gemset.erb
79
+ - lib/generators/gomicroservice/scaffold/_build/.ruby-version
80
+ - lib/generators/gomicroservice/scaffold/_build/Gemfile
81
+ - lib/generators/gomicroservice/scaffold/_build/Rakefile
82
+ - lib/generators/gomicroservice/scaffold/_build/config.yml.erb
83
+ - lib/generators/gomicroservice/scaffold/_build/consul_keys.yml.erb
84
+ - lib/generators/gomicroservice/scaffold/_build/dockercompose/<%= application_name
85
+ %>/docker-compose.yml.erb
86
+ - lib/generators/gomicroservice/scaffold/_build/dockercompose/<%= application_name
87
+ %>/docker-no-server.yml.erb
88
+ - lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/Dockerfile.erb
89
+ - lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/config.ctmpl.erb
90
+ - lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/.s6-svscan/crash
91
+ - lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/.s6-svscan/finish
92
+ - lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/app/finish
93
+ - lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/app/run.erb
94
+ - lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/consul-template/finish
95
+ - lib/generators/gomicroservice/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/consul-template/run.erb
96
+ - lib/generators/gomicroservice/scaffold/_build/features/health.feature
97
+ - lib/generators/gomicroservice/scaffold/_build/features/steps/http.rb
98
+ - lib/generators/gomicroservice/scaffold/_build/features/support/env.rb.erb
99
+ - lib/generators/gomicroservice/scaffold/_build/swagger_spec/swagger.yml.erb
100
+ - lib/generators/gomicroservice/scaffold/global/global.go
101
+ - lib/generators/gomicroservice/scaffold/handlers/const.go.erb
102
+ - lib/generators/gomicroservice/scaffold/handlers/echo.go.erb
103
+ - lib/generators/gomicroservice/scaffold/handlers/echo_test.go.erb
104
+ - lib/generators/gomicroservice/scaffold/handlers/health.go.erb
105
+ - lib/generators/gomicroservice/scaffold/handlers/health_test.go.erb
106
+ - lib/generators/gomicroservice/scaffold/handlers/middleware_requestvalidation.go.erb
107
+ - lib/generators/gomicroservice/scaffold/handlers/middleware_requestvalidation_test.go.erb
108
+ - lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
109
+ - lib/generators/gomicroservice/scaffold/logging/StatsD.go
110
+ - lib/generators/gomicroservice/scaffold/main.go.erb
111
+ - lib/generators/gomicroservice/scaffold/mocks/mocks.go
112
+ - lib/generators/gomicroservice/version.rb
113
+ - minke-generator-go.gemspec
114
+ homepage: https://github.com/nicholasjackson/minkie-generator-go
115
+ licenses:
116
+ - MIT
117
+ metadata:
118
+ entrypoint: generators/gomicroservice
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.5.1
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: Go microservice template for Minke
139
+ test_files: []