souls 0.30.11 → 0.32.1

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.
@@ -0,0 +1,107 @@
1
+ module Souls
2
+ module Upgrade
3
+ class << self
4
+ def gemfile_latest_version
5
+ file_path = "./Gemfile"
6
+ updated_gems = []
7
+ updated_gem_versions = []
8
+ updated_lines = []
9
+ from_dev = false
10
+ File.open(file_path, "r") do |f|
11
+ f.each_line do |line|
12
+ from_dev = true if line.include?("group")
13
+ next unless line.include?("gem ")
14
+
15
+ gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
16
+ url = URI("https://rubygems.org/api/v1/versions/#{gem[0]}/latest.json")
17
+ res = Net::HTTP.get_response(url)
18
+ data = JSON.parse(res.body)
19
+ next if Souls.configuration.fixed_gems.include?(gem[0].to_s)
20
+ next if data["version"].to_s == gem[1].to_s
21
+
22
+ updated_lines << if from_dev
23
+ " gem \"#{gem[0]}\", \"#{data['version']}\""
24
+ else
25
+ "gem \"#{gem[0]}\", \"#{data['version']}\""
26
+ end
27
+ updated_gems << (gem[0]).to_s
28
+ updated_gem_versions << data["version"]
29
+ system("gem update #{gem[0]}")
30
+ end
31
+ end
32
+ {
33
+ gems: updated_gems,
34
+ lines: updated_lines,
35
+ updated_gem_versions: updated_gem_versions
36
+ }
37
+ end
38
+
39
+ def update_gemfile
40
+ file_path = "./Gemfile"
41
+ tmp_file = "./tmp/Gemfile"
42
+ new_gems = gemfile_latest_version
43
+ logs = []
44
+ message = Paint["\nAlready Up to date!", :green]
45
+ return "Already Up to date!" && puts(message) if new_gems[:gems].blank?
46
+
47
+ @i = 0
48
+ File.open(file_path, "r") do |f|
49
+ File.open(tmp_file, "w") do |new_line|
50
+ f.each_line do |line|
51
+ gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
52
+ if new_gems[:gems].include?(gem[0])
53
+ old_ver = gem[1].split(".")
54
+ new_ver = new_gems[:updated_gem_versions][@i].split(".")
55
+ if old_ver[0] < new_ver[0]
56
+ logs << Paint % [
57
+ "#{gem[0]} v#{gem[1]} → %{red_text}",
58
+ :white,
59
+ {
60
+ red_text: ["v#{new_gems[:updated_gem_versions][@i]}", :red]
61
+ }
62
+ ]
63
+ elsif old_ver[1] < new_ver[1]
64
+ logs << Paint % [
65
+ "#{gem[0]} v#{gem[1]} → v#{new_ver[0]}.%{yellow_text}",
66
+ :white,
67
+ {
68
+ yellow_text: ["#{new_ver[1]}.#{new_ver[2]}", :yellow]
69
+ }
70
+ ]
71
+ elsif old_ver[2] < new_ver[2]
72
+ logs << Paint % [
73
+ "#{gem[0]} v#{gem[1]} → v#{new_ver[0]}.#{new_ver[1]}.%{green_text}",
74
+ :white,
75
+ {
76
+ green_text: [(new_ver[2]).to_s, :green]
77
+ }
78
+ ]
79
+ end
80
+ if gem[0] == "souls"
81
+ logs << Paint % [
82
+ "\nSOULs Doc: %{cyan_text}",
83
+ :white,
84
+ { cyan_text: ["https://souls.elsoul.nl\n", :cyan] }
85
+ ]
86
+ end
87
+ new_line.write("#{new_gems[:lines][@i]}\n")
88
+ @i += 1
89
+ else
90
+ new_line.write(line)
91
+ end
92
+ end
93
+ end
94
+ end
95
+ FileUtils.rm("./Gemfile")
96
+ FileUtils.rm("./Gemfile.lock")
97
+ FileUtils.mv("./tmp/Gemfile", "./Gemfile")
98
+ system("bundle update")
99
+ success = Paint["\n\nSuccessfully Updated These Gems!\n", :green]
100
+ puts(success)
101
+ logs.each do |line|
102
+ puts(line)
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.30.11".freeze
2
+ VERSION = "0.32.1".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.9.11
1
+ 0.11.1
@@ -1 +1 @@
1
- 0.9.11
1
+ 0.11.1
@@ -1,4 +1,3 @@
1
- require_relative "./generate/application"
2
1
  require_relative "./generate/mailer"
3
2
 
4
3
  module Souls
@@ -3,7 +3,6 @@ module Souls
3
3
  module Generate
4
4
  class << self
