pliny 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +14 -6
  2. data/README.md +59 -11
  3. data/bin/pliny-generate +2 -14
  4. data/bin/pliny-new +1 -1
  5. data/lib/pliny.rb +1 -2
  6. data/lib/pliny/commands/creator.rb +10 -11
  7. data/lib/pliny/commands/generator.rb +50 -199
  8. data/lib/pliny/commands/generator/base.rb +59 -0
  9. data/lib/pliny/commands/generator/endpoint.rb +44 -0
  10. data/lib/pliny/commands/generator/mediator.rb +21 -0
  11. data/lib/pliny/commands/generator/migration.rb +13 -0
  12. data/lib/pliny/commands/generator/model.rb +30 -0
  13. data/lib/pliny/commands/generator/schema.rb +24 -0
  14. data/lib/pliny/commands/generator/serializer.rb +21 -0
  15. data/lib/pliny/config_helpers.rb +52 -0
  16. data/lib/pliny/helpers/encode.rb +7 -0
  17. data/lib/pliny/log.rb +18 -1
  18. data/lib/pliny/middleware/versioning.rb +3 -3
  19. data/lib/pliny/tasks/db.rake +21 -7
  20. data/lib/pliny/tasks/schema.rake +2 -2
  21. data/lib/pliny/templates/endpoint.erb +5 -5
  22. data/lib/pliny/templates/endpoint_acceptance_test.erb +1 -1
  23. data/lib/pliny/templates/endpoint_scaffold.erb +5 -5
  24. data/lib/pliny/templates/endpoint_scaffold_acceptance_test.erb +1 -1
  25. data/lib/pliny/templates/endpoint_test.erb +1 -0
  26. data/lib/pliny/templates/migration.erb +0 -2
  27. data/lib/pliny/templates/model.erb +0 -2
  28. data/lib/pliny/templates/model_test.erb +0 -1
  29. data/lib/pliny/templates/serializer_test.erb +0 -1
  30. data/lib/pliny/version.rb +1 -1
  31. data/template/.env.sample +2 -1
  32. data/template/README.md +1 -1
  33. data/template/bin/console +1 -3
  34. data/template/bin/run +1 -3
  35. data/template/config.ru +1 -4
  36. data/template/config/config.rb +19 -25
  37. data/template/config/initializers/rollbar.rb +1 -0
  38. data/template/config/puma.rb +2 -2
  39. data/template/db/schema.sql +1 -2
  40. data/template/lib/application.rb +4 -0
  41. data/template/lib/endpoints/base.rb +1 -0
  42. data/template/lib/routes.rb +1 -1
  43. data/template/lib/serializers/base.rb +8 -1
  44. data/test/commands/creator_test.rb +1 -0
  45. data/test/commands/generator/base_test.rb +103 -0
  46. data/test/commands/generator/endpoint_test.rb +15 -0
  47. data/test/commands/generator_test.rb +95 -134
  48. data/test/log_test.rb +16 -0
  49. metadata +100 -69
@@ -24,4 +24,20 @@ describe Pliny::Log do
24
24
  mock(@io).puts "app=pliny foo=bar"
25
25
  Pliny.log(foo: "bar")
26
26
  end
27
+
28
+ it "supports a context" do
29
+ mock(@io).puts "app=pliny foo=bar"
30
+ Pliny.context(app: "pliny") do
31
+ Pliny.log(foo: "bar")
32
+ end
33
+ end
34
+
35
+ it "local context does not overwrite global" do
36
+ Pliny::RequestStore.store[:log_context] = { app: "pliny" }
37
+ mock(@io).puts "app=not_pliny foo=bar"
38
+ Pliny.context(app: "not_pliny") do
39
+ Pliny.log(foo: "bar")
40
+ end
41
+ assert Pliny::RequestStore.store[:log_context][:app] = "pliny"
42
+ end
27
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pliny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur Leach
@@ -9,246 +9,266 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-21 00:00:00.000000000 Z
12
+ date: 2014-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '4.1'
21
- - - ">="
21
+ - - ! '>='
22
22
  - !ruby/object:Gem::Version
