hash-that-tree 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/.gitignore +0 -1
  2. data/README.md +15 -1
  3. data/doc/Gemfile.html +96 -0
  4. data/doc/HashThatTree/FileHashResults.html +258 -0
  5. data/doc/HashThatTree/MD5Compare.html +385 -0
  6. data/doc/HashThatTree.html +177 -0
  7. data/doc/LICENSE_txt.html +114 -0
  8. data/doc/Rakefile.html +94 -0
  9. data/doc/created.rid +6 -0
  10. data/doc/images/brick.png +0 -0
  11. data/doc/images/brick_link.png +0 -0
  12. data/doc/images/bug.png +0 -0
  13. data/doc/images/bullet_black.png +0 -0
  14. data/doc/images/bullet_toggle_minus.png +0 -0
  15. data/doc/images/bullet_toggle_plus.png +0 -0
  16. data/doc/images/date.png +0 -0
  17. data/doc/images/find.png +0 -0
  18. data/doc/images/loadingAnimation.gif +0 -0
  19. data/doc/images/macFFBgHack.png +0 -0
  20. data/doc/images/package.png +0 -0
  21. data/doc/images/page_green.png +0 -0
  22. data/doc/images/page_white_text.png +0 -0
  23. data/doc/images/page_white_width.png +0 -0
  24. data/doc/images/plugin.png +0 -0
  25. data/doc/images/ruby.png +0 -0
  26. data/doc/images/tag_green.png +0 -0
  27. data/doc/images/wrench.png +0 -0
  28. data/doc/images/wrench_orange.png +0 -0
  29. data/doc/images/zoom.png +0 -0
  30. data/doc/index.html +74 -0
  31. data/doc/js/darkfish.js +116 -0
  32. data/doc/js/jquery.js +32 -0
  33. data/doc/js/quicksearch.js +114 -0
  34. data/doc/js/thickbox-compressed.js +10 -0
  35. data/doc/lib/hashthattree_rb.html +54 -0
  36. data/doc/lib/version_rb.html +52 -0
  37. data/doc/rdoc.css +763 -0
  38. data/doc/spec/file3_txt~.html +118 -0
  39. data/doc/spec/file4_txt~.html +118 -0
  40. data/doc/spec/testfiles/1/file1_txt.html +112 -0
  41. data/doc/spec/testfiles/1/file2_txt.html +112 -0
  42. data/doc/spec/testfiles/1/file3_txt.html +114 -0
  43. data/doc/spec/testfiles/1/file4_txt.html +114 -0
  44. data/doc/spec/testfiles/2/file1_txt.html +112 -0
  45. data/doc/spec/testfiles/2/file2_txt.html +112 -0
  46. data/doc/spec/testfiles/2/file3_txt.html +114 -0
  47. data/doc/spec/testfiles/2/file4_txt.html +114 -0
  48. data/doc/spec/testfiles/2/fileA_txt.html +112 -0
  49. data/doc/spec/testfiles/2/fileB_txt.html +112 -0
  50. data/hash-that-tree.gemspec +1 -1
  51. data/lib/hashthattree.rb +46 -20
  52. data/lib/version.rb +1 -1
  53. data/spec/doc/created.rid +11 -0
  54. data/spec/doc/images/brick.png +0 -0
  55. data/spec/doc/images/brick_link.png +0 -0
  56. data/spec/doc/images/bug.png +0 -0
  57. data/spec/doc/images/bullet_black.png +0 -0
  58. data/spec/doc/images/bullet_toggle_minus.png +0 -0
  59. data/spec/doc/images/bullet_toggle_plus.png +0 -0
  60. data/spec/doc/images/date.png +0 -0
  61. data/spec/doc/images/find.png +0 -0
  62. data/spec/doc/images/loadingAnimation.gif +0 -0
  63. data/spec/doc/images/macFFBgHack.png +0 -0
  64. data/spec/doc/images/package.png +0 -0
  65. data/spec/doc/images/page_green.png +0 -0
  66. data/spec/doc/images/page_white_text.png +0 -0
  67. data/spec/doc/images/page_white_width.png +0 -0
  68. data/spec/doc/images/plugin.png +0 -0
  69. data/spec/doc/images/ruby.png +0 -0
  70. data/spec/doc/images/tag_green.png +0 -0
  71. data/spec/doc/images/wrench.png +0 -0
  72. data/spec/doc/images/wrench_orange.png +0 -0
  73. data/spec/doc/images/zoom.png +0 -0
  74. data/spec/doc/index.html +72 -0
  75. data/spec/doc/js/darkfish.js +116 -0
  76. data/spec/doc/js/jquery.js +32 -0
  77. data/spec/doc/js/quicksearch.js +114 -0
  78. data/spec/doc/js/thickbox-compressed.js +10 -0
  79. data/spec/doc/rdoc.css +763 -0
  80. data/spec/doc/testfiles/1/file1_txt.html +100 -0
  81. data/spec/doc/testfiles/1/file2_txt.html +100 -0
  82. data/spec/doc/testfiles/1/file3_txt.html +102 -0
  83. data/spec/doc/testfiles/1/file4_txt.html +102 -0
  84. data/spec/doc/testfiles/2/file1_txt.html +100 -0
  85. data/spec/doc/testfiles/2/file2_txt.html +100 -0
  86. data/spec/doc/testfiles/2/file3_txt.html +102 -0
  87. data/spec/doc/testfiles/2/file4_txt.html +102 -0
  88. data/spec/doc/testfiles/2/fileA_txt.html +100 -0
  89. data/spec/doc/testfiles/2/fileB_txt.html +100 -0
  90. data/spec/testfiles/1/file1.txt +0 -0
  91. data/spec/testfiles/1/file2.txt +0 -0
  92. data/spec/testfiles/1/file3.txt +1 -0
  93. data/spec/testfiles/1/file4.txt +1 -0
  94. data/spec/testfiles/2/file1.txt +0 -0
  95. data/spec/testfiles/2/file2.txt +0 -0
  96. data/spec/testfiles/2/file3.txt +2 -0
  97. data/spec/testfiles/2/file4.txt +2 -0
  98. data/spec/testfiles/2/fileA.txt +0 -0
  99. data/spec/testfiles/2/fileB.txt +0 -0
  100. metadata +144 -3
