middleman-build-reporter 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -4
- data/lib/middleman-build-reporter/extension.rb +1 -1
- data/lib/middleman-build-reporter/reporter.rb +6 -6
- data/lib/middleman-build-reporter/version.rb +1 -1
- data/spec/middleman-build-reporter/extension_spec.rb +3 -2
- data/spec/middleman-build-reporter/reporter_spec.rb +16 -6
- data/spec/spec_helper.rb +0 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bb42f011103c8c6c64bcf3534350ed860241d63
|
4
|
+
data.tar.gz: 4160f15697c31a10132bba24e5905b4342097895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a25df05bb57bf745d080b9d7ee280fd1917dd23cead224b7bbe760d5c28efe897c10ee56b6f50ff32713cfed7b5c86b0159fea4e429583b5f97dfac0dd9d391
|
7
|
+
data.tar.gz: a3e5d2203343f4550c3286523898446ea249053c7dbac4a604b13f44b1f35d5d763ed6b15dc06c7d7f8b9deb243fbce680a3a49198d529b37cd479a9b525dd79
|
data/README.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/mdb/middleman-build-reporter.svg?branch=master)](https://travis-ci.org/mdb/middleman-build-reporter)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/mdb/middleman-build-reporter/badges/gpa.svg)](https://codeclimate.com/github/mdb/middleman-build-reporter)
|
2
3
|
|
3
4
|
# middleman-build-reporter
|
4
5
|
|
5
|
-
|
6
|
+
> Which branch/version/configuration/build has been
|
7
|
+
> deployed to which data center/server/environment?
|
8
|
+
|
9
|
+
middleman-build-reporter is a [Middleman](http://middlemanapp.com) extension
|
10
|
+
to help you understand what code has been deployed to an environment, and
|
11
|
+
whether you're viewing cached or stale build artifacts.
|
6
12
|
|
7
13
|
Features:
|
8
14
|
|
@@ -35,7 +41,7 @@ The `build/build.json`:
|
|
35
41
|
|
36
42
|
middleman-build-reporter also offers a `build_reporter_fingerprint` helper to fingerprint HTML templates:
|
37
43
|
|
38
|
-
```
|
44
|
+
```
|
39
45
|
<!--
|
40
46
|
FINGERPRINT:
|
41
47
|
---
|
@@ -43,7 +49,7 @@ branch: master
|
|
43
49
|
revision: c786c0addcde128a0823c40ebb4a3ab453411f10
|
44
50
|
build_time: '2014-10-21 07:27:51 -0400'
|
45
51
|
version: 1.2.3
|
46
|
-
|
52
|
+
-->
|
47
53
|
```
|
48
54
|
|
49
55
|
## Usage
|
@@ -118,7 +124,7 @@ branch: master
|
|
118
124
|
revision: c786c0addcde128a0823c40ebb4a3ab453411f10
|
119
125
|
build_time: '2014-10-21 07:27:51 -0400'
|
120
126
|
version: 1.2.3
|
121
|
-
|
127
|
+
-->
|
122
128
|
```
|
123
129
|
|
124
130
|
## Reporting additional custom build details
|
@@ -5,7 +5,7 @@ require 'yaml'
|
|
5
5
|
module Middleman
|
6
6
|
module BuildReporter
|
7
7
|
class Reporter
|
8
|
-
|
8
|
+
attr_reader :app, :options, :repo
|
9
9
|
|
10
10
|
def initialize(app_instance, opts = nil)
|
11
11
|
@app = app_instance
|
@@ -25,19 +25,19 @@ module Middleman
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def reporter_file_path
|
28
|
-
"#{
|
28
|
+
"#{app.build_dir}/#{options.reporter_file}"
|
29
29
|
end
|
30
30
|
|
31
31
|
def reporter_extension_file_path
|
32
|
-
"#{
|
32
|
+
"#{app.root}/.build_reporter.yml"
|
33
33
|
end
|
34
34
|
|
35
35
|
def details
|
36
36
|
{
|
37
|
-
'branch' =>
|
38
|
-
'revision' =>
|
37
|
+
'branch' => repo.current_branch,
|
38
|
+
'revision' => repo.log.first.to_s,
|
39
39
|
'build_time' => build_time.to_s,
|
40
|
-
'version' =>
|
40
|
+
'version' => options.version
|
41
41
|
}.merge(details_extension)
|
42
42
|
end
|
43
43
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Middleman::BuildReporterExtension do
|
4
|
-
let(:app) { middleman_app('basic-app') }
|
5
4
|
|
6
|
-
|
5
|
+
subject(:extension) { described_class.new(app) }
|
6
|
+
|
7
|
+
let(:app) { middleman_app('basic-app') }
|
7
8
|
|
8
9
|
context 'its default options' do
|
9
10
|
|
@@ -2,6 +2,10 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Middleman::BuildReporter::Reporter do
|
4
4
|
|
5
|
+
subject(:reporter) do
|
6
|
+
described_class.new app, options
|
7
|
+
end
|
8
|
+
|
5
9
|
let(:git_repo) { Git.open('.') }
|
6
10
|
|
7
11
|
let(:fake_details) { { 'foo' => 'bar' } }
|
@@ -17,18 +21,24 @@ describe Middleman::BuildReporter::Reporter do
|
|
17
21
|
|
18
22
|
let(:app) { middleman_app('basic-app') }
|
19
23
|
|
20
|
-
let(:reporter) do
|
21
|
-
described_class.new app, options
|
22
|
-
end
|
23
|
-
|
24
24
|
describe '#new' do
|
25
25
|
|
26
26
|
it 'sets an attr_accessor\'d @app instance variable to the value of the app it is passed' do
|
27
27
|
expect(reporter.app).to eq app
|
28
28
|
end
|
29
29
|
|
30
|
-
it 'sets
|
31
|
-
expect(reporter.repo.
|
30
|
+
it 'sets the repo root' do
|
31
|
+
expect(reporter.repo.dir.path).to eq(Dir.pwd)
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when a repo root is not specified' do
|
35
|
+
let(:options) do
|
36
|
+
double('options', { repo_root: nil })
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'sets the repo root to the app root' do
|
40
|
+
expect(reporter.repo.dir.path).to eq(app.root)
|
41
|
+
end
|
32
42
|
end
|
33
43
|
end
|
34
44
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-build-reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Ball
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|
@@ -262,4 +262,3 @@ test_files:
|
|
262
262
|
- spec/middleman-build-reporter/extension_spec.rb
|
263
263
|
- spec/middleman-build-reporter/reporter_spec.rb
|
264
264
|
- spec/spec_helper.rb
|
265
|
-
has_rdoc:
|