pliny 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +1 -0
- data/lib/pliny/commands/creator.rb +1 -0
- data/lib/pliny/commands/generator/base.rb +3 -3
- data/lib/pliny/commands/generator/endpoint.rb +1 -1
- data/lib/pliny/commands/generator/serializer.rb +2 -2
- data/lib/pliny/errors.rb +1 -1
- data/lib/pliny/tasks/db.rake +5 -9
- data/lib/pliny/templates/endpoint_test.erb +0 -5
- data/lib/pliny/version.rb +1 -1
- data/template/Gemfile +1 -0
- data/template/Gemfile.lock +1 -0
- data/template/bin/setup +3 -1
- data/template/lib/endpoints/base.rb +1 -0
- data/template/spec/spec_helper.rb +7 -4
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWRlYjI3YjI4NTRlZGYzMWQ1NTEzYjQ4ZDRmNTkyNTk0OGNiMzNlZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjVlZTZlNDhmODRhZTY1MDNiZDJlOGQyYmViY2U3NmUxYTNhMzIzYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDNjYTczMGI3YTk2YzhlZTcxYTk5ZWYxOGUzZTVkYzBiYTM3OTEzMmRjZWRm
|
10
|
+
ZDg2ZTYwYTkxOTc5NzI0NjVkNGZkMjRkMjY1ZDVjNGU5MzNmZDc1ZDk1ODFl
|
11
|
+
YzU4N2E2ZjU2OTc3ZWQ0YjI5ODA5ZjNjZTJiOTNkYzIyZTk2ZGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGNhMjNiOTU3ZTJkYTBjMWZkMmVkOWE2NmQ0NWExZWJmZGZmZmU5MmY1MGQ3
|
14
|
+
MTM2Zjg4ODNkYmJmMTg0OTI2YTEwMjg1ZDAzNDAyZDUyOThhOGJmMGY2Njc5
|
15
|
+
Nzc5N2Y0MWM3YzEyYTE4ZDUyYTkzYWU1NzhkNzJmZDc2NDE2MjA=
|
data/README.md
CHANGED
@@ -16,11 +16,11 @@ module Pliny::Commands
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def singular_class_name
|
19
|
-
name.
|
19
|
+
name.tr('-', '_').singularize.camelize
|
20
20
|
end
|
21
21
|
|
22
22
|
def plural_class_name
|
23
|
-
name.
|
23
|
+
name.tr('-', '_').pluralize.camelize
|
24
24
|
end
|
25
25
|
|
26
26
|
def field_name
|
@@ -32,7 +32,7 @@ module Pliny::Commands
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def table_name
|
35
|
-
name.tableize.
|
35
|
+
name.tableize.tr('/', '_')
|
36
36
|
end
|
37
37
|
|
38
38
|
def display(msg)
|
@@ -4,14 +4,14 @@ module Pliny::Commands
|
|
4
4
|
class Generator
|
5
5
|
class Serializer < Base
|
6
6
|
def create
|
7
|
-
serializer = "./lib/serializers/#{
|
7
|
+
serializer = "./lib/serializers/#{field_name}.rb"
|
8
8
|
render_template('serializer.erb', serializer,
|
9
9
|
singular_class_name: singular_class_name)
|
10
10
|
display "created serializer file #{serializer}"
|
11
11
|
end
|
12
12
|
|
13
13
|
def create_test
|
14
|
-
test = "./spec/serializers/#{
|
14
|
+
test = "./spec/serializers/#{field_name}_spec.rb"
|
15
15
|
render_template('serializer_test.erb', test,
|
16
16
|
singular_class_name: singular_class_name)
|
17
17
|
display "created test #{test}"
|
data/lib/pliny/errors.rb
CHANGED
@@ -21,7 +21,7 @@ module Pliny
|
|
21
21
|
def initialize(message = nil, id = nil, status = nil)
|
22
22
|
meta = Pliny::Errors::META[self.class]
|
23
23
|
message = message || meta[1] + "."
|
24
|
-
id = id || meta[1].downcase.
|
24
|
+
id = id || meta[1].downcase.tr(' ', '_').to_sym
|
25
25
|
@status = status || meta[0]
|
26
26
|
super(message, id)
|
27
27
|
end
|
data/lib/pliny/tasks/db.rake
CHANGED
@@ -78,15 +78,11 @@ namespace :db do
|
|
78
78
|
namespace :schema do
|
79
79
|
desc "Load the database schema"
|
80
80
|
task :load do
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
puts "Loaded `#{name_from_uri(database_url)}`"
|
87
|
-
end
|
88
|
-
else
|
89
|
-
puts "Skipped schema load, schema.sql not present"
|
81
|
+
schema = File.read("./db/schema.sql")
|
82
|
+
database_urls.each do |database_url|
|
83
|
+
db = Sequel.connect(database_url)
|
84
|
+
db.run(schema)
|
85
|
+
puts "Loaded `#{name_from_uri(database_url)}`"
|
90
86
|
end
|
91
87
|
end
|
92
88
|
|
data/lib/pliny/version.rb
CHANGED
data/template/Gemfile
CHANGED
data/template/Gemfile.lock
CHANGED
data/template/bin/setup
CHANGED
@@ -9,7 +9,9 @@ function main {
|
|
9
9
|
}
|
10
10
|
|
11
11
|
function add_new_env_vars {
|
12
|
-
|
12
|
+
# create .env and set perms if it does not exist
|
13
|
+
[ ! -f .env ] && { touch .env ; chmod 0600 .env ; }
|
14
|
+
|
13
15
|
export IFS=$'\n'
|
14
16
|
for var in `cat .env.sample`; do
|
15
17
|
key="${var%%=*}" # get var key
|
@@ -10,17 +10,20 @@ ENV["RACK_ENV"] = "test"
|
|
10
10
|
require "bundler"
|
11
11
|
Bundler.require(:default, :test)
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
require 'dotenv'
|
14
|
+
Dotenv.load('.env.test')
|
15
15
|
|
16
16
|
require_relative "../lib/initializer"
|
17
17
|
|
18
|
-
DatabaseCleaner.strategy = :transaction
|
19
|
-
|
20
18
|
# pull in test initializers
|
21
19
|
Pliny::Utils.require_glob("#{Config.root}/spec/support/**/*.rb")
|
22
20
|
|
23
21
|
RSpec.configure do |config|
|
22
|
+
config.before :suite do
|
23
|
+
DatabaseCleaner.clean_with(:truncation)
|
24
|
+
DatabaseCleaner.strategy = :transaction
|
25
|
+
end
|
26
|
+
|
24
27
|
config.before :all do
|
25
28
|
load('db/seeds.rb') if File.exist?('db/seeds.rb')
|
26
29
|
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.
|
4
|
+
version: 0.4.0
|
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: 2014-09-
|
12
|
+
date: 2014-09-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -271,6 +271,20 @@ dependencies:
|
|
271
271
|
- - ! '>='
|
272
272
|
- !ruby/object:Gem::Version
|
273
273
|
version: 0.7.1
|
274
|
+
- !ruby/object:Gem::Dependency
|
275
|
+
name: pry
|
276
|
+
requirement: !ruby/object:Gem::Requirement
|
277
|
+
requirements:
|
278
|
+
- - ! '>='
|
279
|
+
- !ruby/object:Gem::Version
|
280
|
+
version: '0'
|
281
|
+
type: :development
|
282
|
+
prerelease: false
|
283
|
+
version_requirements: !ruby/object:Gem::Requirement
|
284
|
+
requirements:
|
285
|
+
- - ! '>='
|
286
|
+
- !ruby/object:Gem::Version
|
287
|
+
version: '0'
|
274
288
|
description: Pliny is a set of base classes and helpers to help developers write excellent
|
275
289
|
APIs in Sinatra
|
276
290
|
email:
|