gemstack-cli 0.2.3 → 0.2.5

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: 3b7ea1041a871d84d72d33529ee4b303145363665a6605d0cc5d533fd4604157
4
- data.tar.gz: 02625e8747b1efe7fae2191d356376bc8bdde1500d892cef5f945badb1d5451d
3
+ metadata.gz: 4fece916078245099b1b1a2772b7e53645d7e2420dd1fe28703593beb5e99d6f
4
+ data.tar.gz: 5f4d02f6371f8d95e05a2d9b8b942a70c7806f0848970d8be8d023bc6fc26d72
5
5
  SHA512:
6
- metadata.gz: 96aabfd8af652f60639dd4aa4b155351b654be18ff569a262520c1fec6a1d7f73a1f192c62b7dba551eb4bbdce86fc3e4ad1a00f100d4b4ad6ba51e5a3e56f21
7
- data.tar.gz: 2efe2c5964c8a597efae119096f5293b635574b1b2db68b5be483a203d2d3228ec3ff87018f37865a5caf081b1efd7b97708b55d44465cba61bab223aed6d210
6
+ metadata.gz: f2c6ca47b6f4d6297d5d5a4e1ef7fe54013c479319de64f8db9ffec9a9ad6816c079d956979fbbe0c0fdef720234e3c0dabe3319702d852dfbe2949aa25c101a
7
+ data.tar.gz: fb4a50901dc646436500d6e934d9e0a51f9f211315740c887f147b476d96a3dd0f457993082b0b86c2ecafe4a7e19e5149ea8cc1b6a360423bb59eb55222ff5e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.5
4
+
5
+ See the [GemStack changelog](https://github.com/gemstack-rb/gemstack/blob/main/CHANGELOG.md).
6
+
7
+ ## 0.2.4
8
+
9
+ See the [GemStack changelog](https://github.com/gemstack-rb/gemstack/blob/main/CHANGELOG.md).
10
+
3
11
  ## 0.2.3
4
12
 
5
13
  See the [GemStack changelog](https://github.com/gemstack-rb/gemstack/blob/main/CHANGELOG.md).
@@ -35,7 +35,7 @@ module GemStack
35
35
  # Pins the app to the Ruby that generated it, in files every version
36
36
  # manager reads (.ruby-version: rbenv, rvm, chruby, asdf, mise;
37
37
  # .tool-versions: asdf, mise), and Node.js likewise (.node-version,
38
- # .nvmrc, .tool-versions) — DECISIONS D-066.
38
+ # .nvmrc, .tool-versions).
39
39
  def ruby_version = RUBY_VERSION
40
40
  def node_version = @node_version ||= Dev::Toolchain.pinned_node_version
41
41
  def frontend? = !@options[:skip_frontend]
@@ -4,7 +4,7 @@ module GemStack
4
4
  class CLI < Thor
5
5
  # `gemstack generate deploy` — Dockerfile (api + web targets), compose.yaml
6
6
  # (Postgres, migrations, API, jobs, Next.js, Caddy), Caddyfile, Procfile and
7
- # .dockerignore (DECISIONS D-058). Nothing is deployed anywhere.
7
+ # .dockerignore. Nothing is deployed anywhere.
8
8
  class DeployGenerator < Generator
9
9
  def initialize(root:, output: $stdout, force: false)
10
10
  super(output: output, force: force)
@@ -7,7 +7,7 @@ require "gemstack/dev"
7
7
  module GemStack
8
8
  class CLI < Thor
9
9
  # `gemstack doctor` — checks that an application can run, and says how to
10
- # fix what can't (DECISIONS D-057). Every check is independent: one
10
+ # fix what can't. Every check is independent: one
11
11
  # failure never hides the others. `--production` checks the settings a
12
12
  # deploy needs.
13
13
  class Doctor
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
- ENV["GEMSTACK_ENV"] ||= "development"
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
- ENV["GEMSTACK_ENV"] = options[:environment] || ENV["GEMSTACK_ENV"] || "development"
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 — these are the defaults. See docs/configuration.md.
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
- # config.logger.level = :debug
23
- # config.filter_parameters += %w[iban] # masked in logs
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
- # Connection: config/database.yml (DATABASE_URL / TEST_DATABASE_URL override it).
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
- export function use<%= spec.plural_class %>(page = 1) {
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.3
4
+ version: 0.2.5
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.3
19
+ version: 0.2.5
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.3
26
+ version: 0.2.5
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.3
33
+ version: 0.2.5
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.3
40
+ version: 0.2.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement