middleman-build-reporter 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.travis.yml +3 -0
- data/Gemfile +3 -0
- data/README.md +118 -0
- data/Rakefile +12 -0
- data/features/build_reporter.feature +21 -0
- data/features/custom_build_reporter_file_name.feature +6 -0
- data/features/extended_build_reporter.feature +12 -0
- data/features/json_build_reporter.feature +21 -0
- data/features/no_explicit_version.feature +6 -0
- data/features/step_definitions/git_steps.rb +19 -0
- data/features/step_definitions/json_reporter_file_steps.rb +31 -0
- data/features/step_definitions/version_steps.rb +5 -0
- data/features/support/env.rb +4 -0
- data/features/support/helpers.rb +7 -0
- data/fixtures/basic-app/config.rb +4 -0
- data/fixtures/basic-app/source/images/background.png +0 -0
- data/fixtures/basic-app/source/images/middleman.png +0 -0
- data/fixtures/basic-app/source/index.html.erb +10 -0
- data/fixtures/basic-app/source/javascripts/all.js +1 -0
- data/fixtures/basic-app/source/layouts/layout.erb +19 -0
- data/fixtures/basic-app/source/stylesheets/all.css +55 -0
- data/fixtures/basic-app/source/stylesheets/normalize.css +375 -0
- data/fixtures/custom-reporter-file-name/config.rb +4 -0
- data/fixtures/custom-reporter-file-name/source/images/background.png +0 -0
- data/fixtures/custom-reporter-file-name/source/images/middleman.png +0 -0
- data/fixtures/custom-reporter-file-name/source/index.html.erb +10 -0
- data/fixtures/custom-reporter-file-name/source/javascripts/all.js +1 -0
- data/fixtures/custom-reporter-file-name/source/layouts/layout.erb +19 -0
- data/fixtures/custom-reporter-file-name/source/stylesheets/all.css +55 -0
- data/fixtures/custom-reporter-file-name/source/stylesheets/normalize.css +375 -0
- data/fixtures/extended-build-reporter/.build_reporter.yml +4 -0
- data/fixtures/extended-build-reporter/config.rb +4 -0
- data/fixtures/extended-build-reporter/source/images/background.png +0 -0
- data/fixtures/extended-build-reporter/source/images/middleman.png +0 -0
- data/fixtures/extended-build-reporter/source/index.html.erb +10 -0
- data/fixtures/extended-build-reporter/source/javascripts/all.js +1 -0
- data/fixtures/extended-build-reporter/source/layouts/layout.erb +19 -0
- data/fixtures/extended-build-reporter/source/stylesheets/all.css +55 -0
- data/fixtures/extended-build-reporter/source/stylesheets/normalize.css +375 -0
- data/fixtures/json-reporter-file/config.rb +5 -0
- data/fixtures/json-reporter-file/source/images/background.png +0 -0
- data/fixtures/json-reporter-file/source/images/middleman.png +0 -0
- data/fixtures/json-reporter-file/source/index.html.erb +10 -0
- data/fixtures/json-reporter-file/source/javascripts/all.js +1 -0
- data/fixtures/json-reporter-file/source/layouts/layout.erb +19 -0
- data/fixtures/json-reporter-file/source/stylesheets/all.css +55 -0
- data/fixtures/json-reporter-file/source/stylesheets/normalize.css +375 -0
- data/fixtures/no-version/config.rb +3 -0
- data/fixtures/no-version/source/images/background.png +0 -0
- data/fixtures/no-version/source/images/middleman.png +0 -0
- data/fixtures/no-version/source/index.html.erb +10 -0
- data/fixtures/no-version/source/javascripts/all.js +1 -0
- data/fixtures/no-version/source/layouts/layout.erb +19 -0
- data/fixtures/no-version/source/stylesheets/all.css +55 -0
- data/fixtures/no-version/source/stylesheets/normalize.css +375 -0
- data/lib/middleman-build-reporter/extension.rb +29 -0
- data/lib/middleman-build-reporter/reporter.rb +68 -0
- data/lib/middleman-build-reporter/version.rb +5 -0
- data/lib/middleman-build-reporter.rb +9 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-build-reporter.gemspec +32 -0
- data/spec/middleman-build-reporter/extension_spec.rb +82 -0
- data/spec/middleman-build-reporter/reporter_spec.rb +184 -0
- data/spec/spec_helper.rb +35 -0
- metadata +248 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b39877eb52f82b5dd645fa574f290dabbeda31ab
|
4
|
+
data.tar.gz: c4eda5340278dd8a1805c36c73b94cabdbd804be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2fd1ef6f55335ae01ada5ec5015463e21c931c7d15a40bd5ed4ff05ba4c389043486a5df21e2db02891b8a6555fc70d9f8d1d6636ca0575ce1029667f6895ec5
|
7
|
+
data.tar.gz: bfb45f439283acac26763344244d6bfba9f530a2ad62ce1e3a1ef47f728194c134fa354483ca53cbef10e95ac7b06be569bc6bad3de3f4f819fdf5c2ac124aa9
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/mdb/middleman-build-reporter.svg?branch=master)](https://travis-ci.org/mdb/middleman-build-reporter)
|
2
|
+
|
3
|
+
# middleman-build-reporter
|
4
|
+
|
5
|
+
Fingerprint your [Middleman](http://middlemanapp.com) build with YAML and/or JSON files reporting build-time details.
|
6
|
+
|
7
|
+
middleman-build-reporter helps you understand what code has been deployed to an environment.
|
8
|
+
|
9
|
+
## Output
|
10
|
+
|
11
|
+
middleman-build-reporter can output YAML and/or JSON:
|
12
|
+
|
13
|
+
The `build/build.yaml`:
|
14
|
+
|
15
|
+
```yaml
|
16
|
+
branch: master
|
17
|
+
revision: 244921c81c9e21a1973659df5f702937b91cfcd4
|
18
|
+
build_time: 2014-09-20 10:50:55 -0400
|
19
|
+
version: 1.2.3
|
20
|
+
```
|
21
|
+
|
22
|
+
The `build/build.json`:
|
23
|
+
|
24
|
+
```json
|
25
|
+
{
|
26
|
+
"branch": "master",
|
27
|
+
"revision": "244921c81c9e21a1973659df5f702937b91cfcd4",
|
28
|
+
"build_time": "2014-09-20 10:50:55 -0400",
|
29
|
+
"version": "1.2.3"
|
30
|
+
}
|
31
|
+
```
|
32
|
+
|
33
|
+
## Usage
|
34
|
+
|
35
|
+
In your `Gemfile`:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
gem 'middleman-build-reporter'
|
39
|
+
```
|
40
|
+
|
41
|
+
Install it:
|
42
|
+
|
43
|
+
```bash
|
44
|
+
$ bundle install
|
45
|
+
```
|
46
|
+
|
47
|
+
Activate it within your `config.rb`:
|
48
|
+
|
49
|
+
```
|
50
|
+
activate :build_reporter
|
51
|
+
```
|
52
|
+
|
53
|
+
Supported configuration
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
activate :build_reporter do |build|
|
57
|
+
# optional; the path to your project repository root
|
58
|
+
# this must be absolute or relative from your build directory
|
59
|
+
# defaults to app root
|
60
|
+
build.repo_root = '../../../'
|
61
|
+
|
62
|
+
# optional; the version of your app
|
63
|
+
# defaults to ''
|
64
|
+
build.version = '1.2.3'
|
65
|
+
|
66
|
+
# optional; the build reporter file name
|
67
|
+
# defaults to 'build'
|
68
|
+
build.reporter_file = 'build'
|
69
|
+
|
70
|
+
# optional; an array of desired build reporter file formats
|
71
|
+
# supported formats: yaml, json
|
72
|
+
# defaults to ['yaml']
|
73
|
+
build.reporter_file_formats = ['json', 'json']
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
77
|
+
## Reporting additional custom build details
|
78
|
+
|
79
|
+
Add any additional build details to a `.build_reporter.yml` file in your project's root.
|
80
|
+
|
81
|
+
The `.build_reporter.yml` can be produced as part of your app's build process, or manually managed.
|
82
|
+
|
83
|
+
### Example - custom extended details:
|
84
|
+
|
85
|
+
The `.build_reporter.yml`:
|
86
|
+
|
87
|
+
```
|
88
|
+
---
|
89
|
+
foo: 'bar'
|
90
|
+
```
|
91
|
+
|
92
|
+
The output `build/build.yaml`:
|
93
|
+
|
94
|
+
```
|
95
|
+
branch: master
|
96
|
+
revision: 244921c81c9e21a1973659df5f702937b91cfcd4
|
97
|
+
build_time: 2014-09-20 10:50:55 -0400
|
98
|
+
version: 1.2.3
|
99
|
+
foo: bar
|
100
|
+
```
|
101
|
+
|
102
|
+
### Example - using .build_reporter.yml to override built-in middleman-build-reporter details:
|
103
|
+
|
104
|
+
The `.build_reporter.yml`:
|
105
|
+
|
106
|
+
```
|
107
|
+
---
|
108
|
+
revision: 'some_revision'
|
109
|
+
```
|
110
|
+
|
111
|
+
The output `build/build.yaml`:
|
112
|
+
|
113
|
+
```
|
114
|
+
branch: master
|
115
|
+
revision: some_revision
|
116
|
+
build_time: 2014-09-20 10:50:55 -0400
|
117
|
+
version: 1.2.3
|
118
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'cucumber/rake/task'
|
4
|
+
require 'rake/clean'
|
5
|
+
|
6
|
+
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
7
|
+
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
|
8
|
+
end
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new
|
11
|
+
|
12
|
+
task default: [:spec, :cucumber]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Build reporter
|
2
|
+
|
3
|
+
Scenario: build.yaml should report a branch
|
4
|
+
Given a successfully built app at "basic-app"
|
5
|
+
When I cd to "build"
|
6
|
+
Then the file "build.yaml" should report the current branch
|
7
|
+
|
8
|
+
Scenario: build.yaml should report a revision
|
9
|
+
Given a successfully built app at "basic-app"
|
10
|
+
When I cd to "build"
|
11
|
+
Then the file "build.yaml" should report the current git revision
|
12
|
+
|
13
|
+
Scenario: build.yaml should report a build time
|
14
|
+
Given a successfully built app at "basic-app"
|
15
|
+
When I cd to "build"
|
16
|
+
Then the file "build.yaml" should report the build time
|
17
|
+
|
18
|
+
Scenario: build.yaml should report a version
|
19
|
+
Given a successfully built app at "basic-app"
|
20
|
+
When I cd to "build"
|
21
|
+
Then the file "build.yaml" should contain "version: 1.2.3"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Extended build reporter details
|
2
|
+
|
3
|
+
Scenario: build.yaml should report the custom supplemental details
|
4
|
+
Given a successfully built app at "extended-build-reporter"
|
5
|
+
When I cd to "build"
|
6
|
+
Then the file "build.yaml" should contain "some_key: some value"
|
7
|
+
And the file "build.yaml" should contain "another_key: another value"
|
8
|
+
|
9
|
+
Scenario: build.yaml should override built-in details
|
10
|
+
Given a successfully built app at "extended-build-reporter"
|
11
|
+
When I cd to "build"
|
12
|
+
Then the file "build.yaml" should contain "version: 3.3.3"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: JSON build reporter file
|
2
|
+
|
3
|
+
Scenario: build.json should report a branch
|
4
|
+
Given a successfully built app at "json-reporter-file"
|
5
|
+
When I cd to "build"
|
6
|
+
Then the JSON file "build.json" should report the current branch
|
7
|
+
|
8
|
+
Scenario: build.yaml should report a revision
|
9
|
+
Given a successfully built app at "json-reporter-file"
|
10
|
+
When I cd to "build"
|
11
|
+
Then the JSON file "build.json" should report the current git revision
|
12
|
+
|
13
|
+
Scenario: build.json should report a build time
|
14
|
+
Given a successfully built app at "json-reporter-file"
|
15
|
+
When I cd to "build"
|
16
|
+
Then the JSON file "build.json" should report the build time
|
17
|
+
|
18
|
+
Scenario: build.json should report a version
|
19
|
+
Given a successfully built app at "json-reporter-file"
|
20
|
+
When I cd to "build"
|
21
|
+
Then the JSON file "build.json" should report version "1.2.3"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Then /the file "([^"]*)" should report the current branch/ do |file|
|
2
|
+
branch = Git.open('.').current_branch
|
3
|
+
|
4
|
+
prep_for_fs_check do
|
5
|
+
expect(YAML.load(File.read(file))['branch']).to eq branch
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /the file "([^"]*)" should report the current git revision/ do |file|
|
10
|
+
partial_content = "revision: #{Git.open('.').log.first}"
|
11
|
+
|
12
|
+
check_file_content(file, partial_content, true)
|
13
|
+
end
|
14
|
+
|
15
|
+
Then /the file "([^"]*)" should report the build time/ do |file|
|
16
|
+
partial_content = "build_time: '#{Time.now.strftime('%Y-%m-%d %H:%M')}"
|
17
|
+
|
18
|
+
check_file_content(file, partial_content, true)
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Then /the JSON file "([^"]*)" should report the current branch/ do |file|
|
2
|
+
prep_for_fs_check do
|
3
|
+
json = JSON.parse(File.open(file).read)
|
4
|
+
|
5
|
+
expect(json['branch']).to eq "#{Git.open(gem_root_relative_to_features).current_branch}"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /the JSON file "([^"]*)" should report the current git revision/ do |file|
|
10
|
+
prep_for_fs_check do
|
11
|
+
json = JSON.parse(File.open(file).read)
|
12
|
+
|
13
|
+
expect(json['revision']).to eq "#{Git.open(gem_root_relative_to_features).log.first}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Then /the JSON file "([^"]*)" should report the build time/ do |file|
|
18
|
+
prep_for_fs_check do
|
19
|
+
json = JSON.parse(File.open(file).read)
|
20
|
+
|
21
|
+
expect(json['build_time']).to include "#{Time.now.strftime('%Y-%m-%d %H:%M')}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Then /the JSON file "([^"]*)" should report version "([^"]*)"/ do |file, version|
|
26
|
+
prep_for_fs_check do
|
27
|
+
json = JSON.parse(File.open(file).read)
|
28
|
+
|
29
|
+
expect(json['version']).to eq version
|
30
|
+
end
|
31
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree .
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
|
6
|
+
<!-- Always force latest IE rendering engine or request Chrome Frame -->
|
7
|
+
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
8
|
+
|
9
|
+
<!-- Use title if it's in the page YAML frontmatter -->
|
10
|
+
<title><%= current_page.data.title || "The Middleman" %></title>
|
11
|
+
|
12
|
+
<%= stylesheet_link_tag "normalize", "all" %>
|
13
|
+
<%= javascript_include_tag "all" %>
|
14
|
+
</head>
|
15
|
+
|
16
|
+
<body class="<%= page_classes %>">
|
17
|
+
<%= yield %>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
@charset "utf-8";
|
2
|
+
|
3
|
+
body {
|
4
|
+
background: #d4d4d4 url("../images/background.png");
|
5
|
+
text-align: center;
|
6
|
+
font-family: sans-serif; }
|
7
|
+
|
8
|
+
h1 {
|
9
|
+
color: rgba(0, 0, 0, .3);
|
10
|
+
font-weight: bold;
|
11
|
+
font-size: 32px;
|
12
|
+
letter-spacing: -1px;
|
13
|
+
text-transform: uppercase;
|
14
|
+
text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
|
15
|
+
background: url("../images/middleman.png") no-repeat center 100px;
|
16
|
+
padding: 350px 0 10px;
|
17
|
+
margin: 0; }
|
18
|
+
|
19
|
+
.doc {
|
20
|
+
font-size: 14px;
|
21
|
+
margin: 0; }
|
22
|
+
.doc:before,
|
23
|
+
.doc:after {
|
24
|
+
opacity: .2;
|
25
|
+
padding: 6px;
|
26
|
+
font-style: normal;
|
27
|
+
position: relative;
|
28
|
+
content: "•"; }
|
29
|
+
.doc a {
|
30
|
+
color: rgba(0, 0, 0, 0.3); }
|
31
|
+
.doc a:hover {
|
32
|
+
color: #666; }
|
33
|
+
|
34
|
+
.welcome {
|
35
|
+
-webkit-animation-name: welcome;
|
36
|
+
-webkit-animation-duration: .9s; }
|
37
|
+
|
38
|
+
@-webkit-keyframes welcome {
|
39
|
+
from {
|
40
|
+
-webkit-transform: scale(0);
|
41
|
+
opacity: 0;
|
42
|
+
}
|
43
|
+
50% {
|
44
|
+
-webkit-transform: scale(0);
|
45
|
+
opacity: 0;
|
46
|
+
}
|
47
|
+
82.5% {
|
48
|
+
-webkit-transform: scale(1.03);
|
49
|
+
-webkit-animation-timing-function: ease-out;
|
50
|
+
opacity: 1;
|
51
|
+
}
|
52
|
+
to {
|
53
|
+
-webkit-transform: scale(1);
|
54
|
+
}
|
55
|
+
}
|