spreadsheet_architect 1.4.8 → 2.0.0

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 (131) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -2
  3. data/README.md +117 -98
  4. data/Rakefile +8 -1
  5. data/lib/generators/spreadsheet_architect/add_project_defaults_generator.rb +12 -3
  6. data/lib/spreadsheet_architect.rb +19 -330
  7. data/lib/spreadsheet_architect/action_controller_renderers.rb +9 -19
  8. data/lib/spreadsheet_architect/class_methods/csv.rb +22 -0
  9. data/lib/spreadsheet_architect/class_methods/ods.rb +61 -0
  10. data/lib/spreadsheet_architect/class_methods/xlsx.rb +162 -0
  11. data/lib/spreadsheet_architect/exceptions.rb +47 -0
  12. data/lib/spreadsheet_architect/{set_mime_types.rb → mime_types.rb} +0 -2
  13. data/lib/spreadsheet_architect/monkey_patches/axlsx_column_width.rb +23 -0
  14. data/lib/spreadsheet_architect/utils.rb +223 -0
  15. data/lib/spreadsheet_architect/utils/xlsx.rb +126 -0
  16. data/lib/spreadsheet_architect/version.rb +1 -1
  17. data/test/rails_app/Gemfile +17 -0
  18. data/test/rails_app/Gemfile.lock +176 -0
  19. data/test/rails_app/README.md +24 -0
  20. data/test/rails_app/Rakefile +6 -0
  21. data/test/rails_app/app/assets/config/manifest.js +3 -0
  22. data/test/rails_app/app/assets/javascripts/application.js +16 -0
  23. data/test/rails_app/app/assets/javascripts/cable.js +13 -0
  24. data/test/rails_app/app/assets/stylesheets/application.css +15 -0
  25. data/test/rails_app/app/channels/application_cable/channel.rb +4 -0
  26. data/test/rails_app/app/channels/application_cable/connection.rb +4 -0
  27. data/test/rails_app/app/controllers/application_controller.rb +3 -0
  28. data/test/rails_app/app/controllers/spreadsheets_controller.rb +74 -0
  29. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  30. data/test/rails_app/app/jobs/application_job.rb +2 -0
  31. data/test/rails_app/app/mailers/application_mailer.rb +4 -0
  32. data/test/rails_app/app/models/active_model_object.rb +14 -0
  33. data/test/rails_app/app/models/application_record.rb +3 -0
  34. data/test/rails_app/app/models/bad_plain_ruby_object.rb +3 -0
  35. data/test/rails_app/app/models/custom_post.rb +15 -0
  36. data/test/rails_app/app/models/plain_ruby_object.rb +19 -0
  37. data/test/rails_app/app/models/post.rb +3 -0
  38. data/test/rails_app/app/views/layouts/application.html.erb +14 -0
  39. data/test/rails_app/app/views/layouts/mailer.html.erb +13 -0
  40. data/test/rails_app/app/views/layouts/mailer.text.erb +1 -0
  41. data/test/rails_app/bin/bundle +3 -0
  42. data/test/rails_app/bin/rails +9 -0
  43. data/test/rails_app/bin/rake +9 -0
  44. data/test/rails_app/bin/setup +34 -0
  45. data/test/rails_app/bin/spring +16 -0
  46. data/test/rails_app/bin/update +29 -0
  47. data/test/rails_app/config.ru +5 -0
  48. data/test/rails_app/config/application.rb +15 -0
  49. data/test/rails_app/config/boot.rb +3 -0
  50. data/test/rails_app/config/cable.yml +9 -0
  51. data/test/rails_app/config/database.yml +16 -0
  52. data/test/rails_app/config/environment.rb +5 -0
  53. data/test/rails_app/config/environments/development.rb +54 -0
  54. data/test/rails_app/config/environments/production.rb +86 -0
  55. data/test/rails_app/config/environments/test.rb +42 -0
  56. data/test/rails_app/config/initializers/application_controller_renderer.rb +6 -0
  57. data/test/rails_app/config/initializers/assets.rb +11 -0
  58. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  59. data/test/rails_app/config/initializers/cookies_serializer.rb +5 -0
  60. data/test/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  61. data/test/rails_app/config/initializers/inflections.rb +16 -0
  62. data/test/rails_app/config/initializers/mime_types.rb +4 -0
  63. data/test/rails_app/config/initializers/new_framework_defaults.rb +24 -0
  64. data/test/rails_app/config/initializers/session_store.rb +3 -0
  65. data/test/rails_app/config/initializers/wrap_parameters.rb +14 -0
  66. data/test/rails_app/config/locales/en.yml +23 -0
  67. data/test/rails_app/config/routes.rb +7 -0
  68. data/test/rails_app/config/secrets.yml +22 -0
  69. data/test/{spreadsheet_architect.sqlite3.db → rails_app/db/development.sqlite3} +0 -0
  70. data/test/rails_app/db/migrate/20170103234524_add_posts.rb +10 -0
  71. data/test/rails_app/db/schema.rb +23 -0
  72. data/test/rails_app/db/seeds.rb +7 -0
  73. data/test/rails_app/db/test.sqlite3 +0 -0
  74. data/test/rails_app/log/development.log +1195 -0
  75. data/test/rails_app/log/test.log +52766 -0
  76. data/test/rails_app/public/404.html +67 -0
  77. data/test/rails_app/public/422.html +67 -0
  78. data/test/rails_app/public/500.html +66 -0
  79. data/test/rails_app/public/apple-touch-icon-precomposed.png +0 -0
  80. data/test/rails_app/public/apple-touch-icon.png +0 -0
  81. data/test/rails_app/public/favicon.ico +0 -0
  82. data/test/rails_app/public/robots.txt +5 -0
  83. data/test/rails_app/test/controllers/spreadsheets_controller_test.rb +46 -0
  84. data/test/rails_app/test/models/active_model_object_test.rb +54 -0
  85. data/test/rails_app/test/models/bad_plain_ruby_object_test.rb +30 -0
  86. data/test/rails_app/test/models/csv_test.rb +60 -0
  87. data/test/rails_app/test/models/custom_post_test.rb +47 -0
  88. data/test/rails_app/test/models/ods_test.rb +68 -0
  89. data/test/rails_app/test/models/plain_ruby_object_test.rb +54 -0
  90. data/test/rails_app/test/models/post_test.rb +47 -0
  91. data/test/rails_app/test/models/spreadsheet_architect_utils_test.rb +68 -0
  92. data/test/rails_app/test/models/xlsx_test.rb +99 -0
  93. data/test/rails_app/test/test_helper.rb +21 -0
  94. data/test/rails_app/tmp/active_model_object/csv.csv +21 -0
  95. data/test/rails_app/tmp/active_model_object/ods.ods +0 -0
  96. data/test/rails_app/tmp/active_model_object/xlsx.xlsx +0 -0
  97. data/test/rails_app/tmp/controller_tests/alt_xlsx.xlsx +0 -0
  98. data/test/rails_app/tmp/controller_tests/csv.csv +1 -0
  99. data/test/rails_app/tmp/controller_tests/ods.ods +0 -0
  100. data/test/rails_app/tmp/controller_tests/xlsx.xlsx +0 -0
  101. data/test/rails_app/tmp/custom_posts/csv.csv +1 -0
  102. data/test/rails_app/tmp/custom_posts/empty.xlsx +0 -0
  103. data/test/rails_app/tmp/custom_posts/ods.ods +0 -0
  104. data/test/rails_app/tmp/custom_posts/xlsx.xlsx +0 -0
  105. data/test/rails_app/tmp/empty_model.csv +1 -0
  106. data/test/rails_app/tmp/empty_model.xlsx +0 -0
  107. data/test/rails_app/tmp/empty_sa.csv +0 -0
  108. data/test/rails_app/tmp/empty_sa.xlsx +0 -0
  109. data/test/rails_app/tmp/extreme.xlsx +0 -0
  110. data/test/rails_app/tmp/model.csv +1 -0
  111. data/test/rails_app/tmp/model.xlsx +0 -0
  112. data/test/rails_app/tmp/ods/empty_model.ods +0 -0
  113. data/test/rails_app/tmp/ods/empty_sa.ods +0 -0
  114. data/test/rails_app/tmp/ods/model.ods +0 -0
  115. data/test/rails_app/tmp/ods/model_options.ods +0 -0
  116. data/test/rails_app/tmp/ods/sa.ods +0 -0
  117. data/test/rails_app/tmp/options.csv +1 -0
  118. data/test/rails_app/tmp/plain_ruby_object/csv.csv +4 -0
  119. data/test/rails_app/tmp/plain_ruby_object/ods.ods +0 -0
  120. data/test/rails_app/tmp/plain_ruby_object/xlsx.xlsx +0 -0
  121. data/test/rails_app/tmp/posts/csv.csv +1 -0
  122. data/test/rails_app/tmp/posts/empty.xlsx +0 -0
  123. data/test/rails_app/tmp/posts/ods.ods +0 -0
  124. data/test/rails_app/tmp/posts/xlsx.xlsx +0 -0
  125. data/test/rails_app/tmp/sa.csv +4 -0
  126. data/test/rails_app/tmp/sa.xlsx +0 -0
  127. metadata +255 -21
  128. data/lib/spreadsheet_architect/axlsx_column_width_patch.rb +0 -13
  129. data/test/database.yml +0 -3
  130. data/test/helper.rb +0 -52
  131. data/test/tc_spreadsheet_architect.rb +0 -84
