acts_as_citable 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +38 -0
  4. data/lib/acts_as_citable/base.rb +87 -0
  5. data/lib/acts_as_citable/mime_types.rb +4 -0
  6. data/lib/acts_as_citable/renderers.rb +32 -0
  7. data/lib/acts_as_citable/version.rb +3 -0
  8. data/lib/acts_as_citable.rb +1 -0
  9. data/lib/tasks/acts_as_citable_tasks.rake +4 -0
  10. data/test/acts_as_citable_test.rb +81 -0
  11. data/test/dummy/README.rdoc +261 -0
  12. data/test/dummy/Rakefile +7 -0
  13. data/test/dummy/app/assets/javascripts/application.js +15 -0
  14. data/test/dummy/app/assets/javascripts/test.js +2 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/test/dummy/app/assets/stylesheets/test.css +4 -0
  17. data/test/dummy/app/controllers/application_controller.rb +3 -0
  18. data/test/dummy/app/controllers/test_controller.rb +9 -0
  19. data/test/dummy/app/helpers/application_helper.rb +2 -0
  20. data/test/dummy/app/helpers/test_helper.rb +2 -0
  21. data/test/dummy/app/models/inherited_record.rb +3 -0
  22. data/test/dummy/app/models/record.rb +4 -0
  23. data/test/dummy/app/models/record_changed_field.rb +6 -0
  24. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  25. data/test/dummy/config/application.rb +59 -0
  26. data/test/dummy/config/boot.rb +10 -0
  27. data/test/dummy/config/database.yml +20 -0
  28. data/test/dummy/config/environment.rb +5 -0
  29. data/test/dummy/config/environments/development.rb +37 -0
  30. data/test/dummy/config/environments/production.rb +67 -0
  31. data/test/dummy/config/environments/test.rb +37 -0
  32. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/test/dummy/config/initializers/inflections.rb +15 -0
  34. data/test/dummy/config/initializers/mime_types.rb +5 -0
  35. data/test/dummy/config/initializers/secret_token.rb +7 -0
  36. data/test/dummy/config/initializers/session_store.rb +8 -0
  37. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  38. data/test/dummy/config/locales/en.yml +5 -0
  39. data/test/dummy/config/routes.rb +59 -0
  40. data/test/dummy/config.ru +4 -0
  41. data/test/dummy/db/development.sqlite3 +0 -0
  42. data/test/dummy/db/migrate/20130221210429_create_records.rb +10 -0
  43. data/test/dummy/db/migrate/20130221214225_create_record_changed_fields.rb +10 -0
  44. data/test/dummy/db/schema.rb +30 -0
  45. data/test/dummy/db/test.sqlite3 +0 -0
  46. data/test/dummy/log/development.log +3150 -0
  47. data/test/dummy/log/test.log +6674 -0
  48. data/test/dummy/public/404.html +26 -0
  49. data/test/dummy/public/422.html +26 -0
  50. data/test/dummy/public/500.html +25 -0
  51. data/test/dummy/public/favicon.ico +0 -0
  52. data/test/dummy/script/rails +6 -0
  53. data/test/dummy/test/fixtures/record_changed_fields.yml +9 -0
  54. data/test/dummy/test/fixtures/records.yml +9 -0
  55. data/test/dummy/test/functional/test_controller_test.rb +20 -0
  56. data/test/dummy/test/unit/helpers/test_helper_test.rb +4 -0
  57. data/test/dummy/test/unit/record_changed_field_test.rb +7 -0
  58. data/test/dummy/test/unit/record_test.rb +11 -0
  59. data/test/test_helper.rb +26 -0
  60. metadata +340 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ data: MyString