@@ -0,0 +1,112 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: fileA.txt [RDoc Documentation]</title>
10
+
11
+ <link type="text/css" media="screen" href="../../../rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="../../../js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="../../../js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="../../../js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="../../../js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="../../../index.html">Home</a>
29
+ <a href="../../../index.html#classes">Classes</a>
30
+ <a href="../../../index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="../../../Gemfile.html">Gemfile</a></li>
43
+
44
+ <li class="file"><a href="../../../LICENSE_txt.html">LICENSE.txt</a></li>
45
+
46
+ <li class="file"><a href="../../../Rakefile.html">Rakefile</a></li>
47
+
48
+ <li class="file"><a href="../../../spec/testfiles/1/file1_txt.html">file1.txt</a></li>
49
+
50
+ <li class="file"><a href="../../../spec/testfiles/1/file2_txt.html">file2.txt</a></li>
51
+
52
+ <li class="file"><a href="../../../spec/testfiles/1/file3_txt.html">file3.txt</a></li>
53
+
54
+ <li class="file"><a href="../../../spec/testfiles/1/file4_txt.html">file4.txt</a></li>
55
+
56
+ <li class="file"><a href="../../../spec/testfiles/2/file1_txt.html">file1.txt</a></li>
57
+
58
+ <li class="file"><a href="../../../spec/testfiles/2/file2_txt.html">file2.txt</a></li>
59
+
60
+ <li class="file"><a href="../../../spec/testfiles/2/file3_txt.html">file3.txt</a></li>
61
+
62
+ <li class="file"><a href="../../../spec/testfiles/2/file4_txt.html">file4.txt</a></li>
63
+
64
+ <li class="file"><a href="../../../spec/testfiles/2/fileA_txt.html">fileA.txt</a></li>
65
+
66
+ <li class="file"><a href="../../../spec/testfiles/2/fileB_txt.html">fileB.txt</a></li>
67
+
68
+ </ul>
69
+ </div>
70
+
71
+
72
+ <div id="classindex-section" class="section project-section">
73
+ <h3 class="section-header">Class Index
74
+ <span class="search-toggle"><img src="../../../images/find.png"
75
+ height="16" width="16" alt="[+]"
76
+ title="show/hide quicksearch" /></span></h3>
77
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
78
+ <fieldset>
79
+ <legend>Quicksearch</legend>
80
+ <input type="text" name="quicksearch" value=""
81
+ class="quicksearch-field" />
82
+ </fieldset>
83
+ </form>
84
+
85
+ <ul class="link-list">
86
+
87
+ <li><a href="../../../HashThatTree.html">HashThatTree</a></li>
88
+
89
+ <li><a href="../../../HashThatTree/FileHashResults.html">HashThatTree::FileHashResults</a></li>
90
+
91
+ <li><a href="../../../HashThatTree/MD5Compare.html">HashThatTree::MD5Compare</a></li>
92
+
93
+ </ul>
94
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
95
+ </div>
96
+
97
+
98
+ </div>
99
+ </div>
100
+
101
+ <div id="documentation">
102
+
103
+ </div>
104
+
105
+ <div id="validator-badges">
106
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
107
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
108
+ Rdoc Generator</a> 2</small>.</p>
109
+ </div>
110
+ </body>
111
+ </html>
112
+
@@ -0,0 +1,112 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: fileB.txt [RDoc Documentation]</title>
10
+
11
+ <link type="text/css" media="screen" href="../../../rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="../../../js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="../../../js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="../../../js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="../../../js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="../../../index.html">Home</a>
29
+ <a href="../../../index.html#classes">Classes</a>
30
+ <a href="../../../index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="../../../Gemfile.html">Gemfile</a></li>
43
+
44
+ <li class="file"><a href="../../../LICENSE_txt.html">LICENSE.txt</a></li>
45
+
46
+ <li class="file"><a href="../../../Rakefile.html">Rakefile</a></li>
47
+
48
+ <li class="file"><a href="../../../spec/testfiles/1/file1_txt.html">file1.txt</a></li>
49
+
50
+ <li class="file"><a href="../../../spec/testfiles/1/file2_txt.html">file2.txt</a></li>
51
+
52
+ <li class="file"><a href="../../../spec/testfiles/1/file3_txt.html">file3.txt</a></li>
53
+
54
+ <li class="file"><a href="../../../spec/testfiles/1/file4_txt.html">file4.txt</a></li>
55
+
56
+ <li class="file"><a href="../../../spec/testfiles/2/file1_txt.html">file1.txt</a></li>
57
+
58
+ <li class="file"><a href="../../../spec/testfiles/2/file2_txt.html">file2.txt</a></li>
59
+
60
+ <li class="file"><a href="../../../spec/testfiles/2/file3_txt.html">file3.txt</a></li>
61
+
62
+ <li class="file"><a href="../../../spec/testfiles/2/file4_txt.html">file4.txt</a></li>
63
+
64
+ <li class="file"><a href="../../../spec/testfiles/2/fileA_txt.html">fileA.txt</a></li>
65
+
66
+ <li class="file"><a href="../../../spec/testfiles/2/fileB_txt.html">fileB.txt</a></li>
67
+
68
+ </ul>
69
+ </div>
70
+
71
+
72
+ <div id="classindex-section" class="section project-section">
73
+ <h3 class="section-header">Class Index
74
+ <span class="search-toggle"><img src="../../../images/find.png"
75
+ height="16" width="16" alt="[+]"
76
+ title="show/hide quicksearch" /></span></h3>
77
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
78
+ <fieldset>
79
+ <legend>Quicksearch</legend>
80
+ <input type="text" name="quicksearch" value=""
81
+ class="quicksearch-field" />
82
+ </fieldset>
83
+ </form>
84
+
85
+ <ul class="link-list">
86
+
87
+ <li><a href="../../../HashThatTree.html">HashThatTree</a></li>
88
+
89
+ <li><a href="../../../HashThatTree/FileHashResults.html">HashThatTree::FileHashResults</a></li>
90
+
91
+ <li><a href="../../../HashThatTree/MD5Compare.html">HashThatTree::MD5Compare</a></li>
92
+
93
+ </ul>
94
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
95
+ </div>
96
+
97
+
98
+ </div>
99
+ </div>
100
+
101
+ <div id="documentation">
102
+
103
+ </div>
104
+
105
+ <div id="validator-badges">
106
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
107
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
108
+ Rdoc Generator</a> 2</small>.</p>
109
+ </div>
110
+ </body>
111
+ </html>
112
+
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["johnryan_irl@yahoo.com"]
11
11
  gem.description = "compares the MD5 hashes of the files in two different folders"
