souls 0.14.1 → 0.14.6
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 +4 -4
- data/Gemfile.lock +1 -1
- data/exe/souls +1 -1
- data/lib/souls/init.rb +8 -8
- data/lib/souls/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: e7a6884fade54faa35e418f6444d415f53987e106bdcff1dd146078961a4d97a
|
4
|
+
data.tar.gz: 373db5faf95fdbe73aa504f4f6eab2379e46d47dbb84a77ebbfdbb7912e6cf6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d21cbaa2ae78fb42502c9f200277c93e78a92139835e19db3fec551c5d80989497006cef086f93b47caee9118193984b85687c96566c7e90a11c0a7e9588c3a1
|
7
|
+
data.tar.gz: 9e3f9d3daf4ad77ed04fca0d0f76790d91c7d56156f5317178384e25c5cf58e02256bc203b040a307731c15eaf9b0b18fdee65f0af0d5ed1b8ccafbc3e08388e
|
data/Gemfile.lock
CHANGED
data/exe/souls
CHANGED
@@ -62,7 +62,7 @@ begin
|
|
62
62
|
when "migrate_all"
|
63
63
|
Souls::Init.migrate_all
|
64
64
|
when "migration"
|
65
|
-
`rake db:create_migration NAME=#{ARGV[
|
65
|
+
`rake db:create_migration NAME=#{ARGV[2]}`
|
66
66
|
when "rspec_factory"
|
67
67
|
Souls::Init.rspec_factory class_name: ARGV[2]
|
68
68
|
when "rspec_model"
|
data/lib/souls/init.rb
CHANGED
@@ -300,6 +300,8 @@ module Souls
|
|
300
300
|
end
|
301
301
|
|
302
302
|
def create_mutation_head class_name: "souls"
|
303
|
+
dir_name = "./app/graphql/mutations/#{class_name}"
|
304
|
+
FileUtils.mkdir_p dir_name unless Dir.exist? dir_name
|
303
305
|
file_path = "./app/graphql/mutations/#{class_name}/create_#{class_name}.rb"
|
304
306
|
File.open(file_path, "w") do |new_line|
|
305
307
|
new_line.write <<~EOS
|
@@ -526,11 +528,7 @@ module Souls
|
|
526
528
|
|
527
529
|
def mutation class_name: "souls"
|
528
530
|
singularized_class_name = class_name.singularize
|
529
|
-
|
530
|
-
create_confirm dir_path: "./app/graphql/mutations/#{singularized_class_name}"
|
531
|
-
else
|
532
|
-
Dir.mkdir "./app/graphql/mutations/#{singularized_class_name}"
|
533
|
-
end
|
531
|
+
|
534
532
|
create_mutation_head class_name: singularized_class_name
|
535
533
|
relation_params = create_mutation_params class_name: singularized_class_name
|
536
534
|
create_mutation_after_params class_name: singularized_class_name, relation_params: relation_params
|
@@ -748,8 +746,10 @@ module Souls
|
|
748
746
|
EOS
|
749
747
|
else
|
750
748
|
new_line.write <<-EOS
|
751
|
-
|
752
|
-
get_global_key
|
749
|
+
|
750
|
+
def get_global_key class_name, id
|
751
|
+
Base64.encode64(\"\#{class_name}:\#{id}\")
|
752
|
+
end
|
753
753
|
let(:#{class_name}) { FactoryBot.attributes_for(:#{class_name}, #{@relation_params.join(", ")}) }
|
754
754
|
|
755
755
|
let(:mutation) do
|
@@ -766,7 +766,7 @@ module Souls
|
|
766
766
|
new_line.write " let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n"
|
767
767
|
when /$*_id\z/
|
768
768
|
relation_col = name.gsub("_id", "")
|
769
|
-
@relation_params << "#{name}: get_global_key
|
769
|
+
@relation_params << "#{name}: get_global_key(\"#{name.singularize.camelize.gsub("Id", "")}\", #{relation_col}.id)"
|
770
770
|
new_line.write " let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n"
|
771
771
|
end
|
772
772
|
end
|
data/lib/souls/version.rb
CHANGED