napa 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +41 -8
  4. data/Rakefile +1 -0
  5. data/docs/grape_entity_to_roar.md +110 -0
  6. data/docs/quickstart.md +29 -3
  7. data/lib/napa/active_record_extensions/filter_by_hash.rb +1 -0
  8. data/lib/napa/active_record_extensions/seeder.rb +14 -0
  9. data/lib/napa/cli.rb +28 -2
  10. data/lib/napa/deploy.rb +98 -0
  11. data/lib/napa/deprecations/active_support_behavior.rb +8 -0
  12. data/lib/napa/deprecations/application_api.rb +9 -0
  13. data/lib/napa/deprecations/grape_entity.rb +5 -0
  14. data/lib/napa/deprecations/napa_setup.rb +38 -0
  15. data/lib/napa/deprecations.rb +13 -0
  16. data/lib/napa/gem_dependency.rb +37 -0
  17. data/lib/napa/generators/migration_generator.rb +199 -2
  18. data/lib/napa/generators/readme_generator.rb +47 -0
  19. data/lib/napa/generators/templates/create_table_migration/%migration_filename%.rb.tt +19 -0
  20. data/lib/napa/generators/templates/migration/%migration_filename%.rb.tt +36 -1
  21. data/lib/napa/generators/templates/readme/README.md.tt +55 -0
  22. data/lib/napa/generators/templates/readme/spec/docs/readme_spec.rb +7 -0
  23. data/lib/napa/generators/templates/scaffold/.env.test.tt +3 -0
  24. data/lib/napa/generators/templates/scaffold/.env.tt +3 -0
  25. data/lib/napa/generators/templates/scaffold/.gitignore.tt +1 -0
  26. data/lib/napa/generators/templates/scaffold/Rakefile +2 -1
  27. data/lib/napa/generators/templates/scaffold/app.rb +1 -1
  28. data/lib/napa/generators/templates/scaffold/config.ru.tt +3 -2
  29. data/lib/napa/generators/templates/scaffold/log/{.gitkeep → .keep} +0 -0
  30. data/lib/napa/generators.rb +1 -0
  31. data/lib/napa/middleware/logger.rb +1 -1
  32. data/lib/napa/middleware/request_stats.rb +0 -2
  33. data/lib/napa/output_formatters/entity.rb +4 -0
  34. data/lib/napa/rspec_extensions/response_helpers.rb +29 -0
  35. data/lib/napa/setup.rb +20 -0
  36. data/lib/napa/stats_d_timer.rb +1 -1
  37. data/lib/napa/version.rb +1 -1
  38. data/lib/napa.rb +19 -1
  39. data/lib/tasks/db.rake +7 -0
  40. data/lib/tasks/deploy.rake +2 -4
  41. data/lib/tasks/routes.rake +4 -3
  42. data/napa.gemspec +2 -1
  43. data/spec/active_record_extensions/filter_by_hash_spec.rb +5 -3
  44. data/spec/active_record_extensions/seeder_spec.rb +13 -0
  45. data/spec/authentication_spec.rb +3 -3
  46. data/spec/deprecations/application_api_spec.rb +19 -0
  47. data/spec/deprecations/entity_spec.rb +9 -0
  48. data/spec/deprecations/filter_by_hash_spec.rb +9 -0
  49. data/spec/deprecations/napa_setup_spec.rb +52 -0
  50. data/spec/generators/api_generator_spec.rb +1 -1
  51. data/spec/generators/migration_generator_spec.rb +86 -8
  52. data/spec/generators/readme_generator_spec.rb +35 -0
  53. data/spec/grape_extensions/error_formatter_spec.rb +6 -6
  54. data/spec/identity_spec.rb +13 -13
  55. data/spec/json_error_spec.rb +3 -3
  56. data/spec/logger/log_transaction_spec.rb +6 -6
  57. data/spec/middleware/authentication_spec.rb +8 -8
  58. data/spec/middleware/database_stats_spec.rb +8 -8
  59. data/spec/middleware/request_stats_spec.rb +2 -11
  60. data/spec/spec_helper.rb +11 -2
  61. data/spec/stats_d_timer_spec.rb +23 -0
  62. data/spec/stats_spec.rb +2 -2
  63. data/spec/version_spec.rb +6 -6
  64. metadata +35 -9
  65. data/lib/tasks/git.rake +0 -53