23
23
  version: 4.1.0
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - "~>"
28
+ - - ~>
29
29
  - !ruby/object:Gem::Version
30
30
  version: '4.1'
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 4.1.0
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: multi_json
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.9'
41
- - - ">="
41
+ - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
43
  version: 1.9.3
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - "~>"
48
+ - - ~>
49
49
  - !ruby/object:Gem::Version
50
50
  version: '1.9'
51
- - - ">="
51
+ - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: 1.9.3
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: pg
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - ~>
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0.17'
61
- - - ">="
61
+ - - ! '>='
62
62
  - !ruby/object:Gem::Version
63
63
  version: 0.17.1
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - "~>"
68
+ - - ~>
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0.17'
71
- - - ">="
71
+ - - ! '>='
72
72
  - !ruby/object:Gem::Version
73
73
  version: 0.17.1
74
74
  - !ruby/object:Gem::Dependency
75
75
  name: prmd
76
76
  requirement: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - "~>"
78
+ - - ~>
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0.1'
81
- - - ">="
81
+ - - ! '>='
82
82
  - !ruby/object:Gem::Version
83
83
  version: 0.1.1
84
84
  type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - ~>
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0.1'
91
- - - ">="
91
+ - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: 0.1.1
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: sequel
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - "~>"
98
+ - - ~>
99
99
  - !ruby/object:Gem::Version
100
100
  version: '4.9'
101
- - - ">="
101
+ - - ! '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: 4.9.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '4.9'
111
- - - ">="
111
+ - - ! '>='
112
112
  - !ruby/object:Gem::Version
113
113
  version: 4.9.0
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: sinatra
116
116
  requirement: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - "~>"
118
+ - - ~>
119
119
  - !ruby/object:Gem::Version
120
120
  version: '1.4'
121
- - - ">="
121
+ - - ! '>='
122
122
  - !ruby/object:Gem::Version
123
123
  version: 1.4.5
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - "~>"
128
+ - - ~>
129
129
  - !ruby/object:Gem::Version
130
130
  version: '1.4'
131
- - - ">="
131
+ - - ! '>='
132
132
  - !ruby/object:Gem::Version
133
133
  version: 1.4.5
134
134
  - !ruby/object:Gem::Dependency
135
135
  name: http_accept
136
136
  requirement: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - "~>"
138
+ - - ~>
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0.1'
141
- - - ">="
141
+ - - ! '>='
142
142
  - !ruby/object:Gem::Version
143
143
  version: 0.1.5
144
144
  type: :runtime
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - "~>"
148
+ - - ~>
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0.1'
151
- - - ">="
151
+ - - ! '>='
152
152
  - !ruby/object:Gem::Version
153
153
  version: 0.1.5
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: sinatra-router
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - "~>"
158
+ - - ~>
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0.2'
161
- - - ">="
161
+ - - ! '>='
162
162
  - !ruby/object:Gem::Version
163
163
  version: 0.2.3
164
164
  type: :runtime
165
165
  prerelease: false
166
166
  version_requirements: !ruby/object:Gem::Requirement
167
167
  requirements:
168
- - - "~>"
168
+ - - ~>
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0.2'
171
- - - ">="
171
+ - - ! '>='
172
172
  - !ruby/object:Gem::Version
173
173
  version: 0.2.3
174
+ - !ruby/object:Gem::Dependency
175
+ name: thor
176
+ requirement: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ~>
179
+ - !ruby/object:Gem::Version
180
+ version: '0.19'
181
+ - - ! '>='
182
+ - !ruby/object:Gem::Version
183
+ version: 0.19.1
184
+ type: :runtime
185
+ prerelease: false
186
+ version_requirements: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ~>
189
+ - !ruby/object:Gem::Version
190
+ version: '0.19'
191
+ - - ! '>='
192
+ - !ruby/object:Gem::Version
193
+ version: 0.19.1
174
194
  - !ruby/object:Gem::Dependency