@@ -0,0 +1,4 @@
1
+ Title,Content,Object ID
2
+ My Title,The content...,46986951432100
3
+ My Title,The content...,46986951432080
4
+ My Title,The content...,46986951432060
@@ -0,0 +1 @@
1
+ Name,Content,Age
Binary file
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ test1,test2,test3
2
+ row1
3
+ row2 c1,row2 c2
4
+ the,data
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreadsheet_architect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.8
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weston Ganger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-06 00:00:00.000000000 Z
11
+ date: 2017-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: axlsx
@@ -24,20 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: axlsx_styler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.7
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.7
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rodf
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - '='
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: 0.3.7
47
+ version: 1.0.0
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - '='
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: 0.3.7
54
+ version: 1.0.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -108,9 +122,9 @@ dependencies:
108
122
  - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
- description: SpreadsheetArchitect lets you turn any activerecord relation or ruby
112
- object collection into a XLSX, ODS, or CSV spreadsheets. Generates columns from
113
- model activerecord column_names or from an array of ruby methods.
125
+ description: Spreadsheet Architect is a library that allows you to create XLSX, ODS,
126
+ or CSV spreadsheets easily from ActiveRecord relations, Plain Ruby classes, or predefined
127
+ data.
114
128
  email: westonganger@gmail.com