data/spec/version_spec.rb CHANGED
@@ -5,36 +5,36 @@ describe Napa::Version do
5
5
  context '#major_bump' do
6
6
  it 'should set the major revision value, and the rest should be 0' do
7
7
  stub_const('Napa::VERSION', '1.2.3')
8
- Napa::Version.next_major.should == '2.0.0'
8
+ expect(Napa::Version.next_major).to eq('2.0.0')
9
9
  end
10
10
 
11
11
  it 'should set the major revision value, and the rest should be 0' do
12
12
  stub_const('Napa::VERSION', '5.0.0')
13
- Napa::Version.next_major.should == '6.0.0'
13
+ expect(Napa::Version.next_major).to eq('6.0.0')
14
14
  end
15
15
  end
16
16
 
17
17
  context '#minor_bump' do
18
18
  it 'should set the minor revision value, leaving the major value unchanged and the patch value to 0' do
19
19
  stub_const('Napa::VERSION', '1.2.3')
20
- Napa::Version.next_minor.should == '1.3.0'
20
+ expect(Napa::Version.next_minor).to eq('1.3.0')
21
21
  end
22
22
 
23
23
  it 'should set the minor revision value, leaving the major value unchanged and the patch value to 0' do
24
24
  stub_const('Napa::VERSION', '0.5.0')
25
- Napa::Version.next_minor.should == '0.6.0'
25
+ expect(Napa::Version.next_minor).to eq('0.6.0')
26
26
  end
27
27
  end
28
28
 
29
29
  context 'patch_bump' do
30
30
  it 'should set the patch revision value, leaving the major and minor values unchanged' do
31
31
  stub_const('Napa::VERSION', '1.2.3')
32
- Napa::Version.next_patch.should == '1.2.4'
32
+ expect(Napa::Version.next_patch).to eq('1.2.4')
33
33
  end
34
34
 
35
35
  it 'should set the patch revision value, leaving the major and minor values unchanged' do
36
36
  stub_const('Napa::VERSION', '5.5.5')
37
- Napa::Version.next_patch.should == '5.5.6'
37
+ expect(Napa::Version.next_patch).to eq('5.5.6')
38
38
  end
39
39
  end
40
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: napa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darby Frey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -165,13 +165,13 @@ dependencies:
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
- name: rspec
168
+ name: git
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - '>='
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
- type: :development
174
+ type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
@@ -179,7 +179,7 @@ dependencies:
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
- name: pry
182
+ name: rspec
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - '>='
@@ -193,7 +193,7 @@ dependencies:
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  - !ruby/object:Gem::Dependency
196
- name: git
196
+ name: pry
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - '>='
@@ -265,23 +265,36 @@ files:
265
265
  - README.md
266
266
  - Rakefile
267
267
  - bin/napa
268
+ - docs/grape_entity_to_roar.md
268
269
  - docs/quickstart.md
269
270
  - lib/napa.rb
270
271
  - lib/napa/active_record_extensions/filter_by_hash.rb
271
272
  - lib/napa/active_record_extensions/notifications_subscriber.rb
273
+ - lib/napa/active_record_extensions/seeder.rb
272
274
  - lib/napa/active_record_extensions/stats.rb
273
275
  - lib/napa/authentication.rb
274
276
  - lib/napa/cli.rb
