surikat 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/inspectionProfiles/Project_Default.xml +16 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/surikat.iml +50 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +744 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +399 -0
- data/Rakefile +6 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/exe/surikat +234 -0
- data/lib/surikat.rb +421 -0
- data/lib/surikat/base_model.rb +35 -0
- data/lib/surikat/base_queries.rb +10 -0
- data/lib/surikat/base_type.rb +3 -0
- data/lib/surikat/configurations.rb +22 -0
- data/lib/surikat/new_app.rb +108 -0
- data/lib/surikat/routes.rb +67 -0
- data/lib/surikat/scaffold.rb +503 -0
- data/lib/surikat/session.rb +35 -0
- data/lib/surikat/session_manager.rb +92 -0
- data/lib/surikat/templates/.rspec.tmpl +1 -0
- data/lib/surikat/templates/.standalone_migrations.tmpl +6 -0
- data/lib/surikat/templates/Gemfile.tmpl +31 -0
- data/lib/surikat/templates/Rakefile.tmpl +2 -0
- data/lib/surikat/templates/aaa_queries.rb.tmpl +124 -0
- data/lib/surikat/templates/aaa_spec.rb.tmpl +151 -0
- data/lib/surikat/templates/application.yml.tmpl +14 -0
- data/lib/surikat/templates/base_aaa_model.rb.tmpl +28 -0
- data/lib/surikat/templates/base_model.rb.tmpl +6 -0
- data/lib/surikat/templates/base_spec.rb.tmpl +148 -0
- data/lib/surikat/templates/config.ru.tmpl +61 -0
- data/lib/surikat/templates/console.tmpl +14 -0
- data/lib/surikat/templates/crud_queries.rb.tmpl +105 -0
- data/lib/surikat/templates/database.yml.tmpl +26 -0
- data/lib/surikat/templates/hello_queries.rb.tmpl +19 -0
- data/lib/surikat/templates/hello_spec.rb.tmpl +39 -0
- data/lib/surikat/templates/routes.yml.tmpl +15 -0
- data/lib/surikat/templates/spec_helper.rb.tmpl +11 -0
- data/lib/surikat/templates/test_helper.rb.tmpl +30 -0
- data/lib/surikat/types.rb +45 -0
- data/lib/surikat/version.rb +3 -0
- data/lib/surikat/yaml_configurator.rb +18 -0
- data/surikat.gemspec +47 -0
- metadata +199 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
queries:
|
3
|
+
Hello:
|
4
|
+
class: HelloQueries
|
5
|
+
method: hello
|
6
|
+
output_type: String
|
7
|
+
ShowSession:
|
8
|
+
class: HelloQueries
|
9
|
+
method: show_session
|
10
|
+
output_type: String
|
11
|
+
AddSession:
|
12
|
+
class: HelloQueries
|
13
|
+
method: add_session
|
14
|
+
output_type: String
|
15
|
+
mutations:
|
@@ -0,0 +1,11 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.expect_with :rspec do |expectations|
|
3
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
4
|
+
end
|
5
|
+
|
6
|
+
config.mock_with :rspec do |mocks|
|
7
|
+
mocks.verify_partial_doubles = true
|
8
|
+
end
|
9
|
+
|
10
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
11
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
ENV['RACK_ENV'] = 'test'
|
4
|
+
|
5
|
+
require 'surikat'
|
6
|
+
|
7
|
+
require 'rake'
|
8
|
+
|
9
|
+
`rake db:reset DB=test`
|
10
|
+
|
11
|
+
# In test mode we always start with a new session storage, if we're using a file session storage.
|
12
|
+
if Surikat.config.app['session']['storage'] == 'file'
|
13
|
+
if File.exists? Surikat.config.app['session']['file']
|
14
|
+
File.unlink(Surikat.config.app['session']['file'])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
['queries', 'models'].each do |dir|
|
19
|
+
Dir.glob("#{FileUtils.pwd}/app/#{dir}/*.rb").each {|f| require(f)}
|
20
|
+
end
|
21
|
+
|
22
|
+
Dir.glob("#{FileUtils.pwd}/config/initializers/*.rb").sort.each do |file|
|
23
|
+
require file
|
24
|
+
end
|
25
|
+
|
26
|
+
def dates2string(hash)
|
27
|
+
hash.each do |k, v|
|
28
|
+
hash[k] = v.to_s if v.class.to_s.in?(['Date','Time','DateTime'])
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# This is an internal utility class used to manage the GraphQL types, which are stored in an object dump called 'types.json'.
|
2
|
+
# The developers might want to use this class to CRUD their GraphQL application types. The scaffold generators will also
|
3
|
+
# use this class for the same purpose.
|
4
|
+
class Types
|
5
|
+
|
6
|
+
require 'oj'
|
7
|
+
|
8
|
+
BASIC = ['Int', 'Boolean', 'String', 'Float', 'ID']
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@filename = "#{FileUtils.pwd}/config/types.yml"
|
12
|
+
@types = load
|
13
|
+
end
|
14
|
+
|
15
|
+
def all
|
16
|
+
@types
|
17
|
+
end
|
18
|
+
|
19
|
+
def merge type
|
20
|
+
@types.merge! type
|
21
|
+
save
|
22
|
+
end
|
23
|
+
|
24
|
+
def delete type_name
|
25
|
+
raise "Type #{type_name} not found" unless @types.keys.include?(type_name)
|
26
|
+
@types.delete type_name
|
27
|
+
save
|
28
|
+
end
|
29
|
+
|
30
|
+
def clear
|
31
|
+
@types = {}
|
32
|
+
save
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def load
|
37
|
+
return {} unless File.exists?(@filename)
|
38
|
+
YAML.load_file @filename
|
39
|
+
end
|
40
|
+
|
41
|
+
def save
|
42
|
+
File.open(@filename, 'w') { |file| file.write(@types.to_yaml)}
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module YamlConfigurator
|
2
|
+
|
3
|
+
def self.config_for(name, env)
|
4
|
+
yaml = Pathname.new("config/#{name}.yml")
|
5
|
+
|
6
|
+
#puts "Loading #{name} for environment: #{env}"
|
7
|
+
|
8
|
+
if yaml.exist?
|
9
|
+
require "erb"
|
10
|
+
(YAML.load(ERB.new(yaml.read).result) || {})[env] || {}
|
11
|
+
else
|
12
|
+
raise "Could not load configuration. No such file - #{yaml}"
|
13
|
+
end
|
14
|
+
rescue Psych::SyntaxError => e
|
15
|
+
raise "YAML syntax error occurred while parsing #{yaml}. " "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " "Error: #{e.message}"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/surikat.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "surikat/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "surikat"
|
8
|
+
spec.version = Surikat::VERSION
|
9
|
+
spec.authors = ["Alex Deva"]
|
10
|
+
spec.email = ["me@alxx.se"]
|
11
|
+
|
12
|
+
spec.summary = %q{An API-only, GraphQL centric web framework.}
|
13
|
+
spec.description = %q{Surikat is a web framework that revolves around GraphQL, offering a lot of ready-made functionality such as CRUD operations, automatic query generation, authentication and performance optimisations.}
|
14
|
+
spec.homepage = "https://github.com/alxx/surikat"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
#spec.metadata["allowed_push_host"] = "http://someplace.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.required_ruby_version = '>= 2.3.1'
|
27
|
+
|
28
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
29
|
+
f.match(%r{^(test|spec|features)/}) || f.match(/^surikat-.+.gem$/)
|
30
|
+
end
|
31
|
+
spec.bindir = "exe"
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ["lib"]
|
34
|
+
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
36
|
+
#spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
38
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
39
|
+
|
40
|
+
spec.add_development_dependency "activesupport", "~> 5.2", ">= 5.2.0"
|
41
|
+
spec.add_development_dependency "graphql-libgraphqlparser", "~> 1.2", ">= 1.2.0"
|
42
|
+
spec.add_development_dependency "oj", "~> 3.3", ">= 3.3.5"
|
43
|
+
# spec.add_development_dependency "standalone_migrations", "~> 5.2", ">= 5.2.5"
|
44
|
+
# spec.add_development_dependency "ransack", "~> 1.8", ">= 1.8.2"
|
45
|
+
|
46
|
+
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: surikat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alex Deva
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.10'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.2'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 5.2.0
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '5.2'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 5.2.0
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: graphql-libgraphqlparser
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.2'
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.2.0
|
85
|
+
type: :development
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '1.2'
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.2.0
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: oj
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '3.3'
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 3.3.5
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '3.3'
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: 3.3.5
|
115
|
+
description: Surikat is a web framework that revolves around GraphQL, offering a lot
|
116
|
+
of ready-made functionality such as CRUD operations, automatic query generation,
|
117
|
+
authentication and performance optimisations.
|
118
|
+
email:
|
119
|
+
- me@alxx.se
|
120
|
+
executables:
|
121
|
+
- surikat
|
122
|
+
extensions: []
|
123
|
+
extra_rdoc_files: []
|
124
|
+
files:
|
125
|
+
- ".gitignore"
|
126
|
+
- ".idea/.rakeTasks"
|
127
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
128
|
+
- ".idea/misc.xml"
|
129
|
+
- ".idea/modules.xml"
|
130
|
+
- ".idea/surikat.iml"
|
131
|
+
- ".idea/vcs.xml"
|
132
|
+
- ".idea/workspace.xml"
|
133
|
+
- ".rspec"
|
134
|
+
- ".travis.yml"
|
135
|
+
- Gemfile
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- bin/console
|
140
|
+
- bin/setup
|
141
|
+
- exe/surikat
|
142
|
+
- lib/surikat.rb
|
143
|
+
- lib/surikat/base_model.rb
|
144
|
+
- lib/surikat/base_queries.rb
|
145
|
+
- lib/surikat/base_type.rb
|
146
|
+
- lib/surikat/configurations.rb
|
147
|
+
- lib/surikat/new_app.rb
|
148
|
+
- lib/surikat/routes.rb
|
149
|
+
- lib/surikat/scaffold.rb
|
150
|
+
- lib/surikat/session.rb
|
151
|
+
- lib/surikat/session_manager.rb
|
152
|
+
- lib/surikat/templates/.rspec.tmpl
|
153
|
+
- lib/surikat/templates/.standalone_migrations.tmpl
|
154
|
+
- lib/surikat/templates/Gemfile.tmpl
|
155
|
+
- lib/surikat/templates/Rakefile.tmpl
|
156
|
+
- lib/surikat/templates/aaa_queries.rb.tmpl
|
157
|
+
- lib/surikat/templates/aaa_spec.rb.tmpl
|
158
|
+
- lib/surikat/templates/application.yml.tmpl
|
159
|
+
- lib/surikat/templates/base_aaa_model.rb.tmpl
|
160
|
+
- lib/surikat/templates/base_model.rb.tmpl
|
161
|
+
- lib/surikat/templates/base_spec.rb.tmpl
|
162
|
+
- lib/surikat/templates/config.ru.tmpl
|
163
|
+
- lib/surikat/templates/console.tmpl
|
164
|
+
- lib/surikat/templates/crud_queries.rb.tmpl
|
165
|
+
- lib/surikat/templates/database.yml.tmpl
|
166
|
+
- lib/surikat/templates/hello_queries.rb.tmpl
|
167
|
+
- lib/surikat/templates/hello_spec.rb.tmpl
|
168
|
+
- lib/surikat/templates/routes.yml.tmpl
|
169
|
+
- lib/surikat/templates/spec_helper.rb.tmpl
|
170
|
+
- lib/surikat/templates/test_helper.rb.tmpl
|
171
|
+
- lib/surikat/types.rb
|
172
|
+
- lib/surikat/version.rb
|
173
|
+
- lib/surikat/yaml_configurator.rb
|
174
|
+
- surikat.gemspec
|
175
|
+
homepage: https://github.com/alxx/surikat
|
176
|
+
licenses:
|
177
|
+
- MIT
|
178
|
+
metadata: {}
|
179
|
+
post_install_message:
|
180
|
+
rdoc_options: []
|
181
|
+
require_paths:
|
182
|
+
- lib
|
183
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 2.3.1
|
188
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
requirements: []
|
194
|
+
rubyforge_project:
|
195
|
+
rubygems_version: 2.6.12
|
196
|
+
signing_key:
|
197
|
+
specification_version: 4
|
198
|
+
summary: An API-only, GraphQL centric web framework.
|
199
|
+
test_files: []
|