grape-starter 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.travis.yml +4 -3
- data/Gemfile +2 -1
- data/Rakefile +2 -1
- data/grape-starter.gemspec +3 -3
- data/lib/starter.rb +1 -0
- data/lib/starter/builder.rb +2 -1
- data/lib/starter/builder/base_file.rb +1 -0
- data/lib/starter/builder/file_foo.rb +1 -0
- data/lib/starter/builder/names.rb +1 -0
- data/lib/starter/builder/template_endpoints.rb +11 -10
- data/lib/starter/builder/template_files.rb +1 -0
- data/lib/starter/rake/grape_tasks.rb +1 -0
- data/lib/starter/version.rb +2 -1
- data/template/Gemfile +4 -5
- data/template/config/application.rb +1 -2
- data/template/public/README +1 -0
- metadata +16 -16
- data/template/public/redoc.html +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9a107b2658802ec45e956daba099eaf30ddb37c
|
4
|
+
data.tar.gz: c40cf86001873ac609536d7abbe6c65af5a119d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38fe1d590985b01caea0ed5dc3a33a786b257ed1fe6707f3ab2d6b288decee3f79d6c80a49647fd0a2e657d87bb508e0ef3f4a93ba76c01b92a050d91929786a
|
7
|
+
data.tar.gz: c0190b8d0f884a3e841079ba642763dc4ff2e411a3ce0b9a9789e677d4a02801450773a8d9c407ef811796a8b3930fcc8581bab36c2c4ec85ccc0ba7ea9bf330
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
source 'http://rubygems.org'
|
3
4
|
|
4
5
|
gemspec
|
5
6
|
|
6
7
|
group :development, :test do
|
7
8
|
gem 'awesome_print', require: false
|
8
|
-
gem 'grape', '>= 0.
|
9
|
+
gem 'grape', '>= 0.19.1'
|
9
10
|
gem 'pry', platforms: [:mri]
|
10
11
|
gem 'pry-byebug', platforms: [:mri]
|
11
12
|
gem 'rack-cors', require: false
|
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'bundler/gem_tasks'
|
3
4
|
|
4
5
|
require 'rake'
|
@@ -11,4 +12,4 @@ RSpec::Core::RakeTask.new(:spec)
|
|
11
12
|
require 'rubocop/rake_task'
|
12
13
|
RuboCop::RakeTask.new(:rubocop)
|
13
14
|
|
14
|
-
task default: [
|
15
|
+
task default: %i[spec rubocop]
|
data/grape-starter.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.required_ruby_version = '>= 2.2.6'
|
26
26
|
|
27
|
-
spec.add_dependency 'gli', '
|
28
|
-
spec.add_dependency 'activesupport', '
|
29
|
-
spec.add_dependency 'rubocop', '
|
27
|
+
spec.add_dependency 'gli', '~> 2.16'
|
28
|
+
spec.add_dependency 'activesupport', '~> 5.0'
|
29
|
+
spec.add_dependency 'rubocop', '~> 0.48'
|
30
30
|
end
|
data/lib/starter.rb
CHANGED
data/lib/starter/builder.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'active_support/core_ext/string'
|
3
4
|
|
4
5
|
module Starter
|
@@ -139,7 +140,7 @@ module Starter
|
|
139
140
|
#
|
140
141
|
# provides a file list for the new resource
|
141
142
|
def file_list
|
142
|
-
standards = %w
|
143
|
+
standards = %w[api_file lib_file api_spec lib_spec]
|
143
144
|
|
144
145
|
entity ? standards + ['entity_file'] : standards
|
145
146
|
end
|
@@ -1,27 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Starter
|
3
4
|
module Template
|
4
5
|
# defining the endpoints -> http methods of a resource
|
5
6
|
module Endpoints
|
6
7
|
def crud
|
7
|
-
%i
|
8
|
+
%i[
|
8
9
|
post
|
9
10
|
get_all
|
10
11
|
get_specific
|
11
12
|
put_specific
|
12
13
|
patch_specific
|
13
14
|
delete_specific
|
14
|
-
|
15
|
+
]
|
15
16
|
end
|
16
17
|
|
17
18
|
def singular_one
|
18
|
-
%i
|
19
|
+
%i[
|
19
20
|
post
|
20
21
|
get_one
|
21
22
|
put_one
|
22
23
|
patch_one
|
23
24
|
delete_one
|
24
|
-
|
25
|
+
]
|
25
26
|
end
|
26
27
|
|
27
28
|
# available API/HTTP methods
|
@@ -47,7 +48,7 @@ module Starter
|
|
47
48
|
end"
|
48
49
|
end
|
49
50
|
|
50
|
-
%w
|
51
|
+
%w[get put patch delete].each do |verb|
|
51
52
|
define_method(:"#{verb}_one") do
|
52
53
|
"
|
53
54
|
desc '#{verb} #{resource.singularize}'
|
@@ -57,7 +58,7 @@ module Starter
|
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
|
-
%w
|
61
|
+
%w[get put patch delete].each do |verb|
|
61
62
|
define_method(:"#{verb}_specific") do
|
62
63
|
"
|
63
64
|
desc '#{verb} specific #{resource.singularize}'
|
@@ -80,25 +81,25 @@ module Starter
|
|
80
81
|
"it_behaves_like 'GET all'"
|
81
82
|
end
|
82
83
|
|
83
|
-
%w
|
84
|
+
%w[get delete].each do |verb|
|
84
85
|
define_method(:"#{verb}_one_spec") do
|
85
86
|
"it_behaves_like '#{verb.upcase} one'"
|
86
87
|
end
|
87
88
|
end
|
88
89
|
|
89
|
-
%w
|
90
|
+
%w[put patch].each do |verb|
|
90
91
|
define_method(:"#{verb}_one_spec") do
|
91
92
|
"it_behaves_like '#{verb.upcase} one', params: {}"
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
95
|
-
%w
|
96
|
+
%w[get delete].each do |verb|
|
96
97
|
define_method(:"#{verb}_specific_spec") do
|
97
98
|
"it_behaves_like '#{verb.upcase} specific', key: 1"
|
98
99
|
end
|
99
100
|
end
|
100
101
|
|
101
|
-
%w
|
102
|
+
%w[put patch].each do |verb|
|
102
103
|
define_method(:"#{verb}_specific_spec") do
|
103
104
|
"it_behaves_like '#{verb.upcase} specific', key: 1, params: {}"
|
104
105
|
end
|
data/lib/starter/version.rb
CHANGED
data/template/Gemfile
CHANGED
@@ -6,12 +6,11 @@ gem 'thin'
|
|
6
6
|
gem 'rack'
|
7
7
|
gem 'rack-cors'
|
8
8
|
|
9
|
-
#
|
9
|
+
# FIXME: lock to specific version before you are going into production
|
10
10
|
gem 'grape', git: 'git@github.com:ruby-grape/grape.git'
|
11
|
-
|
12
|
-
gem 'grape-
|
13
|
-
gem 'grape-swagger', '
|
14
|
-
gem 'grape-swagger-entity', '>= 0.1.5'
|
11
|
+
gem 'grape-entity', git: 'git@github.com:ruby-grape/grape-entity.git'
|
12
|
+
gem 'grape-swagger', git: 'git@github.com:ruby-grape/grape-swagger.git'
|
13
|
+
gem 'grape-swagger-entity', git: 'git@github.com:ruby-grape/grape-swagger-entity.git'
|
15
14
|
|
16
15
|
group :development, :test do
|
17
16
|
gem 'grape-starter'
|
@@ -9,7 +9,6 @@ require 'rack'
|
|
9
9
|
|
10
10
|
# provides the documentation of the API
|
11
11
|
class DocApp
|
12
|
-
attr_reader :env
|
13
12
|
def call(env)
|
14
13
|
@env = env
|
15
14
|
[200, { 'Content-Type' => 'text/html' }, [template]]
|
@@ -39,7 +38,7 @@ class DocApp
|
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
|
-
# provides the routing between the API and the
|
41
|
+
# provides the routing between the API and the ReDoc documentation of it
|
43
42
|
class App
|
44
43
|
def initialize
|
45
44
|
@apps = {}
|
@@ -0,0 +1 @@
|
|
1
|
+
… includes public available stuff
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-starter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LeFnord
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.16'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.16'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.0
|
33
|
+
version: '5.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 5.0
|
40
|
+
version: '5.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: '0.48'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: '0.48'
|
55
55
|
description: CLI to create a API skeleton based on Grape and Rack
|
56
56
|
email:
|
57
57
|
- pscholz.le@gmail.com
|
@@ -100,7 +100,7 @@ files:
|
|
100
100
|
- template/config/environment.rb
|
101
101
|
- template/lib/api.rb
|
102
102
|
- template/lib/api/version.rb
|
103
|
-
- template/public/
|
103
|
+
- template/public/README
|
104
104
|
- template/script/console
|
105
105
|
- template/script/server
|
106
106
|
- template/script/setup
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.6.
|
134
|
+
rubygems_version: 2.6.11
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Create a Grape Rack skeleton
|
data/template/public/redoc.html
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>ReDoc</title>
|
5
|
-
<!-- needed for adaptive design -->
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
|
-
|
8
|
-
<!--
|
9
|
-
ReDoc doesn't change outer page styles
|
10
|
-
-->
|
11
|
-
<style>
|
12
|
-
body {
|
13
|
-
margin: 0;
|
14
|
-
padding: 0;
|
15
|
-
}
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
<body>
|
19
|
-
<redoc spec-url='http://localhost:9292/api/v1/oapi.json'></redoc>
|
20
|
-
<script src="https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js"> </script>
|
21
|
-
</body>
|
22
|
-
</html>
|