pliny 0.0.1 → 0.0.3
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 +6 -14
- data/README.md +11 -1
- data/bin/pliny-generate +1 -2
- data/bin/pliny-new +1 -2
- data/lib/pliny/version.rb +1 -1
- data/template/.env.sample +3 -0
- data/template/.env.test +3 -0
- data/template/.gitignore +1 -0
- data/template/.rspec +2 -0
- data/template/.ruby-version +1 -0
- data/template/Gemfile +29 -0
- data/template/Gemfile.lock +101 -0
- data/template/LICENSE +19 -0
- data/template/Procfile +1 -0
- data/template/README.md +5 -0
- data/template/Rakefile +14 -0
- data/template/bin/console +9 -0
- data/template/bin/run +7 -0
- data/template/bin/setup +26 -0
- data/template/config.ru +8 -0
- data/template/config/config.rb +32 -0
- data/template/config/initializers/honeybadger.rb +3 -0
- data/template/config/puma.rb +15 -0
- data/template/db/schema.sql +42 -0
- data/template/docs/schema/meta.json +9 -0
- data/template/docs/schema/schemata/.gitkeep +0 -0
- data/template/lib/endpoints/base.rb +17 -0
- data/template/lib/endpoints/root.rb +7 -0
- data/template/lib/initializer.rb +46 -0
- data/template/lib/mediators/base.rb +7 -0
- data/template/lib/routes.rb +18 -0
- data/template/lib/serializers/base.rb +17 -0
- data/template/spec/spec_helper.rb +45 -0
- data/template/spec/support/log.rb +7 -0
- metadata +68 -39
checksums.yaml
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
metadata.gz: !binary |-
|
|
9
|
-
ZDdjMWFhNjA4OGViMzAyZTE2ODkwYWRjZmZjY2NjYTQzMWM5N2NkYjY0OGM4
|
|
10
|
-
MjA5ZmM1YTg3NzdkNDk4MjU3YTg5M2I5MDYzZjlkN2Y2NjU2MjIyOGIyMzZm
|
|
11
|
-
MzEyNGIwODQ2MTAzZGEyZjRjM2Y5MWYzODE2ZWZkNGFkOTljMDU=
|
|
12
|
-
data.tar.gz: !binary |-
|
|
13
|
-
NjE2ZWI1ZDdjM2QyMDgzZDljN2RmNDNiN2NjOGE3NWUxNTc4NmJmM2UwOWMx
|
|
14
|
-
YzAzM2ViMzJjY2I2MWEwNTE5M2I0Y2U5MTY2ZDMzYjk2YTAwM2Q4MjViMDI4
|
|
15
|
-
NDYyOTk0NTRhNDUzZjUxYmExY2JiNDM3NWZmNDYwYTU4NWEyZmY=
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: cfe2c266b812feb72f369c7f4948d9e598ee887e
|
|
4
|
+
data.tar.gz: fb25f44da90206ceffa0b43830d6c4c076778bfc
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 780a91278cdd16c28c911f96be667b5f399b03ec13c2707d44fe823725e9fd170e1351af0b676a60efae270e45150987f9a4f2b7e5637d607ac6196f003ccb83
|
|
7
|
+
data.tar.gz: 06e9501612f28d03c56cf03ff08057014626fa9229522378cc5c54bed5c2d4963b6a1da4f132e6fea15e59c5a734c2d673996abb090ffd4c850510f285ea058f
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Opinionated template Sinatra app for writing excellent APIs in Ruby.
|
|
4
4
|
|
|
5
|
-
[](https://travis-ci.org/interagent/pliny)
|
|
6
6
|
|
|
7
7
|
It bundles some of the patterns we like to develop these apps:
|
|
8
8
|
|
|
@@ -87,6 +87,16 @@ Or to run a single test suite:
|
|
|
87
87
|
bundle exec rspec spec/acceptance/artists_spec.rb
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
## Development
|
|
91
|
+
|
|
92
|
+
Run tests:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
bundle install
|
|
96
|
+
git submodule update --init
|
|
97
|
+
rake
|
|
98
|
+
```
|
|
99
|
+
|
|
90
100
|
## Meta
|
|
91
101
|
|
|
92
102
|
Created by Brandur Leach and Pedro Belo.
|
data/bin/pliny-generate
CHANGED
data/bin/pliny-new
CHANGED
data/lib/pliny/version.rb
CHANGED
data/template/.env.test
ADDED
data/template/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.env
|
data/template/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.1.1
|
data/template/Gemfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
ruby "2.1.1"
|
|
3
|
+
|
|
4
|
+
gem "honeybadger"
|
|
5
|
+
gem "multi_json"
|
|
6
|
+
gem "oj"
|
|
7
|
+
gem "pg"
|
|
8
|
+
gem "pliny"
|
|
9
|
+
gem "puma"
|
|
10
|
+
gem "rack-ssl"
|
|
11
|
+
gem "rake"
|
|
12
|
+
gem "sequel"
|
|
13
|
+
gem "sequel_pg", require: "sequel"
|
|
14
|
+
gem "sinatra", require: "sinatra/base"
|
|
15
|
+
gem "sinatra-contrib", require: ["sinatra/namespace", "sinatra/reloader"]
|
|
16
|
+
gem "sinatra-router"
|
|
17
|
+
|
|
18
|
+
group :development do
|
|
19
|
+
gem "foreman"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
group :test do
|
|
23
|
+
gem "committee"
|
|
24
|
+
gem "database_cleaner"
|
|
25
|
+
gem "rack-test"
|
|
26
|
+
gem "rr", require: false
|
|
27
|
+
gem "rspec-core"
|
|
28
|
+
gem "rspec-expectations"
|
|
29
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
activesupport (4.1.1)
|
|
5
|
+
i18n (~> 0.6, >= 0.6.9)
|
|
6
|
+
json (~> 1.7, >= 1.7.7)
|
|
7
|
+
minitest (~> 5.1)
|
|
8
|
+
thread_safe (~> 0.1)
|
|
9
|
+
tzinfo (~> 1.1)
|
|
10
|
+
backports (3.6.0)
|
|
11
|
+
committee (0.4.13)
|
|
12
|
+
multi_json (> 0.0)
|
|
13
|
+
rack (> 0.0)
|
|
14
|
+
database_cleaner (1.2.0)
|
|
15
|
+
diff-lcs (1.2.5)
|
|
16
|
+
dotenv (0.7.0)
|
|
17
|
+
erubis (2.7.0)
|
|
18
|
+
foreman (0.67.0)
|
|
19
|
+
dotenv (~> 0.7.0)
|
|
20
|
+
thor (~> 0.17.0)
|
|
21
|
+
honeybadger (1.13.0)
|
|
22
|
+
json
|
|
23
|
+
http_accept (0.1.5)
|
|
24
|
+
i18n (0.6.9)
|
|
25
|
+
json (1.8.1)
|
|
26
|
+
minitest (5.3.4)
|
|
27
|
+
multi_json (1.10.1)
|
|
28
|
+
oj (2.9.0)
|
|
29
|
+
pg (0.17.1)
|
|
30
|
+
pliny (0.0.1)
|
|
31
|
+
activesupport (~> 4.1, >= 4.1.0)
|
|
32
|
+
http_accept (~> 0.1, >= 0.1.5)
|
|
33
|
+
multi_json (~> 1.9, >= 1.9.3)
|
|
34
|
+
pg (~> 0.17, >= 0.17.1)
|
|
35
|
+
prmd (~> 0.1, >= 0.1.1)
|
|
36
|
+
sequel (~> 4.9, >= 4.9.0)
|
|
37
|
+
sinatra (~> 1.4, >= 1.4.5)
|
|
38
|
+
sinatra-router (~> 0.2, >= 0.2.3)
|
|
39
|
+
prmd (0.3.2)
|
|
40
|
+
erubis (~> 2.7)
|
|
41
|
+
puma (2.8.2)
|
|
42
|
+
rack (>= 1.1, < 2.0)
|
|
43
|
+
rack (1.5.2)
|
|
44
|
+
rack-protection (1.5.3)
|
|
45
|
+
rack
|
|
46
|
+
rack-ssl (1.4.1)
|
|
47
|
+
rack
|
|
48
|
+
rack-test (0.6.2)
|
|
49
|
+
rack (>= 1.0)
|
|
50
|
+
rake (10.3.1)
|
|
51
|
+
rr (1.1.2)
|
|
52
|
+
rspec-core (2.14.8)
|
|
53
|
+
rspec-expectations (2.14.5)
|
|
54
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
55
|
+
sequel (4.10.0)
|
|
56
|
+
sequel_pg (1.6.9)
|
|
57
|
+
pg (>= 0.8.0)
|
|
58
|
+
sequel (>= 3.39.0)
|
|
59
|
+
sinatra (1.4.5)
|
|
60
|
+
rack (~> 1.4)
|
|
61
|
+
rack-protection (~> 1.4)
|
|
62
|
+
tilt (~> 1.3, >= 1.3.4)
|
|
63
|
+
sinatra-contrib (1.4.2)
|
|
64
|
+
backports (>= 2.0)
|
|
65
|
+
multi_json
|
|
66
|
+
rack-protection
|
|
67
|
+
rack-test
|
|
68
|
+
sinatra (~> 1.4.0)
|
|
69
|
+
tilt (~> 1.3)
|
|
70
|
+
sinatra-router (0.2.3)
|
|
71
|
+
sinatra (~> 1.4)
|
|
72
|
+
thor (0.17.0)
|
|
73
|
+
thread_safe (0.3.3)
|
|
74
|
+
tilt (1.4.1)
|
|
75
|
+
tzinfo (1.1.0)
|
|
76
|
+
thread_safe (~> 0.1)
|
|
77
|
+
|
|
78
|
+
PLATFORMS
|
|
79
|
+
ruby
|
|
80
|
+
|
|
81
|
+
DEPENDENCIES
|
|
82
|
+
committee
|
|
83
|
+
database_cleaner
|
|
84
|
+
foreman
|
|
85
|
+
honeybadger
|
|
86
|
+
multi_json
|
|
87
|
+
oj
|
|
88
|
+
pg
|
|
89
|
+
pliny
|
|
90
|
+
puma
|
|
91
|
+
rack-ssl
|
|
92
|
+
rack-test
|
|
93
|
+
rake
|
|
94
|
+
rr
|
|
95
|
+
rspec-core
|
|
96
|
+
rspec-expectations
|
|
97
|
+
sequel
|
|
98
|
+
sequel_pg
|
|
99
|
+
sinatra
|
|
100
|
+
sinatra-contrib
|
|
101
|
+
sinatra-router
|
data/template/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
data/template/Procfile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
web: bundle exec puma --config config/puma.rb config.ru
|
data/template/README.md
ADDED
data/template/Rakefile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require "pliny/tasks"
|
|
2
|
+
|
|
3
|
+
# Add your rake tasks to lib/tasks!
|
|
4
|
+
Dir["./lib/tasks/*.rake"].each { |task| load task }
|
|
5
|
+
|
|
6
|
+
task :spec do
|
|
7
|
+
require "rspec/core"
|
|
8
|
+
code = RSpec::Core::Runner.run(
|
|
9
|
+
["./spec"],
|
|
10
|
+
$stderr, $stdout)
|
|
11
|
+
exit(code) unless code == 0
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
task :default => :spec
|
data/template/bin/run
ADDED
data/template/bin/setup
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
function main {
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
add_new_env_vars
|
|
7
|
+
bundle install
|
|
8
|
+
bundle exec rake db:setup db:schema:load db:migrate
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function add_new_env_vars {
|
|
12
|
+
touch .env
|
|
13
|
+
export IFS=$'\n'
|
|
14
|
+
for var in `cat .env.sample`; do
|
|
15
|
+
key="${var%%=*}" # get var key
|
|
16
|
+
var=`eval echo $var` # generate dynamic values
|
|
17
|
+
|
|
18
|
+
# If .env doesn't contain this env key, add it
|
|
19
|
+
if ! `grep -qLE "^$key=" .env`; then
|
|
20
|
+
echo "Adding $key to .env"
|
|
21
|
+
echo $var >> .env
|
|
22
|
+
fi
|
|
23
|
+
done
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
main
|
data/template/config.ru
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require "pliny/config_helpers"
|
|
2
|
+
|
|
3
|
+
# Access all config keys like the following:
|
|
4
|
+
#
|
|
5
|
+
# Config.database_url
|
|
6
|
+
#
|
|
7
|
+
# Each accessor corresponds directly to an ENV key, which has the same name
|
|
8
|
+
# except upcased, i.e. `DATABASE_URL`.
|
|
9
|
+
#
|
|
10
|
+
# Note that *all* keys will come out as strings even if the override was a
|
|
11
|
+
# different type. Make sure to typecast any values that need to be something
|
|
12
|
+
# else (i.e. `.to_i`).
|
|
13
|
+
module Config
|
|
14
|
+
extend Pliny::ConfigHelpers
|
|
15
|
+
|
|
16
|
+
# Mandatory -- exception is raised for these variables when missing.
|
|
17
|
+
mandatory \
|
|
18
|
+
:database_url
|
|
19
|
+
|
|
20
|
+
# Optional -- value is returned or `nil` if it wasn't present.
|
|
21
|
+
optional \
|
|
22
|
+
:placeholder
|
|
23
|
+
|
|
24
|
+
# Override -- value is returned or the set default. Remember to typecast.
|
|
25
|
+
override \
|
|
26
|
+
db_pool: 5,
|
|
27
|
+
port: 5000,
|
|
28
|
+
puma_max_threads: 16,
|
|
29
|
+
puma_min_threads: 1,
|
|
30
|
+
puma_workers: 3,
|
|
31
|
+
rack_env: "development"
|
|
32
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "./config/config"
|
|
2
|
+
|
|
3
|
+
environment Config.rack_env
|
|
4
|
+
port Config.port
|
|
5
|
+
quiet
|
|
6
|
+
threads Config.puma_min_threads.to_i, Config.puma_max_threads.to_i
|
|
7
|
+
workers Config.puma_workers.to_i
|
|
8
|
+
|
|
9
|
+
on_worker_boot do
|
|
10
|
+
# force Sequel's thread pool to be refreshed
|
|
11
|
+
Sequel::DATABASES.each { |db| db.disconnect }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
preload_app!
|
|
15
|
+
Thread.abort_on_exception = true
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
--
|
|
2
|
+
-- PostgreSQL database dump
|
|
3
|
+
--
|
|
4
|
+
|
|
5
|
+
SET statement_timeout = 0;
|
|
6
|
+
SET client_encoding = 'UTF8';
|
|
7
|
+
SET standard_conforming_strings = on;
|
|
8
|
+
SET check_function_bodies = false;
|
|
9
|
+
SET client_min_messages = warning;
|
|
10
|
+
|
|
11
|
+
--
|
|
12
|
+
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
|
|
13
|
+
--
|
|
14
|
+
|
|
15
|
+
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
--
|
|
19
|
+
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
|
|
20
|
+
--
|
|
21
|
+
|
|
22
|
+
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
--
|
|
26
|
+
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
|
|
27
|
+
--
|
|
28
|
+
|
|
29
|
+
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
--
|
|
33
|
+
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: -
|
|
34
|
+
--
|
|
35
|
+
|
|
36
|
+
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
--
|
|
40
|
+
-- PostgreSQL database dump complete
|
|
41
|
+
--
|
|
42
|
+
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Endpoints
|
|
2
|
+
# The base class for all Sinatra-based endpoints. Use sparingly.
|
|
3
|
+
class Base < Sinatra::Base
|
|
4
|
+
register Pliny::Extensions::Instruments
|
|
5
|
+
register Sinatra::Namespace
|
|
6
|
+
|
|
7
|
+
configure :development do
|
|
8
|
+
register Sinatra::Reloader
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
not_found do
|
|
12
|
+
content_type :json
|
|
13
|
+
status 404
|
|
14
|
+
"{}"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Initializer
|
|
2
|
+
def self.run
|
|
3
|
+
require_config
|
|
4
|
+
initialize_database
|
|
5
|
+
require_lib
|
|
6
|
+
require_initializers
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.require_config
|
|
10
|
+
require! "config/config"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.initialize_database
|
|
14
|
+
Sequel.connect(Config.database_url, max_connections: Config.db_pool)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.require_lib
|
|
18
|
+
require! %w(
|
|
19
|
+
lib/endpoints/base
|
|
20
|
+
lib/endpoints/**/*
|
|
21
|
+
lib/mediators/base
|
|
22
|
+
lib/mediators/**/*
|
|
23
|
+
lib/models/**/*
|
|
24
|
+
lib/routes
|
|
25
|
+
lib/serializers/base
|
|
26
|
+
lib/serializers/**/*.rb
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.require_initializers
|
|
31
|
+
Pliny::Utils.require_glob("#{root}/config/initializers/*.rb")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.require!(globs)
|
|
35
|
+
globs = [globs] unless globs.is_a?(Array)
|
|
36
|
+
globs.each do |f|
|
|
37
|
+
Pliny::Utils.require_glob("#{root}/#{f}.rb")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.root
|
|
42
|
+
@@root ||= File.expand_path("../../", __FILE__)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
Initializer.run
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Routes = Rack::Builder.new do
|
|
2
|
+
use Pliny::Middleware::RescueErrors unless Config.rack_env == "development"
|
|
3
|
+
use Honeybadger::Rack
|
|
4
|
+
use Pliny::Middleware::CORS
|
|
5
|
+
use Pliny::Middleware::RequestID
|
|
6
|
+
use Pliny::Middleware::RequestStore, store: Pliny::RequestStore
|
|
7
|
+
use Pliny::Middleware::Timeout, timeout: 45
|
|
8
|
+
use Rack::Deflater
|
|
9
|
+
use Rack::MethodOverride
|
|
10
|
+
use Rack::SSL if Config.rack_env == "production"
|
|
11
|
+
|
|
12
|
+
use Pliny::Router do
|
|
13
|
+
# mount all endpoints here
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# root app; but will also handle some defaults like 404
|
|
17
|
+
run Endpoints::Root
|
|
18
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class Serializers
|
|
2
|
+
class Base
|
|
3
|
+
@@structures = {}
|
|
4
|
+
|
|
5
|
+
def self.structure(type, &blk)
|
|
6
|
+
@@structures["#{self.name}::#{type}"] = blk
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def initialize(type)
|
|
10
|
+
@type = type
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def serialize(object)
|
|
14
|
+
@@structures["#{self.class.name}::#{@type}"].call(object)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
|
4
|
+
# loaded once.
|
|
5
|
+
#
|
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
7
|
+
#
|
|
8
|
+
ENV["RACK_ENV"] = "test"
|
|
9
|
+
|
|
10
|
+
require "bundler"
|
|
11
|
+
Bundler.require(:default, :test)
|
|
12
|
+
|
|
13
|
+
require "rr"
|
|
14
|
+
|
|
15
|
+
root = File.expand_path("../../", __FILE__)
|
|
16
|
+
ENV.update(Pliny::Utils.parse_env("#{root}/.env.test"))
|
|
17
|
+
|
|
18
|
+
require_relative "../lib/initializer"
|
|
19
|
+
|
|
20
|
+
DatabaseCleaner.strategy = :transaction
|
|
21
|
+
|
|
22
|
+
# pull in test initializers
|
|
23
|
+
Pliny::Utils.require_glob("#{Initializer.root}/spec/support/**/*.rb")
|
|
24
|
+
|
|
25
|
+
RSpec.configure do |config|
|
|
26
|
+
config.mock_framework = :rr
|
|
27
|
+
|
|
28
|
+
config.before :each do
|
|
29
|
+
DatabaseCleaner.start
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
config.after :each do
|
|
33
|
+
DatabaseCleaner.clean
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
37
|
+
config.run_all_when_everything_filtered = true
|
|
38
|
+
config.filter_run :focus
|
|
39
|
+
|
|
40
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
41
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
42
|
+
# the seed, which is printed after each run.
|
|
43
|
+
# --seed 1234
|
|
44
|
+
config.order = 'random'
|
|
45
|
+
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.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brandur Leach
|
|
@@ -9,180 +9,180 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-
|
|
12
|
+
date: 2014-06-03 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
174
|
- !ruby/object:Gem::Dependency
|
|
175
175
|
name: rake
|
|
176
176
|
requirement: !ruby/object:Gem::Requirement
|
|
177
177
|
requirements:
|
|
178
|
-
- -
|
|
178
|
+
- - ">="
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
180
|
version: 0.8.7
|
|
181
181
|
type: :development
|
|
182
182
|
prerelease: false
|
|
183
183
|
version_requirements: !ruby/object:Gem::Requirement
|
|
184
184
|
requirements:
|
|
185
|
-
- -
|
|
185
|
+
- - ">="
|
|
186
186
|
- !ruby/object:Gem::Version
|
|
187
187
|
version: 0.8.7
|
|
188
188
|
description: Pliny is a set of base classes and helpers to help developers write excellent
|
|
@@ -232,6 +232,35 @@ files:
|
|
|
232
232
|
- lib/pliny/templates/serializer_test.erb
|
|
233
233
|
- lib/pliny/utils.rb
|
|
234
234
|
- lib/pliny/version.rb
|
|
235
|
+
- template/.env.sample
|
|
236
|
+
- template/.env.test
|
|
237
|
+
- template/.gitignore
|
|
238
|
+
- template/.rspec
|
|
239
|
+
- template/.ruby-version
|
|
240
|
+
- template/Gemfile
|
|
241
|
+
- template/Gemfile.lock
|
|
242
|
+
- template/LICENSE
|
|
243
|
+
- template/Procfile
|
|
244
|
+
- template/README.md
|
|
245
|
+
- template/Rakefile
|
|
246
|
+
- template/bin/console
|
|
247
|
+
- template/bin/run
|
|
248
|
+
- template/bin/setup
|
|
249
|
+
- template/config.ru
|
|
250
|
+
- template/config/config.rb
|
|
251
|
+
- template/config/initializers/honeybadger.rb
|
|
252
|
+
- template/config/puma.rb
|
|
253
|
+
- template/db/schema.sql
|
|
254
|
+
- template/docs/schema/meta.json
|
|
255
|
+
- template/docs/schema/schemata/.gitkeep
|
|
256
|
+
- template/lib/endpoints/base.rb
|
|
257
|
+
- template/lib/endpoints/root.rb
|
|
258
|
+
- template/lib/initializer.rb
|
|
259
|
+
- template/lib/mediators/base.rb
|
|
260
|
+
- template/lib/routes.rb
|
|
261
|
+
- template/lib/serializers/base.rb
|
|
262
|
+
- template/spec/spec_helper.rb
|
|
263
|
+
- template/spec/support/log.rb
|
|
235
264
|
- test/commands/creator_test.rb
|
|
236
265
|
- test/commands/generator_test.rb
|
|
237
266
|
- test/errors_test.rb
|
|
@@ -257,17 +286,17 @@ require_paths:
|
|
|
257
286
|
- lib
|
|
258
287
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
259
288
|
requirements:
|
|
260
|
-
- -
|
|
289
|
+
- - ">="
|
|
261
290
|
- !ruby/object:Gem::Version
|
|
262
291
|
version: '0'
|
|
263
292
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
293
|
requirements:
|
|
265
|
-
- -
|
|
294
|
+
- - ">="
|
|
266
295
|
- !ruby/object:Gem::Version
|
|
267
296
|
version: '0'
|
|
268
297
|
requirements: []
|
|
269
298
|
rubyforge_project:
|
|
270
|
-
rubygems_version: 2.
|
|
299
|
+
rubygems_version: 2.2.1
|
|
271
300
|
signing_key:
|
|
272
301
|
specification_version: 4
|
|
273
302
|
summary: Basic tooling to support API apps in Sinatra
|