175
195
  name: rake
176
196
  requirement: !ruby/object:Gem::Requirement
177
197
  requirements:
178
- - - "~>"
198
+ - - ~>
179
199
  - !ruby/object:Gem::Version
180
200
  version: '0.8'
181
- - - ">="
201
+ - - ! '>='
182
202
  - !ruby/object:Gem::Version
183
203
  version: 0.8.7
184
204
  type: :development
185
205
  prerelease: false
186
206
  version_requirements: !ruby/object:Gem::Requirement
187
207
  requirements:
188
- - - "~>"
208
+ - - ~>
189
209
  - !ruby/object:Gem::Version
190
210
  version: '0.8'
191
- - - ">="
211
+ - - ! '>='
192
212
  - !ruby/object:Gem::Version
193
213
  version: 0.8.7
194
214
  - !ruby/object:Gem::Dependency
195
215
  name: rack-test
196
216
  requirement: !ruby/object:Gem::Requirement
197
217
  requirements:
198
- - - "~>"
218
+ - - ~>
199
219
  - !ruby/object:Gem::Version
200
220
  version: '0.6'
201
- - - ">="
221
+ - - ! '>='
202
222
  - !ruby/object:Gem::Version
203
223
  version: 0.6.2
204
224
  type: :development
205
225
  prerelease: false
206
226
  version_requirements: !ruby/object:Gem::Requirement
207
227
  requirements:
208
- - - "~>"
228
+ - - ~>
209
229
  - !ruby/object:Gem::Version
210
230
  version: '0.6'
211
- - - ">="
231
+ - - ! '>='
212
232
  - !ruby/object:Gem::Version
213
233
  version: 0.6.2
214
234
  - !ruby/object:Gem::Dependency
215
235
  name: rr
216
236
  requirement: !ruby/object:Gem::Requirement
217
237
  requirements:
218
- - - "~>"
238
+ - - ~>
219
239
  - !ruby/object:Gem::Version
220
240
  version: '1.1'
221
- - - ">="
241
+ - - ! '>='
222
242
  - !ruby/object:Gem::Version
223
243
  version: 1.1.2
224
244
  type: :development
225
245
  prerelease: false
226
246
  version_requirements: !ruby/object:Gem::Requirement
227
247
  requirements:
228
- - - "~>"
248
+ - - ~>
229
249
  - !ruby/object:Gem::Version
230
250
  version: '1.1'
231
- - - ">="
251
+ - - ! '>='
232
252
  - !ruby/object:Gem::Version
233
253
  version: 1.1.2
234
254
  - !ruby/object:Gem::Dependency
235
255
  name: timecop
236
256
  requirement: !ruby/object:Gem::Requirement
237
257
  requirements:
238
- - - "~>"
258
+ - - ~>
239
259
  - !ruby/object:Gem::Version
240
260
  version: '0.7'
241
- - - ">="
261
+ - - ! '>='
242
262
  - !ruby/object:Gem::Version
243
263
  version: 0.7.1
244
264
  type: :development
245
265
  prerelease: false
246
266
  version_requirements: !ruby/object:Gem::Requirement
247
267
  requirements:
248
- - - "~>"
268
+ - - ~>
249
269
  - !ruby/object:Gem::Version
250
270
  version: '0.7'
251
- - - ">="
271
+ - - ! '>='
252
272
  - !ruby/object:Gem::Version
253
273
  version: 0.7.1
254
274
  description: Pliny is a set of base classes and helpers to help developers write excellent
@@ -268,9 +288,17 @@ files:
268
288
  - lib/pliny.rb
269
289
  - lib/pliny/commands/creator.rb
270
290
  - lib/pliny/commands/generator.rb
