render_me_pretty 0.8.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +15 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -1
- data/LICENSE.txt +21 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/render_me_pretty/erb/base_handler.rb +11 -12
- data/lib/render_me_pretty/erb/main_error_handler.rb +3 -3
- data/lib/render_me_pretty/erb.rb +54 -56
- data/lib/render_me_pretty/version.rb +1 -1
- data/lib/render_me_pretty.rb +5 -2
- data/render_me_pretty.gemspec +10 -9
- data/tilt_examples.rb +8 -8
- metadata +7 -5
- data/.circleci/config.yml +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b046fa6c8baf78bd662403f3db8c7d069bcf42f244cc6045763f32b592f075
|
4
|
+
data.tar.gz: d30655c34e425304fab8c46fb8d6ba1fec8b6c886d7fb8d95b8579516888a3bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4908d4dfe9b6147284d7ec66f4fce89b2cbeecf186f5a4c93fae1164909921200a2923c6c62f3abef4d075183fd0159cc7e9385d59baef2fdf01df7b796737a3
|
7
|
+
data.tar.gz: b3b036d451a78ede232701541606a0cb1eae094a6f78d64aaaa2924cd4a79e47f4014f5cc9ea715dc6bd7a069f2a52fe484550f5912dcb23e8c4984829d4ddc0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
name: Run RSpec tests
|
2
|
+
on: [push,pull_request]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
steps:
|
7
|
+
- uses: actions/checkout@v2
|
8
|
+
- name: Set up Ruby
|
9
|
+
uses: ruby/setup-ruby@v1
|
10
|
+
with:
|
11
|
+
ruby-version: 3.2
|
12
|
+
bundler-cache: true
|
13
|
+
- name: Run tests
|
14
|
+
run: |
|
15
|
+
bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,17 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [1.0.0] - 2024-08-29
|
7
|
+
- [#5](https://github.com/tongueroo/render_me_pretty/pull/5) Standardrb
|
8
|
+
- [#6](https://github.com/tongueroo/render_me_pretty/pull/6) add mit license
|
9
|
+
- [#7](https://github.com/tongueroo/render_me_pretty/pull/7) on_error config option error exit or raise
|
10
|
+
|
11
|
+
## [0.9.0] - 2023-06-06
|
12
|
+
- [#2](https://github.com/tongueroo/render_me_pretty/pull/2) require tilt so EMPTY_HASH is defined
|
13
|
+
- [#3](https://github.com/tongueroo/render_me_pretty/pull/3) CI: Github Actions Rspec
|
14
|
+
- add github action badge
|
15
|
+
- remove circleci
|
16
|
+
|
6
17
|
## [0.8.4] - 2021-12-28
|
7
18
|
- fix activesupport require
|
8
19
|
|
data/Gemfile
CHANGED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) Tung Nguyen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Render Me Pretty
|
2
2
|
|
3
|
-
|
3
|
+
![workflow](https://github.com/tongueroo/render_me_pretty/actions/workflows/rspec.yml/badge.svg)
|
4
4
|
|
5
5
|
[![BoltOps Badge](https://img.boltops.com/boltops/badges/boltops-badge.png)](https://www.boltops.com)
|
6
6
|
|
data/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
task :
|
2
|
+
task default: :spec
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class RenderMePretty::Erb
|
2
2
|
class BaseHandler
|
3
|
-
def initialize(exception, path, layout_path=nil)
|
3
|
+
def initialize(exception, path, layout_path = nil)
|
4
4
|
@exception = exception
|
5
5
|
@path = path
|
6
6
|
@layout_path = layout_path
|
@@ -8,25 +8,25 @@ class RenderMePretty::Erb
|
|
8
8
|
|
9
9
|
def handle
|
10
10
|
line_number = find_line_number
|
11
|
-
pretty_trace(line_number,
|
11
|
+
pretty_trace(line_number, true) # returns StringIO
|
12
12
|
end
|
13
13
|
|
14
|
-
def pretty_trace(error_line_number, full_message=true)
|
14
|
+
def pretty_trace(error_line_number, full_message = true)
|
15
15
|
io = StringIO.new
|
16
16
|
|
17
17
|
message = full_message ? ": #{@exception.message}" : ""
|
18
18
|
io.puts "#{@exception.class}#{message}".color(:red)
|
19
19
|
|
20
|
-
pretty_path = template_path_with_error.sub(/^\.\//,
|
20
|
+
pretty_path = template_path_with_error.sub(/^\.\//, "")
|
21
21
|
io.puts "Error evaluating ERB template around line #{error_line_number.to_s.color(:red)} of: #{pretty_path}:"
|
22
22
|
|
23
23
|
context = 5 # lines of context
|
24
|
-
top, bottom = [error_line_number-context-1, 0].max, error_line_number+context-1
|
24
|
+
top, bottom = [error_line_number - context - 1, 0].max, error_line_number + context - 1
|
25
25
|
|
26
26
|
lines = IO.read(template_path_with_error).split("\n")
|
27
27
|
spacing = lines.size.to_s.size
|
28
28
|
lines[top..bottom].each_with_index do |line_content, index|
|
29
|
-
current_line_number = top+index+1
|
29
|
+
current_line_number = top + index + 1
|
30
30
|
if current_line_number == error_line_number
|
31
31
|
io.printf("%#{spacing}d %s\n".color(:red), current_line_number, line_content)
|
32
32
|
else
|
@@ -56,11 +56,10 @@ class RenderMePretty::Erb
|
|
56
56
|
# /Users/tung/src/tongueroo/lono/lib/lono/template/dsl.rb:82:in `block in build_templates'
|
57
57
|
# /Users/tung/src/tongueroo/lono/lib/lono/template/dsl.rb:81:in `each'
|
58
58
|
def backtrace_lines
|
59
|
-
full = ENV[
|
59
|
+
full = ENV["FULL_BACKTRACE"]
|
60
|
+
lines = @exception.backtrace
|
60
61
|
if full
|
61
|
-
lines = @exception.backtrace
|
62
62
|
else
|
63
|
-
lines = @exception.backtrace
|
64
63
|
# This filtering business makes is hiding useful info.
|
65
64
|
# Think it was needed for ERB but Tilt provides a better stack trace.
|
66
65
|
# Commenting out for now.
|
@@ -68,15 +67,15 @@ class RenderMePretty::Erb
|
|
68
67
|
# filter out internal lines
|
69
68
|
# removal_index = lines.find_index { |l| l =~ %r[lib/render_me_pretty] }
|
70
69
|
# lines = lines[removal_index..-1] # remove leading lines above the lib/
|
71
|
-
|
70
|
+
# render_me_pretty lines by keeping lines past the removal index
|
72
71
|
# lines.reject! { |l| l =~ %r[lib/render_me_pretty] } # now filter out
|
73
|
-
|
72
|
+
# render_me_pretty lines
|
74
73
|
lines = lines[0..7] # keep 8 lines
|
75
74
|
end
|
76
75
|
lines[0] = lines[0].color(:red)
|
77
76
|
|
78
77
|
# header
|
79
|
-
lines.unshift "\nOriginal backtrace#{full ?
|
78
|
+
lines.unshift "\nOriginal backtrace#{full ? "" : " (last 8 lines)"}:"
|
80
79
|
# footer
|
81
80
|
lines << "\nRe-run with FULL_BACKTRACE=1 to see all lines"
|
82
81
|
lines.join("\n")
|
@@ -7,15 +7,15 @@ class RenderMePretty::Erb
|
|
7
7
|
# error_info = e.backtrace[0]
|
8
8
|
def find_line_number
|
9
9
|
lines = @exception.backtrace
|
10
|
-
error_line = lines.
|
10
|
+
error_line = lines.find do |line|
|
11
11
|
line.include?(template_path_with_error)
|
12
|
-
end
|
12
|
+
end
|
13
13
|
|
14
14
|
if error_line.nil?
|
15
15
|
puts "WARN: Unable to find line number. Fallback and print out full backtrace."
|
16
16
|
puts @exception.backtrace
|
17
17
|
else
|
18
|
-
error_line.split(
|
18
|
+
error_line.split(":")[1].to_i
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
data/lib/render_me_pretty/erb.rb
CHANGED
@@ -1,53 +1,52 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
# ## Usage examples:
|
2
|
+
#
|
3
|
+
# Given an example template /path/to/template.erb that contains:
|
4
|
+
#
|
5
|
+
# a: <%= @a %>
|
6
|
+
#
|
8
7
|
### Variables at initialization
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
Result: a: 1
|
14
|
-
|
8
|
+
#
|
9
|
+
# erb = RenderMePretty::Erb.new("/path/to/template.erb", a: 1)
|
10
|
+
# erb.render
|
11
|
+
#
|
12
|
+
# Result: a: 1
|
13
|
+
#
|
15
14
|
### Variables at render time
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
Result: a: 2
|
21
|
-
|
15
|
+
#
|
16
|
+
# erb = RenderMePretty::Erb.new("/path/to/template.erb")
|
17
|
+
# erb.render(a: 2)
|
18
|
+
#
|
19
|
+
# Result: a: 2
|
20
|
+
#
|
22
21
|
### Variables at both initialization and render time:
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Result: a: 4
|
28
|
-
|
29
|
-
Variables at render time will override variables at initialization time.
|
30
|
-
|
22
|
+
#
|
23
|
+
# erb = RenderMePretty::Erb.new("/path/to/template.erb", a: 3)
|
24
|
+
# erb.render(a: "override", a: 4)
|
25
|
+
#
|
26
|
+
# Result: a: 4
|
27
|
+
#
|
28
|
+
# Variables at render time will override variables at initialization time.
|
29
|
+
#
|
31
30
|
## Context Scope
|
32
|
-
|
33
|
-
If you want to use your own context object, pass it as a variable. The context variable is specially treated as a context object. Example:
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
The context will be `person`. So person methods and instance variables will be available in the ERB templates.
|
40
|
-
|
41
|
-
|
42
|
-
require
|
31
|
+
#
|
32
|
+
# If you want to use your own context object, pass it as a variable. The context variable is specially treated as a context object. Example:
|
33
|
+
#
|
34
|
+
# person = Person.new # must implement get_binding
|
35
|
+
# erb = RenderMePretty::Erb.new("/path/to/template.erb")
|
36
|
+
# erb.render(context: person, a: 2)
|
37
|
+
#
|
38
|
+
# The context will be `person`. So person methods and instance variables will be available in the ERB templates.
|
39
|
+
#
|
40
|
+
require "tilt"
|
41
|
+
require "tilt/erb"
|
43
42
|
|
44
43
|
module RenderMePretty
|
45
44
|
class Erb
|
46
|
-
autoload :BaseHandler,
|
45
|
+
autoload :BaseHandler, "render_me_pretty/erb/base_handler"
|
47
46
|
autoload :SyntaxErrorHandler, "render_me_pretty/erb/syntax_error_handler"
|
48
47
|
autoload :MainErrorHandler, "render_me_pretty/erb/main_error_handler"
|
49
48
|
|
50
|
-
def initialize(path, variables={})
|
49
|
+
def initialize(path, variables = {})
|
51
50
|
@path = path
|
52
51
|
@init_vars = variables
|
53
52
|
@context = variables.delete(:context)
|
@@ -70,11 +69,11 @@ module RenderMePretty
|
|
70
69
|
context = context.clone # so we dont stomp the original object
|
71
70
|
# override context's instance variables with init and render vars.
|
72
71
|
@init_vars.each do |key, value|
|
73
|
-
context.instance_variable_set(
|
72
|
+
context.instance_variable_set("@" + key.to_s, value)
|
74
73
|
end
|
75
74
|
|
76
75
|
# https://github.com/gotar/dry-view/commit/39e3f96625bf90da2e51fb1fd437f18cedb9ae8c
|
77
|
-
tilt_options = {trim:
|
76
|
+
tilt_options = {trim: "-", default_encoding: "utf-8"}
|
78
77
|
if @layout_path
|
79
78
|
layout = Tilt::ERBTemplate.new(@layout_path, tilt_options)
|
80
79
|
else
|
@@ -90,12 +89,8 @@ module RenderMePretty
|
|
90
89
|
else
|
91
90
|
template.render(context)
|
92
91
|
end
|
93
|
-
rescue
|
94
|
-
|
95
|
-
raise
|
96
|
-
else
|
97
|
-
handle_exception(e)
|
98
|
-
end
|
92
|
+
rescue StandardError, ScriptError => e
|
93
|
+
handle_exception(e)
|
99
94
|
end
|
100
95
|
end
|
101
96
|
|
@@ -121,11 +116,15 @@ module RenderMePretty
|
|
121
116
|
end
|
122
117
|
|
123
118
|
def print_result(io)
|
124
|
-
if ENV[
|
119
|
+
if ENV["TEST"]
|
125
120
|
io.string
|
126
121
|
else
|
127
122
|
puts io.string
|
128
|
-
exit
|
123
|
+
if RenderMePretty.on_error.to_sym == :exit
|
124
|
+
exit 1
|
125
|
+
else
|
126
|
+
raise
|
127
|
+
end
|
129
128
|
end
|
130
129
|
end
|
131
130
|
|
@@ -143,11 +142,10 @@ module RenderMePretty
|
|
143
142
|
# /Users/tung/src/tongueroo/lono/lib/lono/template/dsl.rb:82:in `block in build_templates'
|
144
143
|
# /Users/tung/src/tongueroo/lono/lib/lono/template/dsl.rb:81:in `each'
|
145
144
|
def backtrace_lines(e)
|
146
|
-
full = ENV[
|
145
|
+
full = ENV["FULL_BACKTRACE"]
|
146
|
+
lines = e.backtrace
|
147
147
|
if full
|
148
|
-
lines = e.backtrace
|
149
148
|
else
|
150
|
-
lines = e.backtrace
|
151
149
|
# This filtering business makes is hiding useful info.
|
152
150
|
# Think it was needed for ERB but Tilt provides a better stack trace.
|
153
151
|
# Commenting out for now.
|
@@ -155,15 +153,15 @@ module RenderMePretty
|
|
155
153
|
# filter out internal lines
|
156
154
|
# removal_index = lines.find_index { |l| l =~ %r[lib/render_me_pretty] }
|
157
155
|
# lines = lines[removal_index..-1] # remove leading lines above the lib/
|
158
|
-
|
156
|
+
# render_me_pretty lines by keeping lines past the removal index
|
159
157
|
# lines.reject! { |l| l =~ %r[lib/render_me_pretty] } # now filter out
|
160
|
-
|
158
|
+
# render_me_pretty lines
|
161
159
|
lines = lines[0..7] # keep 8 lines
|
162
160
|
end
|
163
161
|
lines[0] = lines[0].color(:red)
|
164
162
|
|
165
163
|
# header
|
166
|
-
lines.unshift "\nOriginal backtrace#{full ?
|
164
|
+
lines.unshift "\nOriginal backtrace#{full ? "" : " (last 8 lines)"}:"
|
167
165
|
# footer
|
168
166
|
lines << "\nRe-run with FULL_BACKTRACE=1 to see all lines"
|
169
167
|
lines.join("\n")
|
data/lib/render_me_pretty.rb
CHANGED
@@ -4,12 +4,15 @@ require "active_support/core_ext/string"
|
|
4
4
|
require "rainbow/ext/string"
|
5
5
|
|
6
6
|
module RenderMePretty
|
7
|
-
autoload :Erb,
|
7
|
+
autoload :Erb, "render_me_pretty/erb"
|
8
8
|
|
9
|
-
def result(path, variables={})
|
9
|
+
def result(path, variables = {})
|
10
10
|
erb = Erb.new(path, variables)
|
11
11
|
erb.render
|
12
12
|
end
|
13
13
|
|
14
|
+
mattr_accessor :on_error
|
15
|
+
self.on_error = :exit # :exit or :raise
|
16
|
+
|
14
17
|
extend self
|
15
18
|
end
|
data/render_me_pretty.gemspec
CHANGED
@@ -3,19 +3,20 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
require "render_me_pretty/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
6
|
+
spec.name = "render_me_pretty"
|
7
|
+
spec.version = RenderMePretty::VERSION
|
8
|
+
spec.authors = ["Tung Nguyen"]
|
9
|
+
spec.email = ["tongueroo@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary
|
12
|
-
spec.homepage
|
11
|
+
spec.summary = "Render ERB template and provide more useful message pointing out the line with the error in the view"
|
12
|
+
spec.homepage = "https://github.com/tongueroo/render_me_pretty"
|
13
|
+
spec.license = "MIT"
|
13
14
|
|
14
|
-
spec.files
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
15
16
|
f.match(%r{^(test|spec|features)/})
|
16
17
|
end
|
17
|
-
spec.bindir
|
18
|
-
spec.executables
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
20
|
spec.require_paths = ["lib"]
|
20
21
|
|
21
22
|
spec.add_dependency "activesupport"
|
data/tilt_examples.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
template = Tilt::ERBTemplate.new(
|
3
|
-
joe = Person.find(
|
4
|
-
|
1
|
+
require "tilt/erb"
|
2
|
+
template = Tilt::ERBTemplate.new("templates/foo.erb")
|
3
|
+
joe = Person.find("joe")
|
4
|
+
template.render(joe, x: 35, y: 42)
|
5
5
|
# If no scope is provided, the template is evaluated within the context of an object created with Object.new.
|
6
6
|
|
7
7
|
# A single Template instance's render method may be called multiple times with different scope and locals arguments. Continuing the previous example, we render the same compiled template but this time in jane's scope:
|
8
8
|
|
9
|
-
jane = Person.find(
|
10
|
-
|
9
|
+
jane = Person.find("jane")
|
10
|
+
template.render(jane, x: 22, y: nil)
|
11
11
|
# Blocks can be passed to render for templates that support running arbitrary ruby code (usually with some form of yield). For instance, assuming the following in foo.erb:
|
12
12
|
|
13
13
|
# Hey <%= yield %>!
|
14
14
|
# The block passed to render is called on yield:
|
15
15
|
|
16
|
-
template = Tilt::ERBTemplate.new(
|
17
|
-
template.render {
|
16
|
+
template = Tilt::ERBTemplate.new("foo.erb")
|
17
|
+
template.render { "Joe" }
|
18
18
|
# => "Hey Joe!"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: render_me_pretty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -101,11 +101,12 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
-
- ".
|
104
|
+
- ".github/workflows/rspec.yml"
|
105
105
|
- ".gitignore"
|
106
106
|
- ".rspec"
|
107
107
|
- CHANGELOG.md
|
108
108
|
- Gemfile
|
109
|
+
- LICENSE.txt
|
109
110
|
- README.md
|
110
111
|
- Rakefile
|
111
112
|
- bin/console
|
@@ -119,7 +120,8 @@ files:
|
|
119
120
|
- render_me_pretty.gemspec
|
120
121
|
- tilt_examples.rb
|
121
122
|
homepage: https://github.com/tongueroo/render_me_pretty
|
122
|
-
licenses:
|
123
|
+
licenses:
|
124
|
+
- MIT
|
123
125
|
metadata: {}
|
124
126
|
post_install_message:
|
125
127
|
rdoc_options: []
|
@@ -136,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
138
|
- !ruby/object:Gem::Version
|
137
139
|
version: '0'
|
138
140
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
141
|
+
rubygems_version: 3.5.10
|
140
142
|
signing_key:
|
141
143
|
specification_version: 4
|
142
144
|
summary: Render ERB template and provide more useful message pointing out the line
|
data/.circleci/config.yml
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# Ruby CircleCI 2.0 configuration file
|
2
|
-
#
|
3
|
-
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
-
#
|
5
|
-
version: 2
|
6
|
-
jobs:
|
7
|
-
build:
|
8
|
-
docker:
|
9
|
-
# specify the version you desire here
|
10
|
-
- image: circleci/ruby:2.5.3
|
11
|
-
|
12
|
-
working_directory: ~/repo
|
13
|
-
|
14
|
-
steps:
|
15
|
-
- checkout
|
16
|
-
|
17
|
-
- run:
|
18
|
-
name: submodule sync
|
19
|
-
command: |
|
20
|
-
git submodule sync
|
21
|
-
git submodule update --init
|
22
|
-
|
23
|
-
# Download and cache dependencies
|
24
|
-
- restore_cache:
|
25
|
-
keys:
|
26
|
-
- v2-dependencies-{{ checksum "Gemfile.lock" }}
|
27
|
-
# fallback to using the latest cache if no exact match is found
|
28
|
-
- v2-dependencies-
|
29
|
-
|
30
|
-
- run:
|
31
|
-
name: install dependencies
|
32
|
-
command: |
|
33
|
-
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
34
|
-
|
35
|
-
- save_cache:
|
36
|
-
paths:
|
37
|
-
- ./vendor/bundle
|
38
|
-
key: v2-dependencies-{{ checksum "Gemfile.lock" }}
|
39
|
-
|
40
|
-
# run tests!
|
41
|
-
- run:
|
42
|
-
name: run tests
|
43
|
-
command: |
|
44
|
-
mkdir /tmp/test-results
|
45
|
-
|
46
|
-
cat >.rspec <<EOL
|
47
|
-
--format documentation
|
48
|
-
--require spec_helper
|
49
|
-
EOL
|
50
|
-
|
51
|
-
bundle exec rspec
|
52
|
-
|
53
|
-
# collect reports
|
54
|
-
- store_test_results:
|
55
|
-
path: /tmp/test-results
|
56
|
-
- store_artifacts:
|
57
|
-
path: /tmp/test-results
|
58
|
-
destination: test-results
|