table_setter 0.2.11 → 0.2.12

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MWQ2NDdlYTA3NDM4MmMyZDkwZDI4MmJhMWZkMjBlM2MzMGJlZDcxNg==
5
+ data.tar.gz: !binary |-
6
+ ZjNiMjgyMzZmYmZlMWIzMjRjODBkODAyMmUzNWU5YjhjNTJiMmUwMg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZDZjZjhlMjY5YTQ1OTJlNTEzMzc4NjU2OTc2YjdmOWE0ZDlkZjJiMTk2NjMz
10
+ N2Y5YjMzMjNmNGZhMjhkYzAyNWVlM2E3YTI1MDk5ODYyZGUwNTQyNWIwZGJk
11
+ YmMyNTAzYmUzNjRjOTYxNmVjMjQ0ODE0MzZjMTRlNWE1ZWFmYzE=
12
+ data.tar.gz: !binary |-
13
+ ZTkyZWQwZGFlYTcwOGRiMDQzOGVhYzA4NDRmNjNhYjY2MjQ1YmUzZGEwOGQw
14
+ M2YxMjljOWQ4YWFlNzIyNWU1MDMwODkzNzVjYjIwZGI5YTM5YWJkNjYwMzdi
15
+ MTI1YzFhZTk4ODhmODBmYjczMzdhNjJmMTE2ODhjMzFhZjY1ZDg=
@@ -0,0 +1,22 @@
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
21
+
22
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in daybreak.gemspec
4
+ gemspec
data/Rakefile CHANGED
@@ -1,58 +1,11 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ require 'bundler/gem_tasks'
3
2
 
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://propublica.github.com/table-setter/"
12
- gem.authors = ["Jeff Larson"]
13
- gem.rubyforge_project = "table-setter"
14
- gem.add_development_dependency "rspec"
15
- gem.add_dependency "rack", ">= 1.1.0"
16
- gem.add_dependency "thin", ">= 1.2.4"
17
- gem.add_dependency "table_fu", ">= 0.3.4"
18
- gem.add_dependency "sinatra", ">= 1.2.1"
19
- gem.add_dependency "sinatra-static-assets", ">= 1.0.3"
20
- gem.add_dependency "emk-sinatra-url-for", ">= 0.2.1"
21
- gem.add_dependency "curb", ">= 0.7.15"
22
- gem.add_dependency "rdiscount", ">= 1.6.8"
23
- gem.executables << "table-setter"
3
+ task :test do
4
+ Dir['./test/*_test.rb'].each do |file|
5
+ ruby file
24
6
  end
25
-
26
- Jeweler::GemcutterTasks.new
27
- rescue LoadError
28
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
29
- end
30
-
31
- require 'spec/rake/spectask'
32
- Spec::Rake::SpecTask.new(:spec) do |spec|
33
- spec.libs << 'lib' << 'spec'
34
- spec.spec_files = FileList['spec/**/*_spec.rb']
35
- end
36
-
37
- Spec::Rake::SpecTask.new(:rcov) do |spec|
38
- spec.libs << 'lib' << 'spec'
39
- spec.pattern = 'spec/**/*_spec.rb'
40
- spec.rcov = true
41
- end
42
-
43
- task :spec => :check_dependencies
44
-
45
- task :default => :spec
46
-
47
- require 'rdoc/task'
48
- Rake::RDocTask.new do |rdoc|
49
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
-
51
- rdoc.rdoc_dir = 'rdoc'
52
- rdoc.title = "table-setter #{version}"
53
- rdoc.rdoc_files.include('README*')
54
- rdoc.rdoc_files.include('lib/**/*.rb')
55
7
  end
8
+ task :default => :test
56
9
 
57
10
  desc "render documentation for gh-pages"
58
11
  task :gh do
@@ -62,3 +15,8 @@ task :gh do
62
15
  end
63
16
  `open index.html`
64
17
  end
18
+
19
+ desc "Publish the docs to gh-pages"
20
+ task :publish do |t|
21
+ system('git push -f origin master:gh-pages')
22
+ end
@@ -1,5 +1,5 @@
1
1
  <%
