Skip to content

Commit

Permalink
Merge pull request #221 from jgebal/feature/parametise_html_assets_link
Browse files Browse the repository at this point in the history
The ut_coverage_html_reporter now accepts parameter to use different …
  • Loading branch information
Pazus committed Mar 6, 2017
2 parents 397e786 + cfc77d8 commit 8734716
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
16 changes: 12 additions & 4 deletions source/reporters/ut_coverage_html_reporter.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ create or replace type body ut_coverage_html_reporter is
a_project_name varchar2 := null,
a_schema_names ut_varchar2_list := null,
a_include_object_list ut_varchar2_list := null,
a_exclude_object_list ut_varchar2_list := null
a_exclude_object_list ut_varchar2_list := null,
a_html_report_assets_path varchar2 := null
) return self as result is
begin
self.init($$plsql_unit);
ut_coverage.init(a_schema_names, a_include_object_list, a_exclude_object_list);
self.project_name := a_project_name;
assets_path := nvl(a_html_report_assets_path, ut_coverage_report_html_helper.get_default_html_assets_path());
return;
end;

Expand All @@ -41,7 +43,8 @@ create or replace type body ut_coverage_html_reporter is
a_object_type_subexpression positive,
a_file_to_object_type_mapping ut_key_value_pairs,
a_include_object_list ut_varchar2_list := null,
a_exclude_object_list ut_varchar2_list := null
a_exclude_object_list ut_varchar2_list := null,
a_html_report_assets_path varchar2 := null
) return self as result is
l_mappings ut_coverage_file_mappings;
begin
Expand All @@ -52,6 +55,7 @@ create or replace type body ut_coverage_html_reporter is
self.init($$plsql_unit);
ut_coverage.init(l_mappings, a_include_object_list, a_exclude_object_list);
self.project_name := a_project_name;
assets_path := nvl(a_html_report_assets_path, ut_coverage_report_html_helper.get_default_html_assets_path());
return;
end;

Expand All @@ -61,14 +65,16 @@ create or replace type body ut_coverage_html_reporter is
a_object_owner varchar2 := null,
a_file_paths ut_varchar2_list,
a_include_object_list ut_varchar2_list := null,
a_exclude_object_list ut_varchar2_list := null
a_exclude_object_list ut_varchar2_list := null,
a_html_report_assets_path varchar2 := null
) return self as result is
l_mappings ut_coverage_file_mappings;
begin
l_mappings := ut_coverage.build_file_mappings( a_object_owner, a_file_paths );
self.init($$plsql_unit);
ut_coverage.init(l_mappings, a_include_object_list, a_exclude_object_list);
self.project_name := a_project_name;
assets_path := nvl(a_html_report_assets_path, ut_coverage_report_html_helper.get_default_html_assets_path());
return;
end;

Expand All @@ -77,12 +83,14 @@ create or replace type body ut_coverage_html_reporter is
a_project_name varchar2 := null,
a_file_mappings ut_coverage_file_mappings,
a_include_object_list ut_varchar2_list := null,
a_exclude_object_list ut_varchar2_list := null
a_exclude_object_list ut_varchar2_list := null,
a_html_report_assets_path varchar2 := null
) return self as result is
begin
self.init($$plsql_unit);
ut_coverage.init(a_file_mappings, a_include_object_list, a_exclude_object_list);
self.project_name := a_project_name;
assets_path := nvl(a_html_report_assets_path, ut_coverage_report_html_helper.get_default_html_assets_path());
return;
end;

Expand Down
13 changes: 9 additions & 4 deletions source/reporters/ut_coverage_html_reporter.tps
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ create or replace type ut_coverage_html_reporter under ut_coverage_reporter_base
limitations under the License.
*/
project_name varchar2(4000),
assets_path varchar2(4000),
constructor function ut_coverage_html_reporter(
self in out nocopy ut_coverage_html_reporter,
a_project_name varchar2 := null,
a_schema_names ut_varchar2_list := null,
a_include_object_list ut_varchar2_list := null,
a_exclude_object_list ut_varchar2_list := null
a_exclude_object_list ut_varchar2_list := null,
a_html_report_assets_path varchar2 := null
) return self as result,

constructor function ut_coverage_html_reporter(
Expand All @@ -35,7 +37,8 @@ create or replace type ut_coverage_html_reporter under ut_coverage_reporter_base
a_object_type_subexpression positive,
a_file_to_object_type_mapping ut_key_value_pairs,
a_include_object_list ut_varchar2_list := null,
a_exclude_object_list ut_varchar2_list := null
a_exclude_object_list ut_varchar2_list := null,
a_html_report_assets_path varchar2 := null
) return self as result,

