simplecov-html 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,15 +1,15 @@
1
1
  = HTML formatter for SimpleCov
2
2
 
3
- Note: To learn more about SimpleCov, check out the main repo at http://github.com/colszowka/simplecov
3
+ === Note: To learn more about SimpleCov, check out the main repo at http://github.com/colszowka/simplecov
4
4
 
5
- Generates a nice HTML overview of your SimpleCov coverage results.
5
+ Generates a nice HTML report of your SimpleCov coverage results on Ruby 1.9 using client-side Javascript
6
+ quite extensively.
6
7
 
7
8
  To use, add this to your Bundler Gemfile:
8
9
 
9
- gem 'simplecov-html', '>= 0.3.3'
10
+ gem 'simplecov-html', '>= 0.3.5'
10
11
 
11
- The html formatter will be used automatically. The HTML is put into the 'coverage' subdirectory of the
12
- current working directory (supposedly the main dir of your project)
12
+ The html formatter will be used automatically then.
13
13
 
14
14
  == Note on Patches/Pull Requests
15
15
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
data/assets/app.js CHANGED
@@ -12,35 +12,46 @@ $(document).ready(function() {
12
12
  null
13
13
  ]
14
14
  });
15
+ $('.source_table tbody tr:odd').addClass('odd');
16
+ $('.source_table tbody tr:even').addClass('even');
15
17
 
16
18
  $("a.src_link").fancybox({
17
19
  'hideOnContentClick': true
18
20
  });
19
21
 
20
- $('.source_table tbody tr:odd').addClass('odd');
21
- $('.source_table tbody tr:even').addClass('even');
22
-
22
+ // Hide src files and file list container
23
23
  $('.source_files').hide();
24
24
  $('.file_list_container').hide();
25
25
 
26
+ // Add tabs based upon existing file_list_containers
26
27
  $('.file_list_container h2').each(function(){
27
- $('.group_tabs').append('<li><a href="' + $(this).attr('id') + '">' + $(this).html() + '</a></li>');
28
+ $('.group_tabs').append('<li><a href="#' + $(this).parent().attr('id') + '">' + $(this).html() + '</a></li>');
28
29
  });
29
30
 
31
+ $('.group_tabs a').each( function() {
32
+ $(this).addClass($(this).attr('href').replace('#', ''));
33
+ });
34
+
30
35
  $('.group_tabs a').live('focus', function() {
31
36
  $(this).blur();
32
37
  });
38
+
33
39
  $('.group_tabs a').live('click', function(){
34
40
  if (!$(this).parent().hasClass('active')) {
35
41
  $('.group_tabs a').parent().removeClass('active');
36
42
  $(this).parent().addClass('active');
37
43
  $('.file_list_container').hide();
38
- $(".file_list_container h2#" + $(this).attr('href')).parent().show();
44
+ $(".file_list_container" + $(this).attr('href')).show();
45
+ window.location.href = window.location.href.split('#')[0] + $(this).attr('href').replace('#', '#_');
39
46
  };
40
47
  return false;
41
48
  });
42
49
 
43
- $('.group_tabs a:first').click();
50
+ if (jQuery.url.attr('anchor')) {
51
+ $('.group_tabs a.'+jQuery.url.attr('anchor').replace('_', '')).click();
52
+ } else {
53
+ $('.group_tabs a:first').click();
54
+ };
44
55
 
45
56
  $("abbr.timeago").timeago();
46
57
  $('#loading').fadeOut();
