xing-backend 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/role.rb +24 -0
  3. data/config/locales/json.yml +29 -0
  4. data/config/routes.rb +3 -0
  5. data/db/migrate/20140828011806_initial.rb +45 -0
  6. data/db/migrate/20140914030703_devise_token_auth_add_token_info_to_users.rb +20 -0
  7. data/db/migrate/20140929192921_remove_login_from_users.rb +5 -0
  8. data/lib/xing-backend.rb +1 -0
  9. data/lib/xing/engine.rb +4 -0
  10. data/lib/xing/nominal/database_config_validator.rb +31 -0
  11. data/lib/xing/nominal/dependency_utils.rb +26 -0
  12. data/lib/xing/nominal/secrets_validator.rb +50 -0
  13. data/lib/xing/nominal/yaml_config_validator.rb +44 -0
  14. data/lib/xing/services.rb +0 -2
  15. data/lib/xing/services/class_registry.rb +31 -0
  16. data/lib/xing/services/{page_wrapper.rb → paged_wrapper.rb} +2 -2
  17. data/lib/xing/snapshot.rb +4 -0
  18. data/lib/xing/snapshot/domain_helpers.rb +24 -0
  19. data/lib/xing/snapshot/fetcher.rb +35 -0
  20. data/lib/xing/snapshot/local_site_snapshot.rb +37 -0
  21. data/lib/xing/snapshot/remote_site_snapshot.rb +16 -0
  22. data/lib/xing/snapshot/site_page_set.rb +29 -0
  23. data/lib/xing/snapshot/site_snapshot.rb +41 -0
  24. data/lib/xing/snapshot/sitemap.rb +68 -0
  25. data/lib/xing/snapshot/writer.rb +15 -0
  26. data/lib/xing/spec_helpers.rb +7 -0
  27. data/lib/xing/spec_helpers/api_response_matchers.rb +26 -0
  28. data/lib/xing/spec_helpers/ci_support.rb +6 -0
  29. data/lib/xing/spec_helpers/dom_equiv.rb +26 -0
  30. data/lib/xing/spec_helpers/json_requests.rb +58 -0
  31. data/lib/xing/spec_helpers/routing_spec_patch.rb +28 -0
  32. data/lib/xing/spec_helpers/split_servers.rb +15 -0
  33. data/lib/xing/spec_helpers/test_url_helpers.rb +5 -0
  34. data/lib/xing/static.rb +1 -0
  35. data/lib/xing/static/backend_url_cookie.rb +16 -0
  36. data/lib/xing/static/goto_param.rb +30 -0
  37. data/lib/xing/static/logger.rb +11 -0
  38. data/lib/xing/static/rack_app.rb +40 -0
  39. data/lib/xing/tasks/all.rake +4 -0
  40. data/lib/xing/tasks/db_recycle.rake +4 -0
  41. data/lib/xing/tasks/dependencies_common.rake +49 -0
  42. data/lib/xing/tasks/sample_data.rake +49 -0
  43. data/lib/xing/tasks/take_snapshot.rake +4 -0
  44. data/spec/xing/builders/list_builder_spec.rb +0 -2
  45. data/spec/xing/builders/ordered_list_builder_spec.rb +0 -2
  46. data/spec/xing/nominal/database_config_validator_spec.rb +98 -0
  47. data/spec/xing/nominal/secrets_validator_spec.rb +78 -0
  48. data/spec/xing/serializers/list_spec.rb +116 -0
  49. data/spec/xing/serializers/paged_index_spec.rb +2 -2
  50. data/spec/xing/serializers/paged_list_spec.rb +1 -1
  51. data/spec/xing/services/error_converter_spec.rb +1 -3
  52. data/spec/xing/services/paged_wrapper_spec.rb +30 -0
  53. data/spec/xing/snapshot/remote_snapshot_fetcher_spec.rb +81 -0
  54. data/spec/xing/{services → snapshot}/snapshot_fetcher_spec.rb +6 -4
  55. data/spec_help/dummy/db/test.sqlite3 +0 -0
  56. data/spec_help/dummy/log/test.log +143 -0
  57. data/spec_help/file-sandbox.rb +164 -0
  58. data/spec_help/spec_helper.rb +0 -2
  59. metadata +152 -12
  60. data/lib/xing/services/snapshot_fetcher.rb +0 -33
  61. data/lib/xing/services/snapshot_writer.rb +0 -19