constructor function ut_coverage_html_reporter(
Expand All @@ -44,15 +47,17 @@ create or replace type ut_coverage_html_reporter under ut_coverage_reporter_base
a_object_owner varchar2 := null,
a_file_paths ut_varchar2_list,
a_include_object_list ut_varchar2_list := null,
a_exclude_object_list ut_varchar2_list := null
a_exclude_object_list ut_varchar2_list := null,
a_html_report_assets_path varchar2 := null
) return self as result,

constructor function ut_coverage_html_reporter(
self in out nocopy ut_coverage_html_reporter,
a_project_name varchar2 := null,
a_file_mappings ut_coverage_file_mappings,
a_include_object_list ut_varchar2_list := null,
a_exclude_object_list ut_varchar2_list := null
a_exclude_object_list ut_varchar2_list := null,
a_html_report_assets_path varchar2 := null
) return self as result,

overriding member procedure after_calling_run(self in out nocopy ut_coverage_html_reporter, a_run in ut_run)
Expand Down
19 changes: 12 additions & 7 deletions source/reporters/ut_coverage_report_html_helper.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ create or replace package body ut_coverage_report_html_helper is
gc_ignored constant varchar2(7) := 'never';
gc_covered constant varchar2(7) := 'covered';

gc_assets_path constant varchar2(200) := 'https://jgebal.github.io/utPLSQL-coverage-html/assets/';

function get_default_html_assets_path return varchar2 deterministic is
c_assets_path constant varchar2(200) := 'https://utplsql.github.io/utPLSQL-coverage-html/assets/';
begin
return c_assets_path;
end;

function coverage_css_class(a_covered_pct number) return varchar2 is
l_result varchar2(10);
Expand Down Expand Up @@ -201,7 +206,7 @@ create or replace package body ut_coverage_report_html_helper is
/*
* public definitions
*/
function get_index(a_coverage_data ut_coverage.t_coverage, a_project_name varchar2 := null, a_command_line varchar2 := null) return clob is
function get_index(a_coverage_data ut_coverage.t_coverage, a_assets_path varchar2, a_project_name varchar2 := null, a_command_line varchar2 := null) return clob is

l_file_part varchar2(32767);
l_result clob;
Expand All @@ -222,12 +227,12 @@ create or replace package body ut_coverage_report_html_helper is
'<!DOCTYPE html><html xmlns=''http://www.w3.org/1999/xhtml''><head>' ||
'<title>'||l_title||'</title>' ||
'<meta http-equiv="content-type" content="text/html; charset=utf-8" />' ||
'<script src='''||gc_assets_path||'application.js'' type=''text/javascript''></script>' ||
'<link href='''||gc_assets_path||'application.css'' media=''screen, projection, print'' rel=''stylesheet'' type=''text/css''>' ||
'<link rel="shortcut icon" type="image/png" href="'||gc_assets_path||'favicon_'||coverage_css_class(l_coverage_pct)||'.png" />' ||
'<link rel="icon" type="image/png" href="'||gc_assets_path||'favicon_'||coverage_css_class(l_coverage_pct)||'.png" />' ||
'<script src='''||a_assets_path||'application.js'' type=''text/javascript''></script>' ||
'<link href='''||a_assets_path||'application.css'' media=''screen, projection, print'' rel=''stylesheet'' type=''text/css''>' ||
'<link rel="shortcut icon" type="image/png" href="'||a_assets_path||'favicon_'||coverage_css_class(l_coverage_pct)||'.png" />' ||
'<link rel="icon" type="image/png" href="'||a_assets_path||'favicon_'||coverage_css_class(l_coverage_pct)||'.png" />' ||
'</head>' ||
'<body><div id="loading"><img src="'||gc_assets_path||'loading.gif" alt="loading"/></div>' ||
'<body><div id="loading"><img src="'||a_assets_path||'loading.gif" alt="loading"/></div>' ||
'<div id="wrapper" style="display:none;">' ||
'<div class="timestamp">Generated <abbr class="timeago" title="'||l_time_str||'">'||l_time_str||'</abbr></div>' ||
'<ul class="group_tabs"></ul>' ||
Expand Down
3 changes: 2 additions & 1 deletion source/reporters/ut_coverage_report_html_helper.pks
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ create or replace package ut_coverage_report_html_helper authid current_user is
See the License for the specific language governing permissions and
limitations under the License.
*/
function get_default_html_assets_path return varchar2 deterministic;

function get_index(a_coverage_data ut_coverage.t_coverage, a_project_name varchar2 := null, a_command_line varchar2 := null) return clob;
function get_index(a_coverage_data ut_coverage.t_coverage, a_assets_path varchar2, a_project_name varchar2 := null, a_command_line varchar2 := null) return clob;

end;
/

0 comments on commit 8734716

Please sign in to comment.