minke-generator-netmvc 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +14 -0
  6. data/CODE_OF_CONDUCT.md +49 -0
  7. data/Gemfile +9 -0
  8. data/Gemfile.lock +95 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +55 -0
  11. data/Rakefile +7 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/lib/generators/netmvc.rb +31 -0
  15. data/lib/generators/netmvc/scaffold/.gitignore.erb +5 -0
  16. data/lib/generators/netmvc/scaffold/Controllers/HealthController.cs.erb +19 -0
  17. data/lib/generators/netmvc/scaffold/Program.cs.erb +25 -0
  18. data/lib/generators/netmvc/scaffold/Properties/launchSettings.json +28 -0
  19. data/lib/generators/netmvc/scaffold/README.md +39 -0
  20. data/lib/generators/netmvc/scaffold/Startup.cs.erb +43 -0
  21. data/lib/generators/netmvc/scaffold/_build/.gitignore +1 -0
  22. data/lib/generators/netmvc/scaffold/_build/.ruby-gemset.erb +1 -0
  23. data/lib/generators/netmvc/scaffold/_build/.ruby-version +1 -0
  24. data/lib/generators/netmvc/scaffold/_build/Gemfile +11 -0
  25. data/lib/generators/netmvc/scaffold/_build/Rakefile +4 -0
  26. data/lib/generators/netmvc/scaffold/_build/config.yml.erb +54 -0
  27. data/lib/generators/netmvc/scaffold/_build/consul_keys.yml.erb +13 -0
  28. data/lib/generators/netmvc/scaffold/_build/dockercompose/<%= application_name %>/docker-compose.yml.erb +32 -0
  29. data/lib/generators/netmvc/scaffold/_build/dockercompose/<%= application_name %>/docker-no-server.yml.erb +25 -0
  30. data/lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/Dockerfile.erb +36 -0
  31. data/lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/appsettings.ctmpl.erb +10 -0
  32. data/lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/.s6-svscan/crash +1 -0
  33. data/lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/.s6-svscan/finish +1 -0
  34. data/lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/app/finish +1 -0
  35. data/lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/app/run.erb +3 -0
  36. data/lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/consul-template/finish +1 -0
  37. data/lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/consul-template/run.erb +3 -0
  38. data/lib/generators/netmvc/scaffold/_build/features/health.feature +14 -0
  39. data/lib/generators/netmvc/scaffold/_build/features/steps/http.rb +5 -0
  40. data/lib/generators/netmvc/scaffold/_build/features/support/env.rb.erb +13 -0
  41. data/lib/generators/netmvc/scaffold/_build/swagger_spec/swagger.yml.erb +34 -0
  42. data/lib/generators/netmvc/scaffold/appsettings.json +10 -0
  43. data/lib/generators/netmvc/scaffold/project.json.erb +60 -0
  44. data/lib/generators/netmvc/scaffold/web.config +14 -0
  45. data/lib/generators/netmvc/version.rb +7 -0
  46. data/minke-generator-netmvc.gemspec +28 -0
  47. metadata +133 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6eb4b5d8385a79c2ea372c961e857341deeec5ac