115
129
  executables: []
116
130
  extensions: []
@@ -123,13 +137,125 @@ files:
123
137
  - lib/generators/spreadsheet_architect/add_project_defaults_generator.rb
124
138
  - lib/spreadsheet_architect.rb
125
139
  - lib/spreadsheet_architect/action_controller_renderers.rb
126
- - lib/spreadsheet_architect/axlsx_column_width_patch.rb
127
- - lib/spreadsheet_architect/set_mime_types.rb
140
+ - lib/spreadsheet_architect/class_methods/csv.rb
141
+ - lib/spreadsheet_architect/class_methods/ods.rb
142
+ - lib/spreadsheet_architect/class_methods/xlsx.rb
143
+ - lib/spreadsheet_architect/exceptions.rb
144
+ - lib/spreadsheet_architect/mime_types.rb
145
+ - lib/spreadsheet_architect/monkey_patches/axlsx_column_width.rb
146
+ - lib/spreadsheet_architect/utils.rb
147
+ - lib/spreadsheet_architect/utils/xlsx.rb
128
148
  - lib/spreadsheet_architect/version.rb
129
- - test/database.yml
130
- - test/helper.rb
131
- - test/spreadsheet_architect.sqlite3.db
132
- - test/tc_spreadsheet_architect.rb
149
+ - test/rails_app/Gemfile
150
+ - test/rails_app/Gemfile.lock
151
+ - test/rails_app/README.md
152
+ - test/rails_app/Rakefile
153
+ - test/rails_app/app/assets/config/manifest.js
154
+ - test/rails_app/app/assets/javascripts/application.js
155
+ - test/rails_app/app/assets/javascripts/cable.js
156
+ - test/rails_app/app/assets/stylesheets/application.css
157
+ - test/rails_app/app/channels/application_cable/channel.rb
158
+ - test/rails_app/app/channels/application_cable/connection.rb
159
+ - test/rails_app/app/controllers/application_controller.rb
160
+ - test/rails_app/app/controllers/spreadsheets_controller.rb
161
+ - test/rails_app/app/helpers/application_helper.rb
162
+ - test/rails_app/app/jobs/application_job.rb
163
+ - test/rails_app/app/mailers/application_mailer.rb
164
+ - test/rails_app/app/models/active_model_object.rb
165
+ - test/rails_app/app/models/application_record.rb
166
+ - test/rails_app/app/models/bad_plain_ruby_object.rb
167
+ - test/rails_app/app/models/custom_post.rb
168
+ - test/rails_app/app/models/plain_ruby_object.rb
169
+ - test/rails_app/app/models/post.rb
170
+ - test/rails_app/app/views/layouts/application.html.erb
171
+ - test/rails_app/app/views/layouts/mailer.html.erb
172
+ - test/rails_app/app/views/layouts/mailer.text.erb
173
+ - test/rails_app/bin/bundle
174
+ - test/rails_app/bin/rails
175
+ - test/rails_app/bin/rake
176
+ - test/rails_app/bin/setup
177
+ - test/rails_app/bin/spring
178
+ - test/rails_app/bin/update
179
+ - test/rails_app/config.ru
180
+ - test/rails_app/config/application.rb
181
+ - test/rails_app/config/boot.rb
182
+ - test/rails_app/config/cable.yml
183
+ - test/rails_app/config/database.yml
184
+ - test/rails_app/config/environment.rb
185
+ - test/rails_app/config/environments/development.rb
186
+ - test/rails_app/config/environments/production.rb
187
+ - test/rails_app/config/environments/test.rb
188
+ - test/rails_app/config/initializers/application_controller_renderer.rb
189
+ - test/rails_app/config/initializers/assets.rb
190
+ - test/rails_app/config/initializers/backtrace_silencers.rb
191
+ - test/rails_app/config/initializers/cookies_serializer.rb
192
+ - test/rails_app/config/initializers/filter_parameter_logging.rb
193
+ - test/rails_app/config/initializers/inflections.rb
194
+ - test/rails_app/config/initializers/mime_types.rb
195
+ - test/rails_app/config/initializers/new_framework_defaults.rb
196
+ - test/rails_app/config/initializers/session_store.rb
197
+ - test/rails_app/config/initializers/wrap_parameters.rb
198
+ - test/rails_app/config/locales/en.yml
199
+ - test/rails_app/config/routes.rb
200
+ - test/rails_app/config/secrets.yml
201
+ - test/rails_app/db/development.sqlite3
202
+ - test/rails_app/db/migrate/20170103234524_add_posts.rb
203
+ - test/rails_app/db/schema.rb
204
+ - test/rails_app/db/seeds.rb
205
+ - test/rails_app/db/test.sqlite3
206
+ - test/rails_app/log/development.log
207
+ - test/rails_app/log/test.log
208
+ - test/rails_app/public/404.html
209
+ - test/rails_app/public/422.html
210
+ - test/rails_app/public/500.html
211
+ - test/rails_app/public/apple-touch-icon-precomposed.png
212
+ - test/rails_app/public/apple-touch-icon.png
213
+ - test/rails_app/public/favicon.ico
214
+ - test/rails_app/public/robots.txt
215
+ - test/rails_app/test/controllers/spreadsheets_controller_test.rb
216
+ - test/rails_app/test/models/active_model_object_test.rb
217
+ - test/rails_app/test/models/bad_plain_ruby_object_test.rb
218
+ - test/rails_app/test/models/csv_test.rb
219
+ - test/rails_app/test/models/custom_post_test.rb
220
+ - test/rails_app/test/models/ods_test.rb
221
+ - test/rails_app/test/models/plain_ruby_object_test.rb
222
+ - test/rails_app/test/models/post_test.rb
223
+ - test/rails_app/test/models/spreadsheet_architect_utils_test.rb
224
+ - test/rails_app/test/models/xlsx_test.rb
225
+ - test/rails_app/test/test_helper.rb
226
+ - test/rails_app/tmp/active_model_object/csv.csv
227
+ - test/rails_app/tmp/active_model_object/ods.ods
228
+ - test/rails_app/tmp/active_model_object/xlsx.xlsx
229
+ - test/rails_app/tmp/controller_tests/alt_xlsx.xlsx
230
+ - test/rails_app/tmp/controller_tests/csv.csv
231
+ - test/rails_app/tmp/controller_tests/ods.ods
232
+ - test/rails_app/tmp/controller_tests/xlsx.xlsx
233
+ - test/rails_app/tmp/custom_posts/csv.csv
234
+ - test/rails_app/tmp/custom_posts/empty.xlsx
235
+ - test/rails_app/tmp/custom_posts/ods.ods
236
+ - test/rails_app/tmp/custom_posts/xlsx.xlsx
237
+ - test/rails_app/tmp/empty_model.csv
238
+ - test/rails_app/tmp/empty_model.xlsx
239
+ - test/rails_app/tmp/empty_sa.csv
240
+ - test/rails_app/tmp/empty_sa.xlsx
241
+ - test/rails_app/tmp/extreme.xlsx
242
+ - test/rails_app/tmp/model.csv
243
+ - test/rails_app/tmp/model.xlsx
244
+ - test/rails_app/tmp/ods/empty_model.ods
245
+ - test/rails_app/tmp/ods/empty_sa.ods
246
+ - test/rails_app/tmp/ods/model.ods
247
+ - test/rails_app/tmp/ods/model_options.ods
248
+ - test/rails_app/tmp/ods/sa.ods
249
+ - test/rails_app/tmp/options.csv
250
+ - test/rails_app/tmp/plain_ruby_object/csv.csv
251
+ - test/rails_app/tmp/plain_ruby_object/ods.ods
252
+ - test/rails_app/tmp/plain_ruby_object/xlsx.xlsx
253
+ - test/rails_app/tmp/posts/csv.csv
254
+ - test/rails_app/tmp/posts/empty.xlsx
255
+ - test/rails_app/tmp/posts/ods.ods
256
+ - test/rails_app/tmp/posts/xlsx.xlsx
257
+ - test/rails_app/tmp/sa.csv
258
+ - test/rails_app/tmp/sa.xlsx
133
259
  homepage: https://github.com/westonganger/spreadsheet_architect
