pliny 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/pliny-new +1 -1
- data/lib/pliny/log.rb +1 -1
- data/lib/pliny/templates/endpoint_acceptance_test.erb +1 -1
- data/lib/pliny/templates/endpoint_scaffold_acceptance_test.erb +1 -1
- data/lib/pliny/templates/endpoint_test.erb +1 -1
- data/lib/pliny/templates/mediator_test.erb +2 -2
- data/lib/pliny/templates/model_test.erb +1 -1
- data/lib/pliny/templates/serializer_test.erb +1 -1
- data/lib/pliny/version.rb +1 -1
- data/lib/template/spec/endpoints/schema_spec.rb +1 -1
- data/lib/template/spec/spec_helper.rb +1 -0
- data/spec/commands/generator/base_spec.rb +48 -0
- data/spec/commands/generator/mediator_spec.rb +24 -0
- data/spec/commands/generator/migration_spec.rb +17 -0
- data/spec/commands/generator/model_spec.rb +31 -0
- data/spec/commands/generator/serializer_spec.rb +24 -0
- data/spec/log_spec.rb +8 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f4e78e4099e7a811247f8cf6bbb1d2ee8850716
|
4
|
+
data.tar.gz: a7051ec4fe9bfa69c7c817b4fa5f271be119dc1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a116d663a3409d028f39906dd30308ae5a3cf55b8b60334af914001c39f6c5281e5b329056cbd37b968132335a08566371f73a0df0ddf050f46fbda9daab45e0
|
7
|
+
data.tar.gz: d5a2a86e30b5cb2146d0c684f374d85b3d794abe212962d041ac91be861b0006cb691fe29f430b6d61e825f847860e9481df29fae57e2929c012951fdd5bc279
|
data/bin/pliny-new
CHANGED
data/lib/pliny/log.rb
CHANGED
data/lib/pliny/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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
|