middleman-build-reporter 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1d0cb47f7eb75379745a61569987fb21d197e31
4
- data.tar.gz: db005e812ee235648d5c61f749a85453387172cc
3
+ metadata.gz: 3bb42f011103c8c6c64bcf3534350ed860241d63
4
+ data.tar.gz: 4160f15697c31a10132bba24e5905b4342097895
5
5
  SHA512:
6
- metadata.gz: cc7fb3d5f8877b3a17d356268b5b6d7995c482f9982a9bb176013c5bd684d12195edd1f20780114214ac5709ea7306d91db5b3ae6fda8db952b2ca170bf3cfe8
7
- data.tar.gz: eeeec727c5801ed6cddbafefbb8f8c9fbebdf5140671d9958d99560a10163d28652c1b6a66245322ad267f2b0605de57b78e0ec4ef178ef59a5c68bac8ae7906
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
- middleman-build-reporter is a [Middleman](http://middlemanapp.com) to help you understand what code has been deployed to an environment, and whether you're viewing cached or stale build artifacts.
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
- ```html
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
@@ -25,7 +25,7 @@ module Middleman
25
25
  '<!--',
26
26
  'FINGERPRINT:',
27
27
  "#{config.build_report.details.to_yaml}",
28
- '--!>',
28
+ '-->',
29
29
  ].join("\n")
30
30
  end
31
31
  end
@@ -5,7 +5,7 @@ require 'yaml'
5
5
  module Middleman
6
6
  module BuildReporter
7
7
  class Reporter
8
- attr_accessor :app, :repo
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
- "#{@app.build_dir}/#{@options.reporter_file}"
28
+ "#{app.build_dir}/#{options.reporter_file}"
29
29
  end
30
30
 
31
31
  def reporter_extension_file_path
32
- "#{@app.root}/.build_reporter.yml"
32
+ "#{app.root}/.build_reporter.yml"
33
33
  end
34
34
 
35
35
  def details
36
36
  {
37
- 'branch' => @repo.current_branch,
38
- 'revision' => @repo.log.first.to_s,
37
+ 'branch' => repo.current_branch,
38
+ 'revision' => repo.log.first.to_s,
39
39
  'build_time' => build_time.to_s,
40
- 'version' => @options.version
40
+ 'version' => options.version
41
41
  }.merge(details_extension)
42
42
  end
43
43
 
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module BuildReporter
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
@@ -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
- let(:extension) { described_class.new(app) }
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 a @repo on the reporter' do
31
- expect(reporter.repo.class).to eq Git::Base
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
 
@@ -1,5 +1,4 @@
1
1
  require 'bundler/setup'
2
- require 'git'
3
2
 
4
3
  Bundler.require(:development)
5
4
 
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.3
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: 2014-11-20 00:00:00.000000000 Z
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: