GithubHelp home page GithubHelp logo

middleman-build-reporter's Introduction

Build Status Code Climate

middleman-build-reporter

Which branch/version/configuration/build has been deployed to which data center/server/environment?

middleman-build-reporter is a Middleman extension to help you understand what code has been deployed to an environment, and whether you're viewing cached or stale build artifacts.

Features:

  1. Generate YAML and/or JSON files reporting build-time/version details for your Middleman app.
  2. Fingerprint each Middleman HTML template with a <!-- FINGERPRINT --> comment surfacing build-time/version details.

Output

middleman-build-reporter can output YAML and/or JSON:

The build/build.yaml:

branch: master
revision: 244921c81c9e21a1973659df5f702937b91cfcd4
build_time: 2014-09-20 10:50:55 -0400
version: 1.2.3

The build/build.json:

{
  "branch": "master",
  "revision": "244921c81c9e21a1973659df5f702937b91cfcd4",
  "build_time": "2014-09-20 10:50:55 -0400",
  "version": "1.2.3"
}

middleman-build-reporter also offers a build_reporter_fingerprint helper to fingerprint HTML templates:

<!--
FINGERPRINT:
---
branch: master
revision: c786c0addcde128a0823c40ebb4a3ab453411f10
build_time: '2014-10-21 07:27:51 -0400'
version: 1.2.3
-->

Usage

In your Gemfile:

gem 'middleman-build-reporter'

Install it:

$ bundle install

Activate it within your config.rb:

activate :build_reporter

Supported configuration

activate :build_reporter do |build|
  # optional; the path to your project repository root
  # this must be absolute or relative from your build directory
  # defaults to app root
  build.repo_root = '../../../'

  # optional; the version of your app
  # defaults to ''
  build.version = '1.2.3'

  # optional; the build reporter file name
  # defaults to 'build'
  build.reporter_file = 'build'

  # optional; an array of desired build reporter file formats
  # supported formats: yaml, json
  # defaults to ['yaml']
  build.reporter_file_formats = ['yaml', 'json']
end

Fingerprinting your HTML templates

Use the build_reporter_fingerprint to fingerprint your HTML templates with build/version details:

Example usage in layouts/layout.erb:

<body>
  <h1>Some Site</h1>
</body>

<%= build_reporter_fingerprint %>

Example fingerprint HTML comment:

<body>
  <h1>Some Site</h1>
</body>

<!--
FINGERPRINT:
---
branch: master
revision: c786c0addcde128a0823c40ebb4a3ab453411f10
build_time: '2014-10-21 07:27:51 -0400'
version: 1.2.3
-->

Reporting additional custom build details

Add any additional build details to a .build_reporter.yml file in your project's root.

The .build_reporter.yml can be produced as part of your app's build process, or manually managed.

Example - custom extended details:

The .build_reporter.yml:

---
foo: 'bar'
baz: 'bim'

The output build/build.yaml:

branch: master
revision: 244921c81c9e21a1973659df5f702937b91cfcd4
build_time: 2014-09-20 10:50:55 -0400
version: 1.2.3
foo: bar
baz: bim

Example - using .build_reporter.yml to override built-in middleman-build-reporter details:

The .build_reporter.yml file can also override the values set by Middleman::BuildReporter::Reporter.

The .build_reporter.yml:

---
revision: 'some_revision'
build_time: 'some_other_time'

The output build/build.yaml:

branch: master
revision: some_revision
build_time: some_other_time
version: 1.2.3

middleman-build-reporter's People

Contributors

iamjarvo avatar mdb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

middleman-build-reporter's Issues

Html comment breaks validation

The fingerprint comment ends in --!> but it should be -->
This isn't correct html and fails validation.
Plus this causes middleman's minify html it strips everything out of the tag

Error in Jenkins when running ' bundle exec middleman build'

Hi there. I'm guessing something isn't getting returned from the git call as expected?
This works fine on my local mac, fails on Jenkins server. Any ideas?

Console log:

/usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-build-reporter-0.0.4/lib/middleman-build-reporter/reporter.rb:41:in merge': no implicit conversion of false into Hash (TypeError) from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-build-reporter-0.0.4/lib/middleman-build-reporter/reporter.rb:41:indetails'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-build-reporter-0.0.4/lib/middleman-build-reporter/reporter.rb:61:in serialize' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-build-reporter-0.0.4/lib/middleman-build-reporter/reporter.rb:21:inblock in write'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-build-reporter-0.0.4/lib/middleman-build-reporter/reporter.rb:18:in each' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-build-reporter-0.0.4/lib/middleman-build-reporter/reporter.rb:18:inwrite'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-build-reporter-0.0.4/lib/middleman-build-reporter/extension.rb:16:in after_build' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-core-3.3.6/lib/middleman-core/extension.rb:159:inblock in bind_after_build'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/uber-0.0.8/lib/uber/options.rb:80:in instance_exec' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/uber-0.0.8/lib/uber/options.rb:80:inproc!'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/uber-0.0.8/lib/uber/options.rb:69:in evaluate_for' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/uber-0.0.8/lib/uber/options.rb:60:inevaluate'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/hooks-0.4.0/lib/hooks/hook.rb:53:in execute_callback' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/hooks-0.4.0/lib/hooks/hook.rb:40:inblock in run'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/hooks-0.4.0/lib/hooks/hook.rb:39:in each' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/hooks-0.4.0/lib/hooks/hook.rb:39:ininject'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/hooks-0.4.0/lib/hooks/hook.rb:39:in run' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/hooks-0.4.0/lib/hooks.rb:55:inrun_hook_for'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/hooks-0.4.0/lib/hooks/instance_hooks.rb:6:in run_hook' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-core-3.3.6/lib/middleman-core/cli/build.rb:72:inbuild'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/thor-0.19.1/lib/thor/command.rb:27:in run' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/thor-0.19.1/lib/thor.rb:359:in dispatch' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/thor-0.19.1/lib/thor/base.rb:440:instart'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-core-3.3.6/lib/middleman-core/cli.rb:72:in method_missing' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/thor-0.19.1/lib/thor/command.rb:29:inrun'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/thor-0.19.1/lib/thor/command.rb:126:in run' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/thor-0.19.1/lib/thor.rb:359:in dispatch' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/thor-0.19.1/lib/thor/base.rb:440:instart'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-core-3.3.6/lib/middleman-core/cli.rb:20:in start' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/gems/middleman-core-3.3.6/bin/middleman:18:in<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/bin/middleman:23:in load' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/bin/middleman:23:in

'
from /usr/local/rvm/gems/ruby-2.1.1@mapquest/bin/ruby_executable_hooks:15:in eval' from /usr/local/rvm/gems/ruby-2.1.1@mapquest/bin/ruby_executable_hooks:15:in'
Build step 'Execute shell' marked build as failure

Support middleman 4.0

Ran into some bugs with middleman 4.0. Working on a branch to support the changes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.