mjhugo / grails-build-info

Provides a Grails controller/view that display basic information about a deployed WAR file
Other
8 stars 14 forks source link

When returning json dont return arrays with name/values in them. Instead... #11

Closed erichelgeson closed 9 years ago

erichelgeson commented 9 years ago

... return the {key:value,key:value}

erichelgeson commented 9 years ago

I owe you a :beer: next time I see you. My pervious PR had 2 issues:

  1. I left the <g:meta> tag in one of the gsps, which caused me to overlook how the tests were working since now we are building the [:] in the controller.
  2. I was returning ugly json, which would be hard to parse (realized only after I started trying to parse, but I was returning arrays of maps instead of just the [:] ):

Nicer JSON, easier to parse -

$ curl -s http://localhost:8080/test/buildInfo.json | jq '.buildInfoProperties."environment.GIT_COMMIT"'
"123"
{
  "buildInfoProperties": {
    "build.date": "Thu Dec 04 10:37:15 CST 2014",
    "scm.version": "123",
    "environment.GIT_BRANCH": "eric",
    "environment.GIT_COMMIT": "123"
  },
  "installedPlugins": {
    "assetPipeline": "1.9.9",
    "buildInfo": "1.2.7-SNAPSHOT",
    "cache": "1.1.8",
    "codecs": "2.4.4",
    "controllers": "2.4.4",
    "controllersAsync": "2.4.4",
    "converters": "2.4.4",
    "core": "2.4.4",
    "databaseMigration": "1.4.0",
    "dataBinding": "2.4.4",
    "dataSource": "2.4.4",
    "domainClass": "2.4.4",
    "filters": "2.4.4",
    "groovyPages": "2.4.4",
    "hibernate4": "4.3.6.1",
    "i18n": "2.4.4",
    "jquery": "1.11.1",
    "logging": "2.4.4",
    "mimeTypes": "2.4.4",
    "restResponder": "2.4.4",
    "scaffolding": "2.1.2",
    "services": "2.4.4",
    "servlets": "2.4.4",
    "urlMappings": "2.4.4",
    "validation": "2.4.4",
    "webxml": "1.4.1"
  },
  "runtimeEnvironment": {
    "environment": "development",
    "app.version": "0.1",
    "app.grails.version": "2.4.4",
    "java.version": "1.7.0_51"
  }
}
mjhugo commented 9 years ago

Thanks for the PR and the fix! 1.2.8 published

erichelgeson commented 9 years ago

Thanks! Sorry for the oversight. Let me know when you want that beer :)