@@ -1,7 +1,5 @@
1
1
  require 'codeclimate-test-reporter'
2
2
  CodeClimate::TestReporter.start
3
- require 'simplecov'
4
- SimpleCov.start 'rails'
5
3
 
6
4
  require 'rspec'
7
5
  require 'rspec/core/formatters/base_formatter'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xing-backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Dorn
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-01-05 00:00:00.000000000 Z
14
+ date: 2016-01-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -19,19 +19,22 @@ dependencies:
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: 4.2.1
22
+ version: '4.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 4.2.1
29
+ version: '4.2'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: active_model_serializers
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: '0.9'
37
+ - - ">="
35
38
  - !ruby/object:Gem::Version
36
39
  version: 0.9.3
37
40
  type: :runtime
@@ -39,6 +42,9 @@ dependencies:
39
42
  version_requirements: !ruby/object:Gem::Requirement
40
43
  requirements:
41
44
  - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.9'
47
+ - - ">="
42
48
  - !ruby/object:Gem::Version
43
49
  version: 0.9.3
44
50
  - !ruby/object:Gem::Dependency
@@ -60,6 +66,9 @@ dependencies:
60
66
  requirement: !ruby/object:Gem::Requirement
61
67
  requirements:
62
68
  - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '0.1'
71
+ - - ">="
63
72
  - !ruby/object:Gem::Version
64
73
  version: 0.1.31
65
74
  type: :runtime
@@ -67,6 +76,9 @@ dependencies:
67
76
  version_requirements: !ruby/object:Gem::Requirement
68
77
  requirements:
69
78
  - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '0.1'
81
+ - - ">="
70
82
  - !ruby/object:Gem::Version
71
83
  version: 0.1.31
72
84
  - !ruby/object:Gem::Dependency
@@ -84,19 +96,47 @@ dependencies:
84
96
  - !ruby/object:Gem::Version
85
97
  version: '0.3'
86
98
  - !ruby/object:Gem::Dependency
87
- name: typhoeus
99
+ name: json_spec
88
100
  requirement: !ruby/object:Gem::Requirement
89
101
  requirements:
90
102
  - - "~>"
91
103
  - !ruby/object:Gem::Version
92
- version: '0.7'
104
+ version: '1.1'
93
105
  type: :runtime
94
106
  prerelease: false
95
107
  version_requirements: !ruby/object:Gem::Requirement
96
108
  requirements:
97
109
  - - "~>"
98
110
  - !ruby/object:Gem::Version
99
- version: '0.7'
111
+ version: '1.1'
112
+ - !ruby/object:Gem::Dependency
113
+ name: hash_validator
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '0.4'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '0.4'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rack-cors
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '0.4'
133
+ type: :runtime
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '0.4'
100
140
  - !ruby/object:Gem::Dependency
101
141
  name: sidekiq
102
142
  requirement: !ruby/object:Gem::Requirement
@@ -111,6 +151,62 @@ dependencies:
111
151
  - - "~>"
112
152
  - !ruby/object:Gem::Version
113
153
  version: '3.3'
154
+ - !ruby/object:Gem::Dependency
155
+ name: sinatra
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '1.3'
161
+ type: :runtime
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '1.3'
168
+ - !ruby/object:Gem::Dependency
169
+ name: builder
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - "~>"
173
+ - !ruby/object:Gem::Version
174
+ version: '3.1'
175
+ type: :runtime
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '3.1'
182
+ - !ruby/object:Gem::Dependency
183
+ name: typhoeus
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '0.7'
189
+ type: :runtime
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - "~>"
194
+ - !ruby/object:Gem::Version
195
+ version: '0.7'
196
+ - !ruby/object:Gem::Dependency
197
+ name: selenium-webdriver
198
+ requirement: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ type: :runtime
204
+ prerelease: false
205
+ version_requirements: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
114
210
  description: |2