@@ -0,0 +1,174 @@
1
+ // JQuery URL Parser
2
+ // Written by Mark Perkins, mark@allmarkedup.com
3
+ // License: http://unlicense.org/ (i.e. do what you want with it!)
4
+
5
+ jQuery.url = function()
6
+ {
7
+ var segments = {};
8
+
9
+ var parsed = {};
10
+
11
+ /**
12
+ * Options object. Only the URI and strictMode values can be changed via the setters below.
13
+ */
14
+ var options = {
15
+
16
+ url : window.location, // default URI is the page in which the script is running
17
+
18
+ strictMode: false, // 'loose' parsing by default
19
+
20
+ key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], // keys available to query
21
+
22
+ q: {
23
+ name: "queryKey",
24
+ parser: /(?:^|&)([^&=]*)=?([^&]*)/g
25
+ },
26
+
27
+ parser: {
28
+ strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs
29
+ loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs
30
+ }
31
+
32
+ };
33
+
34
+ /**
35
+ * Deals with the parsing of the URI according to the regex above.
36
+ * Written by Steven Levithan - see credits at top.
37
+ */
38
+ var parseUri = function()
39
+ {
40
+ str = decodeURI( options.url );
41
+
42
+ var m = options.parser[ options.strictMode ? "strict" : "loose" ].exec( str );
43
+ var uri = {};
44
+ var i = 14;
45
+
46
+ while ( i-- ) {
47
+ uri[ options.key[i] ] = m[i] || "";
48
+ }
49
+
50
+ uri[ options.q.name ] = {};
51
+ uri[ options.key[12] ].replace( options.q.parser, function ( $0, $1, $2 ) {
52
+ if ($1) {
53
+ uri[options.q.name][$1] = $2;
54
+ }
55
+ });
56
+
57
+ return uri;
58
+ };
59
+
60
+ /**
61
+ * Returns the value of the passed in key from the parsed URI.
62
+ *
63
+ * @param string key The key whose value is required
64
+ */
65
+ var key = function( key )
66
+ {
67
+ if ( ! parsed.length )
68
+ {
69
+ setUp(); // if the URI has not been parsed yet then do this first...
70
+ }
71
+ if ( key == "base" )
72
+ {
73
+ if ( parsed.port !== null && parsed.port !== "" )
74
+ {
75
+ return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/";
76
+ }
77
+ else
78
+ {
79
+ return parsed.protocol+"://"+parsed.host+"/";
80
+ }
81
+ }
82
+
83
+ return ( parsed[key] === "" ) ? null : parsed[key];
84
+ };
85
+
86
+ /**
87
+ * Returns the value of the required query string parameter.
88
+ *
89
+ * @param string item The parameter whose value is required
90
+ */
91
+ var param = function( item )
92
+ {
93
+ if ( ! parsed.length )
94
+ {
95
+ setUp(); // if the URI has not been parsed yet then do this first...
96
+ }
97
+ return ( parsed.queryKey[item] === null ) ? null : parsed.queryKey[item];
98
+ };
99
+
100
+ /**
101
+ * 'Constructor' (not really!) function.
102
+ * Called whenever the URI changes to kick off re-parsing of the URI and splitting it up into segments.
103
+ */
104
+ var setUp = function()
105
+ {
106
+ parsed = parseUri();
107
+
108
+ getSegments();
109
+ };
110
+
111
+ /**
112
+ * Splits up the body of the URI into segments (i.e. sections delimited by '/')
113
+ */
114
+ var getSegments = function()
115
+ {
116
+ var p = parsed.path;
117
+ segments = []; // clear out segments array
118
+ segments = parsed.path.length == 1 ? {} : ( p.charAt( p.length - 1 ) == "/" ? p.substring( 1, p.length - 1 ) : path = p.substring( 1 ) ).split("/");
119
+ };
120
+
121
+ return {
122
+
123
+ /**
124
+ * Sets the parsing mode - either strict or loose. Set to loose by default.
125
+ *
126
+ * @param string mode The mode to set the parser to. Anything apart from a value of 'strict' will set it to loose!
127
+ */
128
+ setMode : function( mode )
129
+ {
130
+ strictMode = mode == "strict" ? true : false;
131
+ return this;
132
+ },
133
+
134
+ /**
135
+ * Sets URI to parse if you don't want to to parse the current page's URI.
136
+ * Calling the function with no value for newUri resets it to the current page's URI.
137
+ *
138
+ * @param string newUri The URI to parse.
139
+ */
140
+ setUrl : function( newUri )
141
+ {
142
+ options.url = newUri === undefined ? window.location : newUri;
143
+ setUp();
144
+ return this;
145
+ },
146
+
147
+ /**
148
+ * Returns the value of the specified URI segment. Segments are numbered from 1 to the number of segments.
149
+ * For example the URI http://test.com/about/company/ segment(1) would return 'about'.
150
+ *
151
+ * If no integer is passed into the function it returns the number of segments in the URI.
152
+ *
153
+ * @param int pos The position of the segment to return. Can be empty.
154
+ */
155
+ segment : function( pos )
156
+ {
157
+ if ( ! parsed.length )
158
+ {
159
+ setUp(); // if the URI has not been parsed yet then do this first...
160
+ }
161
+ if ( pos === undefined )
162
+ {
163
+ return segments.length;
164
+ }
165
+ return ( segments[pos] === "" || segments[pos] === undefined ) ? null : segments[pos];
166
+ },
167
+
168
+ attr : key, // provides public access to private 'key' function - see above
169
+
170
+ param : param // provides public access to private 'param' function - see above
171
+
172
+ };
173
+
174
+ }();
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{simplecov-html}
8
- s.version = "0.3.4"
8
+ s.version = "0.3.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Christoph Olszowka"]
12
- s.date = %q{2010-08-24}
12
+ s.date = %q{2010-08-25}
13
13
  s.description = %q{HTML formatter for SimpleCov code coverage tool for ruby 1.9+}