5
5
  def mailer(class_name: "mailer", option: "")
6
- puts(option)
7
6
  if option.to_sym == :sendgrid
8
7
  sendgrid_mailer(class_name: class_name)
9
8
  else
@@ -52,10 +51,6 @@ module Souls
52
51
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
53
52
  file_path
54
53
  end
55
-
56
- def sendgrid_mailer(class_name: "mailer")
57
- p("Coming Soon..")
58
- end
59
54
  end
60
55
  end
61
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.11
4
+ version: 0.32.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-08-18 00:00:00.000000000 Z
13
+ date: 2021-08-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -82,8 +82,9 @@ dependencies:
82
82
  - - '='
83
83
  - !ruby/object:Gem::Version
84
84
  version: 0.3.0
85
- description: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。クラウド環境への自動デプロイ、CI/CD
86
- ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
85
+ description: |-
86
+ SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
87
+ クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
87
88
  email:
88
89
  - f.kawasaki@elsoul.nl
89
90
  - s.kishi@elsoul.nl
@@ -128,20 +129,28 @@ files:
128
129
  - lib/souls/cli/docker.rb
129
130
  - lib/souls/cli/docker/docker.rb
130
131
  - lib/souls/cli/gcloud.rb
131
- - lib/souls/cli/gcloud/compute.rb
132
+ - lib/souls/cli/gcloud/gcloud.rb
132
133
  - lib/souls/cli/gcloud/iam.rb
133
- - lib/souls/cli/gcloud/methods.rb
134
+ - lib/souls/cli/gcloud/iam/iam.rb
134
135
  - lib/souls/cli/gcloud/pubsub.rb
136
+ - lib/souls/cli/gcloud/pubsub/subscriptions.rb
137
+ - lib/souls/cli/gcloud/pubsub/topics.rb
135
138
  - lib/souls/cli/gcloud/run.rb
139
+ - lib/souls/cli/gcloud/run/run.rb
140
+ - lib/souls/cli/gcloud/sql.rb
141
+ - lib/souls/cli/gcloud/sql/sql.rb
136
142
  - lib/souls/cli/release.rb
137
143
  - lib/souls/cli/release/release.rb
144
+ - lib/souls/cli/sync.rb
145
+ - lib/souls/cli/sync/model.rb
146
+ - lib/souls/cli/upgrade.rb
147
+ - lib/souls/cli/upgrade/gem_update.rb
138
148
  - lib/souls/init.rb
139
149
  - lib/souls/version.rb
140
150
  - lib/souls/versions/.souls_api_version
141
151
  - lib/souls/versions/.souls_worker_version
142
152
  - lib/souls/worker.rb
143
153
  - lib/souls/worker/generate.rb
144
- - lib/souls/worker/generate/application.rb
145
154
  - lib/souls/worker/generate/mailer.rb
146
155
  homepage: https://souls.elsoul.nl
147
156
  licenses:
@@ -168,6 +177,6 @@ requirements: []
168
177
  rubygems_version: 3.2.22
169
178
  signing_key:
170
179
  specification_version: 4
171
- summary: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。クラウド環境への自動デプロイ、CI/CD
172
- ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
180
+ summary: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
181
+ クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
173
182
  test_files: []