115
211
  Xing is a Rails + AngularJS + Hypermedia web development framework and platform. This
116
212
  gem contains the base code for a backend/rails server in Xing.
@@ -123,6 +219,12 @@ executables: []
123
219
  extensions: []
124
220
  extra_rdoc_files: []
125
221
  files:
222
+ - app/models/role.rb
223
+ - config/locales/json.yml
224
+ - config/routes.rb
225
+ - db/migrate/20140828011806_initial.rb
226
+ - db/migrate/20140914030703_devise_token_auth_add_token_info_to_users.rb
227
+ - db/migrate/20140929192921_remove_login_from_users.rb
126
228
  - lib/xing-backend.rb
127
229
  - lib/xing/builders.rb
128
230
  - lib/xing/builders/list_builder.rb
@@ -132,6 +234,10 @@ files:
132
234
  - lib/xing/engine.rb
133
235
  - lib/xing/mappers.rb
134
236
  - lib/xing/mappers/base.rb
237
+ - lib/xing/nominal/database_config_validator.rb
238
+ - lib/xing/nominal/dependency_utils.rb
239
+ - lib/xing/nominal/secrets_validator.rb
240
+ - lib/xing/nominal/yaml_config_validator.rb
135
241
  - lib/xing/serializers.rb
136
242
  - lib/xing/serializers/base.rb
137
243
  - lib/xing/serializers/list.rb
@@ -140,24 +246,55 @@ files:
140
246
  - lib/xing/serializers/paged_list.rb
141
247
  - lib/xing/serializers/root_resources.rb
142
248
  - lib/xing/services.rb
249
+ - lib/xing/services/class_registry.rb
143
250
  - lib/xing/services/error_converter.rb
144
251
  - lib/xing/services/json_tree_lister.rb
145
252
  - lib/xing/services/locator.rb
146
- - lib/xing/services/page_wrapper.rb
147
- - lib/xing/services/snapshot_fetcher.rb
148
- - lib/xing/services/snapshot_writer.rb
253
+ - lib/xing/services/paged_wrapper.rb
254
+ - lib/xing/snapshot.rb
255
+ - lib/xing/snapshot/domain_helpers.rb
256
+ - lib/xing/snapshot/fetcher.rb
257
+ - lib/xing/snapshot/local_site_snapshot.rb
258
+ - lib/xing/snapshot/remote_site_snapshot.rb
259
+ - lib/xing/snapshot/site_page_set.rb
260
+ - lib/xing/snapshot/site_snapshot.rb
261
+ - lib/xing/snapshot/sitemap.rb
262
+ - lib/xing/snapshot/writer.rb
263
+ - lib/xing/spec_helpers.rb
264
+ - lib/xing/spec_helpers/api_response_matchers.rb
265
+ - lib/xing/spec_helpers/ci_support.rb
266
+ - lib/xing/spec_helpers/dom_equiv.rb
267
+ - lib/xing/spec_helpers/json_requests.rb
268
+ - lib/xing/spec_helpers/routing_spec_patch.rb
269
+ - lib/xing/spec_helpers/split_servers.rb
270
+ - lib/xing/spec_helpers/test_url_helpers.rb
271
+ - lib/xing/static.rb
272
+ - lib/xing/static/backend_url_cookie.rb
273
+ - lib/xing/static/goto_param.rb
274
+ - lib/xing/static/logger.rb
275
+ - lib/xing/static/rack_app.rb
276
+ - lib/xing/tasks/all.rake
277
+ - lib/xing/tasks/db_recycle.rake
278
+ - lib/xing/tasks/dependencies_common.rake
279
+ - lib/xing/tasks/sample_data.rake
280
+ - lib/xing/tasks/take_snapshot.rake
149
281
  - spec/xing/builders/list_builder_spec.rb
150
282
  - spec/xing/builders/ordered_list_builder_spec.rb
151
283
  - spec/xing/controllers/base_spec.rb
152
284
  - spec/xing/controllers/root_resources_controller_spec.rb
153
285
  - spec/xing/mappers/base_spec.rb