14
14
  s.email = %q{christoph at olszowka.de}
15
15
  s.extra_rdoc_files = [
@@ -49,6 +49,7 @@ Gem::Specification.new do |s|
49
49
  "assets/jquery-1.4.2.min.js",
50
50
  "assets/jquery.dataTables.min.js",
51
51
  "assets/jquery.timeago.js",
52
+ "assets/jquery.url.js",
52
53
  "assets/loading.gif",
53
54
  "assets/magnify.png",
54
55
  "assets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png",
data/views/file_list.erb CHANGED
@@ -1,8 +1,9 @@
1
- <div class="file_list_container">
2
- <h2 id="<%= title.gsub(/[^a-zA-Z]/, '') %>">
1
+ <div class="file_list_container" id="<%= title.gsub(/[^a-zA-Z]/, '') %>">
2
+ <h2>
3
3
  <%= title %>
4
4
  (<span class="<%= coverage_css_class(coverage(source_files)) %>"><%= coverage(source_files).round(2) %>%</span>)
5
5
  </h2>
6
+ <a name="<%= title.gsub(/[^a-zA-Z]/, '') %>"></a>
6
7
  <div>
7
8
  <b><%= source_files.length %></b> files in total.
8
9
  <b><%= lines_of_code(source_files) %></b> relevant lines.
data/views/layout.erb CHANGED
@@ -7,6 +7,7 @@
7
7
  <script src='<%= assets_path('jquery.dataTables.min.js') %>' type='text/javascript'></script>
8
8
  <script src='<%= assets_path('fancybox/jquery.fancybox-1.3.1.pack.js') %>' type='text/javascript'></script>
9
9
  <script src='<%= assets_path('jquery.timeago.js') %>' type='text/javascript'></script>
10
+ <script src='<%= assets_path('jquery.url.js') %>' type='text/javascript'></script>
10
11
  <script src='<%= assets_path('app.js') %>' type='text/javascript'></script>
11
12
  <link href='<%= assets_path('stylesheet.css') %>' media='screen, projection, print' rel='stylesheet' type='text/css'>
12
13
  <link href='<%= assets_path('fancybox/jquery.fancybox-1.3.1.css') %>' media='screen, projection, print' rel='stylesheet' type='text/css'>
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 4
9
- version: 0.3.4
8
+ - 5
9
+ version: 0.3.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Christoph Olszowka
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-24 00:00:00 +02:00
17
+ date: 2010-08-25 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -89,6 +89,7 @@ files:
89
89
  - assets/jquery-1.4.2.min.js
90
90
  - assets/jquery.dataTables.min.js
91
91
  - assets/jquery.timeago.js
92
+ - assets/jquery.url.js
92
93
  - assets/loading.gif
93
94
  - assets/magnify.png
94
95
  - assets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png