transcribable 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/Rakefile +32 -0
  3. data/lib/generators/templates/assets/stylesheets/simple_frame.css +284 -0
  4. data/lib/generators/templates/config/documentcloud.yml +3 -0
  5. data/lib/generators/templates/controller.rb +48 -0
  6. data/lib/generators/templates/migration.rb +15 -0
  7. data/lib/generators/templates/migration_add_columns.rb +13 -0
  8. data/lib/generators/templates/model.rb +10 -0
  9. data/lib/generators/templates/views/_form.html.erb +32 -0
  10. data/lib/generators/templates/views/layouts/simple_frame.html.erb +50 -0
  11. data/lib/generators/templates/views/new.html.erb +28 -0
  12. data/lib/generators/transcribable_generator.rb +59 -0
  13. data/lib/tasks/harvester.rake +23 -0
  14. data/lib/transcribable.rb +156 -0
  15. data/lib/transcribable/railtie.rb +11 -0
  16. data/lib/transcribable/version.rb +3 -0
  17. data/test/dummy/README.rdoc +28 -0
  18. data/test/dummy/Rakefile +6 -0
  19. data/test/dummy/app/assets/javascripts/application.js +13 -0
  20. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  21. data/test/dummy/app/controllers/application_controller.rb +5 -0
  22. data/test/dummy/app/helpers/application_helper.rb +2 -0
  23. data/test/dummy/app/models/filing.rb +6 -0
  24. data/test/dummy/app/models/transcription.rb +10 -0
  25. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  26. data/test/dummy/bin/bundle +3 -0
  27. data/test/dummy/bin/rails +4 -0
  28. data/test/dummy/bin/rake +4 -0
  29. data/test/dummy/config.ru +4 -0
  30. data/test/dummy/config/application.rb +23 -0
  31. data/test/dummy/config/boot.rb +5 -0
  32. data/test/dummy/config/database.yml +25 -0
  33. data/test/dummy/config/environment.rb +5 -0
  34. data/test/dummy/config/environments/development.rb +29 -0
  35. data/test/dummy/config/environments/production.rb +80 -0
  36. data/test/dummy/config/environments/test.rb +36 -0
  37. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  39. data/test/dummy/config/initializers/inflections.rb +16 -0
  40. data/test/dummy/config/initializers/mime_types.rb +5 -0
  41. data/test/dummy/config/initializers/secret_token.rb +12 -0
  42. data/test/dummy/config/initializers/session_store.rb +3 -0
  43. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  44. data/test/dummy/config/locales/en.yml +23 -0
  45. data/test/dummy/config/routes.rb +56 -0
  46. data/test/dummy/db/schema.rb +19 -0
  47. data/test/dummy/db/test.sqlite3 +0 -0
  48. data/test/dummy/log/test.log +979 -0
  49. data/test/dummy/public/404.html +58 -0
  50. data/test/dummy/public/422.html +58 -0
  51. data/test/dummy/public/500.html +57 -0
  52. data/test/dummy/public/favicon.ico +0 -0
  53. data/test/test_helper.rb +15 -0
  54. data/test/transcribable_test.rb +72 -0
  55. metadata +202 -0
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
@@ -0,0 +1,72 @@
1
+ require 'test_helper'
2
+
3
+ class TranscribableTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Transcribable
6
+ end
7
+
8
+ test "transcribable table is set" do
9
+ assert_equal "filings", Transcribable.table
10
+ end
11
+
12
+ test "transcribable attrs are set" do
13
+ h = {"buyer"=>:string, "amount"=>:integer, "notes"=>:text}
14
+ assert_equal h, Transcribable.transcribable_attrs
15
+ end
16
+
17
+ test "skipped attr is set" do
18
+ skipped = [:notes]
19
+ assert_equal skipped, Filing.skipped_attrs
20
+ end
21
+
22
+ test "set verification level" do
23
+ assert_equal 4, Filing.verification_threshhold
24
+ end
25
+ end
26
+
27
+ class TranscribableAssignerTest < ActiveSupport::TestCase
28
+ def setup
29
+ @user = "40765bb0cfa90130c5fb442c03361f6e"
30
+ @doc1 = Filing.create({:id => 1, :url => "https://www.documentcloud.org/documents/326844-fox-chicago-public-file", :verified => true})
31
+ @doc2 = Filing.create({:id => 2, :url => "https://www.documentcloud.org/documents/326749-abc-chicago"})
32
+ @doc3 = Filing.create({:id => 3, :url => "https://www.documentcloud.org/documents/326753-cbs-chicago-public-file"})
33
+
34
+ @transcription1 = Transcription.create({:filing_id => 2, :user_id => @user})
35
+ end
36
+
37
+ def teardown
38
+ Filing.delete_all
39
+ Transcription.delete_all
40
+ end
41
+
42
+ test "should assign documents that aren't verified or transcribed by the user" do
43
+ assigned = Filing.assign!(@user)
44
+ assert_equal @doc3.id, assigned.id
45
+ end
46
+ end
47
+
48
+ class TranscribableVerifierTest < ActiveSupport::TestCase
49
+ def setup
50
+ Filing.set_verification_threshhold(1)
51
+
52
+ @user1 = "40765bb0cfa90130c5fb442c03361f6e"
53
+ @user2 = "5aa499f0cfb30130c5fc442c03361f6e"
54
+
55
+ @doc = Filing.create({:id => 1, :url => "https://www.documentcloud.org/documents/326749-abc-chicago"})
56
+
57
+ @transcription1 = Transcription.create({:filing_id => 1, :user_id => @user1, :buyer => "Restore Our Future", :amount => 123.45})
58
+ @transcription2 = Transcription.create({:filing_id => 1, :user_id => @user2, :buyer => "Restore our Future", :amount => 123.45})
59
+ end
60
+
61
+ def teardown
62
+ Filing.delete_all
63
+ Transcription.delete_all
64
+ end
65
+
66
+ test "should verify transcriptions" do
67
+ f = Filing.find(1)
68
+ f.verify!
69
+
70
+ assert_equal true, f.verified
71
+ end
72
+ end
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: transcribable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Al Shaw
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rest-client
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: uuid
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: sqlite3
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Drop in crowdsourcing for your Rails app.
79
+ email:
80
+ - almshaw@gmail.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - lib/generators/templates/assets/stylesheets/simple_frame.css
86
+ - lib/generators/templates/config/documentcloud.yml
87
+ - lib/generators/templates/controller.rb
88
+ - lib/generators/templates/migration.rb
89
+ - lib/generators/templates/migration_add_columns.rb
90
+ - lib/generators/templates/model.rb
91
+ - lib/generators/templates/views/_form.html.erb
92
+ - lib/generators/templates/views/layouts/simple_frame.html.erb
93
+ - lib/generators/templates/views/new.html.erb
94
+ - lib/generators/transcribable_generator.rb
95
+ - lib/tasks/harvester.rake
96
+ - lib/transcribable/railtie.rb
97
+ - lib/transcribable/version.rb
98
+ - lib/transcribable.rb
99
+ - MIT-LICENSE
100
+ - Rakefile
101
+ - test/dummy/app/assets/javascripts/application.js
102
+ - test/dummy/app/assets/stylesheets/application.css
103
+ - test/dummy/app/controllers/application_controller.rb
104
+ - test/dummy/app/helpers/application_helper.rb
105
+ - test/dummy/app/models/filing.rb
106
+ - test/dummy/app/models/transcription.rb
107
+ - test/dummy/app/views/layouts/application.html.erb
108
+ - test/dummy/bin/bundle
109
+ - test/dummy/bin/rails
110
+ - test/dummy/bin/rake
111
+ - test/dummy/config/application.rb
112
+ - test/dummy/config/boot.rb
113
+ - test/dummy/config/database.yml
114
+ - test/dummy/config/environment.rb
115
+ - test/dummy/config/environments/development.rb
116
+ - test/dummy/config/environments/production.rb
117
+ - test/dummy/config/environments/test.rb
118
+ - test/dummy/config/initializers/backtrace_silencers.rb
119
+ - test/dummy/config/initializers/filter_parameter_logging.rb
120
+ - test/dummy/config/initializers/inflections.rb
121
+ - test/dummy/config/initializers/mime_types.rb
122
+ - test/dummy/config/initializers/secret_token.rb
123
+ - test/dummy/config/initializers/session_store.rb
124
+ - test/dummy/config/initializers/wrap_parameters.rb
125
+ - test/dummy/config/locales/en.yml
126
+ - test/dummy/config/routes.rb
127
+ - test/dummy/config.ru
128
+ - test/dummy/db/schema.rb
129
+ - test/dummy/db/test.sqlite3
130
+ - test/dummy/log/test.log
131
+ - test/dummy/public/404.html
132
+ - test/dummy/public/422.html
133
+ - test/dummy/public/500.html
134
+ - test/dummy/public/favicon.ico
135
+ - test/dummy/Rakefile
136
+ - test/dummy/README.rdoc
137
+ - test/test_helper.rb
138
+ - test/transcribable_test.rb
139
+ homepage: https://github.com/propublica/transcribable
140
+ licenses: []
141
+ post_install_message:
142
+ rdoc_options: []
143
+ require_paths:
144
+ - lib
145
+ required_ruby_version: !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
148
+ - - ! '>='
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ none: false
153
+ requirements:
154
+ - - ! '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ requirements: []
158
+ rubyforge_project:
159
+ rubygems_version: 1.8.23
160
+ signing_key:
161
+ specification_version: 3
162
+ summary: Drop in crowdsourcing for your Rails app.
163
+ test_files:
164
+ - test/dummy/app/assets/javascripts/application.js
165
+ - test/dummy/app/assets/stylesheets/application.css
166
+ - test/dummy/app/controllers/application_controller.rb
167
+ - test/dummy/app/helpers/application_helper.rb
168
+ - test/dummy/app/models/filing.rb
169
+ - test/dummy/app/models/transcription.rb
170
+ - test/dummy/app/views/layouts/application.html.erb
171
+ - test/dummy/bin/bundle
172
+ - test/dummy/bin/rails
173
+ - test/dummy/bin/rake
174
+ - test/dummy/config/application.rb
175
+ - test/dummy/config/boot.rb
176
+ - test/dummy/config/database.yml
177
+ - test/dummy/config/environment.rb
178
+ - test/dummy/config/environments/development.rb
179
+ - test/dummy/config/environments/production.rb
180
+ - test/dummy/config/environments/test.rb
181
+ - test/dummy/config/initializers/backtrace_silencers.rb
182
+ - test/dummy/config/initializers/filter_parameter_logging.rb
183
+ - test/dummy/config/initializers/inflections.rb
184
+ - test/dummy/config/initializers/mime_types.rb
185
+ - test/dummy/config/initializers/secret_token.rb
186
+ - test/dummy/config/initializers/session_store.rb
187
+ - test/dummy/config/initializers/wrap_parameters.rb
188
+ - test/dummy/config/locales/en.yml
189
+ - test/dummy/config/routes.rb
190
+ - test/dummy/config.ru
191
+ - test/dummy/db/schema.rb
192
+ - test/dummy/db/test.sqlite3
193
+ - test/dummy/log/test.log
194
+ - test/dummy/public/404.html
195
+ - test/dummy/public/422.html
196
+ - test/dummy/public/500.html
197
+ - test/dummy/public/favicon.ico
198
+ - test/dummy/Rakefile
199
+ - test/dummy/README.rdoc
200
+ - test/test_helper.rb
201
+ - test/transcribable_test.rb
202
+ has_rdoc: