grape-app 0.5.1 → 0.5.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 +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +7 -0
- data/Gemfile.lock +33 -17
- data/Rakefile +6 -2
- data/bin/grape-app +1 -3
- data/grape-app.gemspec +8 -10
- data/lib/grape-app.rb +1 -1
- data/lib/grape/app.rb +8 -8
- data/lib/grape/app/cli.rb +12 -2
- data/lib/grape/app/configuration.rb +4 -4
- data/lib/grape/app/helpers/params.rb +0 -2
- data/lib/grape/app/helpers/respond_with.rb +1 -3
- data/lib/grape/app/initializers/post.rb +3 -5
- data/lib/grape/app/tasks.rb +3 -2
- data/lib/grape/app/tasks/core.rake +19 -0
- data/lib/grape/app/tasks/databases.rake +4 -2
- data/lib/grape/app/templates/Gemfile +1 -1
- data/lib/grape/app/templates/Rakefile +7 -2
- data/lib/grape/app/templates/app/api.rb +0 -1
- data/lib/grape/app/templates/app/models.rb +2 -2
- data/lib/grape/app/templates/config.ru +1 -2
- data/lib/grape/app/templates/config/environment.rb +1 -1
- data/lib/grape/app/templates/config/environments/production.rb +0 -2
- data/lib/grape/app/templates/spec/spec_helper.rb +8 -5
- data/spec/grape/app_spec.rb +3 -3
- data/spec/scenario/Gemfile +1 -1
- data/spec/scenario/app/api/v1.rb +2 -2
- data/spec/scenario/config/environments/test.rb +1 -1
- metadata +28 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 41f23bad1b0bde492375ac52d86c29e03b20e85d5c976a24b5bf647eacfc8f27
|
|
4
|
+
data.tar.gz: b5a923a5a8ceadc42254b495abe6e7ef5735cbaf3a7d5f4a0325d809bfcf7c4b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2dcfcd9cc76a9eb5512324b2f726a84efeab43c324d07b0c513c2857a4148d0c63580203c6aef4a81bb1b882e07176ed902aed2f9fb95cedd01009f4a8301e0
|
|
7
|
+
data.tar.gz: 3eea8678d1dfcccbbbe1d98ad352187fb889d52f511785eb819e67c5a35aab2f2e8396abaf502464c4558df4b7c56d11295a65d05071328d96d14a4bcd0bd308
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
grape-app (0.5.
|
|
4
|
+
grape-app (0.5.3)
|
|
5
5
|
activesupport
|
|
6
6
|
grape (>= 1.0.0)
|
|
7
7
|
grape-entity
|
|
@@ -12,18 +12,19 @@ PATH
|
|
|
12
12
|
GEM
|
|
13
13
|
remote: https://rubygems.org/
|
|
14
14
|
specs:
|
|
15
|
-
activemodel (5.
|
|
16
|
-
activesupport (= 5.
|
|
17
|
-
activerecord (5.
|
|
18
|
-
activemodel (= 5.
|
|
19
|
-
activesupport (= 5.
|
|
20
|
-
arel (
|
|
21
|
-
activesupport (5.
|
|
15
|
+
activemodel (5.2.0)
|
|
16
|
+
activesupport (= 5.2.0)
|
|
17
|
+
activerecord (5.2.0)
|
|
18
|
+
activemodel (= 5.2.0)
|
|
19
|
+
activesupport (= 5.2.0)
|
|
20
|
+
arel (>= 9.0)
|
|
21
|
+
activesupport (5.2.0)
|
|
22
22
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
23
|
-
i18n (
|
|
23
|
+
i18n (>= 0.7, < 2)
|
|
24
24
|
minitest (~> 5.1)
|
|
25
25
|
tzinfo (~> 1.1)
|
|
26
|
-
arel (
|
|
26
|
+
arel (9.0.0)
|
|
27
|
+
ast (2.4.0)
|
|
27
28
|
axiom-types (0.1.1)
|
|
28
29
|
descendants_tracker (~> 0.0.4)
|
|
29
30
|
ice_nine (~> 0.11.0)
|
|
@@ -36,7 +37,7 @@ GEM
|
|
|
36
37
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
37
38
|
diff-lcs (1.3)
|
|
38
39
|
equalizer (0.0.11)
|
|
39
|
-
grape (1.0.
|
|
40
|
+
grape (1.0.3)
|
|
40
41
|
activesupport
|
|
41
42
|
builder
|
|
42
43
|
mustermann-grape (~> 1.0.0)
|
|
@@ -46,22 +47,27 @@ GEM
|
|
|
46
47
|
grape-entity (0.7.1)
|
|
47
48
|
activesupport (>= 4.0)
|
|
48
49
|
multi_json (>= 1.3.2)
|
|
49
|
-
i18n (0.
|
|
50
|
+
i18n (1.0.1)
|
|
50
51
|
concurrent-ruby (~> 1.0)
|
|
51
52
|
ice_nine (0.11.2)
|
|
52
53
|
minitest (5.11.3)
|
|
53
54
|
multi_json (1.13.1)
|
|
54
|
-
mustermann (1.0.
|
|
55
|
+
mustermann (1.0.2)
|
|
55
56
|
mustermann-grape (1.0.0)
|
|
56
57
|
mustermann (~> 1.0.0)
|
|
57
|
-
|
|
58
|
+
parallel (1.12.1)
|
|
59
|
+
parser (2.5.1.0)
|
|
60
|
+
ast (~> 2.4.0)
|
|
61
|
+
powerpack (0.1.1)
|
|
62
|
+
rack (2.0.5)
|
|
58
63
|
rack-accept (0.4.5)
|
|
59
64
|
rack (>= 0.4)
|
|
60
65
|
rack-cors (1.0.2)
|
|
61
66
|
rack-ssl-enforcer (0.2.9)
|
|
62
|
-
rack-test (0.
|
|
67
|
+
rack-test (1.0.0)
|
|
63
68
|
rack (>= 1.0, < 3)
|
|
64
|
-
|
|
69
|
+
rainbow (3.0.0)
|
|
70
|
+
rake (12.3.1)
|
|
65
71
|
rspec (3.7.0)
|
|
66
72
|
rspec-core (~> 3.7.0)
|
|
67
73
|
rspec-expectations (~> 3.7.0)
|
|
@@ -75,11 +81,20 @@ GEM
|
|
|
75
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
76
82
|
rspec-support (~> 3.7.0)
|
|
77
83
|
rspec-support (3.7.1)
|
|
84
|
+
rubocop (0.55.0)
|
|
85
|
+
parallel (~> 1.10)
|
|
86
|
+
parser (>= 2.5)
|
|
87
|
+
powerpack (~> 0.1)
|
|
88
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
89
|
+
ruby-progressbar (~> 1.7)
|
|
90
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
91
|
+
ruby-progressbar (1.9.0)
|
|
78
92
|
sqlite3 (1.3.13)
|
|
79
93
|
thor (0.20.0)
|
|
80
94
|
thread_safe (0.3.6)
|
|
81
|
-
tzinfo (1.2.
|
|
95
|
+
tzinfo (1.2.5)
|
|
82
96
|
thread_safe (~> 0.1)
|
|
97
|
+
unicode-display_width (1.3.2)
|
|
83
98
|
virtus (1.0.5)
|
|
84
99
|
axiom-types (~> 0.1)
|
|
85
100
|
coercible (~> 1.0)
|
|
@@ -96,6 +111,7 @@ DEPENDENCIES
|
|
|
96
111
|
rack-test
|
|
97
112
|
rake
|
|
98
113
|
rspec
|
|
114
|
+
rubocop
|
|
99
115
|
sqlite3
|
|
100
116
|
|
|
101
117
|
BUNDLED WITH
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
require 'bundler/setup'
|
|
2
2
|
require 'bundler/gem_tasks'
|
|
3
|
-
require 'rspec/core/rake_task'
|
|
4
3
|
|
|
4
|
+
require 'rspec/core/rake_task'
|
|
5
5
|
RSpec::Core::RakeTask.new(:spec)
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
require 'rubocop/rake_task'
|
|
8
|
+
RuboCop::RakeTask.new(:rubocop)
|
|
9
|
+
|
|
10
|
+
task default: %i[spec rubocop]
|
data/bin/grape-app
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
if File.exist?(File.expand_path('
|
|
4
|
-
$:.unshift(File.expand_path('../../lib', __FILE__))
|
|
5
|
-
end
|
|
3
|
+
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__)) if File.exist?(File.expand_path('../.git', __dir__))
|
|
6
4
|
require "grape/app/cli"
|
data/grape-app.gemspec
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
Gem::Specification.new do |s|
|
|
1
|
+
Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
|
|
4
2
|
s.name = 'grape-app'
|
|
5
|
-
s.version = '0.5.
|
|
3
|
+
s.version = '0.5.3'
|
|
6
4
|
s.authors = ['Black Square Media Ltd']
|
|
7
5
|
s.email = ['info@blacksquaremedia.com']
|
|
8
|
-
s.summary = %
|
|
9
|
-
s.description = %
|
|
6
|
+
s.summary = %(Stanalone Grape API apps)
|
|
7
|
+
s.description = %()
|
|
10
8
|
s.homepage = 'https://github.com/bsm/grape-app'
|
|
11
9
|
s.license = 'MIT'
|
|
12
10
|
|
|
@@ -16,18 +14,18 @@ Gem::Specification.new do |s|
|
|
|
16
14
|
s.require_paths = ['lib']
|
|
17
15
|
s.required_ruby_version = '>= 2.2'
|
|
18
16
|
|
|
17
|
+
s.add_dependency 'activesupport'
|
|
19
18
|
s.add_dependency 'grape', '>= 1.0.0'
|
|
20
19
|
s.add_dependency 'grape-entity'
|
|
21
|
-
s.add_dependency 'activesupport'
|
|
22
20
|
s.add_dependency 'rack-cors'
|
|
23
21
|
s.add_dependency 'rack-ssl-enforcer'
|
|
24
22
|
s.add_dependency 'thor'
|
|
25
23
|
|
|
24
|
+
s.add_development_dependency 'activerecord'
|
|
26
25
|
s.add_development_dependency 'bundler'
|
|
26
|
+
s.add_development_dependency 'rack-test'
|
|
27
27
|
s.add_development_dependency 'rake'
|
|
28
28
|
s.add_development_dependency 'rspec'
|
|
29
|
-
s.add_development_dependency '
|
|
29
|
+
s.add_development_dependency 'rubocop'
|
|
30
30
|
s.add_development_dependency 'sqlite3'
|
|
31
|
-
s.add_development_dependency 'rack-test'
|
|
32
31
|
end
|
|
33
|
-
|
data/lib/grape-app.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require 'grape/app'
|
|
1
|
+
require 'grape/app' # rubocop:disable Naming/FileName
|
data/lib/grape/app.rb
CHANGED
|
@@ -12,7 +12,7 @@ class Grape::App < Grape::API
|
|
|
12
12
|
class << self
|
|
13
13
|
|
|
14
14
|
# Run initializers
|
|
15
|
-
def init!(root
|
|
15
|
+
def init!(root=nil) # rubocop:disable Metrics/AbcSize
|
|
16
16
|
@root = Pathname.new(root) if root
|
|
17
17
|
|
|
18
18
|
# Require bundle
|
|
@@ -36,11 +36,11 @@ class Grape::App < Grape::API
|
|
|
36
36
|
|
|
37
37
|
# @return [Grape::App::Configuration] the configuration
|
|
38
38
|
def config
|
|
39
|
-
@
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
@config ||= if respond_to?(:superclass) && superclass.respond_to?(:config)
|
|
40
|
+
superclass.config.inheritable_copy
|
|
41
|
+
else
|
|
42
|
+
Class.new(Grape::App::Configuration).new
|
|
43
|
+
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# Configure the app
|
|
@@ -78,13 +78,13 @@ class Grape::App < Grape::API
|
|
|
78
78
|
private
|
|
79
79
|
|
|
80
80
|
def require_all(*args)
|
|
81
|
-
args
|
|
81
|
+
args += ['**', '*.rb']
|
|
82
82
|
Dir[root.join(*args).to_s].sort.each {|f| require f }
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def require_one(*args)
|
|
86
86
|
path = root.join(*args).to_s
|
|
87
|
-
require path if File.
|
|
87
|
+
require path if File.exist?("#{path}.rb")
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
end
|
data/lib/grape/app/cli.rb
CHANGED
|
@@ -2,7 +2,6 @@ require 'grape/app'
|
|
|
2
2
|
require 'thor'
|
|
3
3
|
|
|
4
4
|
module Grape::App::CLI
|
|
5
|
-
|
|
6
5
|
class Builder < Thor::Group
|
|
7
6
|
include Thor::Actions
|
|
8
7
|
argument :name, required: true
|
|
@@ -30,8 +29,19 @@ module Grape::App::CLI
|
|
|
30
29
|
|
|
31
30
|
class Runner < Thor
|
|
32
31
|
register Builder, :new, "new NAME", "create a new application"
|
|
33
|
-
end
|
|
34
32
|
|
|
33
|
+
desc 'console ENV', 'Launch console'
|
|
34
|
+
def console(env='development')
|
|
35
|
+
ENV['GRAPE_ENV'] = env
|
|
36
|
+
require File.expand_path('config/environment', Dir.pwd)
|
|
37
|
+
|
|
38
|
+
require 'irb'
|
|
39
|
+
require 'irb/completion'
|
|
40
|
+
|
|
41
|
+
ARGV.clear
|
|
42
|
+
IRB.start
|
|
43
|
+
end
|
|
44
|
+
end
|
|
35
45
|
end
|
|
36
46
|
|
|
37
47
|
Grape::App::CLI::Runner.start
|
|
@@ -11,13 +11,13 @@ class Grape::App::Configuration < ActiveSupport::InheritableOptions
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def cors_allow_origins=(value)
|
|
14
|
-
warn "[DEPRECATION] setting `config.cors_allow_origins` is deprecated. Please use `config.cors` with a block instead. [#{caller
|
|
14
|
+
warn "[DEPRECATION] setting `config.cors_allow_origins` is deprecated. Please use `config.cors` with a block instead. [#{caller(1..1).first}]"
|
|
15
15
|
|
|
16
16
|
value = Array.wrap(value)
|
|
17
|
-
|
|
17
|
+
cors do
|
|
18
18
|
allow do
|
|
19
|
-
origins
|
|
20
|
-
resource
|
|
19
|
+
origins *value # rubocop:disable Lint/AmbiguousOperator
|
|
20
|
+
resource '*', headers: :any, methods: %i[get post options delete put]
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
require 'grape_entity'
|
|
2
2
|
|
|
3
3
|
module Grape::App::Helpers::RespondWith
|
|
4
|
-
|
|
5
4
|
class Errors < Grape::Entity
|
|
6
5
|
expose :errors
|
|
7
6
|
end
|
|
8
7
|
|
|
9
8
|
# @param [ActiveRecord::Base] record validated record
|
|
10
|
-
def respond_with(record, opts
|
|
9
|
+
def respond_with(record, opts={})
|
|
11
10
|
unless record.errors.empty?
|
|
12
11
|
opts[:with] = Errors
|
|
13
12
|
status 400
|
|
14
13
|
end
|
|
15
14
|
present record, opts
|
|
16
15
|
end
|
|
17
|
-
|
|
18
16
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
if Grape::App.config.raise_on_missing_translations
|
|
2
|
-
handler =
|
|
2
|
+
handler = ->(exception, *) { exception = exception.to_exception if exception.respond_to?(:to_exception); raise exception }
|
|
3
3
|
I18n.exception_handler = handler
|
|
4
4
|
end
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ if defined?(ActiveRecord)
|
|
|
7
7
|
require 'yaml'
|
|
8
8
|
require 'erb'
|
|
9
9
|
|
|
10
|
-
configurations = YAML.
|
|
10
|
+
configurations = YAML.safe_load(ERB.new(Grape::App.root.join('config', 'database.yml').read).result) || {}
|
|
11
11
|
if ENV['DATABASE_URL']
|
|
12
12
|
configurations[Grape::App.env.to_s] ||= {}
|
|
13
13
|
configurations[Grape::App.env.to_s]['url'] ||= ENV['DATABASE_URL']
|
|
@@ -17,7 +17,5 @@ if defined?(ActiveRecord)
|
|
|
17
17
|
ActiveRecord::Base.default_timezone = :utc
|
|
18
18
|
ActiveRecord::Base.establish_connection(Grape::App.env.to_sym)
|
|
19
19
|
|
|
20
|
-
if defined?(ActiveRecord::ConnectionAdapters::ConnectionManagement)
|
|
21
|
-
Grape::App.middleware.use ActiveRecord::ConnectionAdapters::ConnectionManagement
|
|
22
|
-
end
|
|
20
|
+
Grape::App.middleware.use ActiveRecord::ConnectionAdapters::ConnectionManagement if defined?(ActiveRecord::ConnectionAdapters::ConnectionManagement)
|
|
23
21
|
end
|
data/lib/grape/app/tasks.rb
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
load File.expand_path(
|
|
1
|
+
load File.expand_path('tasks/core.rake', __dir__)
|
|
2
2
|
|
|
3
3
|
begin
|
|
4
4
|
require 'active_record'
|
|
5
|
-
load File.expand_path(
|
|
5
|
+
load File.expand_path('tasks/databases.rake', __dir__)
|
|
6
6
|
rescue LoadError
|
|
7
|
+
nil
|
|
7
8
|
end
|
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
task :environment do
|
|
2
2
|
require Bundler.root.join("config", "environment").to_s
|
|
3
3
|
end
|
|
4
|
+
|
|
5
|
+
desc 'Launch console'
|
|
6
|
+
task console: :environment do
|
|
7
|
+
::ARGV.clear
|
|
8
|
+
|
|
9
|
+
require 'irb'
|
|
10
|
+
require 'irb/completion'
|
|
11
|
+
|
|
12
|
+
IRB.start(Grape::App.root.to_s)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
desc 'List all routes'
|
|
16
|
+
task routes: :environment do
|
|
17
|
+
Grape::App.routes.each do |route|
|
|
18
|
+
method = route.request_method.ljust(7)
|
|
19
|
+
path = route.path.sub(":version", route.version.to_s)
|
|
20
|
+
puts " #{method} #{path}"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -10,7 +10,7 @@ ActiveRecord::Tasks::DatabaseTasks.tap do |config|
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
namespace :db do
|
|
13
|
+
namespace :db do # rubocop:disable Metrics/BlockLength
|
|
14
14
|
|
|
15
15
|
Rake::Task['load_config'].clear
|
|
16
16
|
|
|
@@ -31,9 +31,11 @@ namespace :db do
|
|
|
31
31
|
name = ENV["NAME"]
|
|
32
32
|
path = File.join(migrations_path, "#{Time.now.utc.strftime('%Y%m%d%H%M%S')}_#{name}.rb")
|
|
33
33
|
|
|
34
|
+
ar_version = [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR].join('.')
|
|
35
|
+
|
|
34
36
|
FileUtils.mkdir_p(migrations_path)
|
|
35
37
|
File.write path, <<-MIGRATION.strip_heredoc
|
|
36
|
-
class #{name.camelize} < ActiveRecord::Migration
|
|
38
|
+
class #{name.camelize} < ActiveRecord::Migration[#{ar_version}]
|
|
37
39
|
def change
|
|
38
40
|
end
|
|
39
41
|
end
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
require 'bundler/setup'
|
|
2
|
-
require 'rspec/core/rake_task'
|
|
3
2
|
require 'grape/app/tasks'
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
begin
|
|
5
|
+
require 'rspec/core/rake_task'
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
7
|
+
rescue LoadError
|
|
8
|
+
nil # so it won't fail in production env, where rspec is usually not installed
|
|
9
|
+
end
|
|
10
|
+
|
|
6
11
|
task default: :spec
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
ENV['RACK_ENV'] ||= 'test'
|
|
2
|
-
require File.expand_path('
|
|
2
|
+
require File.expand_path('../config/environment', __dir__)
|
|
3
3
|
|
|
4
4
|
RSpec.configure do |config|
|
|
5
|
+
# ActiveRecord::Migration
|
|
6
|
+
config.before :suite do
|
|
7
|
+
ActiveRecord::Migration.maintain_test_schema!
|
|
8
|
+
end if defined?(ActiveRecord)
|
|
5
9
|
|
|
6
10
|
# DatabaseCleaner
|
|
7
11
|
config.before :suite do
|
|
@@ -12,12 +16,11 @@ RSpec.configure do |config|
|
|
|
12
16
|
DatabaseCleaner.cleaning { example.run }
|
|
13
17
|
end
|
|
14
18
|
|
|
15
|
-
#
|
|
16
|
-
config.include
|
|
19
|
+
# FactoryBot
|
|
20
|
+
config.include FactoryBot::Syntax::Methods
|
|
17
21
|
config.before :suite do
|
|
18
|
-
|
|
22
|
+
FactoryBot.find_definitions
|
|
19
23
|
end
|
|
20
|
-
|
|
21
24
|
end
|
|
22
25
|
|
|
23
26
|
# Test with Airborne
|
data/spec/grape/app_spec.rb
CHANGED
|
@@ -4,7 +4,7 @@ RSpec.describe Grape::App do
|
|
|
4
4
|
include Rack::Test::Methods
|
|
5
5
|
|
|
6
6
|
subject { described_class }
|
|
7
|
-
before { subject.init! File.expand_path('
|
|
7
|
+
before { subject.init! File.expand_path('../scenario', __dir__) }
|
|
8
8
|
|
|
9
9
|
def app
|
|
10
10
|
subject.middleware
|
|
@@ -56,7 +56,7 @@ RSpec.describe Grape::App do
|
|
|
56
56
|
expect(last_response.body).to eq(%({"status":"OK"}))
|
|
57
57
|
expect(last_response.headers).to include(
|
|
58
58
|
"Access-Control-Allow-Origin" => "*",
|
|
59
|
-
"X-MyApp"
|
|
59
|
+
"X-MyApp" => "true",
|
|
60
60
|
)
|
|
61
61
|
|
|
62
62
|
header 'Origin', 'test.host'
|
|
@@ -65,7 +65,7 @@ RSpec.describe Grape::App do
|
|
|
65
65
|
expect(last_response.body).to eq(%({"error":"bad request"}))
|
|
66
66
|
expect(last_response.headers).to include(
|
|
67
67
|
"Access-Control-Allow-Origin" => "*",
|
|
68
|
-
"X-MyApp"
|
|
68
|
+
"X-MyApp" => "true",
|
|
69
69
|
)
|
|
70
70
|
end
|
|
71
71
|
|
data/spec/scenario/Gemfile
CHANGED
data/spec/scenario/app/api/v1.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: grape-app
|
|
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
|
- Black Square Media Ltd
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-05-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: activesupport
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: grape
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -39,7 +53,7 @@ dependencies:
|
|
|
39
53
|
- !ruby/object:Gem::Version
|
|
40
54
|
version: '0'
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
56
|
+
name: rack-cors
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
44
58
|
requirements:
|
|
45
59
|
- - ">="
|
|
@@ -53,7 +67,7 @@ dependencies:
|
|
|
53
67
|
- !ruby/object:Gem::Version
|
|
54
68
|
version: '0'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: rack-
|
|
70
|
+
name: rack-ssl-enforcer
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
58
72
|
requirements:
|
|
59
73
|
- - ">="
|
|
@@ -67,7 +81,7 @@ dependencies:
|
|
|
67
81
|
- !ruby/object:Gem::Version
|
|
68
82
|
version: '0'
|
|
69
83
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
84
|
+
name: thor
|
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
|
72
86
|
requirements:
|
|
73
87
|
- - ">="
|
|
@@ -81,13 +95,13 @@ dependencies:
|
|
|
81
95
|
- !ruby/object:Gem::Version
|
|
82
96
|
version: '0'
|
|
83
97
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
98
|
+
name: activerecord
|
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
|
86
100
|
requirements:
|
|
87
101
|
- - ">="
|
|
88
102
|
- !ruby/object:Gem::Version
|
|
89
103
|
version: '0'
|
|
90
|
-
type: :
|
|
104
|
+
type: :development
|
|
91
105
|
prerelease: false
|
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
107
|
requirements:
|
|
@@ -109,7 +123,7 @@ dependencies:
|
|
|
109
123
|
- !ruby/object:Gem::Version
|
|
110
124
|
version: '0'
|
|
111
125
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
126
|
+
name: rack-test
|
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
|
114
128
|
requirements:
|
|
115
129
|
- - ">="
|
|
@@ -123,7 +137,7 @@ dependencies:
|
|
|
123
137
|
- !ruby/object:Gem::Version
|
|
124
138
|
version: '0'
|
|
125
139
|
- !ruby/object:Gem::Dependency
|
|
126
|
-
name:
|
|
140
|
+
name: rake
|
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
|
128
142
|
requirements:
|
|
129
143
|
- - ">="
|
|
@@ -137,7 +151,7 @@ dependencies:
|
|
|
137
151
|
- !ruby/object:Gem::Version
|
|
138
152
|
version: '0'
|
|
139
153
|
- !ruby/object:Gem::Dependency
|
|
140
|
-
name:
|
|
154
|
+
name: rspec
|
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
|
142
156
|
requirements:
|
|
143
157
|
- - ">="
|
|
@@ -151,7 +165,7 @@ dependencies:
|
|
|
151
165
|
- !ruby/object:Gem::Version
|
|
152
166
|
version: '0'
|
|
153
167
|
- !ruby/object:Gem::Dependency
|
|
154
|
-
name:
|
|
168
|
+
name: rubocop
|
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
|
156
170
|
requirements:
|
|
157
171
|
- - ">="
|
|
@@ -165,7 +179,7 @@ dependencies:
|
|
|
165
179
|
- !ruby/object:Gem::Version
|
|
166
180
|
version: '0'
|
|
167
181
|
- !ruby/object:Gem::Dependency
|
|
168
|
-
name:
|
|
182
|
+
name: sqlite3
|
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
|
170
184
|
requirements:
|
|
171
185
|
- - ">="
|
|
@@ -188,6 +202,7 @@ extra_rdoc_files: []
|
|
|
188
202
|
files:
|
|
189
203
|
- ".editorconfig"
|
|
190
204
|
- ".gitignore"
|
|
205
|
+
- ".rubocop.yml"
|
|
191
206
|
- ".travis.yml"
|
|
192
207
|
- Gemfile
|
|
193
208
|
- Gemfile.lock
|
|
@@ -253,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
253
268
|
version: '0'
|
|
254
269
|
requirements: []
|
|
255
270
|
rubyforge_project:
|
|
256
|
-
rubygems_version: 2.
|
|
271
|
+
rubygems_version: 2.7.3
|
|
257
272
|
signing_key:
|
|
258
273
|
specification_version: 4
|
|
259
274
|
summary: Stanalone Grape API apps
|