Skip to content

Commit 9f43bfe

Browse files
Fix path to template when used as gem
1 parent af36ab6 commit 9f43bfe

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This tool is inspired by a number of projects [rubrowser](http://www.emadelsaid.
2121

2222
The pretty `d3` visualisations are directly copied from `objc-dependency-visualiser`.
2323

24-
A huge shout out to the poeple behind these projects.
24+
A huge shout out to the people behind these projects.
2525

2626
## Usage
2727

lib/cpp_dependency_graph/graph_visualiser.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def generate_html_file(deps, file)
3939
json_connections = JSON.pretty_generate(connections)
4040
# File.write(file, json_nodes + json_connections)
4141

42-
template = File.read('views/index.html.template')
42+
template_file = resolve_file_path('views/index.html.template')
43+
template = File.read(template_file)
4344
contents = template % { dependency_links: json_connections }
4445
File.write(file, contents)
4546
end
@@ -51,4 +52,8 @@ def create_node(name)
5152
node.attributes[:shape] = 'box3d'
5253
node
5354
end
55+
56+
def resolve_file_path(path)
57+
File.expand_path("../../../#{path}", __FILE__)
58+
end
5459
end

0 commit comments

Comments
 (0)