table_setter 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. data/.document +5 -0
  2. data/.gitignore +20 -0
  3. data/LICENSE +20 -0
  4. data/README +10 -0
  5. data/Rakefile +66 -0
  6. data/TODO +3 -0
  7. data/VERSION.yml +5 -0
  8. data/bin/table-setter +5 -0
  9. data/doc/TableFu/Formatting.html +178 -0
  10. data/doc/TableSetter/App.html +176 -0
  11. data/doc/TableSetter/Command.html +376 -0
  12. data/doc/TableSetter/Table.html +1813 -0
  13. data/doc/TableSetter.html +292 -0
  14. data/doc/_index.html +146 -0
  15. data/doc/class_list.html +36 -0
  16. data/doc/css/common.css +1 -0
  17. data/doc/css/full_list.css +50 -0
  18. data/doc/css/style.css +268 -0
  19. data/doc/file.README.html +68 -0
  20. data/doc/file_list.html +38 -0
  21. data/doc/frames.html +13 -0
  22. data/doc/index.html +68 -0
  23. data/doc/js/app.js +99 -0
  24. data/doc/js/full_list.js +106 -0
  25. data/doc/js/jquery.js +19 -0
  26. data/doc/method_list.html +291 -0
  27. data/doc/top-level-namespace.html +85 -0
  28. data/documentation/css/dawn.css +121 -0
  29. data/documentation/css/styles.css +63 -0
  30. data/documentation/images/folder.png +0 -0
  31. data/documentation/images/key.png +0 -0
  32. data/documentation/images/proplogo.png +0 -0
  33. data/documentation/images/publish.png +0 -0
  34. data/documentation/images/text-x-generic.png +0 -0
  35. data/documentation/index.html.erb +221 -0
  36. data/documentation/tables/example/index.html +4074 -0
  37. data/documentation/tables/example_faceted/index.html +17239 -0
  38. data/documentation/tables/example_formatted/index.html +861 -0
  39. data/documentation/tables/example_local/1/index.html +6084 -0
  40. data/documentation/tables/example_local/10/index.html +6084 -0
  41. data/documentation/tables/example_local/11/index.html +6084 -0
  42. data/documentation/tables/example_local/12/index.html +6084 -0
  43. data/documentation/tables/example_local/13/index.html +6084 -0
  44. data/documentation/tables/example_local/14/index.html +6084 -0
  45. data/documentation/tables/example_local/15/index.html +6084 -0
  46. data/documentation/tables/example_local/16/index.html +6084 -0
  47. data/documentation/tables/example_local/17/index.html +6084 -0
  48. data/documentation/tables/example_local/18/index.html +6084 -0
  49. data/documentation/tables/example_local/19/index.html +6084 -0
  50. data/documentation/tables/example_local/2/index.html +6084 -0
  51. data/documentation/tables/example_local/20/index.html +6084 -0
  52. data/documentation/tables/example_local/21/index.html +6084 -0
  53. data/documentation/tables/example_local/22/index.html +6084 -0
  54. data/documentation/tables/example_local/23/index.html +6084 -0
  55. data/documentation/tables/example_local/24/index.html +1404 -0
  56. data/documentation/tables/example_local/3/index.html +6084 -0
  57. data/documentation/tables/example_local/4/index.html +6084 -0
  58. data/documentation/tables/example_local/5/index.html +6084 -0
  59. data/documentation/tables/example_local/6/index.html +6084 -0
  60. data/documentation/tables/example_local/7/index.html +6084 -0
  61. data/documentation/tables/example_local/8/index.html +6084 -0
  62. data/documentation/tables/example_local/9/index.html +6084 -0
  63. data/documentation/tables/example_local/index.html +6084 -0
  64. data/documentation/tables/favicon.ico +0 -0
  65. data/documentation/tables/images/th_arrow_asc.gif +0 -0
  66. data/documentation/tables/images/th_arrow_desc.gif +0 -0
  67. data/documentation/tables/index.html +48 -0
  68. data/documentation/tables/javascripts/application.js +32 -0
  69. data/documentation/tables/javascripts/jquery.tablesorter.js +852 -0
  70. data/documentation/tables/javascripts/jquery.tablesorter.multipagefilter.js +111 -0
  71. data/documentation/tables/javascripts/jquery.tablesorter.pager.js +183 -0
  72. data/documentation/tables/stylesheets/stylesheet.css +67 -0
  73. data/index.html +238 -0
  74. data/lib/table_setter/app.rb +54 -0
  75. data/lib/table_setter/command.rb +139 -0
  76. data/lib/table_setter/table.rb +226 -0
  77. data/lib/table_setter.rb +32 -0
  78. data/spec/spec.opts +1 -0
  79. data/spec/spec_helper.rb +11 -0
  80. data/spec/table-setter-app_spec.rb +24 -0
  81. data/spec/table-setter_spec.rb +179 -0
  82. data/table_setter.gemspec +171 -0
  83. data/template/config.ru +33 -0
  84. data/template/public/favicon.ico +0 -0
  85. data/template/public/images/th_arrow_asc.gif +0 -0
  86. data/template/public/images/th_arrow_desc.gif +0 -0
  87. data/template/public/javascripts/application.js +32 -0
  88. data/template/public/javascripts/jquery.tablesorter.js +852 -0
  89. data/template/public/javascripts/jquery.tablesorter.multipagefilter.js +111 -0
  90. data/template/public/javascripts/jquery.tablesorter.pager.js +183 -0
  91. data/template/public/stylesheets/stylesheet.css +74 -0
  92. data/template/tables/example.yml +21 -0
  93. data/template/tables/example_faceted.yml +27 -0
  94. data/template/tables/example_formatted.csv +1 -0
  95. data/template/tables/example_formatted.yml +27 -0
  96. data/template/tables/example_local.csv +5806 -0
  97. data/template/tables/example_local.yml +27 -0
  98. data/template/views/404.erb +4 -0
  99. data/template/views/500.erb +4 -0
  100. data/template/views/index.erb +7 -0
  101. data/template/views/layout.erb +34 -0
  102. data/template/views/table.erb +78 -0
  103. metadata +240 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+