12
12
  gem.summary = "Allows the user to enter two folder locations and the gem will iterate through the files, creating and comparing the MD5 hashes of the files with the same name"
13
- gem.homepage = ""
13
+ gem.homepage = "http://github.com/jnyryan/hash-that-tree"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
data/lib/hashthattree.rb CHANGED
@@ -1,16 +1,36 @@
1
1
  require 'digest/md5'
2
2
 
3
+ # The program takes an initial word or phrase from
4
+ # the command line (or in the absence of a
5
+ # parameter from the first line of standard
6
+ # input). In then reads successive words or
7
+ # phrases from standard input and reports whether
8
+ # they are angrams of the first word.
9
+
10
+ #
11
+ # Author:: John Ryan (mailto:555john@gmail.com)
12
+ # Copyright:: Copyright (c) 2012 John Ryan
13
+ # License:: Distributes under the same terms as Ruby
14
+
3
15
  module HashThatTree
4
- class HashThatTree
5
- attr_accessor :folder1, :folder2
16
+
17
+ # This class accepts two folders and provides methods to iterate
18
+ # through them creating a hash of each file within and can display
19
+ # the results for analysis
20
+
21
+ class MD5Compare
22
+ attr_accessor :folder1, :folder2
6
23
 
7
- def initialize(folder1, folder2)
24
+ #initialize the class with the folders to be compared
25
+ def initialize(folder1, folder2)
8
26
  @folder1 = folder1