2
- require 'yaml'
2
+ require './lib/table_setter/version.rb'
3
3
  %>
4
4
  <!DOCTYPE html>
5
5
  <html>
@@ -11,10 +11,7 @@ require 'yaml'
11
11
  </head>
12
12
  <body>
13
13
  <a href="http://www.propublica.org" class="propublica">&nbsp;</a>
14
- <h1>TableSetter <small>&ndash; Version: <%=
15
- config = YAML.load(File.read('VERSION.yml'))
16
- "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
17
- %></small></h1>
14
+ <h1>TableSetter <small>&ndash; Version: <%= TableSetter::VERSION %></small></h1>
18
15
  <p><a href="https://github.com/propublica/table-setter">TableSetter</a> is a Ruby app that provides an easy way to present CSVs hosted locally or remotely (e.g. on google, etc) in custom HTML. TableSetter in the wild: <a href="http://projects.propublica.org/tables/failed-banks">a list of all stimulus projects from last year</a>, <a href="http://projects.propublica.org/tables/stimulus-spending-progress">the stimulus spending progress</a>, or <a href="http://projects.propublica.org/tables/failed-banks">a list of failed banks due to the last recession</a>.</p>
19
16
  <p>Each table is filterable and sortable on multiple columns. Also each column can be formatted in one of many different styles. In production mode, <strong>TableSetter</strong> provides valid expires headers and can be coupled with an upstream cache like <a href="http://rtomayko.github.com/rack-cache/">Rack::Cache</a> or varnish for speedy presentation.</p>
20
17
  <h2><a id="toc">Table of Contents</a></h2>
@@ -239,6 +236,8 @@ script/generate table-setter</pre>
239
236
  <a href="http://github.com/palewire">Ben Welsh</a>, and
240
237
  <a href="http://github.com/jpmckinney">James McKinney</a>.</p>
241
238
  <h2><a id="changes" href="#toc">Change Log</a></h2>
239
+ <strong>0.2.12</strong>
240
+ <p>General clean up and fix dependencies.</p>
242
241
  <strong>0.2.10</strong>
243
242
  <p>Switch to https for google key.</p>
244
243
  <strong>0.2.9</strong>
@@ -287,4 +286,4 @@ script/generate table-setter</pre>
287
286
  <pre><%= File.open("LICENSE").read %></pre>
288
287
 
289
288
  </body>
290
- </html>
289
+ </html>
@@ -34,8 +34,7 @@ module TableSetter
34
34
  end
35
35
 
36
36
  def table_path
37
- @config_path + "/tables/"
37
+ "#{@config_path}/tables/"
38
38
  end
39
-
40
39
  end
41
- end
40
+ end
@@ -25,7 +25,6 @@ module TableSetter
25
25
  # It performs the requested data manipulations form the yml file after the data has been loaded.
26
26
  # We're keeping this explicit to control against unnecessary http requests.
27
27
  def load
28
- csv = csv_data
29
28
  if @table_opts[:column_options]
30
29
  @table_opts[:column_options]['style'] ||= {}
31
30
  end
