pliny 0.13.0 → 0.13.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37b966bf5f40236d28804fba3d57ad356343f1b5
4
- data.tar.gz: 67053ff9193b72b45e476da6ede34581811aba4b
3
+ metadata.gz: 6f4e78e4099e7a811247f8cf6bbb1d2ee8850716
4
+ data.tar.gz: a7051ec4fe9bfa69c7c817b4fa5f271be119dc1e
5
5
  SHA512:
6
- metadata.gz: a6a9fc47cd36460cd66965491f52f6a66a6d6fa1495d043f50fa90f831f91d4a38a121136b40a1c21a1777f0f2460e9e6caa1e1137695ada1e5d73181a00cfb3
7
- data.tar.gz: b449a031bb3b3f940f3ab791b9c3ac2ec665b0c20bbed23c9e15f0d596f274072d28c29a22074d4c544777ff90446572eea916bb28718ea114d3702908910990
6
+ metadata.gz: a116d663a3409d028f39906dd30308ae5a3cf55b8b60334af914001c39f6c5281e5b329056cbd37b968132335a08566371f73a0df0ddf050f46fbda9daab45e0
7
+ data.tar.gz: d5a2a86e30b5cb2146d0c684f374d85b3d794abe212962d041ac91be861b0006cb691fe29f430b6d61e825f847860e9481df29fae57e2929c012951fdd5bc279
data/bin/pliny-new CHANGED
@@ -5,7 +5,7 @@ require_relative '../lib/pliny/commands/creator'
5
5
 
6
6
  OptionParser.new do |options|
7
7
  opts = {}
8
- options.banner = "Usage: pliny-new app-name [options]"
8
+ options.banner = "Usage: pliny-new NAME"
9
9
 
10
10
  begin
11
11
  options.parse!
data/lib/pliny/log.rb CHANGED
@@ -60,7 +60,7 @@ module Pliny
60
60
  rescue
61
61
  log_to_stream(stream, data.merge(
62
62
  at: "exception", elapsed: (Time.now - start).to_f))
63
- raise
63
+ raise $!
64
64
  end
65
65
  end
66
66
  end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Endpoints::<%= plural_class_name %> do
3
+ RSpec.describe Endpoints::<%= plural_class_name %> do
4
4
  include Committee::Test::Methods
5
5
  include Rack::Test::Methods
6
6
 
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Endpoints::<%= plural_class_name %> do
3
+ RSpec.describe Endpoints::<%= plural_class_name %> do
4
4
  include Committee::Test::Methods
5
5
  include Rack::Test::Methods
6
6
 
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Endpoints::<%= plural_class_name %> do
3
+ RSpec.describe Endpoints::<%= plural_class_name %> do
4
4
  include Rack::Test::Methods
5
5
 
6
6
  describe "GET <%= url_path %>" do
@@ -1,5 +1,5 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Mediators::<%= singular_class_name %> do
4
-
3
+ RSpec.describe Mediators::<%= singular_class_name %> do
4
+
5
5
  end
@@ -1,4 +1,4 @@
1
1
  require "spec_helper"
2
2
 
3
- describe <%= singular_class_name %> do
3
+ RSpec.describe <%= singular_class_name %> do
4
4
  end
@@ -1,4 +1,4 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Serializers::<%= singular_class_name %> do
3
+ RSpec.describe Serializers::<%= singular_class_name %> do
4
4
  end
data/lib/pliny/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pliny
2
- VERSION = "0.13.0"
2
+ VERSION = "0.13.1"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Endpoints::Schema do
3
+ RSpec.describe Endpoints::Schema do
4
4
  include Rack::Test::Methods
5
5
 
6
6
  let(:schema_filename) { "#{Config.root}/schema/schema.json" }
@@ -35,6 +35,7 @@ RSpec.configure do |config|
35
35
  DatabaseCleaner.clean
36
36
  end
37
37
 
38
+ config.disable_monkey_patching!
38
39
  config.expect_with :minitest
39
40
  config.run_all_when_everything_filtered = true
40
41
  config.filter_run :focus
@@ -69,4 +69,52 @@ describe Pliny::Commands::Generator::Base do
69
69
  end
70
70
  end
71
71
  end
72
+
73
+ describe '#display' do
74
+ it 'puts given message into stream' do
75
+ stream = StringIO.new
76
+ message = 'Hello world'
77
+ generator('resource_history', {}, stream).display(message)
78
+
79
+ assert_includes stream.string, message
80
+ end
81
+ end
82
+
83
+ describe '#render_template' do
84
+ it 'renders template into a string' do
85
+ template = generator('resource_history').render_template('endpoint.erb')
86
+ assert_match /module Endpoints/, template
87
+ end
88
+ end
89
+
90
+ describe '#write_template' do
91
+ let(:destination_path) { File.join(Dir.mktmpdir, 'endpoint.rb') }
92
+
93
+ before do
94
+ generator('resource_history').write_template('endpoint.erb', destination_path)
95
+ end
96
+
97
+ it 'renders given template into a file by given path' do
98
+ assert File.exist?(destination_path)
99
+ assert_match /module Endpoints/, File.read(destination_path)
100
+ end
101
+ end
102
+
103
+ describe '#write_file' do
104
+ let(:destination_path) { File.join(Dir.mktmpdir, 'foo.txt') }
105
+
106
+ before do
107
+ generator('resource_history').write_file(destination_path) do
108
+ 'Hello world'
109
+ end
110
+ end
111
+
112
+ it 'creates a file by given path' do
113
+ assert File.exist?(destination_path)
114
+ end
115
+
116
+ it 'writes given content into a file' do
117
+ assert_match /Hello world/, File.read(destination_path)
118
+ end
119
+ end
72
120
  end