291
+ - lib/pliny/commands/generator/base.rb
292
+ - lib/pliny/commands/generator/endpoint.rb
293
+ - lib/pliny/commands/generator/mediator.rb
294
+ - lib/pliny/commands/generator/migration.rb
295
+ - lib/pliny/commands/generator/model.rb
296
+ - lib/pliny/commands/generator/schema.rb
297
+ - lib/pliny/commands/generator/serializer.rb
271
298
  - lib/pliny/config_helpers.rb
272
299
  - lib/pliny/errors.rb
273
300
  - lib/pliny/extensions/instruments.rb
301
+ - lib/pliny/helpers/encode.rb
274
302
  - lib/pliny/helpers/params.rb
275
303
  - lib/pliny/log.rb
276
304
  - lib/pliny/middleware/cors.rb
@@ -300,6 +328,23 @@ files:
300
328
  - lib/pliny/templates/serializer_test.erb
301
329
  - lib/pliny/utils.rb
302
330
  - lib/pliny/version.rb
331
+ - test/commands/creator_test.rb
332
+ - test/commands/generator/base_test.rb
333
+ - test/commands/generator/endpoint_test.rb
334
+ - test/commands/generator_test.rb
335
+ - test/errors_test.rb
336
+ - test/extensions/instruments_test.rb
337
+ - test/integration_test.rb
338
+ - test/log_test.rb
339
+ - test/middleware/cors_test.rb
340
+ - test/middleware/request_id_test.rb
341
+ - test/middleware/request_store_test.rb
342
+ - test/middleware/rescue_errors_test.rb
343
+ - test/middleware/timeout_test.rb
344
+ - test/middleware/versioning_test.rb
345
+ - test/request_store_test.rb
346
+ - test/router_test.rb
347
+ - test/test_helper.rb
303
348
  - template/.env.sample
304
349
  - template/.env.test
305
350
  - template/.gitignore
@@ -323,6 +368,7 @@ files:
323
368
  - template/db/seeds.rb
324
369
  - template/docs/schema/meta.json
325
370
  - template/docs/schema/schemata/.gitkeep
371
+ - template/lib/application.rb
326
372
  - template/lib/endpoints/base.rb
327
373
  - template/lib/endpoints/root.rb
328
374
  - template/lib/initializer.rb
@@ -332,22 +378,7 @@ files:
332
378
  - template/spec/spec_helper.rb
333
379
  - template/spec/support/auto_define_rack_app.rb
334
380
  - template/spec/support/log.rb
335
- - test/commands/creator_test.rb
336
- - test/commands/generator_test.rb
337
- - test/errors_test.rb
338
- - test/extensions/instruments_test.rb
339
- - test/integration_test.rb
340
- - test/log_test.rb
341
- - test/middleware/cors_test.rb
342
- - test/middleware/request_id_test.rb
343
- - test/middleware/request_store_test.rb
344
- - test/middleware/rescue_errors_test.rb
345
- - test/middleware/timeout_test.rb
346
- - test/middleware/versioning_test.rb
347
- - test/request_store_test.rb
348
- - test/router_test.rb
349
- - test/test_helper.rb
350
- homepage: https://github.com/12-oz/pliny
381
+ homepage: https://github.com/interagent/pliny
351
382
  licenses:
352
383
  - MIT
353
384
  metadata: {}
@@ -357,17 +388,17 @@ require_paths:
357
388
  - lib
358
389
  required_ruby_version: !ruby/object:Gem::Requirement
359
390
  requirements:
360
- - - ">="
391
+ - - ! '>='
361
392
  - !ruby/object:Gem::Version
362
393
  version: '0'
363
394
  required_rubygems_version: !ruby/object:Gem::Requirement
364
395
  requirements:
365
- - - ">="
396
+ - - ! '>='
366
397
  - !ruby/object:Gem::Version
367
398
  version: '0'
368
399
  requirements: []
369
400
  rubyforge_project:
370
- rubygems_version: 2.2.2
401
+ rubygems_version: 2.0.7
371
402
  signing_key:
372
403
  specification_version: 4
373
404
  summary: Basic tooling to support API apps in Sinatra