134
260
  licenses: []
135
261
  metadata: {}
@@ -149,12 +275,120 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
275
  version: '0'
150
276
  requirements: []
151
277
  rubyforge_project:
152
- rubygems_version: 2.5.1
278
+ rubygems_version: 2.6.8
153
279
  signing_key:
154
280
  specification_version: 4
155
- summary: Spreadsheet Generator for ActiveRecord Models and Ruby Classes/Modules
281
+ summary: Spreadsheet Architect is a library that allows you to create XLSX, ODS, or
282
+ CSV spreadsheets easily from ActiveRecord relations, Plain Ruby classes, or predefined
283
+ data.
156
284
  test_files:
157
- - test/helper.rb
158
- - test/tc_spreadsheet_architect.rb
159
- - test/database.yml
160
- - test/spreadsheet_architect.sqlite3.db
285
+ - test/rails_app/app/helpers/application_helper.rb
286
+ - test/rails_app/app/jobs/application_job.rb
287
+ - test/rails_app/app/mailers/application_mailer.rb
288
+ - test/rails_app/app/views/layouts/mailer.html.erb
289
+ - test/rails_app/app/views/layouts/application.html.erb
290
+ - test/rails_app/app/views/layouts/mailer.text.erb
291
+ - test/rails_app/app/channels/application_cable/connection.rb
292
+ - test/rails_app/app/channels/application_cable/channel.rb
293
+ - test/rails_app/app/assets/javascripts/cable.js
294
+ - test/rails_app/app/assets/javascripts/application.js
295
+ - test/rails_app/app/assets/stylesheets/application.css
296
+ - test/rails_app/app/assets/config/manifest.js
297
+ - test/rails_app/app/controllers/application_controller.rb
298
+ - test/rails_app/app/controllers/spreadsheets_controller.rb
299
+ - test/rails_app/app/models/bad_plain_ruby_object.rb
300
+ - test/rails_app/app/models/plain_ruby_object.rb
301
+ - test/rails_app/app/models/application_record.rb
302
+ - test/rails_app/app/models/custom_post.rb
303
+ - test/rails_app/app/models/post.rb
304
+ - test/rails_app/app/models/active_model_object.rb
305
+ - test/rails_app/test/test_helper.rb
306
+ - test/rails_app/test/controllers/spreadsheets_controller_test.rb
307
+ - test/rails_app/test/models/post_test.rb
308
+ - test/rails_app/test/models/csv_test.rb
309
+ - test/rails_app/test/models/spreadsheet_architect_utils_test.rb
310
+ - test/rails_app/test/models/custom_post_test.rb
311
+ - test/rails_app/test/models/active_model_object_test.rb
312
+ - test/rails_app/test/models/plain_ruby_object_test.rb
313
+ - test/rails_app/test/models/bad_plain_ruby_object_test.rb
314
+ - test/rails_app/test/models/ods_test.rb
315
+ - test/rails_app/test/models/xlsx_test.rb
316
+ - test/rails_app/README.md
317
+ - test/rails_app/bin/update
318
+ - test/rails_app/bin/rake
319
+ - test/rails_app/bin/setup
320
+ - test/rails_app/bin/spring
321
+ - test/rails_app/bin/rails
322
+ - test/rails_app/bin/bundle
323
+ - test/rails_app/db/test.sqlite3
324
+ - test/rails_app/db/schema.rb
325
+ - test/rails_app/db/migrate/20170103234524_add_posts.rb
326
+ - test/rails_app/db/seeds.rb
327
+ - test/rails_app/db/development.sqlite3
328
+ - test/rails_app/tmp/empty_sa.csv
329
+ - test/rails_app/tmp/sa.csv
330
+ - test/rails_app/tmp/options.csv
331
+ - test/rails_app/tmp/model.xlsx
332
+ - test/rails_app/tmp/custom_posts/csv.csv
333
+ - test/rails_app/tmp/custom_posts/ods.ods
334
+ - test/rails_app/tmp/custom_posts/xlsx.xlsx
335
+ - test/rails_app/tmp/custom_posts/empty.xlsx
336
+ - test/rails_app/tmp/empty_model.csv
337
+ - test/rails_app/tmp/controller_tests/csv.csv
338
+ - test/rails_app/tmp/controller_tests/ods.ods
339
+ - test/rails_app/tmp/controller_tests/alt_xlsx.xlsx
340
+ - test/rails_app/tmp/controller_tests/xlsx.xlsx
341
+ - test/rails_app/tmp/extreme.xlsx
342
+ - test/rails_app/tmp/ods/model.ods
343
+ - test/rails_app/tmp/ods/empty_model.ods
344
+ - test/rails_app/tmp/ods/sa.ods
345
+ - test/rails_app/tmp/ods/model_options.ods
346
+ - test/rails_app/tmp/ods/empty_sa.ods
347
+ - test/rails_app/tmp/model.csv
348
+ - test/rails_app/tmp/active_model_object/csv.csv
349
+ - test/rails_app/tmp/active_model_object/ods.ods
350
+ - test/rails_app/tmp/active_model_object/xlsx.xlsx
351
+ - test/rails_app/tmp/empty_model.xlsx
352
+ - test/rails_app/tmp/plain_ruby_object/csv.csv
353
+ - test/rails_app/tmp/plain_ruby_object/ods.ods
354
+ - test/rails_app/tmp/plain_ruby_object/xlsx.xlsx
355
+ - test/rails_app/tmp/sa.xlsx
356
+ - test/rails_app/tmp/empty_sa.xlsx
357
+ - test/rails_app/tmp/posts/csv.csv
358
+ - test/rails_app/tmp/posts/ods.ods
359
+ - test/rails_app/tmp/posts/xlsx.xlsx
360
+ - test/rails_app/tmp/posts/empty.xlsx
361
+ - test/rails_app/public/apple-touch-icon.png
362
+ - test/rails_app/public/500.html
363
+ - test/rails_app/public/404.html
364
+ - test/rails_app/public/422.html
365
+ - test/rails_app/public/apple-touch-icon-precomposed.png
366
+ - test/rails_app/public/favicon.ico
367
+ - test/rails_app/public/robots.txt
368
+ - test/rails_app/Rakefile
369
+ - test/rails_app/config/cable.yml
370
+ - test/rails_app/config/application.rb
371
+ - test/rails_app/config/boot.rb
372
+ - test/rails_app/config/routes.rb
373
+ - test/rails_app/config/environments/development.rb
374
+ - test/rails_app/config/environments/test.rb
375
+ - test/rails_app/config/environments/production.rb
376
+ - test/rails_app/config/database.yml
377
+ - test/rails_app/config/initializers/new_framework_defaults.rb
378
+ - test/rails_app/config/initializers/backtrace_silencers.rb
379
+ - test/rails_app/config/initializers/assets.rb
380
+ - test/rails_app/config/initializers/mime_types.rb
381
+ - test/rails_app/config/initializers/inflections.rb
382
+ - test/rails_app/config/initializers/filter_parameter_logging.rb
383
+ - test/rails_app/config/initializers/cookies_serializer.rb
384
+ - test/rails_app/config/initializers/application_controller_renderer.rb
385
+ - test/rails_app/config/initializers/wrap_parameters.rb
386
+ - test/rails_app/config/initializers/session_store.rb
387
+ - test/rails_app/config/secrets.yml
388
+ - test/rails_app/config/locales/en.yml
389
+ - test/rails_app/config/environment.rb
390
+ - test/rails_app/config.ru
391
+ - test/rails_app/Gemfile
392
+ - test/rails_app/Gemfile.lock
393
+ - test/rails_app/log/development.log
394
+ - test/rails_app/log/test.log
@@ -1,13 +0,0 @@
1
- if defined? Axlsx
2
- Axlsx::Col.class_eval do
3
- def width=(v)
4
- if v.nil?
5
- @custom_width = false
6
- @width = nil
7
- elsif @width.nil? || @width < v+5
8
- @custom_width = @best_fit = v != nil
9
- @width = v + 5
10
- end
11
- end
12
- end
13
- end
data/test/database.yml DELETED
@@ -1,3 +0,0 @@
1
- sqlite3:
2
- adapter: sqlite3
3
- database: test/spreadsheet_architect.sqlite3.db
data/test/helper.rb DELETED
@@ -1,52 +0,0 @@
1
- config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
2
- ActiveRecord::Base.establish_connection(config['sqlite3'])
3
- ActiveRecord::Schema.define(version: 0) do
4
- begin
5
- drop_table :posts, :force => true
6
- drop_table :other_posts, :force => true
7
- rescue
8
- #dont really care if the tables are not dropped
9
- end
10
-
11
- create_table(:posts, :force => true) do |t|
12
- t.string :name
13
- t.string :title
14
- t.text :content
15
- t.integer :votes
16
- t.timestamps null: false
17
- end
18
-
19
- create_table(:other_posts, :force => true) do |t|
20
- t.string :name
21
- t.string :title
22
- t.text :content
23
- t.integer :votes
24
- t.timestamps null: false
25
- end
26
- end
27
-
28
- class Post < ActiveRecord::Base
29
- include SpreadsheetArchitect
30
-
31
- def spreadsheet_columns
32
- [:name, :title, :content, :votes, :ranking]
33
- end
34
-
35
- def ranking
36
- 1
37
- end
38
- end
39
-
40
- class OtherPost < ActiveRecord::Base
41
- include SpreadsheetArchitect
42
- end
43
-
44
- posts = []
45
- posts << Post.new(name: "first post", title: "This is the first post", content: "I am a very good first post!", votes: 1)
46
- posts << Post.new(name: "second post", title: "This is the second post", content: "I am the best post!", votes: 7)
47
- posts.each { |p| p.save! }
48
-
49
- posts = []
50
- posts << OtherPost.new(name: "my other first", title: "first other post", content: "the first other post!", votes: 1)
51
- posts << OtherPost.new(name: "my other second", title: "second other post", content: "last other post!", votes: 7)
52
- posts.each { |p| p.save! }
@@ -1,84 +0,0 @@
1
- #!/usr/bin/env ruby -w
2
- require "spreadsheet_architect"
3
- require 'yaml'
4
- require 'active_record'
5
- require 'minitest'
6
-
7
- require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
8
-
9
- class TestSpreadsheetArchitect < MiniTest::Test
10
- class Post < ActiveRecord::Base
11
- include SpreadsheetArchitect
12
-
13
- def self.spreadsheet_columns
14
- [:name, :title, :content, :votes, :ranking]
15
- end
16
-
17
- def ranking
18
- 1
19
- end
20
- end
21
-
22
- class OtherPost < ActiveRecord::Base
23
- include SpreadsheetArchitect
24
- end
25
-
26
- class PlainPost
27
- include SpreadsheetArchitect
28
-
29
- def self.spreadsheet_columns
30
- [:name, :title, :content]
31
- end
32
-
33
- def name
34
- "the name"
35
- end
36
-
37
- def title
38
- "the title"
39
- end
40
-
41
- def content
42
- "the content"
43
- end
44
- end
45
-
46
- test "test_spreadsheet_options" do
47
- assert_equal([:name, :title, :content, :votes, :ranking], Post.spreadsheet_columns)
48
- assert_equal([:name, :title, :content, :votes, :created_at, :updated_at], OtherPost.column_names)
49
- assert_equal([:name, :title, :content], PlainPost.spreadsheet_columns)
50
- end
51
- end
52
-
53
- class TestToCsv < MiniTest::Test
54
- test "test_class_method" do
55
- p = Post.to_csv(spreadsheet_columns: [:name, :votes, :content, :ranking])
56
- assert_equal(true, p.is_a?(String))
57
- end
58
- test 'test_chained_method' do
59
- p = Post.order("name asc").to_csv(spreadsheet_columns: [:name, :votes, :content, :ranking])
60
- assert_equal(true, p.is_a?(String))
61
- end
62
- end
63
-
64
- class TestToOds < MiniTest::Test
65
- test 'test_class_method' do
66
- p = Post.to_ods(spreadsheet_columns: [:name, :votes, :content, :ranking])
67
- assert_equal(true, p.is_a?(String))
68
- end
69
- test 'test_chained_method' do
70
- p = Post.order("name asc").to_ods(spreadsheet_columns: [:name, :votes, :content, :ranking])
71
- assert_equal(true, p.is_a?(String))
72
- end
73
- end
74
-
75
- class TestToXlsx < MiniTest::Test
76
- test 'test_class_method' do
77
- p = Post.to_xlsx(spreadsheet_columns: [:name, :votes, :content, :ranking])
78
- assert_equal(true, p.is_a?(String))
79
- end
80
- test 'test_chained_method' do
81
- p = Post.order("name asc").to_xlsx(spreadsheet_columns: [:name, :votes, :content, :ranking])
82
- assert_equal(true, p.is_a?(String))
83
- end
84
- end