277
+ - lib/napa/deploy.rb
278
+ - lib/napa/deprecations.rb
279
+ - lib/napa/deprecations/active_support_behavior.rb
280
+ - lib/napa/deprecations/application_api.rb
281
+ - lib/napa/deprecations/grape_entity.rb
282
+ - lib/napa/deprecations/napa_setup.rb
283
+ - lib/napa/gem_dependency.rb
275
284
  - lib/napa/generators.rb
276
285
  - lib/napa/generators/api_generator.rb
277
286
  - lib/napa/generators/migration_generator.rb
287
+ - lib/napa/generators/readme_generator.rb
278
288
  - lib/napa/generators/scaffold_generator.rb
279
289
  - lib/napa/generators/templates/api/app/apis/%name_tableize%_api.rb.tt
280
290
  - lib/napa/generators/templates/api/app/models/%name_underscore%.rb.tt
281
291
  - lib/napa/generators/templates/api/app/representers/%name_underscore%_representer.rb.tt
282
292
  - lib/napa/generators/templates/api/spec/apis/%name_tableize%_api_spec.rb.tt
283
293
  - lib/napa/generators/templates/api/spec/models/%name_underscore%_spec.rb.tt
294
+ - lib/napa/generators/templates/create_table_migration/%migration_filename%.rb.tt
284
295
  - lib/napa/generators/templates/migration/%migration_filename%.rb.tt
296
+ - lib/napa/generators/templates/readme/README.md.tt
297
+ - lib/napa/generators/templates/readme/spec/docs/readme_spec.rb
285
298
  - lib/napa/generators/templates/scaffold/.env.test.tt
286
299
  - lib/napa/generators/templates/scaffold/.env.tt
287
300
  - lib/napa/generators/templates/scaffold/.gitignore.tt
@@ -300,7 +313,7 @@ files:
300
313
  - lib/napa/generators/templates/scaffold/config/middleware/honeybadger.rb
301
314
  - lib/napa/generators/templates/scaffold/db/schema.rb
302
315
  - lib/napa/generators/templates/scaffold/lib/.keep
303
- - lib/napa/generators/templates/scaffold/log/.gitkeep
316
+ - lib/napa/generators/templates/scaffold/log/.keep
304
317
  - lib/napa/generators/templates/scaffold/spec/apis/hello_api_spec.rb.tt
305
318
  - lib/napa/generators/templates/scaffold/spec/factories/.gitkeep
306
319
  - lib/napa/generators/templates/scaffold/spec/spec_helper.rb
@@ -327,13 +340,18 @@ files:
327
340
  - lib/napa/version.rb
328
341
  - lib/tasks/db.rake
329
342
  - lib/tasks/deploy.rake
330
- - lib/tasks/git.rake
331
343
  - lib/tasks/routes.rake
332
344
  - napa.gemspec
333
345
  - spec/active_record_extensions/filter_by_hash_spec.rb
346
+ - spec/active_record_extensions/seeder_spec.rb
334
347
  - spec/authentication_spec.rb
348
+ - spec/deprecations/application_api_spec.rb
349
+ - spec/deprecations/entity_spec.rb
350
+ - spec/deprecations/filter_by_hash_spec.rb
351
+ - spec/deprecations/napa_setup_spec.rb
335
352
  - spec/generators/api_generator_spec.rb
336
353
  - spec/generators/migration_generator_spec.rb
354
+ - spec/generators/readme_generator_spec.rb
337
355
  - spec/generators/scaffold_generator_spec.rb
338
356
  - spec/grape_extensions/error_formatter_spec.rb
339
357
  - spec/grape_extensions/include_nil_spec.rb
@@ -346,6 +364,7 @@ files:
346
364
  - spec/middleware/database_stats_spec.rb
347
365
  - spec/middleware/request_stats_spec.rb
348
366
  - spec/spec_helper.rb
367
+ - spec/stats_d_timer_spec.rb
349
368
  - spec/stats_spec.rb
350
369
  - spec/version_spec.rb