286
+ - spec/xing/nominal/database_config_validator_spec.rb
287
+ - spec/xing/nominal/secrets_validator_spec.rb
154
288
  - spec/xing/serializers/base_spec.rb
289
+ - spec/xing/serializers/list_spec.rb
155
290
  - spec/xing/serializers/paged_index_spec.rb
156
291
  - spec/xing/serializers/paged_list_spec.rb
157
292
  - spec/xing/serializers/root_resources_spec.rb
158
293
  - spec/xing/services/error_converter_spec.rb
159
294
  - spec/xing/services/json_tree_lister_spec.rb
160
- - spec/xing/services/snapshot_fetcher_spec.rb
295
+ - spec/xing/services/paged_wrapper_spec.rb
296
+ - spec/xing/snapshot/remote_snapshot_fetcher_spec.rb
297
+ - spec/xing/snapshot/snapshot_fetcher_spec.rb
161
298
  - spec/xing_spec.rb
162
299
  - spec_help/dummy/README.rdoc
163
300
  - spec_help/dummy/Rakefile
@@ -189,10 +326,13 @@ files:
189
326
  - spec_help/dummy/config/locales/en.yml
190
327
  - spec_help/dummy/config/routes.rb
191
328
  - spec_help/dummy/config/secrets.yml
329
+ - spec_help/dummy/db/test.sqlite3
330
+ - spec_help/dummy/log/test.log
192
331
  - spec_help/dummy/public/404.html
193
332
  - spec_help/dummy/public/422.html
194
333
  - spec_help/dummy/public/500.html
195
334
  - spec_help/dummy/public/favicon.ico
335
+ - spec_help/file-sandbox.rb
196
336
  - spec_help/spec_helper.rb
197
337
  homepage: http://github.com/xing-backend
198
338
  licenses:
@@ -204,7 +344,7 @@ rdoc_options:
204
344
  - "--main"
205
345
  - doc/README
206
346
  - "--title"
207
- - xing-backend-0.0.19 Documentation
347
+ - xing-backend-0.0.20 Documentation
208
348
  require_paths:
209
349
  - lib/
210
350
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -1,33 +0,0 @@
1
- require 'typhoeus'
2
- require 'addressable/uri'
3
- require 'xing/services/snapshot_writer'
4
- require 'sidekiq/worker'
5
-
6
- module Xing::Services
7
- class SnapshotFetcher
8
- include Sidekiq::Worker
9
- include SnapshotWriter
10
-
11
- def perform(url, path)
12
- admin_server = Rails.application.secrets.snapshot_server['url']
13
- user_password = "#{Rails.application.secrets.snapshot_server['user']}:#{Rails.application.secrets.snapshot_server['password']}"
14
- snapshot_url = Addressable::URI.join(url,path).to_s
15
- request = Typhoeus::Request.new(admin_server, userpwd: user_password, params: { url: snapshot_url })
16
-
17
- hydra = Typhoeus::Hydra.new
18
- hydra.queue(request)
19
- hydra.run
20
-
21
- response = request.response
22
-
23
- if response.success?
24
- html = response.body
25
- write(path, html)
26
- else
27
- logger.warn response.status_message
28
- logger.warn response.body
29
- raise "Query to #{admin_server} for #{path} failed!"
30
- end
31
- end
32
- end
33
- end
@@ -1,19 +0,0 @@
1
- module Xing::Services
2
- module SnapshotWriter
3
- def write(path, html)
4
- if Rails.env.test?
5
- snapshot_file = "#{ Rails.root }/spec/fixtures/sitemap_scratch/#{path.present? ? path : 'index'}.html"
6
- else
7
- snapshot_file = "#{ Rails.root }/public/frontend_snapshots/#{path.present? ? path : 'index'}.html"
8
- end
9
- dirname = File.dirname(snapshot_file)
10
- unless File.directory?(dirname)
11
- FileUtils.mkdir_p(dirname)
12
- end
13
-
14
- File.open(snapshot_file, "w+:ASCII-8BIT:UTF-8") do |f|
15
- f.write(html)
16
- end
17
- end
18
- end
19
- end