9
27
  @folder2 = folder2
10
28
  @filehash = Hash.new
11
- usage
29
+ validate
12
30
  end
13
- def usage
31
+
32
+ # Validates the input ensuring the arguments are both valid folders
33
+ def validate
14
34
  if(folder1==nil) || (folder1=="") || !Dir.exists?(folder1)
15
35
  puts "a valid folder path is required as argument 1"
16
36
  exit
@@ -23,12 +43,14 @@ module HashThatTree
23
43
 
24
44
  end
25
45
 
26
- def compare_folders
46
+ # Iterates through the folders and creates a FileHashResults object containing the
47
+ # results of the comparisson
48
+ def compare
27
49
 
28
50
  Dir.foreach(@folder1) do |item|
29
51
  next if item == '.' or item == '..'
30
52
  the_hash = Digest::MD5.hexdigest(File.read(File.join(@folder1, item)))
31
- filedata = FileData.new(the_hash, nil)
53
+ filedata = FileHashResults.new(item, the_hash, nil)
32
54
  @filehash[item] = filedata
33
55
  end
34
56
 
@@ -36,29 +58,33 @@ module HashThatTree
36
58
  next if item == '.' or item == '..'
37
59
  the_hash = Digest::MD5.hexdigest(File.read(File.join(@folder2, item)))
38
60
  if(@filehash[item]==nil)
39
- filedata = FileData.new(nil, the_hash)
61
+ filedata = FileHashResults.new(item, nil, the_hash)
40
62
  @filehash[item] = filedata
41
63
  next
42
64
  end
43
- @filehash[item].file2 = the_hash
65
+ @filehash[item].file_hash2 = the_hash
44
66
  end
45
67
  end
46
68
 
69
+ #Dumps the contents of the FileHashResults object to standard out
47
70
  def display_results
48
71
  puts "FileName Hash1 Hash2"