@@ -0,0 +1,3 @@
1
+ module TableSetter
2
+ VERSION = "0.2.12"
3
+ end
@@ -1,168 +1,33 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/table_setter/version', __FILE__)
5
3
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{table_setter}
8
- s.version = "0.2.11"
4
+ Gem::Specification.new do |gem|
5
+ gem.name = %q{table_setter}
6
+ gem.version = TableSetter::VERSION
9
7
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Jeff Larson"]
12
- s.date = %q{2012-03-09}
13
- s.description = %q{A sinatra based app for rendering CSVs hosted on google docs or locally in custom HTML}
14
- s.email = %q{thejefflarson@gmail.com}
15
- s.executables = ["table-setter", "table-setter"]
16
- s.extra_rdoc_files = [
17
- "LICENSE",
18
- "README",
19
- "TODO"
20
- ]
21
- s.files = [
22
- ".document",
23
- "LICENSE",
24
- "README",
25
- "Rakefile",
26
- "TODO",
27
- "VERSION.yml",
28
- "bin/table-setter",
29
- "doc/TableFu/Formatting.html",
30
- "doc/TableSetter.html",
31
- "doc/TableSetter/App.html",
32
- "doc/TableSetter/Command.html",
33
- "doc/TableSetter/Table.html",
34
- "doc/_index.html",
35
- "doc/class_list.html",
36
- "doc/css/common.css",
37
- "doc/css/full_list.css",
38
- "doc/css/style.css",
39
- "doc/file.README.html",
40
- "doc/file_list.html",
41
- "doc/frames.html",
42
- "doc/index.html",
43
- "doc/js/app.js",
44
- "doc/js/full_list.js",
45
- "doc/js/jquery.js",
46
- "doc/method_list.html",
47
- "doc/top-level-namespace.html",
48
- "documentation/css/dawn.css",
49
- "documentation/css/styles.css",
50
- "documentation/images/folder.png",
51
- "documentation/images/key.png",
52
- "documentation/images/proplogo.png",
53
- "documentation/images/publish.png",
54
- "documentation/images/text-x-generic.png",
55
- "documentation/index.html.erb",
56
- "documentation/tables/example/index.html",
57
- "documentation/tables/example_faceted/index.html",
58
- "documentation/tables/example_formatted/index.html",
59
- "documentation/tables/example_local/1/index.html",
60
- "documentation/tables/example_local/10/index.html",
61
- "documentation/tables/example_local/11/index.html",
62
- "documentation/tables/example_local/12/index.html",
63
- "documentation/tables/example_local/13/index.html",
64
- "documentation/tables/example_local/14/index.html",
65
- "documentation/tables/example_local/15/index.html",
66
- "documentation/tables/example_local/16/index.html",
67
- "documentation/tables/example_local/17/index.html",
68
- "documentation/tables/example_local/18/index.html",
69
- "documentation/tables/example_local/19/index.html",
70
- "documentation/tables/example_local/2/index.html",
71
- "documentation/tables/example_local/20/index.html",
72
- "documentation/tables/example_local/21/index.html",
73
- "documentation/tables/example_local/22/index.html",
74
- "documentation/tables/example_local/23/index.html",
75
- "documentation/tables/example_local/24/index.html",
76
- "documentation/tables/example_local/3/index.html",
77
- "documentation/tables/example_local/4/index.html",
78
- "documentation/tables/example_local/5/index.html",
79
- "documentation/tables/example_local/6/index.html",
80
- "documentation/tables/example_local/7/index.html",
81
- "documentation/tables/example_local/8/index.html",
82
- "documentation/tables/example_local/9/index.html",
83
- "documentation/tables/example_local/index.html",
84
- "documentation/tables/favicon.ico",
85
- "documentation/tables/images/th_arrow_asc.gif",
86
- "documentation/tables/images/th_arrow_desc.gif",
87
- "documentation/tables/index.html",
88
- "documentation/tables/javascripts/application.js",
89
- "documentation/tables/javascripts/jquery.tablesorter.js",
90
- "documentation/tables/javascripts/jquery.tablesorter.multipagefilter.js",
91
- "documentation/tables/javascripts/jquery.tablesorter.pager.js",
92
- "documentation/tables/stylesheets/stylesheet.css",
93
- "index.html",
94
- "lib/table_setter.rb",
95
- "lib/table_setter/app.rb",
96
- "lib/table_setter/command.rb",
97
- "lib/table_setter/table.rb",
98
- "spec/spec.opts",
99
- "spec/spec_helper.rb",
100
- "spec/table-setter-app_spec.rb",
101
- "spec/table-setter-command_spec.rb",
102
- "spec/table-setter_spec.rb",
103
- "table_setter.gemspec",
104
- "template/config.ru",
105
- "template/lib/formatters.rb",
106
- "template/public/favicon.ico",
107
- "template/public/images/th_arrow_asc.gif",
108
- "template/public/images/th_arrow_desc.gif",
109
- "template/public/javascripts/application.js",
110
- "template/public/javascripts/jquery.tablesorter.js",
111
- "template/public/javascripts/jquery.tablesorter.multipagefilter.js",
112
- "template/public/javascripts/jquery.tablesorter.pager.js",
113
- "template/public/stylesheets/stylesheet.css",
114
- "template/tables/example.yml",
115
- "template/tables/example_faceted.yml",
116
- "template/tables/example_formatted.csv",
117
- "template/tables/example_formatted.yml",
118
- "template/tables/example_local.csv",
119
- "template/tables/example_local.yml",
120
- "template/views/404.erb",
121
- "template/views/500.erb",
122
- "template/views/index.erb",
123
- "template/views/layout.erb",
124
- "template/views/table.erb"
125
- ]
126
- s.homepage = %q{http://propublica.github.com/table-setter/}
127
- s.require_paths = ["lib"]
128
- s.rubyforge_project = %q{table-setter}
129
- s.rubygems_version = %q{1.6.2}
130
- s.summary = %q{A sinatra based app for rendering CSVs in custom HTML}
8
+ gem.authors = ["Jeff Larson"]
9
+ gem.date = %q{2012-03-09}
10
+ gem.description = %q{A sinatra based app for rendering CSVs hosted on google docs or locally in custom HTML}
11
+ gem.email = %q{thejefflarson@gmail.com}
12
+ gem.executables = ["table-setter", "table-setter"]
131
13
 
132
- if s.respond_to? :specification_version then
133
- s.specification_version = 3
14
+ gem.files = `git ls-files`.split($\).reject {|f| f =~ /^(index)/}
15
+ gem.test_files = gem.files.grep(%r{^(spec)/})
16
+ gem.name = "table_setter"
17
+ gem.require_paths = ["lib"]
18
+ gem.licenses = ["MIT"]
19
+ gem.homepage = %q{http://propublica.github.com/table-setter/}
20
+ gem.require_paths = ["lib"]
21
+ gem.summary = %q{A sinatra based app for rendering CSVs in custom HTML}
134
22
 
135
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
136
- s.add_development_dependency(%q<rspec>, [">= 0"])
137
- s.add_runtime_dependency(%q<rack>, [">= 1.1.0"])
138
- s.add_runtime_dependency(%q<thin>, [">= 1.2.4"])
139
- s.add_runtime_dependency(%q<table_fu>, [">= 0.3.4"])
140
- s.add_runtime_dependency(%q<sinatra>, [">= 1.2.1"])
141
- s.add_runtime_dependency(%q<sinatra-static-assets>, [">= 1.0.3"])
142
- s.add_runtime_dependency(%q<emk-sinatra-url-for>, [">= 0.2.1"])
143
- s.add_runtime_dependency(%q<curb>, [">= 0.7.15"])
144
- s.add_runtime_dependency(%q<rdiscount>, [">= 1.6.8"])
145
- else
146
- s.add_dependency(%q<rspec>, [">= 0"])
147
- s.add_dependency(%q<rack>, [">= 1.1.0"])
148
- s.add_dependency(%q<thin>, [">= 1.2.4"])
149
- s.add_dependency(%q<table_fu>, [">= 0.3.4"])
150
- s.add_dependency(%q<sinatra>, [">= 1.2.1"])
151
- s.add_dependency(%q<sinatra-static-assets>, [">= 1.0.3"])
152
- s.add_dependency(%q<emk-sinatra-url-for>, [">= 0.2.1"])
153
- s.add_dependency(%q<curb>, [">= 0.7.15"])
154
- s.add_dependency(%q<rdiscount>, [">= 1.6.8"])
155
- end
156
- else
157
- s.add_dependency(%q<rspec>, [">= 0"])
158
- s.add_dependency(%q<rack>, [">= 1.1.0"])
159
- s.add_dependency(%q<thin>, [">= 1.2.4"])
160
- s.add_dependency(%q<table_fu>, [">= 0.3.4"])
161
- s.add_dependency(%q<sinatra>, [">= 1.2.1"])
162
- s.add_dependency(%q<sinatra-static-assets>, [">= 1.0.3"])
163
- s.add_dependency(%q<emk-sinatra-url-for>, [">= 0.2.1"])
164
- s.add_dependency(%q<curb>, [">= 0.7.15"])
165
- s.add_dependency(%q<rdiscount>, [">= 1.6.8"])
166
- end
23
+ gem.add_development_dependency %q<minitest>
24
+ gem.add_dependency %q<rack>
25
+ gem.add_dependency %q<thin>
26
+ gem.add_dependency %q<table_fu>
27
+ gem.add_dependency %q<sinatra>
28
+ gem.add_dependency %q<sinatra-static-assets>
29
+ gem.add_dependency %q<emk-sinatra-url-for>
30
+ gem.add_dependency %q<curb>
31
+ gem.add_dependency %q<rdiscount>
167
32
  end
168
33
 
@@ -0,0 +1,22 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
+ require 'rack/test'
3
+
4
+
5
+ describe TableSetter::App, "in the application" do
6
+ include Rack::Test::Methods
7
+
8
+ def app
9
+ TableSetter::App
10
+ end
11
+
12
+ it "should render the homepage" do
13
+ get '/'
14
+ assert last_response.body.include?("All Tables")
15
+ end
16
+
17
+ it "should render a table" do
18
+ get '/example_local/'
19
+ assert last_response.ok?
20
+ assert last_response.body.include?("Browse All Approved Stimulus Highway Projects")
21
+ end
22
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  describe TableSetter::Command do
4
4
  INSTALL_DIRECTORY = File.join "/", "tmp", "table-setter-test", "/"
@@ -14,42 +14,41 @@ describe TableSetter::Command do
14
14
  def install
15
15
  `#{TABLE_SETTER} install #{INSTALL_DIRECTORY}`
16
16
  end
17
-
18
- after(:each) do
17
+
18
+ after do
19
19
  cleanup
20
20
  end
21
-
22
- before(:each) do
21
+
22
+ before do
23
23
  install
24
24
  end
25
-
25
+
26
26
  it 'should install the configuration directory in a custom spot' do
27
27
  Dir["#{TEMPLATE_DIR}/**/*"].each do |template_file|
28
- File.exists?(template_file.gsub(TEMPLATE_DIR, INSTALL_DIRECTORY)).should be_true
28
+ assert File.exists?(template_file.gsub(TEMPLATE_DIR, INSTALL_DIRECTORY))
29
29
  end
30
30
  end
31
-
31
+
32
32
  def build_and_test(prefix="")
33
33
  prefix_option = "-p #{prefix}" if prefix.length > 0
34
34
  `#{TABLE_SETTER} build #{INSTALL_DIRECTORY} #{prefix_option}`
35
35
  Dir["#{TEMPLATE_DIR}/public/*"].each do |asset|
36
36
  corrected_path = asset.gsub(File.join(TEMPLATE_DIR, "public"), File.join(INSTALL_DIRECTORY, "out", "#{prefix}"))
37
-
38
- File.exists?(corrected_path).should be_true
37
+
38
+ assert File.exists?(corrected_path)
39
39
  end
40
40
  end
41
-
41
+
42
42
  it 'should build the tables and install the assets in the correct folder with prefix' do
43
43
  build_and_test "test"
44
44
  end
45
-
45
+
46
46
  it 'should build the tables and install the assets in the correct folder without prefix' do
47
47
  build_and_test
48
48
  end
49
-
49
+
50
50
  it 'should build a table' do
51
51
  `#{TABLE_SETTER} build #{INSTALL_DIRECTORY}`
52
- File.exists?("#{INSTALL_DIRECTORY}/out/example/index.html").should be_true
52
+ assert File.exists?("#{INSTALL_DIRECTORY}/out/example/index.html")
53
53
  end
54
-
55
- end
54
+ end