@@ -0,0 +1,24 @@
1
+ require 'pliny/commands/generator/mediator'
2
+ require 'spec_helper'
3
+
4
+ describe Pliny::Commands::Generator::Mediator do
5
+ subject { described_class.new('creator', {}, StringIO.new) }
6
+
7
+ around do |example|
8
+ Dir.chdir(Dir.mktmpdir, &example)
9
+ end
10
+
11
+ describe '#create' do
12
+ it 'creates a mediator file' do
13
+ subject.create
14
+ assert File.exist?('lib/mediators/creator.rb')
15
+ end
16
+ end
17
+
18
+ describe '#create_test' do
19
+ it 'creates a mediator test file' do
20
+ subject.create_test
21
+ assert File.exist?('spec/mediators/creator_spec.rb')
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ require 'pliny/commands/generator/migration'
2
+ require 'spec_helper'
3
+
4
+ describe Pliny::Commands::Generator::Migration do
5
+ subject { described_class.new('create_artists', {}, StringIO.new) }
6
+
7
+ around do |example|
8
+ Dir.chdir(Dir.mktmpdir, &example)
9
+ end
10
+
11
+ describe '#create' do
12
+ it 'creates a migration file' do
13
+ subject.create
14
+ assert_equal 1, Dir.glob("db/migrate/*_create_artists.rb").size
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,31 @@
1
+ require 'pliny/commands/generator/model'
2
+ require 'spec_helper'
3
+
4
+ describe Pliny::Commands::Generator::Model do
5
+ subject { described_class.new('artist', {}, StringIO.new) }
6
+
7
+ around do |example|
8
+ Dir.chdir(Dir.mktmpdir, &example)
9
+ end
10
+
11
+ describe '#create' do
12
+ it 'creates a model file' do
13
+ subject.create
14
+ assert File.exist?('lib/models/artist.rb')
15
+ end
16
+ end
17
+
18
+ describe '#create_migration' do
19
+ it 'creates a migration file' do
20
+ subject.create_migration
21
+ assert_equal 1, Dir.glob("db/migrate/*_create_artists.rb").size
22
+ end
23
+ end
24
+
25
+ describe '#create_test' do
26
+ it 'creates a model test file' do
27
+ subject.create_test
28
+ assert File.exist?('spec/models/artist_spec.rb')
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,24 @@
1
+ require 'pliny/commands/generator/serializer'
2
+ require 'spec_helper'
3
+
4
+ describe Pliny::Commands::Generator::Serializer do
5
+ subject { described_class.new('artist', {}, StringIO.new) }
6
+
7
+ around do |example|
8
+ Dir.chdir(Dir.mktmpdir, &example)
9
+ end
10
+
11
+ describe '#create' do
12
+ it 'creates a serializer file' do
13
+ subject.create
14
+ assert File.exist?('lib/serializers/artist.rb')
15
+ end
16
+ end
17
+
18
+ describe '#create_test' do
19
+ it 'creates a serializer test file' do
20
+ subject.create_test
21
+ assert File.exist?('spec/serializers/artist_spec.rb')
22
+ end
23
+ end
24
+ end
data/spec/log_spec.rb CHANGED
@@ -16,6 +16,14 @@ describe Pliny::Log do
16
16
  Pliny.log(foo: "bar", baz: 42)
17
17
  end
18
18
 
19
+ it "re-raises errors" do
20
+ assert_raises(RuntimeError) do
21
+ Pliny.log(foo: "bar") do
22
+ raise RuntimeError
23
+ end
24
+ end
25
+ end
26
+
19
27
  it "supports blocks to log stages and elapsed" do
20
28
  mock(@io).print "foo=bar at=start\n"
21
29
  mock(@io).print "foo=bar at=finish elapsed=0.000\n"
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.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur Leach
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-23 00:00:00.000000000 Z
12
+ date: 2015-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -439,7 +439,11 @@ files:
439
439
  - spec/commands/creator_spec.rb
440
440
  - spec/commands/generator/base_spec.rb
441
441
  - spec/commands/generator/endpoint_spec.rb
442
+ - spec/commands/generator/mediator_spec.rb
443
+ - spec/commands/generator/migration_spec.rb
444
+ - spec/commands/generator/model_spec.rb
442
445
  - spec/commands/generator/schema_spec.rb
446
+ - spec/commands/generator/serializer_spec.rb
443
447
  - spec/commands/generator_spec.rb
444
448
  - spec/commands/updater_spec.rb
445
449
  - spec/db_support_spec.rb
@@ -478,7 +482,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
478
482
  version: '0'
479
483
  requirements: []
480
484
  rubyforge_project:
481
- rubygems_version: 2.4.3
485
+ rubygems_version: 2.4.5
482
486
  signing_key:
483
487
  specification_version: 4
484
488
  summary: Basic tooling to support API apps in Sinatra