49
- @filehash.each{ |key, value| puts "#{key} is #{value.file1} #{value.file2}" }
72
+ @filehash.each{ |key, value| puts "#{value.file_name} is #{value.file_hash1} #{value.file_hash2}" }
50
73
  end
74
+
51
75
  end
76
+
77
+ #Container for the results of the file comparisson
78
+ class FileHashResults
79
+ attr_accessor :file_name, :file_hash1, :file_hash2
80
+ def initialize(file_name, file_hash1, file_hash2)
81
+ @file_name = file_name
82
+ @file_hash1 = file_hash1
83
+ @file_hash2 = file_hash2
84
+ end
85
+ end
52
86
 
53
- class FileData
54
- attr_accessor :file1, :file2
55
- def initialize(file1, file2)
56
- @file1 = file1
57
- @file2 = file2
58
- end
59
- end
60
-
61
- htt = HashThatTree.new(ARGV[0], ARGV[1])
62
- htt.compare_folders
87
+ htt = MD5Compare.new(ARGV[0], ARGV[1])
88
+ htt.compare
63
89
  htt.display_results
64
90
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HashThatTree
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,11 @@
1
+ Mon, 05 Nov 2012 10:44:16 +0000
2
+ ./testfiles/2/file3.txt Mon, 05 Nov 2012 10:07:10 +0000
3
+ ./testfiles/2/fileA.txt Mon, 05 Nov 2012 10:07:28 +0000
4
+ ./testfiles/2/file1.txt Mon, 05 Nov 2012 10:05:23 +0000
5
+ ./testfiles/2/file2.txt Mon, 05 Nov 2012 10:05:23 +0000
6
+ ./testfiles/2/file4.txt Mon, 05 Nov 2012 10:07:22 +0000
7
+ ./testfiles/2/fileB.txt Mon, 05 Nov 2012 10:07:28 +0000
8
+ ./testfiles/1/file3.txt Mon, 05 Nov 2012 10:06:38 +0000
9
+ ./testfiles/1/file1.txt Mon, 05 Nov 2012 10:05:23 +0000
10
+ ./testfiles/1/file2.txt Mon, 05 Nov 2012 10:05:23 +0000
11
+ ./testfiles/1/file4.txt Mon, 05 Nov 2012 10:06:44 +0000
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,72 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
+
9
+ <title>RDoc Documentation</title>
10
+
11
+ <link type="text/css" media="screen" href="rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
16
+ <script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script>
17
+
18
+ </head>
19
+ <body class="indexpage">
20
+
21
+
22
+ <h1>RDoc Documentation</h1>
23
+
24
+
25
+ <p>This is the API documentation for 'RDoc Documentation'.</p>
26
+
27
+
28
+
29
+
30
+ <h2>Files</h2>
31
+ <ul>
32
+
33
+ <li class="file"><a href="testfiles/1/file1_txt.html">file1.txt</a></li>
34
+
35
+ <li class="file"><a href="testfiles/1/file2_txt.html">file2.txt</a></li>
36
+
37
+ <li class="file"><a href="testfiles/1/file3_txt.html">file3.txt</a></li>
38
+
39
+ <li class="file"><a href="testfiles/1/file4_txt.html">file4.txt</a></li>
40
+
41
+ <li class="file"><a href="testfiles/2/file1_txt.html">file1.txt</a></li>
42
+
43
+ <li class="file"><a href="testfiles/2/file2_txt.html">file2.txt</a></li>
44
+
45
+ <li class="file"><a href="testfiles/2/file3_txt.html">file3.txt</a></li>
46
+
47
+ <li class="file"><a href="testfiles/2/file4_txt.html">file4.txt</a></li>
48
+
49
+ <li class="file"><a href="testfiles/2/fileA_txt.html">fileA.txt</a></li>
50
+
51
+ <li class="file"><a href="testfiles/2/fileB_txt.html">fileB.txt</a></li>
52
+
53
+ </ul>
54
+
55
+
56
+ <h2 id="classes">Classes/Modules</h2>
57
+ <ul>
58
+
59
+ </ul>
60
+
61
+ <h2 id="methods">Methods</h2>
62
+ <ul>
63
+
64
+ </ul>
65
+
66
+ <div id="validator-badges">
67
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
68
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
69
+ Rdoc Generator</a> 2</small>.</p>
70
+ </div>
71
+ </body>
72
+ </html>
@@ -0,0 +1,116 @@
1
+ /**
2
+ *
3
+ * Darkfish Page Functions
4
+ * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
5
+ *
6
+ * Author: Michael Granger <mgranger@laika.com>
7
+ *
8
+ */
9
+
10
+ /* Provide console simulation for firebug-less environments */
11
+ if (!("console" in window) || !("firebug" in console)) {
12
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
13
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
14
+
15
+ window.console = {};
16
+ for (var i = 0; i < names.length; ++i)
17
+ window.console[names[i]] = function() {};
18
+ };
19
+
20
+
21
+ /**
22
+ * Unwrap the first element that matches the given @expr@ from the targets and return them.
23
+ */
24
+ $.fn.unwrap = function( expr ) {
25
+ return this.each( function() {
26
+ $(this).parents( expr ).eq( 0 ).after( this ).remove();
27
+ });
28
+ };
29
+
30
+
31
+ function showSource( e ) {
32
+ var target = e.target;
33
+ var codeSections = $(target).
34
+ parents('.method-detail').
35
+ find('.method-source-code');
36
+
37
+ $(target).
38
+ parents('.method-detail').
39
+ find('.method-source-code').
40
+ slideToggle();
41
+ };
42
+
43
+ function hookSourceViews() {
44
+ $('.method-description,.method-heading').click( showSource );
45
+ };
46
+
47
+ function toggleDebuggingSection() {
48
+ $('.debugging-section').slideToggle();
49
+ };
50
+
51
+ function hookDebuggingToggle() {
52
+ $('#debugging-toggle img').click( toggleDebuggingSection );
53
+ };
54
+
55
+ function hookQuickSearch() {
56
+ $('.quicksearch-field').each( function() {
57
+ var searchElems = $(this).parents('.section').find( 'li' );
58
+ var toggle = $(this).parents('.section').find('h3 .search-toggle');
59
+ // console.debug( "Toggle is: %o", toggle );
60
+ var qsbox = $(this).parents('form').get( 0 );
61
+
62
+ $(this).quicksearch( this, searchElems, {
63
+ noSearchResultsIndicator: 'no-class-search-results',
64
+ focusOnLoad: false
65
+ });
66
+ $(toggle).click( function() {
67
+ // console.debug( "Toggling qsbox: %o", qsbox );
68
+ $(qsbox).toggle();
69
+ });
70
+ });
71
+ };
72
+
73
+ function highlightTarget( anchor ) {
74
+ console.debug( "Highlighting target '%s'.", anchor );
75
+
76
+ $("a[name=" + anchor + "]").each( function() {
77
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
78
+ console.debug( "Wrapping the target-section" );
79
+ $('div.method-detail').unwrap( 'div.target-section' );
80
+ $(this).parent().wrap( '<div class="target-section"></div>' );
81
+ } else {
82
+ console.debug( "Already wrapped." );
83
+ }
84
+ });
85
+ };
86
+
87
+ function highlightLocationTarget() {
88
+ console.debug( "Location hash: %s", window.location.hash );
89
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
90
+
91
+ var anchor = window.location.hash.substring(1);
92
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
93
+
94
+ highlightTarget( anchor );
95
+ };
96
+
97
+ function highlightClickTarget( event ) {
98
+ console.debug( "Highlighting click target for event %o", event.target );
99
+ try {
100
+ var anchor = $(event.target).attr( 'href' ).substring(1);
101
+ console.debug( "Found target anchor: %s", anchor );
102
+ highlightTarget( anchor );
103
+ } catch ( err ) {
104
+ console.error( "Exception while highlighting: %o", err );
105
+ };
106
+ };
107
+
108
+
109
+ $(document).ready( function() {
110
+ hookSourceViews();
111
+ hookDebuggingToggle();
112
+ hookQuickSearch();
113
+ highlightLocationTarget();
114
+
115
+ $('ul.link-list a').bind( "click", highlightClickTarget );
116
+ });