gemstack-cli 0.2.3 → 0.2.4
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7896a4b00040ddd5556a6923b290c0fc08bcad07884246023343f5a84e7356c7
|
|
4
|
+
data.tar.gz: 30d763aa7d951a808183769dce19cd92b4c577b7aabc9c17af29ec7197b8eda2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 65e7fbeb0df98c81341c1cbb4f0a65ad7d8a13b590479fb47b7f100aec542504cd56c1e1f06154ab75b7ea02278a3ccf98ef62e998e71b81026132480bfdb71b
|
|
7
|
+
data.tar.gz: b35aff968928d09ca121b29607d579ede74c74829cd55713b001462f5d73e6b69087a31b0389239a53278e637ee678e1877d59497e3f7e201727d96f89a7948a
|
data/CHANGELOG.md
CHANGED
data/lib/gemstack/cli.rb
CHANGED
|
@@ -86,7 +86,7 @@ module GemStack
|
|
|
86
86
|
method_option :grep, aliases: "-g", type: :string, desc: "Only routes matching this text"
|
|
87
87
|
def routes
|
|
88
88
|
root = Project.ensure_bundle!(self.class.argv)
|
|
89
|
-
|
|
89
|
+
use_environment!
|
|
90
90
|
Project.load_config!(root)
|
|
91
91
|
GemStack.config.reload_code = false
|
|
92
92
|
GemStack.config.logger.level = :warn
|
|
@@ -101,7 +101,7 @@ module GemStack
|
|
|
101
101
|
desc "console", "Start an IRB session with the application loaded (alias: c)"
|
|
102
102
|
def console
|
|
103
103
|
root = Project.ensure_bundle!(self.class.argv)
|
|
104
|
-
|
|
104
|
+
use_environment!
|
|
105
105
|
Project.load_config!(root)
|
|
106
106
|
GemStack.boot!
|
|
107
107
|
require "irb"
|
|
@@ -228,6 +228,9 @@ module GemStack
|
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
no_commands do
|
|
231
|
+
# -e ENV, else GEMSTACK_ENV, else development.
|
|
232
|
+
def use_environment! = ENV["GEMSTACK_ENV"] = options[:environment] || ENV["GEMSTACK_ENV"] || "development"
|
|
233
|
+
|
|
231
234
|
def generate_model(root, name, args)
|
|
232
235
|
abort("Usage: gemstack generate model NAME field:type ...") unless name && !args.empty?
|
|
233
236
|
spec = ResourceSpec.new(name, args)
|
|
@@ -12,19 +12,43 @@ Bundler.require(:default, GemStack.env.to_sym)
|
|
|
12
12
|
GemStack.configure do |config|
|
|
13
13
|
config.name = "<%= name %>"
|
|
14
14
|
|
|
15
|
-
# Everything below is optional
|
|
16
|
-
#
|
|
15
|
+
# Settings for every environment. Everything below is optional: each line
|
|
16
|
+
# shows the default — uncomment one to change it. Per-environment settings go
|
|
17
|
+
# in config/environments/*.rb. All settings: docs/configuration.md.
|
|
18
|
+
|
|
19
|
+
# ── HTTP ────────────────────────────────────────────────────────────────
|
|
17
20
|
# config.http.api_path = "/api" # where the API lives (routes are relative to it)
|
|
18
21
|
# config.http.max_body_size = 10 * 1024 * 1024 # bytes; larger requests get 413
|
|
19
22
|
# config.http.json = :json # or :oj (add gem "oj"), or your own codec
|
|
20
23
|
# config.http.cors.origins = [] # only for frontends on another domain
|
|
21
24
|
# config.http.middleware.use MyMiddleware # add / insert_before / swap / delete
|
|
22
|
-
|
|
23
|
-
#
|
|
25
|
+
|
|
26
|
+
# ── Pagination: paginate(...) in controllers, ?page=2&per_page=50 (docs/pagination.md) ──
|
|
27
|
+
# config.http.pagination.per_page = 25 # records per page when the client doesn't say
|
|
28
|
+
# config.http.pagination.max_per_page = 100 # the most a client may ask for with ?per_page=
|
|
29
|
+
|
|
30
|
+
# ── Responses ───────────────────────────────────────────────────────────
|
|
31
|
+
# config.http.compression.enabled = true # gzip/Brotli responses over 1 KB (add gem "brotli" for br)
|
|
32
|
+
# config.http.etags = true # ETag + 304 Not Modified for GET responses
|
|
33
|
+
|
|
34
|
+
# ── Logging ─────────────────────────────────────────────────────────────
|
|
35
|
+
# config.logger.level = :debug # :info in production (or GEMSTACK_LOG_LEVEL)
|
|
36
|
+
# config.filter_parameters += %w[iban] # masked in logs, next to password, token, secret…
|
|
24
37
|
<% if database? -%>
|
|
25
|
-
|
|
26
|
-
#
|
|
38
|
+
|
|
39
|
+
# ── Database — the connection is in config/database.yml (DATABASE_URL overrides it) ──
|
|
27
40
|
# config.db.pool_size = 5 # default: GEMSTACK_MAX_THREADS (one per Puma thread)
|
|
28
41
|
# config.db.statement_timeout = 5_000 # ms
|
|
29
42
|
<% end -%>
|
|
43
|
+
|
|
44
|
+
# ── Cache (GemStack.cache) ──────────────────────────────────────────────
|
|
45
|
+
# config.cache.store = :memory # :redis to share it between processes (gem "redis-client")
|
|
46
|
+
# config.cache.default_expires_in = nil # seconds; nil = until evicted
|
|
47
|
+
|
|
48
|
+
# ── Background jobs ─────────────────────────────────────────────────────
|
|
49
|
+
# config.jobs.default_queue = "default"
|
|
50
|
+
# config.jobs.default_max_attempts = 10 # then the job is kept as failed
|
|
51
|
+
|
|
52
|
+
# ── Mail ────────────────────────────────────────────────────────────────
|
|
53
|
+
# config.mail.default_from = "<%= name %> <no-reply@localhost>" # or MAIL_FROM
|
|
30
54
|
end
|
|
@@ -11,10 +11,11 @@ export const <%= spec.variable %>Keys = {
|
|
|
11
11
|
};
|
|
12
12
|
<% if spec.action?(:index) -%>
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// perPage: records per page; omit it to use the API's default (config.http.pagination.per_page).
|
|
15
|
+
export function use<%= spec.plural_class %>(page = 1, perPage?: number) {
|
|
15
16
|
return useQuery({
|
|
16
|
-
queryKey: [...<%= spec.variable %>Keys.all, "page", page],
|
|
17
|
-
queryFn: () => <%= spec.client_name %>.list({ page }),
|
|
17
|
+
queryKey: [...<%= spec.variable %>Keys.all, "page", page, perPage],
|
|
18
|
+
queryFn: () => <%= spec.client_name %>.list({ page, per_page: perPage }),
|
|
18
19
|
placeholderData: keepPreviousData, // keep the current page visible while the next one loads
|
|
19
20
|
});
|
|
20
21
|
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gemstack-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adware Technologies
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.2.
|
|
19
|
+
version: 0.2.4
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.2.
|
|
26
|
+
version: 0.2.4
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: gemstack-dev
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - '='
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.2.
|
|
33
|
+
version: 0.2.4
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - '='
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.2.
|
|
40
|
+
version: 0.2.4
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: thor
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|