Skip to content

Commit

Permalink
Render templates using the root directory (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGreen authored Sep 1, 2022
1 parent 73b5e4f commit 3b90f4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/test_summary_buildkite_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
require 'test_summary_buildkite_plugin/utils'
require 'test_summary_buildkite_plugin/version'

ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))

module TestSummaryBuildkitePlugin
def self.run
plugins = JSON.parse(ENV.fetch('BUILDKITE_PLUGINS'), symbolize_names: true)
Expand Down
2 changes: 1 addition & 1 deletion lib/test_summary_buildkite_plugin/haml_render.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module TestSummaryBuildkitePlugin
class HamlRender
def self.render(name, params, folder: nil)
filename = %W[templates/#{folder}/#{name}.html.haml templates/#{name}.html.haml].find { |f| File.exist?(f) }
filename = %W[#{ROOT_DIR}/templates/#{folder}/#{name}.html.haml #{ROOT_DIR}/templates/#{name}.html.haml].find { |f| File.exist?(f) }
if filename
engine = Haml::Engine.new(File.read(filename), escape_html: true)
engine.render(Object.new, params)
Expand Down
2 changes: 1 addition & 1 deletion lib/test_summary_buildkite_plugin/input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Input
def self.create(type:, **options)
type = type.to_sym
raise StandardError, "Unknown file type: #{type}" unless TYPES.key?(type)
TYPES[type].new(options)
TYPES[type].new(**options)
end

class Base
Expand Down

0 comments on commit 3b90f4d

Please sign in to comment.