9
+ ## VIM
10
+ *.swp
11
+
12
+ ## PROJECT::GENERAL
13
+ coverage
14
+ rdoc
15
+ pkg
16
+ tester
17
+ template/out/
18
+
19
+ ## PROJECT::SPECIFIC
20
+ log
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 ProPublica
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,10 @@
1
+ =
2
+ TableSetter
3
+
4
+ TableSetter is a Ruby app which provides an easy way to present CSVs hosted locally or remotely in custom HTML.
5
+
6
+ documentation
7
+ http://propublica.github.com/table-setter/
8
+
9
+ examples
10
+ http://propublica.github.com/table-setter/documentation/tables/example/
data/Rakefile ADDED
@@ -0,0 +1,66 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "table_setter"
8
+ gem.summary = %Q{A sinatra based app for rendering CSVs in custom HTML}
9
+ gem.description = %Q{A sinatra based app for rendering CSVs hosted on google docs or locally in custom HTML}
10
+ gem.email = "thejefflarson@gmail.com"
11
+ gem.homepage = "http://github.com/thejefflarson/table-setter"
12
+ gem.authors = ["Jeff Larson"]
13
+ gem.rubyforge_project = "table-setter"
14
+ gem.add_development_dependency "rspec", ">= 1.2.9"
15
+ gem.add_development_dependency "rack", ">= 1.1.0"
16
+ gem.add_development_dependency "thin", ">= 1.2.5"
17
+ gem.add_dependency "table_fu", ">= 0.1.1"
18
+ gem.add_dependency "sinatra", ">= 0.9.4"
19
+ gem.add_dependency "sinatra-static-assets", ">= 0.5.0"
20
+ gem.add_dependency "emk-sinatra-url-for", ">= 0.2.1"
21
+ gem.add_dependency "curb", ">= 0.6.6.0"
22
+ gem.executables << "table-setter"
23
+ end
24
+
25
+ Jeweler::GemcutterTasks.new
26
+ Jeweler::RubyforgeTasks.new do |rubyforge|
27
+ rubyforge.doc_task = "rdoc"
28
+ end
29
+ rescue LoadError
30
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
31
+ end
32
+
33
+ require 'spec/rake/spectask'
34
+ Spec::Rake::SpecTask.new(:spec) do |spec|
35
+ spec.libs << 'lib' << 'spec'
36
+ spec.spec_files = FileList['spec/**/*_spec.rb']
37
+ end
38
+
39
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
40
+ spec.libs << 'lib' << 'spec'
41
+ spec.pattern = 'spec/**/*_spec.rb'
42
+ spec.rcov = true
43
+ end
44
+
45
+ task :spec => :check_dependencies
46
+
47
+ task :default => :spec
48
+
49
+ require 'rake/rdoctask'
50
+ Rake::RDocTask.new do |rdoc|
51
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "table-setter #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
57
+ end
58
+
59
+ desc "render documentation for gh-pages"
60
+ task :gh do
61
+ require 'erb'
62
+ File.open("index.html", "w") do |f|
63
+ f.write ERB.new(File.open("documentation/index.html.erb").read).result
64
+ end
65
+ `open index.html`
66
+ end
data/TODO ADDED
@@ -0,0 +1,3 @@
1
+ TODO:
2
+ fix table.rb to load from a uri resource instead of just a file, or a google key
3
+
data/VERSION.yml ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 1
4
+ :patch: 2
5
+ :build:
data/bin/table-setter ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby -rrubygems
2
+
3
+ require File.dirname(__FILE__ ) + "/../lib/table_setter"
4
+
5
+ TableSetter::Command.new
@@ -0,0 +1,178 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>Class: TableFu::Formatting</title>
7
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="../_index.html">Index (F)</a> &raquo;
27
+ <span class='title'>TableFu</span>
28
+ &raquo;
29
+ <span class="title">Formatting</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: TableFu::Formatting
47
+
48
+
49
+ </h1>
50
+
51
+ <dl class="box">
52
+
53
+ <dt class="r1">Inherits:</dt>
54
+ <dd class="r1">
55
+ <span class="inheritName">Object</span>
56
+
57
+ <ul class="fullTree">
58
+ <li>Object</li>
59
+
60
+ <li class="next">TableFu::Formatting</li>
61
+
62
+ </ul>
63
+ <a href="#" class="inheritanceTree">show all</a>
64
+
65
+ </dd>
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r2 last">Defined in:</dt>
75
+ <dd class="r2 last">lib/table_setter/table.rb</dd>
76
+
77
+ </dl>
78
+ <div class="clear"></div>
79
+
80
+
81
+
82
+
83
+ <h2>Class Method Summary</h2>
84
+
85
+ <ul class="summary">
86
+
87
+ <li class="public ">
88
+ <span class="summary_signature">
89
+
90
+ <a href="#bar-class_method" title="bar (class method)">+ (Object) <strong>bar</strong>(percent) </a>
91
+
92
+
93
+
94
+ </span>
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <span class="summary_desc">
103
+ In order to show a sideways bar chart, we&#8217;re extending the builtin
104
+ TableFu formatters.
105
+
106
+ </span>
107
+
108
+ </li>
109
+
110
+
111
+ </ul>
112
+
113
+
114
+ <div id="class_method_details" class="method_details_list">
115
+ <h2>Class Method Details</h2>
116
+
117
+
118
+ <div class="method_details first">
119
+ <p class="signature first" id="bar-class_method">
120
+
121
+ + (<tt>Object</tt>) <strong>bar</strong>(percent)
122
+
123
+
124
+
125
+ </p><div class="docstring">
126
+ <div class="discussion">
127
+ <p>
128
+ In order to show a sideways bar chart, we&#8217;re extending the builtin
129
+ TableFu formatters.
130
+ </p>
131
+
132
+
133
+ </div>
134
+ </div>
135
+ <div class="tags">
136
+
137
+ </div><table class="source_code">
138
+ <tr>
139
+ <td>
140
+ <pre class="lines">
141
+
142
+
143
+ 218
144
+ 219
145
+ 220
146
+ 221
147
+ 222
148
+ 223
149
+ 224</pre>
150
+ </td>
151
+ <td>
152
+ <pre class="code"><span class="info file"># File 'lib/table_setter/table.rb', line 218</span>
153
+
154
+ <span class='def def kw'>def</span> <span class='bar identifier id'>bar</span><span class='lparen token'>(</span><span class='percent identifier id'>percent</span><span class='rparen token'>)</span>
155
+ <span class='percent identifier id'>percent</span> <span class='assign token'>=</span> <span class='percent identifier id'>percent</span><span class='dot token'>.</span><span class='to_f identifier id'>to_f</span>
156
+ <span class='if if kw'>if</span> <span class='percent identifier id'>percent</span> <span class='lt op'>&lt;</span> <span class='integer val'>1</span>
157
+ <span class='percent identifier id'>percent</span> <span class='assign token'>=</span> <span class='percent identifier id'>percent</span> <span class='mult op'>*</span> <span class='integer val'>100</span>
158
+ <span class='end end kw'>end</span>
159
+ <span class='dstring node'>&quot;&lt;div class=\&quot;bar\&quot; style=\&quot;width:#{percent}%\&quot;&gt;#{percent}%&lt;/div&gt;&quot;</span>
160
+ <span class='end end kw'>end</span>
161
+ </pre>
162
+ </td>
163
+ </tr>
164
+ </table>
165
+ </div>
166
+
167
+ </div>
168
+
169
+ </div>
170
+
171
+ <div id="footer">
172
+ Generated on Tue Mar 9 17:18:07 2010 by
173
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
174
+ 0.5.3 (ruby-1.8.7).
175
+ </div>
176
+
177
+ </body>
178
+ </html>
@@ -0,0 +1,176 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>Class: TableSetter::App</title>
7
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="../_index.html">Index (A)</a> &raquo;
27
+ <span class='title'><a href="../TableSetter.html" title="TableSetter (module)">TableSetter</a></span>
28
+ &raquo;
29
+ <span class="title">App</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: TableSetter::App
47
+
48
+
49
+ </h1>
50
+
51
+ <dl class="box">
52
+
53
+ <dt class="r1">Inherits:</dt>
54
+ <dd class="r1">
55
+ <span class="inheritName">Sinatra::Base</span>
56
+
57
+ <ul class="fullTree">
58
+ <li>Object</li>
59
+
60
+ <li class="next">Sinatra::Base</li>
61
+
62
+ <li class="next">TableSetter::App</li>
63
+
64
+ </ul>
65
+ <a href="#" class="inheritanceTree">show all</a>
66
+
67
+ </dd>
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ <dt class="r2 last">Defined in:</dt>
77
+ <dd class="r2 last">lib/table_setter/app.rb</dd>
78
+
79
+ </dl>
80
+ <div class="clear"></div>
81
+
82
+
83
+
84
+
85
+ <h2>Class Attribute Summary</h2>
86
+ <ul class="summary">
87
+
88
+ <li class="public ">
89
+ <span class="summary_signature">
90
+
91
+ <a href="#cache_timeout-class_method" title="cache_timeout (class method)">+ (Object) <strong>cache_timeout</strong> </a>
92
+
93
+
94
+
95
+ </span>
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+ <span class="summary_desc">
107
+ Returns the value of attribute cache_timeout.
108
+
109
+ </span>
110
+
111
+ </li>
112
+
113
+
114
+ </ul>
115
+
116
+
117
+
118
+ <div id="class_attr_details" class="attr_details">
119
+ <h2>Class Attribute Details</h2>
120
+
121
+
122
+ <span id="cache_timeout=-class_method"></span>
123
+ <span id="cache_timeout-class_method"></span>
124
+ <div class="method_details first">
125
+ <p class="signature first" id="cache_timeout-class_method">
126
+
127
+ + (<tt>Object</tt>) <strong>cache_timeout</strong>
128
+
129
+
130
+
131
+ </p><div class="docstring">
132
+ <div class="discussion">
133
+ <p>
134
+ Returns the value of attribute cache_timeout
135
+ </p>
136
+
137
+
138
+ </div>
139
+ </div>
140
+ <div class="tags">
141
+
142
+ </div><table class="source_code">
143
+ <tr>
144
+ <td>
145
+ <pre class="lines">
146
+
147
+
148
+ 46
149
+ 47
150
+ 48</pre>
151
+ </td>
152
+ <td>
153
+ <pre class="code"><span class="info file"># File 'lib/table_setter/app.rb', line 46</span>
154
+
155
+ <span class='def def kw'>def</span> <span class='cache_timeout identifier id'>cache_timeout</span>
156
+ <span class='@cache_timeout ivar id'>@cache_timeout</span> <span class='orop op'>||</span> <span class='integer val'>0</span>
157
+ <span class='end end kw'>end</span>
158
+ </pre>
159
+ </td>
160
+ </tr>
161
+ </table>
162
+ </div>
163
+
164
+ </div>
165
+
166
+
167
+ </div>
168
+
169
+ <div id="footer">
170
+ Generated on Tue Mar 9 17:18:08 2010 by
171
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
172
+ 0.5.3 (ruby-1.8.7).
173
+ </div>
174
+
175
+ </body>
176
+ </html>