@@ -1,69 +0,0 @@
1
- module Souls
2
- module Gcloud
3
- class << self
4
- def return_method(args)
5
- method = args[1]
6
- case method
7
- when "get_iam_key"
8
- app_name = Souls.configuration.app
9
- project_id = Souls.configuration.project_id
10
- Souls::Gcloud.create_service_account(service_account: app_name)
11
- Souls::Gcloud.create_service_account_key(service_account: app_name, project_id: project_id)
12
- Souls::Gcloud.export_key_to_console
13
- Souls::Gcloud.enable_permissions
14
- when "auth_login"
15
- project_id = Souls.configuration.project_id
16
- Souls::Gcloud.auth_login(project_id: project_id)
17
- when "enable_permissions"
18
- service_account = Souls.configuration.app
19
- project_id = Souls.configuration.project_id
20
- Souls::Gcloud.enable_permissions
21
- Souls::Gcloud.add_permissions(service_account: service_account, project_id: project_id)
22
- when "create_pubsub_topic"
23
- topic_name = args[2] || "send-user-mail"
24
- Souls::Gcloud.create_pubsub_topic(topic_name: topic_name)
25
- when "create_pubsub_subscription"
26
- project_id = Souls.configuration.project_id
27
- topic_name = args[2] || "send-user-mail"
28
- service_account = "#{Souls.configuration.app}@#{project_id}.iam.gserviceaccount.com"
29
- endpoint = Souls.configuration.worker_endpoint
30
- Souls::Gcloud.create_pubsub_subscription(
31
- topic_name: topic_name,
32
- project_id: project_id,
33
- service_account: service_account,
34
- endpoint: endpoint
35
- )
36
- when "create_sql_instance"
37
- instance_name = "#{Souls.configuration.app}-db"
38
- root_pass = args[2] || "password"
39
- zone = args[3] || "asia-northeast1-b"
40
- Souls::Gcloud.create_sql_instance(instance_name: instance_name, root_pass: root_pass, zone: zone)
41
- when "create_service_account"
42
- service_account = Souls.configuration.app
43
- Souls::Gcloud.create_service_account(service_account: service_account)
44
- when "create_service_account_key"
45
- service_account = Souls.configuration.app
46
- project_id = Souls.configuration.project_id
47
- Souls::Gcloud.create_service_account_key(service_account: service_account, project_id: project_id)
48
- when "add_service_account_role"
49
- service_account = Souls.configuration.app
50
- project_id = Souls.configuration.project_id
51
- role = args[2] || "roles/firebase.admin"
52
- Souls::Gcloud.add_service_account_role(service_account: service_account, project_id: project_id, role: role)
53
- when "add_permissions"
54
- service_account = Souls.configuration.app
55
- project_id = Souls.configuration.project_id
56
- Souls::Gcloud.add_permissions(service_account: service_account, project_id: project_id)
57
- when "run_list"
58
- project_id = Souls.configuration.project_id
59
- Souls::Gcloud.run_list(project_id: project_id)
60
- when "run_awake"
61
- app_name = Souls.configuration.app
62
- Souls::Gcloud.run_awake(app_name: app_name)
63
- else
64
- raise(StandardError, "Wrong Method!")
65
- end
66
- end
67
- end
68
- end
69
- end
@@ -1,150 +0,0 @@
1
- module Souls
2
- module Worker
3
- module Generate
4
- ## Common Methods
5
- def self.generated_paths(class_name: "user")
6
- singularized_class_name = class_name.singularize.underscore
7
- pluralized_class_name = class_name.pluralize.underscore
8
- [
9
- "./app/models/#{singularized_class_name}.rb",
10
- "./app/policies/#{singularized_class_name}_policy.rb",
11
- "./app/graphql/mutations/create_#{singularized_class_name}.rb",
12
- "./app/graphql/mutations/delete_#{singularized_class_name}.rb",
13
- "./app/graphql/mutations/destroy_delete_#{singularized_class_name}.rb",
14
- "./app/graphql/mutations/update_#{singularized_class_name}.rb",
15
- "./app/graphql/queries/#{singularized_class_name}.rb",
16
- "./app/graphql/queries/#{pluralized_class_name}.rb",
17
- "./app/graphql/resolvers/#{singularized_class_name}_search.rb",
18
- "./app/graphql/types/#{singularized_class_name}_type.rb",
19
- "./app/graphql/types/edges/#{singularized_class_name}_edge.rb",
20
- "./app/graphql/types/connections/#{singularized_class_name}_connection.rb",
21
- "./spec/factories/#{pluralized_class_name}.rb",
22
- "./spec/mutations/#{singularized_class_name}_spec.rb",
23
- "./spec/models/#{singularized_class_name}_spec.rb",
24
- "./spec/queries/#{singularized_class_name}_spec.rb",
25
- "./spec/policies/#{singularized_class_name}_policy_spec.rb",
26
- "./spec/resolvers/#{singularized_class_name}_search_spec.rb"
27
- ]
28
- end
29
-
30
- def self.get_type_and_name(line)
31
- line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
32
- end
33
-
34
- def self.get_tables
35
- path = "./db/schema.rb"
36
- tables = []
37
- File.open(path, "r") do |f|
38
- f.each_line.with_index do |line, _i|
39
- tables << line.split("\"")[1] if line.include?("create_table")
40
- end
41
- end
42
- tables
43
- end
44
-
45
- def self.type_check(type)
46
- {
47
- bigint: "Integer",
48
- string: "String",
49
- float: "Float",
50
- text: "String",
51
- datetime: "String",
52
- date: "String",
53
- boolean: "Boolean",
54
- integer: "Integer"
55
- }[type.to_sym]
56
- end
57
-
58
- def self.get_test_type(type)
59
- {
60
- bigint: 1,
61
- float: 4.2,
62
- string: '"MyString"',
63
- text: '"MyString"',
64
- datetime: "Time.now",
65
- date: "Time.now",
66
- boolean: false,
67
- integer: 1
68
- }[type.to_sym]
69
- end
70
-
71
- def self.table_check(line: "", class_name: "")
72
- if line.include?("create_table") && (line.split[1].gsub("\"", "").gsub(",", "") == class_name.pluralize.to_s)
73
-
74
- return true
75
- end
76
-
77
- false
78
- end
79
-
80
- def self.migrate(class_name: "souls")
81
- singularized_class_name = class_name.singularize
82
- model(class_name: singularized_class_name)
83
- type(class_name: singularized_class_name)
84
- edge(class_name: singularized_class_name)
85
- connection(class_name: singularized_class_name)
86
- resolver(class_name: singularized_class_name)
87
- rspec_factory(class_name: singularized_class_name)
88
- rspec_model(class_name: singularized_class_name)
89
- rspec_mutation(class_name: singularized_class_name)
90
- rspec_query(class_name: singularized_class_name)
91
- rspec_resolver(class_name: singularized_class_name)
92
- query(class_name: singularized_class_name)
93
- mutation(class_name: singularized_class_name)
94
- policy(class_name: singularized_class_name)
95
- rspec_policy(class_name: singularized_class_name)
96
- rescue StandardError => e
97
- raise(StandardError, e)
98
- end
99
-
100
- def self.migrate_all
101
- puts(Paint["Let's Go SOULs AUTO CRUD Assist!\n", :cyan])
102
- Souls::Api::Generate.get_tables.each do |table|
103
- Souls::Api::Generate.migrate(class_name: table.singularize)
104
- puts(Paint["Generated #{table.camelize} CRUD Files\n", :yellow])
105
- end
106
- end
107
-
108
- def self.delete_all(class_name: "souls")
109
- singularized_class_name = class_name.singularize.underscore
110
- pluralized_class_name = class_name.pluralize.underscore
111
- FileUtils.rm("./app/models/#{singularized_class_name}.rb")
112
- FileUtils.rm("./app/policies/#{singularized_class_name}_policy.rb")
113
- FileUtils.rm_rf("./app/graphql/mutations/base/#{singularized_class_name}")
114
- FileUtils.rm("./app/graphql/queries/#{singularized_class_name}.rb")
115
- FileUtils.rm("./app/graphql/queries/#{pluralized_class_name}.rb")
116
- FileUtils.rm("./app/graphql/resolvers/#{singularized_class_name}_search.rb")
117
- FileUtils.rm("./app/graphql/types/#{singularized_class_name}_type.rb")
118
- FileUtils.rm("./app/graphql/types/edges/#{singularized_class_name}_edge.rb")
119
- FileUtils.rm("./app/graphql/types/connections/#{singularized_class_name}_connection.rb")
120
- FileUtils.rm("./spec/factories/#{pluralized_class_name}.rb")
121
- FileUtils.rm("./spec/mutations/base/#{singularized_class_name}_spec.rb")
122
- FileUtils.rm("./spec/models/#{singularized_class_name}_spec.rb")
123
- FileUtils.rm("./spec/queries/#{singularized_class_name}_spec.rb")
124
- FileUtils.rm("./spec/policies/#{singularized_class_name}_policy_spec.rb")
125
- FileUtils.rm("./spec/resolvers/#{singularized_class_name}_search_spec.rb")
126
- puts(Paint["deleted #{class_name.camelize} CRUD!", :yellow])
127
- rescue StandardError => e
128
- raise(StandardError, e)
129
- end
130
-
131
- def self.update_delete(class_name: "souls")
132
- singularized_class_name = class_name.singularize.underscore
133
- pluralized_class_name = class_name.pluralize.underscore
134
- FileUtils.rm_rf("./app/graphql/mutations/#{singularized_class_name}")
135
- FileUtils.rm("./app/graphql/queries/#{singularized_class_name}.rb")
136
- FileUtils.rm("./app/graphql/queries/#{pluralized_class_name}.rb")
137
- FileUtils.rm("./app/graphql/resolvers/#{singularized_class_name}_search.rb")
138
- FileUtils.rm("./app/graphql/types/#{singularized_class_name}_type.rb")
139
- FileUtils.rm("./app/graphql/types/edges/#{singularized_class_name}_edge.rb")
140
- FileUtils.rm("./app/graphql/types/connections/#{singularized_class_name}_connection.rb")
141
- FileUtils.rm("./spec/mutations/#{singularized_class_name}_spec.rb")
142
- FileUtils.rm("./spec/queries/#{singularized_class_name}_spec.rb")
143
- FileUtils.rm("./spec/resolvers/#{singularized_class_name}_search_spec.rb")
144
- puts("deleted #{class_name.camelize} CRUD!")
145
- rescue StandardError => e
146
- raise(StandardError, e)
147
- end
148
- end
149
- end
150
- end