graphql_scaffold_fan 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +7 -1
- data/lib/generators/graphql_scaffold/init_generator.rb +1 -1
- data/lib/generators/graphql_scaffold/mutation_generator.rb +3 -3
- data/lib/generators/templates/mutation_delete.haml +1 -1
- data/lib/graphql_scaffold_fan/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84f167b5a1e8c21a585366673d66334bf50ef2b1a7c7734bad0876c1688fbaab
|
4
|
+
data.tar.gz: d7b35e8aa095be976130c52cc3cfd76b46dcb95af51a3d37d5578b705f56fde8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2866addc1ca028afc26af9017467d623c4010d574183d5cddb0a0a0e2fb7ba42b52fcc9dd5b2b437893b41545df0df7c5023adfd09e805fbfc9d38250a741331
|
7
|
+
data.tar.gz: 284f2af7999e7e3fb32cffeeecb828f567a8e566ac0f7e3fa930d65d79f59484d9c7ae8e5e7c18cff138bfbc0d46beddd478873117bcc84cee34d67529c7f3be
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,6 +9,7 @@ TODO: Delete this and the text above, and describe your gem
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
+
gem 'graphql'
|
12
13
|
gem 'graphql_scaffold_fan'
|
13
14
|
```
|
14
15
|
|
@@ -22,7 +23,12 @@ Or install it yourself as:
|
|
22
23
|
|
23
24
|
## Usage
|
24
25
|
|
25
|
-
|
26
|
+
Run `rails generate -h` to see if the GraphqlScaffold genertors have been loaded correctly
|
27
|
+
Example commands:
|
28
|
+
`rails generate graphql_scaffold:init <ProjectName>` Initial command will use the root folder name as its ProjectName, so be free to enter any character here.
|
29
|
+
`rails generate graphql_scaffold:mutation <MutationName>`
|
30
|
+
`rails generate graphql_scaffold:type <TypeName>`
|
31
|
+
|
26
32
|
|
27
33
|
## Development
|
28
34
|
|
@@ -19,7 +19,7 @@ module GraphqlScaffold
|
|
19
19
|
def create_admin_schema_file
|
20
20
|
@top_folder_name = File.basename(Dir.getwd)
|
21
21
|
dir_path = 'app/graphql'
|
22
|
-
file_path = dir_path + "
|
22
|
+
file_path = dir_path + "/#{@top_folder_name.underscore}_admin_schema.rb"
|
23
23
|
FileUtils.mkdir_p(dir_path) unless File.exist?(dir_path)
|
24
24
|
|
25
25
|
if File.exist?(file_path)
|
@@ -6,9 +6,9 @@ module GraphqlScaffold
|
|
6
6
|
|
7
7
|
def create_base_admin_mutation_file
|
8
8
|
mutations_dir_path = 'app/graphql/mutations'
|
9
|
-
generator_path =
|
9
|
+
generator_path = mutations_dir_path + '/base_admin_mutation.rb'
|
10
10
|
|
11
|
-
FileUtils.mkdir_p(
|
11
|
+
FileUtils.mkdir_p(mutations_dir_path) unless File.exist?(mutations_dir_path)
|
12
12
|
|
13
13
|
if File.exist?(generator_path)
|
14
14
|
p 'File base_admin_mutation.rb already exists'
|
@@ -117,7 +117,7 @@ module GraphqlScaffold
|
|
117
117
|
file_data = file.read
|
118
118
|
new_file_data = file_data.insert(-15, " has_admin_mutation :#{class_name}\n ")
|
119
119
|
File.write(file, new_file_data)
|
120
|
-
p 'Write to
|
120
|
+
p 'Write to mutation_type.rb successfully'
|
121
121
|
else
|
122
122
|
template 'mutation_type.haml', generator_path
|
123
123
|
end
|
@@ -5,7 +5,7 @@ module Mutations
|
|
5
5
|
type Types::Admin::<%= class_name %>Type
|
6
6
|
|
7
7
|
def resolve(id:)
|
8
|
-
<%= class_name.underscore %> =
|
8
|
+
<%= class_name.underscore %> = <%= class_name %>.find(id)
|
9
9
|
<%= class_name.underscore %>.destroy!
|
10
10
|
<%= class_name.underscore %>
|
11
11
|
end
|