351
370
  - tasks/version.rake
@@ -360,7 +379,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
360
379
  requirements:
361
380
  - - '>='
362
381
  - !ruby/object:Gem::Version
363
- version: '0'
382
+ version: '2.0'
364
383
  required_rubygems_version: !ruby/object:Gem::Requirement
365
384
  requirements:
366
385
  - - '>='
@@ -374,9 +393,15 @@ specification_version: 4
374
393
  summary: A simple framework for building APIs with Grape
375
394
  test_files:
376
395
  - spec/active_record_extensions/filter_by_hash_spec.rb
396
+ - spec/active_record_extensions/seeder_spec.rb
377
397
  - spec/authentication_spec.rb
398
+ - spec/deprecations/application_api_spec.rb
399
+ - spec/deprecations/entity_spec.rb
400
+ - spec/deprecations/filter_by_hash_spec.rb
401
+ - spec/deprecations/napa_setup_spec.rb
378
402
  - spec/generators/api_generator_spec.rb
379
403
  - spec/generators/migration_generator_spec.rb
404
+ - spec/generators/readme_generator_spec.rb
380
405
  - spec/generators/scaffold_generator_spec.rb
381
406
  - spec/grape_extensions/error_formatter_spec.rb
382
407
  - spec/grape_extensions/include_nil_spec.rb
@@ -389,5 +414,6 @@ test_files:
389
414
  - spec/middleware/database_stats_spec.rb
390
415
  - spec/middleware/request_stats_spec.rb
391
416
  - spec/spec_helper.rb
417
+ - spec/stats_d_timer_spec.rb
392
418
  - spec/stats_spec.rb
393
419
  - spec/version_spec.rb
data/lib/tasks/git.rake DELETED
@@ -1,53 +0,0 @@
1
- namespace :git do
2
- client = Octokit::Client.new(:access_token => ENV['GITHUB_OAUTH_TOKEN'])
3
- logger = Logger.new(STDOUT)
4
-
5
- github_repo = ENV['GITHUB_REPO']
6
- local_sha = `git rev-parse HEAD`.strip
7
-
8
- desc "Verify git repository is in a good state for deployment"
9
- task :verify do
10
- raise RuntimeError, "ENV['GITHUB_REPO'] is not defined" if github_repo.nil?
11
- raise RuntimeError, "ENV['GITHUB_OAUTH_TOKEN'] is not defined" if ENV['GITHUB_OAUTH_TOKEN'].nil?
12
-
13
- logger.info "Verifying git repository is in a good state"
14
-
15
- # Be sure local HEAD exists on remote
16
- begin
17
- remote_commit = client.commit(github_repo, local_sha)
18
- rescue Octokit::NotFound
19
- raise RuntimeError, "Local commit #{local_sha} does not exist on remote. Be sure to push your changes."
20
- end
21
-
22
- # Check for uncommited changes
23
- unless(system("git diff --quiet HEAD"))
24
- raise RuntimeError, "You have uncommited changes. Either commit or stash them before continuing."
25
- end
26
-
27
- # Check for untracked files
28
- unless(`git status --porcelain | grep '^??' | wc -l`.strip == "0")
29
- raise RuntimeError, "You have untracked files. Either commit or remove them before continuing."
30
- end
31
- end
32
-
33
- desc "Set tag, which triggers deploy"
34
- task :set_tag, :tag do |t, args|
35
- tag = args[:tag] || "production"
36
- logger.info "Setting #{tag} tag on github"
37
-
38
- # Update ref, create ref if it doesn't exist
39
- begin
40
- client.update_ref(
41
- github_repo,
42
- "tags/#{tag}",
43
- local_sha
44
- )
45
- rescue Octokit::UnprocessableEntity
46
- client.create_ref(
47
- github_repo,
48
- "tags/#{tag}",
49
- local_sha
50
- )
51
- end
52
- end
53
- end