solidus_graphql_api 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/config/routes.rb +3 -3
- data/lib/generators/solidus_graphql_api/install/install_generator.rb +15 -0
- data/lib/solidus_graphql_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b70e2d5f59a6c13b84aff295c38c79dfea0766153a7bfcecc142aa85e64f9777
|
4
|
+
data.tar.gz: 4d1b6d9c8bd5a64f01e8d9aa676538b27e40baea77bb75fb17925793c94ff1d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b98e71007944b1dbb8779a411111fa5475b0b3975473b6a6bd06faa07ed1c101426f19f9a9d3bdfacca20776664a135974fbf87dd5928cd186f629484cc937d
|
7
|
+
data.tar.gz: 317033639c010dd0b072af1c79338e10794d712abc8ce7ad2fd6a2e97980a33d32702c91bb1fe567177f272c7b29fe6d621f38108a05cc4e17b0a02ac281da29
|
data/README.md
CHANGED
@@ -26,7 +26,8 @@ bin/rails generate solidus_graphql_api:install
|
|
26
26
|
```
|
27
27
|
|
28
28
|
Unlike the REST API which has a variety of endpoints, the GraphQL API has a
|
29
|
-
single endpoint accessible under `/graphql`.
|
29
|
+
single endpoint accessible under `/graphql`. It will be automatically
|
30
|
+
inserted into your `routes.rb` file after running the generator.
|
30
31
|
|
31
32
|
For example in development you can use:
|
32
33
|
|
data/config/routes.rb
CHANGED
@@ -5,6 +5,9 @@ module SolidusGraphqlApi
|
|
5
5
|
class InstallGenerator < Rails::Generators::Base
|
6
6
|
class_option :auto_run_migrations, type: :boolean, default: false
|
7
7
|
source_root File.expand_path('templates', __dir__)
|
8
|
+
argument :app_path, type: :string, default: Rails.root
|
9
|
+
|
10
|
+
MOUNT_GRAPHQL_ENGINE = "mount SolidusGraphqlApi::Engine, at: '/graphql'"
|
8
11
|
|
9
12
|
def copy_initializer
|
10
13
|
template 'initializer.rb', 'config/initializers/solidus_graphql_api.rb'
|
@@ -22,6 +25,18 @@ module SolidusGraphqlApi
|
|
22
25
|
puts 'Skipping bin/rails db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
|
23
26
|
end
|
24
27
|
end
|
28
|
+
|
29
|
+
def install_routes
|
30
|
+
if Pathname(app_path).join('config', 'routes.rb').read.include? MOUNT_GRAPHQL_ENGINE
|
31
|
+
say_status :route_exist, MOUNT_GRAPHQL_ENGINE, :blue
|
32
|
+
else
|
33
|
+
route <<~RUBY
|
34
|
+
# This line installs graphql's main route to execute queries
|
35
|
+
|
36
|
+
mount SolidusGraphqlApi::Engine, at: '/graphql'
|
37
|
+
RUBY
|
38
|
+
end
|
39
|
+
end
|
25
40
|
end
|
26
41
|
end
|
27
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_graphql_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Rimondi
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-08-
|
13
|
+
date: 2023-08-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: batch-loader
|