Skip to content

Commit

Permalink
Merge pull request #14 for v0.10 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevatkm authored Mar 29, 2018
2 parents fd0d4d7 + 728f536 commit 0a37091
Show file tree
Hide file tree
Showing 44 changed files with 1,044 additions and 215 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Folders
_obj
_test
vendor/*/

# test
coverage.out
Expand Down
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ branches:
# skip tags build, we are building branch and master that is enough for
# consistenty check and release. Let's use Travis CI resources optimally
# for aah framework.
- /^v[0-9]\.[0-9]/
- /^v[0-9.]+$/

go:
- 1.8
- 1.9
- "1.10"
- tip

go_import_path: aahframework.org/tools.v0/aah

install:
- git config --global http.https://aahframework.org.followRedirects true
- go get -t -v ./...

script:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016-2017 Jeevanandam M., https://myjeeva.com <jeeva@myjeeva.com>
Copyright (c) 2016-2018 Jeevanandam M., https://myjeeva.com <jeeva@myjeeva.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Home of all aah framework CLI tools.
## aah CLI Tool
[![Build Status](https://travis-ci.org/go-aah/tools.svg?branch=master)](https://travis-ci.org/go-aah/tools) [![Go Report Card](https://goreportcard.com/badge/aahframework.org/tools.v0)](https://goreportcard.com/report/aahframework.org/tools.v0/aah)
[![Powered by Go](https://img.shields.io/badge/powered_by-go-blue.svg)](https://golang.org)
[![Version](https://img.shields.io/badge/version-0.9-blue.svg)](https://github.com/go-aah/tools/releases/latest)
[![Version](https://img.shields.io/badge/version-0.10-blue.svg)](https://github.com/go-aah/tools/releases/latest)
[![License](https://img.shields.io/github/license/go-aah/tools.svg)](LICENSE) [![Twitter](https://img.shields.io/badge/twitter-@aahframework-55acee.svg)](https://twitter.com/aahframework)

***Release [v0.9](https://github.com/go-aah/tools/releases/latest) tagged on Oct 04, 2017***
***Release [v0.10](https://github.com/go-aah/tools/releases/latest) tagged on Mar 28, 2018***

aah framework - A scalable, performant, rapid development Web framework for Go.
aah - A secure, flexible, rapid Go web framework.

Requires `go1.8` and above.

Expand Down
12 changes: 9 additions & 3 deletions aah/aah.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ var (
gocmd string
gosrcDir string

libNames = []string{"aah", "ahttp", "aruntime", "config", "essentials", "forge", "i18n",
"log", "router", "security", "test", "tools", "valpar", "view"}
libNames = []string{"tools", "aah", "ahttp", "aruntime", "config", "essentials", "forge", "i18n",
"log", "router", "security", "test", "valpar", "view"}

// abstract it, so we can do unit test
fatal = log.Fatal
fatalf = log.Fatalf
exit = os.Exit

// cli logger
cliLog *log.Logger
)

func checkPrerequisites() error {
Expand Down Expand Up @@ -87,7 +90,7 @@ func main() {
}()

if err := checkPrerequisites(); err != nil {
fatal(err)
logFatal(err)
}

app := cli.NewApp()
Expand All @@ -97,6 +100,7 @@ func main() {
app.Author = "Jeevanandam M."
app.Email = "jeeva@myjeeva.com"
app.Copyright = "Copyright (c) Jeevanandam M. <jeeva@myjeeva.com>"
app.EnableBashCompletion = true

app.Before = printHeader
app.Commands = []cli.Command{
Expand All @@ -106,6 +110,8 @@ func main() {
listCmd,
cleanCmd,
switchCmd,
updateCmd,
generateCmd,
}

sort.Sort(cli.FlagsByName(app.Flags))
Expand Down
109 changes: 109 additions & 0 deletions aah/app-template/app/init.go.atmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// aah application initialization - configuration, server extensions, middleware's, etc.
// Customize it per your application needs.

package main

import (
"aahframework.org/aah.v0"{{ if eq .AppType "web" }}

// Registering HTML minifier for web application
_ "github.com/aah-cb/minify"{{ end }}{{ if eq .AppViewEngine "pug" }}

// Registering Pug View Engine (formerly known as Jade)
_ "github.com/aah-cb/ve-pug"{{ end }}
)

func init() {

//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
// Server Extensions
// Doc: https://docs.aahframework.org/server-extension.html
//
// Best Practice: Define a function with meaningful name in a package and
// register it here. Extensions function name gets logged in the log,
// its very helpful to have meaningful log information.
//
// Such as:
// - Dedicated package for config loading
// - Dedicated package for datasource connections
// - etc
//__________________________________________________________________________

// Event: OnInit
// Published right after the `aah.AppConfig()` is loaded.
//
// aah.OnInit(config.LoadRemote)

// Event: OnStart
// Published right before the start of aah go Server.
//
// aah.OnStart(db.Connect)
// aah.OnStart(cache.Load)

// Event: OnShutdown
// Published on receiving OS Signals `SIGINT` or `SIGTERM`.
//
// aah.OnShutdown(cache.Flush)
// aah.OnShutdown(db.Disconnect)

//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
// Middleware's
// Doc: https://docs.aahframework.org/middleware.html
//
// Executed in the order they are defined. It is recommended; NOT to change
// the order of pre-defined aah framework middleware's.
//__________________________________________________________________________
aah.Middlewares(
aah.RouteMiddleware,
aah.CORSMiddleware,
aah.BindMiddleware,{{ if eq .AppType "web" }}
aah.AntiCSRFMiddleware,{{ end }}
aah.AuthcAuthzMiddleware,

//
// NOTE: Register your Custom middleware's right here
//

aah.ActionMiddleware,
)

//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
// Add Application Error Handler
// Doc: https://docs.aahframework.org/error-handling.html
//__________________________________________________________________________
// aah.SetErrorHandler(AppErrorHandler)

{{- if eq .AppType "web" }}

//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
// Add Custom Template Functions
// Doc: https://docs.aahframework.org/template-funcs.html
//__________________________________________________________________________
// aah.AddTemplateFunc(template.FuncMap{
// // ...
// })

//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
// Add Custom Session Store
// Doc: https://docs.aahframework.org/session.html
//__________________________________________________________________________
// aah.AddSessionStore("redis", &RedisSessionStore{}){{ end }}

//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
// Add Custom value Parser
// Doc: https://docs.aahframework.org/request-parameters-auto-bind.html
//__________________________________________________________________________
// if err := aah.AddValueParser(reflect.TypeOf(CustomType{}), customParser); err != nil {
// log.Error(err)
// }

//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
// Add Custom Validation Functions
// Doc: https://godoc.org/gopkg.in/go-playground/validator.v9
//__________________________________________________________________________
// Obtain aah validator instance, then add yours
// validator := valpar.Validator()
//
// // Add your validation funcs

}
21 changes: 14 additions & 7 deletions aah/app-template/config/aah.conf.atmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ name = "{{ .AppName }}"
# Friendly description of application
desc = "aah framework {{ .AppType }} application"

# Application type, typically either Web or API.
type = "{{ .AppType }}"

# Application instance name is used when you're running aah application cluster.
# This value is used in the context based logging, it distinguishes your instance
# log from other instances.
Expand Down Expand Up @@ -324,6 +327,10 @@ runtime {
# Whether to collect all the Go routines details or not.
# Default value is `false`.
#all_goroutines = true

# Whether to strip source `src` base path from file path.
# Default value is `false`.
#strip_src_base = true
}
}

Expand Down Expand Up @@ -400,15 +407,15 @@ cache {
# Doc: https://docs.aahframework.org/app-config.html#section-view
# ---------------------------------------------------------------
view {
# Choosing view engine for application. In the upcoming release framework
# will provide support to amber, pongo2, and jade. However you can implement
# on your own with simple `view.Enginer` interface.
# Default value is `go`. Currently only `go` is supported.
#engine = "go"
# Choosing view engine for application. You could implement
# on your own with simple interface `view.Enginer`.
# Default value is `go`.
engine = "{{ .AppViewEngine }}"

# Choose your own view file extension.
# Default value is `.html`.
#ext = ".html"
# Default value is chosen based on `view.engine`,
# while creating a new app using command `aah new`.
ext = "{{ .AppViewFileExt }}"

# Choose whether you need a case sensitive view file resolve or not.
# For e.g.: "/views/pages/app/login.tmpl" == "/views/pages/App/Login.tmpl"
Expand Down
55 changes: 52 additions & 3 deletions aah/app-template/config/routes.conf.atmpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,52 @@ domains {
# `anonymous` auth scheme.
# Default value is empty string.
#default_auth = ""

{{ if .AppCORSEnable -}}
#----------------------------------------------------------------------------
# CORS (Cross-Origin Resource Sharing)
# Doc: https://docs.aahframework.org/cors.html
#----------------------------------------------------------------------------
cors {
# Default value is `false`.
enable = true

# Specify `Access-Control-Allow-Origin` header values.
# # Default value is `*`.
#allow_origins = [
# "https://www.example.com",
# "http://sample.com"
#]

# Specify `Access-Control-Allow-Headers` header values.
# Default values are `Accept`, `AcceptLanguage`, `Authorization`, `Origin`.
#allow_headers = [
# "Accept",
# "Authorization",
# "Content-Type",
# "Origin"
#]

# Specify `Access-Control-Allow-Methods` header values.
# Default values are `GET`, `POST`, `HEAD`.
#allow_methods = ["GET", "POST", "HEAD"]

# Specify `Access-Control-Expose-Headers` header values.
# Default value - `cors.allow_headers` values are used if not provided.
#expose_headers = [
# "X-Custom-Header1",
# "X-Custom-Header2"
#]

# Specify `Access-Control-Max-Age` header value.
# Default value is `24h`.
#max_age = "48h"

# Specify `Access-Control-Allow-Credentials` header value.
# Default value is `false`.
#allow_credentials = true
}{{ end }}

{{ if eq .AppType "web" -}}
#----------------------------------------------------------------------------
# Static Routes Configuration
Expand Down Expand Up @@ -75,11 +121,14 @@ domains {

# serving single file
favicon {
path = "/favicon.png"
path = "/favicon.ico"

# Direct file mapping, It can be relative to application base directory
# or an absolute path. If it's relative path '/static/' prefixed automatically
file = "img/favicon.png"
# or an absolute path. For relative path, it uses below `base_dir` config value.
file = "img/favicon.ico"

# Default value for relative path file mapping is `public_assets.dir`
#base_dir = "assets"
}

# Robots Configuration file.
Expand Down
5 changes: 3 additions & 2 deletions aah/app-template/config/security.conf.atmpl
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ security {
#cleanup_interval = "30m"
}{{ end }}{{ end -}}

{{ if eq .AppType "web" -}}# ------------------------------------------------------------
{{ if eq .AppType "web" -}}
# ------------------------------------------------------------
# Anti-CSRF Protection
# Doc: https://docs.aahframework.org/anti-csrf-protection.html
# ------------------------------------------------------------
Expand Down Expand Up @@ -343,7 +344,7 @@ security {
# lengths are `16`, `24`, or `32` bytes to select `AES-128`, `AES-192`, or `AES-256`.
# Default value is `32` bytes (`aah new` generates strong one).
enc_key = "{{ .AppAntiCSRFEncKey }}"
}{{ end -}}
}{{ end }}

# ---------------------------------------------------------------------------
# HTTP Secure Header(s)
Expand Down
Binary file modified aah/app-template/static/img/aah-framework-logo.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added aah/app-template/static/img/favicon.ico
Binary file not shown.
Binary file removed aah/app-template/static/img/favicon.png
Binary file not shown.
2 changes: 0 additions & 2 deletions aah/app-template/views/common/error_footer.html

This file was deleted.

2 changes: 0 additions & 2 deletions aah/app-template/views/common/head_tags.html

This file was deleted.

9 changes: 0 additions & 9 deletions aah/app-template/views/errors/404.html

This file was deleted.

9 changes: 0 additions & 9 deletions aah/app-template/views/errors/500.html

This file was deleted.

1 change: 1 addition & 0 deletions aah/app-template/views/go/common/error_footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{ .Error.Code }} {{ .Error.Message }}</title>
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet" type="text/css">
<style>
html {-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
Expand Down Expand Up @@ -32,5 +31,4 @@
padding: 20px;
}
</style>
</head>
<body>
</head>
2 changes: 2 additions & 0 deletions aah/app-template/views/go/common/head_tags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link href="/static/css/aah.css" rel="stylesheet" />
Loading

0 comments on commit 0a37091

Please sign in to comment.