5
+ from_format: MyString
6
+
7
+ two:
8
+ data: MyString
9
+ from_format: MyString
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ data: MyString
5
+ format: MyString
6
+
7
+ two:
8
+ data: MyString
9
+ format: MyString
@@ -0,0 +1,20 @@
1
+ require 'test_helper'
2
+
3
+ class TestControllerTest < ActionController::TestCase
4
+ test "should respond to bibtex" do
5
+ get :test, :format => "bibtex", :use_route => :test
6
+ assert_response :success
7
+ end
8
+ test "should respond to bib" do
9
+ get :test, :format => "bib", :use_route => :test
10
+ assert_response :success
11
+ end
12
+ test "should respond to ris" do
13
+ get :test, :format => "ris", :use_route => :test
14
+ assert_response :success
15
+ end
16
+ test "should not respond to arbitrary format" do
17
+ get :test, :format => "csf", :use_route => :test
18
+ assert_response :not_acceptable
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class TestHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class RecordChangedFieldTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ class RecordTest < ActiveSupport::TestCase
4
+ test "should be able to create a new Record" do
5
+ rec = Record.new(:data => "itemType: book", :format => "csf")
6
+ assert rec.to_ris.eql? "TY - BOOK\nER -\n\n"
7
+ assert rec.to_bibtex.eql? "@book{????\n}"
8
+ assert rec.to_openurl.eql? "rft.ulr_ver=Z39.88-2004&rft.ctx_ver=Z39.88-2004&rft.rfr_id=info:sid/libraries.nyu.edu:citero&rft_val_fmlt=info:ofi/fmt:kev:mtx:book&rft.genre=book"
9
+ assert rec.to_easybib.eql? "{\"source\":\"book\",\"book\":{\"title\":null},\"pubtype\":{\"main\":\"pubnonperiodical\"},\"pubnonperiodical\":{},\"contributors\":[{}]}"
10
+ end
11
+ end
@@ -0,0 +1,26 @@
1
+ require 'simplecov'
2
+ require 'simplecov-rcov'
3
+
4
+ require 'coveralls'
5
+ Coveralls.wear!
6
+
7
+
8
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
9
+ SimpleCov.start 'rails'
10
+
11
+ # Configure Rails Environment
12
+ ENV["RAILS_ENV"] = "test"
13
+
14
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
15
+ require "rails/test_help"
16
+ require "nokogiri"
17
+
18
+ Rails.backtrace_cleaner.remove_silencers!
19
+
20
+ # Load support files
21
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
22
+
23
+ # Load fixtures from the engine
24
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
25
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
26
+ end
metadata ADDED
@@ -0,0 +1,340 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_citable
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.0.1
6
+ platform: ruby
7
+ authors:
8
+ - hab278
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 3.2.12
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.12
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
30
+ - !ruby/object:Gem::Dependency
31
+ name: citero-jruby
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: !binary |-
37
+ MQ==
38
+ none: false
39
+ requirement: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: !binary |-
44
+ MQ==
45
+ none: false
46
+ prerelease: false
47
+ type: :runtime
48
+ - !ruby/object:Gem::Dependency
49
+ name: activerecord-jdbcsqlite3-adapter
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: !binary |-
55
+ MA==
56
+ none: false
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: !binary |-
62
+ MA==
63
+ none: false
64
+ prerelease: false
65
+ type: :development
66
+ - !ruby/object:Gem::Dependency
67
+ name: nokogiri
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: !binary |-
73
+ MA==
74
+ none: false
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: !binary |-
80
+ MA==
81
+ none: false
82
+ prerelease: false
83
+ type: :development
84
+ - !ruby/object:Gem::Dependency
85
+ name: brakeman
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: !binary |-
91
+ MA==
92
+ none: false
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: !binary |-
98
+ MA==
99
+ none: false
100
+ prerelease: false
101
+ type: :development
102
+ - !ruby/object:Gem::Dependency
103
+ name: simplecov
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: !binary |-
109
+ MA==
110
+ none: false
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: !binary |-
116
+ MA==
117
+ none: false
118
+ prerelease: false
119
+ type: :development
120
+ - !ruby/object:Gem::Dependency
121
+ name: simplecov-rcov
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: !binary |-
127
+ MA==
128
+ none: false
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: !binary |-
134
+ MA==
135
+ none: false
136
+ prerelease: false
137
+ type: :development
138
+ - !ruby/object:Gem::Dependency
139
+ name: test-unit
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: !binary |-
145
+ MA==
146
+ none: false
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: !binary |-
152
+ MA==
153
+ none: false
154
+ prerelease: false
155
+ type: :development
156
+ - !ruby/object:Gem::Dependency
157
+ name: coveralls
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: !binary |-
163
+ MA==
164
+ none: false
165
+ requirement: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: !binary |-
170
+ MA==
171
+ none: false
172
+ prerelease: false
173
+ type: :development
174
+ - !ruby/object:Gem::Dependency
175
+ name: ruby-debug
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: !binary |-
181
+ MA==
182
+ none: false
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: !binary |-
188
+ MA==
189
+ none: false
190
+ prerelease: false
191
+ type: :development
192
+ description: Uses Citero to translate a model from one format to another.
193
+ email:
194
+ - hab278@nyu.edu
195
+ executables: []
196
+ extensions: []
197
+ extra_rdoc_files: []
198
+ files:
199
+ - lib/acts_as_citable.rb
200
+ - lib/acts_as_citable/base.rb
201
+ - lib/acts_as_citable/mime_types.rb
202
+ - lib/acts_as_citable/renderers.rb
203
+ - lib/acts_as_citable/version.rb
204
+ - lib/tasks/acts_as_citable_tasks.rake
205
+ - MIT-LICENSE
206
+ - Rakefile
207
+ - README.rdoc
208
+ - test/acts_as_citable_test.rb
209
+ - test/test_helper.rb
210
+ - test/dummy/config.ru
211
+ - test/dummy/Rakefile
212
+ - test/dummy/README.rdoc
213
+ - test/dummy/app/assets/javascripts/application.js
214
+ - test/dummy/app/assets/javascripts/test.js
215
+ - test/dummy/app/assets/stylesheets/application.css
216
+ - test/dummy/app/assets/stylesheets/test.css
217
+ - test/dummy/app/controllers/application_controller.rb
218
+ - test/dummy/app/controllers/test_controller.rb
219
+ - test/dummy/app/helpers/application_helper.rb
220
+ - test/dummy/app/helpers/test_helper.rb
221
+ - test/dummy/app/models/inherited_record.rb
222
+ - test/dummy/app/models/record.rb
223
+ - test/dummy/app/models/record_changed_field.rb
224
+ - test/dummy/app/views/layouts/application.html.erb
225
+ - test/dummy/config/application.rb
226
+ - test/dummy/config/boot.rb
227
+ - test/dummy/config/database.yml
228
+ - test/dummy/config/environment.rb
229
+ - test/dummy/config/routes.rb
230
+ - test/dummy/config/environments/development.rb
231
+ - test/dummy/config/environments/production.rb
232
+ - test/dummy/config/environments/test.rb
233
+ - test/dummy/config/initializers/backtrace_silencers.rb
234
+ - test/dummy/config/initializers/inflections.rb
235
+ - test/dummy/config/initializers/mime_types.rb
236
+ - test/dummy/config/initializers/secret_token.rb
237
+ - test/dummy/config/initializers/session_store.rb
238
+ - test/dummy/config/initializers/wrap_parameters.rb
239
+ - test/dummy/config/locales/en.yml
240
+ - test/dummy/db/development.sqlite3
241
+ - test/dummy/db/schema.rb
242
+ - test/dummy/db/test.sqlite3
243
+ - test/dummy/db/migrate/20130221210429_create_records.rb
244
+ - test/dummy/db/migrate/20130221214225_create_record_changed_fields.rb
245
+ - test/dummy/log/development.log
246
+ - test/dummy/log/test.log
247
+ - test/dummy/public/404.html
248
+ - test/dummy/public/422.html
249
+ - test/dummy/public/500.html
250
+ - test/dummy/public/favicon.ico
251
+ - test/dummy/script/rails
252
+ - test/dummy/test/fixtures/record_changed_fields.yml
253
+ - test/dummy/test/fixtures/records.yml
254
+ - test/dummy/test/functional/test_controller_test.rb
255
+ - test/dummy/test/unit/record_changed_field_test.rb
256
+ - test/dummy/test/unit/record_test.rb
257
+ - test/dummy/test/unit/helpers/test_helper_test.rb
258
+ homepage:
259
+ licenses: []
260
+ post_install_message:
261
+ rdoc_options: []
262
+ require_paths:
263
+ - lib
264
+ required_ruby_version: !ruby/object:Gem::Requirement
265
+ requirements:
266
+ - - ">="
267
+ - !ruby/object:Gem::Version
268
+ segments:
269
+ - 0
270
+ hash: 2
271
+ version: !binary |-
272
+ MA==
273
+ none: false
274
+ required_rubygems_version: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ segments:
279
+ - 0
280
+ hash: 2
281
+ version: !binary |-
282
+ MA==
283
+ none: false
284
+ requirements: []
285
+ rubyforge_project:
286
+ rubygems_version: 1.8.24
287
+ signing_key:
288
+ specification_version: 3
289
+ summary: Acts As gem for allowing models to be used as citable objects.
290
+ test_files:
291
+ - test/acts_as_citable_test.rb
292
+ - test/test_helper.rb
293
+ - test/dummy/config.ru
294
+ - test/dummy/Rakefile
295
+ - test/dummy/README.rdoc
296
+ - test/dummy/app/assets/javascripts/application.js
297
+ - test/dummy/app/assets/javascripts/test.js
298
+ - test/dummy/app/assets/stylesheets/application.css
299
+ - test/dummy/app/assets/stylesheets/test.css
300
+ - test/dummy/app/controllers/application_controller.rb
301
+ - test/dummy/app/controllers/test_controller.rb
302
+ - test/dummy/app/helpers/application_helper.rb
303
+ - test/dummy/app/helpers/test_helper.rb
304
+ - test/dummy/app/models/inherited_record.rb
305
+ - test/dummy/app/models/record.rb
306
+ - test/dummy/app/models/record_changed_field.rb
307
+ - test/dummy/app/views/layouts/application.html.erb
308
+ - test/dummy/config/application.rb
309
+ - test/dummy/config/boot.rb
310
+ - test/dummy/config/database.yml
311
+ - test/dummy/config/environment.rb
312
+ - test/dummy/config/routes.rb
313
+ - test/dummy/config/environments/development.rb
314
+ - test/dummy/config/environments/production.rb
315
+ - test/dummy/config/environments/test.rb
316
+ - test/dummy/config/initializers/backtrace_silencers.rb
317
+ - test/dummy/config/initializers/inflections.rb
318
+ - test/dummy/config/initializers/mime_types.rb
319
+ - test/dummy/config/initializers/secret_token.rb
320
+ - test/dummy/config/initializers/session_store.rb
321
+ - test/dummy/config/initializers/wrap_parameters.rb
322
+ - test/dummy/config/locales/en.yml
323
+ - test/dummy/db/development.sqlite3
324
+ - test/dummy/db/schema.rb
325
+ - test/dummy/db/test.sqlite3
326
+ - test/dummy/db/migrate/20130221210429_create_records.rb
327
+ - test/dummy/db/migrate/20130221214225_create_record_changed_fields.rb
328
+ - test/dummy/log/development.log
329
+ - test/dummy/log/test.log
330
+ - test/dummy/public/404.html
331
+ - test/dummy/public/422.html
332
+ - test/dummy/public/500.html
333
+ - test/dummy/public/favicon.ico
334
+ - test/dummy/script/rails
335
+ - test/dummy/test/fixtures/record_changed_fields.yml
336
+ - test/dummy/test/fixtures/records.yml
337
+ - test/dummy/test/functional/test_controller_test.rb
338
+ - test/dummy/test/unit/record_changed_field_test.rb
339
+ - test/dummy/test/unit/record_test.rb
340
+ - test/dummy/test/unit/helpers/test_helper_test.rb