4
+ data.tar.gz: d94cefb86923bce6c741d17d4d5a80d71062fe50
5
+ SHA512:
6
+ metadata.gz: d5233f56e627266c613ad66d8c312490a2d1f2375533f305e7e9910d1454fdd69d12b924f8cbc3b7130e489b429382deb4d38ac12ecbd1ac64bd974c0e2e2940
7
+ data.tar.gz: 42a493d34840eba6b1449b404f9a8d0811b25af331e938468a68110517f29c48bd4ad95bc615a5afaf3c4707394b0cdc36757f5a020495a57a3d9a8aa8578518
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ /pkg
2
+ .DS_Store
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ minke-generator-netmvc
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-netmvc
11
+ on:
12
+ repo: nicholasjackson/minke-generator-netmvc
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/Gemfile.lock ADDED
@@ -0,0 +1,95 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ minke-generator-netmvc (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.3.8)
10
+ builder (3.2.2)
11
+ colorize (0.7.7)
12
+ consul_loader (1.0.0)
13
+ rest-client
14
+ cucumber (2.3.3)
15
+ builder (>= 2.1.2)
16
+ cucumber-core (~> 1.4.0)
17
+ cucumber-wire (~> 0.0.1)
18
+ diff-lcs (>= 1.1.3)
19
+ gherkin (~> 3.2.0)
20
+ multi_json (>= 1.7.5, < 2.0)
21
+ multi_test (>= 0.1.2)
22
+ cucumber-api (0.3)
23
+ cucumber (~> 2.0)
24
+ json-schema (~> 2.5)
25
+ jsonpath (~> 0.5)
26
+ rest-client (~> 1.8)
27
+ cucumber-core (1.4.0)
28
+ gherkin (~> 3.2.0)
29
+ cucumber-wire (0.0.1)
30
+ diff-lcs (1.2.5)
31
+ docker-api (1.28.0)
32
+ excon (>= 0.38.0)
33
+ json
34
+ domain_name (0.5.20160310)
35
+ unf (>= 0.0.5, < 1.0.0)
36
+ excon (0.49.0)
37
+ gherkin (3.2.0)
38
+ http-cookie (1.0.2)
39
+ domain_name (~> 0.5)
40
+ json (1.8.3)
41
+ json-schema (2.6.2)
42
+ addressable (~> 2.3.8)
43
+ jsonpath (0.5.8)
44
+ multi_json
45
+ mime-types (2.99.1)
46
+ mini_portile2 (2.0.0)
47
+ minke (1.0.1)
48
+ colorize
49
+ consul_loader (~> 1.0)
50
+ cucumber
51
+ docker-api
52
+ multi_json
53
+ rake (~> 10.0)
54
+ rest-client (~> 1.8)
55
+ multi_json (1.12.1)
56
+ multi_test (0.1.2)
57
+ netrc (0.11.0)
58
+ nokogiri (1.6.7.2)
59
+ mini_portile2 (~> 2.0.0.rc2)
60
+ rake (10.5.0)
61
+ rest-client (1.8.0)
62
+ http-cookie (>= 1.0.2, < 2.0)
63
+ mime-types (>= 1.16, < 3.0)
64
+ netrc (~> 0.7)
65
+ rspec (3.4.0)
66
+ rspec-core (~> 3.4.0)
67
+ rspec-expectations (~> 3.4.0)
68
+ rspec-mocks (~> 3.4.0)
69
+ rspec-core (3.4.4)
70
+ rspec-support (~> 3.4.0)
71
+ rspec-expectations (3.4.0)
72
+ diff-lcs (>= 1.2.0, < 2.0)
73
+ rspec-support (~> 3.4.0)
74
+ rspec-mocks (3.4.1)
75
+ diff-lcs (>= 1.2.0, < 2.0)
76
+ rspec-support (~> 3.4.0)
77
+ rspec-support (3.4.1)
78
+ unf (0.1.4)
79
+ unf_ext
80
+ unf_ext (0.0.7.2)
81
+
82
+ PLATFORMS
83
+ ruby
84
+
85
+ DEPENDENCIES
86
+ bundler (~> 1.11)
87
+ cucumber-api (~> 0.3)
88
+ minke
89
+ minke-generator-netmvc!
90
+ nokogiri
91
+ rake (~> 10.0)
92
+ rspec (~> 3.0)
93
+
94
+ BUNDLED WITH
95
+ 1.12.3
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,55 @@
1
+ # Minke::Generators::NetMVC
2
+
3
+ [![Build Status](https://travis-ci.org/nicholasjackson/minke-generator-netmvc.svg?branch=master)](https://travis-ci.org/nicholasjackson/minke-generator-netmvc)
4
+
5
+ This generator creates a REST API Microservice in .NET Core MVC.
6
+
7
+ ## Available variables for template (erb style)
8
+ - <%= application_name %>: The name of the application executable
9
+ - <%= namespace %>: Namespace of the application
10
+ - <%= src_root %>: Source root of the application
11
+
12
+ ## Testing your template
13
+ ```
14
+ $ bundle
15
+ ```
16
+
17
+ Test your generator by running ...
18
+ ```
19
+ $ bundle exec minke -g minke-generator-netmvc -o ../temp -a tester -n mynamespace
20
+ ```
21
+
22
+ ## Installation
23
+
24
+ Add this line to your application's Gemfile:
25
+
26
+ ```ruby
27
+ gem 'minke-generator-netmvc'
28
+ ```
29
+
30
+ And then execute:
31
+
32
+ $ bundle
33
+
34
+ Or install it yourself as:
35
+
36
+ $ gem install minke-generator-netmvc
37
+
38
+ ## Usage
39
+
40
+ TODO: Write usage instructions here
41
+
42
+ ## Development
43
+
44
+ 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.
45
+
46
+ 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).
47
+
48
+ ## Contributing
49
+
50
+ 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.
51
+
52
+
53
+ ## License
54
+
55
+ 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,31 @@
1
+ require "generators/netmvc/version"
2
+
3
+ require 'minke/generators/register'
4
+ require 'minke/generators/config'
5
+
6
+ module Minke
7
+ module Generators
8
+ module NetMVC
9
+ # Register the template with minke
10
+ config = Minke::Generators::Config.new
11
+ config.name = 'minke-generator-netmvc'
12
+ config.template_location = File.expand_path(File.dirname(__FILE__)) + '/netmvc/scaffold'
13
+
14
+ config.build_settings = Minke::Generators::BuildSettings.new
15
+
16
+ config.build_settings.build_commands = Minke::Generators::BuildCommands.new.tap do |bc|
17
+ bc.fetch = [['/bin/bash', '-c', 'dotnet restore --packages ./.nuget']]
18
+ bc.build = [['/bin/bash', '-c', 'NUGET_PACKAGES=./.nuget dotnet build']]
19
+ bc.test = [['/bin/bash', '-c', 'NUGET_PACKAGES=./.nuget dotnet test']]
20
+ end
21
+
22
+ config.build_settings.docker_settings = Minke::Generators::DockerSettings.new.tap do |bs|
23
+ bs.image = 'microsoft/dotnet:latest'
24
+ bs.binds = ["<%= src_root %>:/src"]
25
+ bs.working_directory = '/src' # working directory is added via a class patch to enable lazy load
26
+ end
27
+
28
+ Minke::Generators.register config
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ /<%= application_name %>
2
+ /bin
3
+ /obj
4
+ .DS_Store
5
+ /.nuget
@@ -0,0 +1,19 @@
1
+ using Microsoft.AspNetCore.Mvc;
2
+
3
+ namespace <%= namespace %>.Controllers
4
+ {
5
+ [Route("v1/[controller]")]
6
+ public class HealthController : Controller
7
+ {
8
+ public class HealthResponse {
9
+ public string Status { get; set; }
10
+ }
11
+
12
+ // GET api/health
13
+ [HttpGet]
14
+ public HealthResponse Get()
15
+ {
16
+ return new HealthResponse { Status = "ok" };
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,25 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.IO;
4
+ using System.Linq;
5
+ using System.Threading.Tasks;
6
+ using Microsoft.AspNetCore.Hosting;
7
+ using Microsoft.AspNetCore.Builder;
8
+
9
+ namespace <%= namespace %>
10
+ {
11
+ public class Program
12
+ {
13
+ public static void Main(string[] args)
14
+ {
15
+ var host = new WebHostBuilder()
16
+ .UseKestrel()
17
+ .UseContentRoot(Directory.GetCurrentDirectory())
18
+ .UseIISIntegration()
19
+ .UseStartup<Startup>()
20
+ .Build();
21
+
22
+ host.Run();
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "iisSettings": {
3
+ "windowsAuthentication": false,
4
+ "anonymousAuthentication": true,
5
+ "iisExpress": {
6
+ "applicationUrl": "http://localhost:55368/",
7
+ "sslPort": 0
8
+ }
9
+ },
10
+ "profiles": {
11
+ "IIS Express": {
12
+ "commandName" : "IISExpress",
13
+ "launchBrowser": true,
14
+ "launchUrl": "api/values",
15
+ "environmentVariables" : {
16
+ "ASPNETCORE_ENVIRONMENT": "Development"
17
+ }
18
+ },
19
+ "TransformAPI": {
20
+ "commandName": "Project",
21
+ "launchBrowser": true,
22
+ "launchUrl": "http://localhost:5000/api/values",
23
+ "environmentVariables": {
24
+ "ASPNETCORE_ENVIRONMENT": "Development"
25
+ }
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,39 @@
1
+ # Welcome to ASP.NET Core
2
+
3
+ We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
4
+
5
+ You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016)
6
+
7
+ ## This application consists of:
8
+
9
+ * Sample pages using ASP.NET Core MVC
10
+ * [Gulp](https://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries
11
+ * Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939)
12
+
13
+ ## How to
14
+
15
+ * [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600)
16
+ * [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562)
17
+ * [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315)
18
+ * [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316)
19
+ * [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317)
20
+ * [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318)
21
+ * [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319)
22
+
23
+ ## Overview
24
+
25
+ * [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008)
26
+ * [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320)
27
+ * [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602)
28
+ * [Security](https://go.microsoft.com/fwlink/?LinkId=398603)
29
+ * [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321)
30
+ * [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322)
31
+ * [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323)
32
+
33
+ ## Run & Deploy
34
+
35
+ * [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851)
36
+ * [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853)
37
+ * [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609)
38
+
39
+ We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015)
@@ -0,0 +1,43 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Linq;
4
+ using System.Threading.Tasks;
5
+ using Microsoft.AspNetCore.Builder;
6
+ using Microsoft.AspNetCore.Hosting;
7
+ using Microsoft.Extensions.Configuration;
8
+ using Microsoft.Extensions.DependencyInjection;
9
+ using Microsoft.Extensions.Logging;
10
+
11
+ namespace <%= namespace %>
12
+ {
13
+ public class Startup
14
+ {
15
+ public Startup(IHostingEnvironment env)
16
+ {
17
+ var builder = new ConfigurationBuilder()
18
+ .SetBasePath(env.ContentRootPath)
19
+ .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
20
+ .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
21
+ .AddEnvironmentVariables();
22
+ Configuration = builder.Build();
23
+ }
24
+
25
+ public IConfigurationRoot Configuration { get; }
26
+
27
+ // This method gets called by the runtime. Use this method to add services to the container.
28
+ public void ConfigureServices(IServiceCollection services)
29
+ {
30
+ // Add framework services.
31
+ services.AddMvc();
32
+ }
33
+
34
+ // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
35
+ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
36
+ {
37
+ loggerFactory.AddConsole(Configuration.GetSection("Logging"));
38
+ loggerFactory.AddDebug();
39
+
40
+ app.UseMvc();
41
+ }
42
+ }
43
+ }
@@ -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-netmvc', :path => '/Users/nicj/Developer/gems/minke-generator-netmvc'
@@ -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,54 @@
1
+ ---
2
+ application_name: '<%= application_name %>'
3
+ namespace: '<%= namespace %>'
4
+ generator_name: minke-generator-netmvc
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
+ application_docker_file: './dockerfile/<%= application_name %>/'
13
+ application_compose_file: './dockercompose/<%= application_name %>/docker-compose.yml'
14
+ fetch:
15
+ enabled: true
16
+ build:
17
+ post:
18
+ copy:
19
+ -
20
+ from: '../bin'
21
+ to: './dockerfile/<%= application_name %>/bin'
22
+ -
23
+ from: '../.nuget'
24
+ to: './dockerfile/<%= application_name %>/.nuget'
25
+ -
26
+ from: '../project.json'
27
+ to: './dockerfile/<%= application_name %>/project.json'
28
+ -
29
+ from: '../web.config'
30
+ to: './dockerfile/<%= application_name %>/web.config'
31
+ -
32
+ from: './swagger_spec/swagger.yml'
33
+ to: './dockerfile/<%= application_name %>/swagger_spec'
34
+ run:
35
+ pre:
36
+ consul_loader:
37
+ config_file: './consul_keys.yml'
38
+ url:
39
+ address: consul
40
+ port: 8500
41
+ type: private
42
+ cucumber:
43
+ pre:
44
+ consul_loader:
45
+ config_file: './consul_keys.yml'
46
+ url:
47
+ address: consul
48
+ port: 8500
49
+ type: private
50
+ health_check:
51
+ address: <%= application_name %>
52
+ port: 5000
53
+ path: /v1/health
54
+ 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
+ - "::5000"
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,36 @@
1
+ FROM microsoft/dotnet:latest
2
+
3
+ EXPOSE 5000
4
+
5
+ # Install supervisor and consul-template
6
+ RUN apt-get update
7
+ RUN yes | apt-get install wget tar unzip
8
+
9
+ # s6 overlay
10
+ ADD https://github.com/just-containers/s6-overlay/releases/download/v1.17.2.0/s6-overlay-amd64.tar.gz /tmp/s6-overlay.tar.gz
11
+ RUN tar xvfz /tmp/s6-overlay.tar.gz -C /; \
12
+ rm -rf /etc/s6
13
+
14
+ RUN wget https://releases.hashicorp.com/consul-template/0.14.0/consul-template_0.14.0_linux_386.zip; \
15
+ unzip consul-template_0.14.0_linux_386.zip; \
16
+ mv consul-template /bin/consul-template
17
+
18
+ # Create directory for server files
19
+ RUN mkdir /<%= application_name %>
20
+
21
+ COPY s6-etc /etc/s6
22
+ RUN chmod -R 755 /etc/s6; \
23
+ chmod -R 755 /etc/s6
24
+
25
+ # Add consul template
26
+ COPY appsettings.ctmpl /<%= application_name %>/appsettings.ctmpl
27
+
28
+ # Add server files
29
+ ADD swagger_spec /swagger
30
+ ADD bin /<%= application_name %>/bin
31
+ ADD .nuget /<%= application_name %>/.nuget
32
+ ADD web.config /<%= application_name %>/web.config
33
+ ADD project.json /<%= application_name %>/project.json
34
+
35
+ ENTRYPOINT ["/bin/s6-svscan","/etc/s6"]
36
+ CMD []
@@ -0,0 +1,10 @@
1
+ {
2
+ "Logging": {
3
+ "IncludeScopes": false,
4
+ "LogLevel": {
5
+ "Default": "Debug",
6
+ "System": "Information",
7
+ "Microsoft": "Information"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ exec /bin/consul-template -consul=$CONSUL -template "/<%= application_name %>/appsettings.ctmpl:/<%= application_name %>/appsettings.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 %>', '5000', :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,10 @@
1
+ {
2
+ "Logging": {
3
+ "IncludeScopes": false,
4
+ "LogLevel": {
5
+ "Default": "Debug",
6
+ "System": "Information",
7
+ "Microsoft": "Information"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "dependencies": {
3
+ "Microsoft.NETCore.App": {
4
+ "version": "1.0.0-rc2-3002702",
5
+ "type": "platform"
6
+ },
7
+ "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
8
+ "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
9
+ "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
10
+ "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
11
+ "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",
12
+ "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
13
+ "Microsoft.Extensions.Logging": "1.0.0-rc2-final",
14
+ "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
15
+ "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final"
16
+ },
17
+
18
+ "tools": {
19
+ "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
20
+ "version": "1.0.0-preview1-final",
21
+ "imports": "portable-net45+win8+dnxcore50"
22
+ }
23
+ },
24
+
25
+ "frameworks": {
26
+ "netcoreapp1.0": {
27
+ "imports": [
28
+ "dotnet5.6",
29
+ "dnxcore50",
30
+ "portable-net45+win8"
31
+ ]
32
+ }
33
+ },
34
+
35
+ "buildOptions": {
36
+ "emitEntryPoint": true,
37
+ "preserveCompilationContext": true
38
+ },
39
+
40
+ "runtimeOptions": {
41
+ "gcServer": true
42
+ },
43
+
44
+ "publishOptions": {
45
+ "include": [
46
+ "wwwroot",
47
+ "Views",
48
+ "appsettings.json",
49
+ "web.config"
50
+ ]
51
+ },
52
+
53
+ "scripts": {
54
+ "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
55
+ },
56
+
57
+ "tooling": {
58
+ "defaultNamespace": "<%= namespace %>"
59
+ }
60
+ }
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <configuration>
3
+
4
+ <!--
5
+ Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
6
+ -->
7
+
8
+ <system.webServer>
9
+ <handlers>
10
+ <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
11
+ </handlers>
12
+ <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
13
+ </system.webServer>
14
+ </configuration>
@@ -0,0 +1,7 @@
1
+ module Minke
2
+ module Generators
3
+ module NetMVC
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ 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/netmvc/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'minke-generator-netmvc'
8
+ spec.version = Minke::Generators::NetMVC::VERSION
9
+ spec.authors = ['Nic Jackson']
10
+ spec.email = ['jackson.nic@gmail.com']
11
+
12
+ spec.summary = '.Net Core MVC microservice template for Minke'
13
+ spec.description = '.Net Core MVC microservice for Minke, please see https://github.com/nicholasjackson/minkie for further details'
14
+ spec.homepage = 'https://github.com/nicholasjackson/minkie-generator-netmvc'
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/netmvc' }
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,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minke-generator-netmvc
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-21 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: ".Net Core MVC 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
+ - ".ruby-gemset"
65
+ - ".ruby-version"
66
+ - ".travis.yml"
67
+ - CODE_OF_CONDUCT.md
68
+ - Gemfile
69
+ - Gemfile.lock
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - bin/console
74
+ - bin/setup
75
+ - lib/generators/netmvc.rb
76
+ - lib/generators/netmvc/scaffold/.gitignore.erb
77
+ - lib/generators/netmvc/scaffold/Controllers/HealthController.cs.erb
78
+ - lib/generators/netmvc/scaffold/Program.cs.erb
79
+ - lib/generators/netmvc/scaffold/Properties/launchSettings.json
80
+ - lib/generators/netmvc/scaffold/README.md
81
+ - lib/generators/netmvc/scaffold/Startup.cs.erb
82
+ - lib/generators/netmvc/scaffold/_build/.gitignore
83
+ - lib/generators/netmvc/scaffold/_build/.ruby-gemset.erb
84
+ - lib/generators/netmvc/scaffold/_build/.ruby-version
85
+ - lib/generators/netmvc/scaffold/_build/Gemfile
86
+ - lib/generators/netmvc/scaffold/_build/Rakefile
87
+ - lib/generators/netmvc/scaffold/_build/config.yml.erb
88
+ - lib/generators/netmvc/scaffold/_build/consul_keys.yml.erb
89
+ - lib/generators/netmvc/scaffold/_build/dockercompose/<%= application_name %>/docker-compose.yml.erb
90
+ - lib/generators/netmvc/scaffold/_build/dockercompose/<%= application_name %>/docker-no-server.yml.erb
91
+ - lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/Dockerfile.erb
92
+ - lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/appsettings.ctmpl.erb
93
+ - lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/.s6-svscan/crash
94
+ - lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/.s6-svscan/finish
95
+ - lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/app/finish
96
+ - lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/app/run.erb
97
+ - lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/consul-template/finish
98
+ - lib/generators/netmvc/scaffold/_build/dockerfile/<%= application_name %>/s6-etc/consul-template/run.erb
99
+ - lib/generators/netmvc/scaffold/_build/features/health.feature
100
+ - lib/generators/netmvc/scaffold/_build/features/steps/http.rb
101
+ - lib/generators/netmvc/scaffold/_build/features/support/env.rb.erb
102
+ - lib/generators/netmvc/scaffold/_build/swagger_spec/swagger.yml.erb
103
+ - lib/generators/netmvc/scaffold/appsettings.json
104
+ - lib/generators/netmvc/scaffold/project.json.erb
105
+ - lib/generators/netmvc/scaffold/web.config
106
+ - lib/generators/netmvc/version.rb
107
+ - minke-generator-netmvc.gemspec
108
+ homepage: https://github.com/nicholasjackson/minkie-generator-netmvc
109
+ licenses:
110
+ - MIT
111
+ metadata:
112
+ entrypoint: generators/netmvc
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.5.1
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: ".Net Core MVC microservice template for Minke"
133
+ test_files: []