skyward 0.4.0 → 0.4.2

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: 0d5ad91d8d26c204af3b712b7fee66fab575d37c1cfeb3b6b3c97444c04f3656
4
- data.tar.gz: 213282afcdea36418210140fa79ccdac2ab7365d188a2992e9ddd994d818b6f9
3
+ metadata.gz: e14ce47342c3e4aef4fce27d7ecf9c2536673a7df249b69d985fa49d83fe52f1
4
+ data.tar.gz: 1f8aa953c9b81fcdfca039e5764cbfaa30bc6dba85699ccbee756ac62b3ba98d
5
5
  SHA512:
6
- metadata.gz: 3afbb8bd0632c7dd29ba303341194e7688ba9f4b15dd6a8e9e6c6b39063cf4868b8d45ddf4bfc6003c5a3327cfc637118071ea08f7920a0c6c78d5096ed42ac3
7
- data.tar.gz: 9ddc7eda951422bcdb69eb018291a26d44d09564d7a422c099991777a5a498426eedfd6246627d99a09f017c771736311de9e0588d51ae9f5a482dced2918211
6
+ metadata.gz: 4ae3372c45e3720d4979f79eb4dec61cbd5382f44f17da5d20de115f017006b098b208a01c3675e6d918a5894a04d7096ee69728979ef3d175eb6a794f735091
7
+ data.tar.gz: 9ff878a6574679c63021053f46ee8ab4161f7ffef2fca013fff62dcd7c5348ddb4f6705e2a7822ecb1744102c8091a4a9f427ca0d759b5cc43bfdc41a290cf82
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jake Bottrall
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -14,11 +14,11 @@ Each works without the other. Add this gem when you want both.
14
14
 
15
15
  ```ruby
16
16
  # Gemfile
17
- gem "skyward"
17
+ gem 'skyward'
18
18
  ```
19
19
 
20
20
  ```ruby
21
- require "skyward" # requires skyward/api and skyward/orm
21
+ require 'skyward' # requires skyward/api and skyward/orm
22
22
  ```
23
23
 
24
24
  Skyward supports every Ruby that isn't end-of-life (3.3 and later, as of November 2026).
@@ -67,4 +67,4 @@ This README is the spec, and this section lists each part of it that's built, as
67
67
 
68
68
  - **One reading of each type.** The `skyward` gem's tests hold Skyward API and Skyward ORM to the promise both READMEs make, that a row read from the database and the same class sent as JSON are the same thing, on SQLite and on PostgreSQL. A table class with a column of every type both read (`Integer`, `Float`, `BigDecimal`, `String`, `bool`, `Date`, `Time`, a union of symbols, `Hash[String, untyped]` and an `Array[T]` of each of those but the Hash, a nullable one of each scalar and of the Hash, and a nullable `Array[String]?`) makes the round trip: a row the ORM inserts, returned from an endpoint typed with the class, read back with `Skyward::API::Test.client` and posted to an endpoint that takes the class as `body:`, arrives `==` to the row the database holds, a `Time` with microseconds and a non-UTC offset included, a `BigDecimal` with more digits than a `Float` holds, a `Hash[String, untyped]` that nests an object in an array in an object and holds a Float, an Integer past 64 bits, `null`, `false`, an empty object and a non-ASCII key, and Arrays, an empty one among them, whose Strings hold a comma, a quote, a brace, a backslash and `"NULL"`. The class's OpenAPI component and the ORM's columns agree, field by field, on name, type, an Array's items, nullability and enum values. The types only one gem reads are listed in the test, so teaching either gem a type means updating the list: for now `Hash[String, T]` with any `T` but `untyped`, `Array[T]` of any other `T`, records, classes with typed readers, unions of them and literals are read by Skyward API alone.
69
69
  - **`skyward new`.** `skyward new NAME` writes the app [Starting an app](#starting-an-app) describes, every file of it from a function of the name alone, then runs `bundle install` in it unless given `--skip-bundle`, outside any bundle `skyward` runs under, so `bundle exec skyward new` installs the app's Gemfile, not the outer one. The app is blank: its one endpoint is `GET /up`, and `modules/` and `db/migrate/` are empty, each holding only a `.keep` so git keeps it. A missing name, more than one, a name that isn't lowercase letters, digits and underscores starting with a letter, or a path that exists and isn't an empty directory prints why and exits 1, writing nothing. The packaging check builds and installs the gems, runs `skyward new demo`, and fails unless the app's own `bin/ci` passes with them, Steep, `skyward check` and `skyward migrate` with no migrations included.
70
- - **The getting-started guide and `llms.txt`.** [`docs/getting-started.md`](../docs/getting-started.md) walks a newcomer from `gem install skyward` to a running, tested, documented API, showing each step's command, code and output, for Skyward 0.3. It starts from the blank app and builds a resource from nothing: a table class, its migration, a typed API mounted in `app.rb`, its tests, `bin/ci`, `skyward serve` and `curl`. Every command in it has been run, in order, on a fresh app. [`llms.txt`](../llms.txt), at the repository root, points agents at the guide, each gem's README and the `AGENTS.md` that `skyward new` writes, as raw Markdown.
70
+ - **The getting-started guide and `llms.txt`.** [`docs/getting-started.md`](../docs/getting-started.md) walks a newcomer from `gem install skyward` to a running, tested, documented API, showing each step's command, code and output, for Skyward 0.3. It starts from the blank app and builds a resource from nothing: a table class, its migration, a typed API mounted in `app.rb`, its tests, `bin/ci`, `skyward serve` and `curl`. Every command in it has been run, in order, on a fresh app. [`llms.txt`](https://github.com/bottrall/skyward/blob/main/llms.txt), at the repository root, points agents at the guide, each gem's README and the `AGENTS.md` that `skyward new` writes, as raw Markdown.
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
- gem "skyward", "= {{version}}"
6
- gem "sqlite3", "~> 2.10"
5
+ gem 'skyward', '= {{version}}'
6
+ gem 'sqlite3', '~> 2.10'
7
7
 
8
8
  # Falcon serves the app in development (skyward serve) and in production. The
9
9
  # app's code never requires it, which keeps its signatures out of the RBS
10
10
  # collection.
11
- gem "falcon", "~> 0.57", require: false
11
+ gem 'falcon', '~> 0.57', require: false
12
12
 
13
13
  group :development, :test do
14
14
  # skyward check runs both.
15
- gem "rbs-inline", "~> 0.14", require: false
16
- gem "steep", "~> 2.1", require: false
15
+ gem 'rbs-inline', '~> 0.14', require: false
16
+ gem 'steep', '~> 2.1', require: false
17
17
  end
18
18
 
19
19
  group :test do
20
- gem "minitest", "~> 6.0"
21
- gem "rake", "~> 13.4"
20
+ gem 'minitest', '~> 6.0'
21
+ gem 'rake', '~> 13.4'
22
22
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "minitest/test_task"
3
+ require 'minitest/test_task'
4
4
 
5
5
  Minitest::TestTask.create
6
6
 
@@ -3,13 +3,13 @@
3
3
  D = Steep::Diagnostic
4
4
 
5
5
  target :app do
6
- signature "sig"
6
+ signature 'sig'
7
7
 
8
- check "*.rb", "lib", "modules"
8
+ check '*.rb', 'lib', 'modules'
9
9
 
10
10
  # The Skyward gems' signatures come with the gems, and the rest from the RBS
11
11
  # collection, which bin/setup installs.
12
- collection_config "rbs_collection.yaml"
12
+ collection_config 'rbs_collection.yaml'
13
13
 
14
14
  configure_code_diagnostics(D::Ruby.all_error)
15
15
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  # rbs_inline: enabled
4
4
 
5
- require_relative "boot"
5
+ require_relative 'boot'
6
6
 
7
- App = Skyward.app(docs: true, title: "{{title}}") do |app|
7
+ App = Skyward.app(docs: true, title: '{{title}}') do |app|
8
8
  app.mount HealthAPI.new
9
9
  end #: Skyward::API::_RackApp
@@ -2,17 +2,17 @@
2
2
 
3
3
  # rbs_inline: enabled
4
4
 
5
- require "skyward"
6
- require "zeitwerk"
5
+ require 'skyward'
6
+ require 'zeitwerk'
7
7
 
8
8
  loader = Zeitwerk::Loader.new
9
9
  loader.push_dir("#{__dir__}/lib")
10
10
  loader.push_dir("#{__dir__}/modules")
11
- loader.inflector.inflect("api" => "API", "health_api" => "HealthAPI")
11
+ loader.inflector.inflect('api' => 'API', 'health_api' => 'HealthAPI')
12
12
  # skyward serve unloads the app's code to reload it, which Zeitwerk allows only
13
13
  # for a loader set up with reloading on.
14
- loader.enable_reloading if ENV["RACK_ENV"] == "development"
14
+ loader.enable_reloading if ENV['RACK_ENV'] == 'development'
15
15
  loader.setup
16
16
  loader.eager_load
17
17
 
18
- Skyward.connect(ENV.fetch("DATABASE_URL", "sqlite://#{__dir__}/db/{{name}}.sqlite3"))
18
+ Skyward.connect(ENV.fetch('DATABASE_URL', "sqlite://#{__dir__}/db/{{name}}.sqlite3"))
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "app"
3
+ require_relative 'app'
4
4
  run App
@@ -3,10 +3,10 @@
3
3
  # rbs_inline: enabled
4
4
 
5
5
  class HealthAPI < Skyward::API
6
- description "Whether the app is up, for load balancers and uptime checks."
6
+ description 'Whether the app is up, for load balancers and uptime checks.'
7
7
 
8
- get "/up", to: :show, summary: "Report that the app is up."
8
+ get '/up', to: :show, summary: 'Report that the app is up.'
9
9
 
10
10
  # @rbs return: { status: "ok" }
11
- def show = { status: "ok" }
11
+ def show = { status: 'ok' }
12
12
  end
@@ -1,27 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "test_helper"
3
+ require 'test_helper'
4
4
 
5
- describe "App" do
5
+ describe 'App' do
6
6
  let(:client) { Skyward::API::Test.client(App) }
7
7
 
8
- describe "GET /up" do
9
- it "says the app is up" do
10
- assert_equal({ status: "ok" }, client.get("/up").json)
8
+ describe 'GET /up' do
9
+ it 'says the app is up' do
10
+ assert_equal({ status: 'ok' }, client.get('/up').json)
11
11
  end
12
12
  end
13
13
 
14
- describe "GET /openapi.json" do
15
- it "documents every endpoint" do
16
- paths = client.get("/openapi.json").json[:paths].keys
14
+ describe 'GET /openapi.json' do
15
+ it 'documents every endpoint' do
16
+ paths = client.get('/openapi.json').json[:paths].keys
17
17
 
18
18
  assert_equal %i[/up], paths
19
19
  end
20
20
  end
21
21
 
22
- describe "GET /docs" do
23
- it "serves the API reference" do
24
- assert_includes client.get("/docs").body, "<title>{{title}}</title>"
22
+ describe 'GET /docs' do
23
+ it 'serves the API reference' do
24
+ assert_includes client.get('/docs').body, '<title>{{title}}</title>'
25
25
  end
26
26
  end
27
27
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "test_helper"
3
+ require 'test_helper'
4
4
 
5
5
  describe HealthAPI do
6
- describe "#show" do
7
- it "says the app is up" do
8
- assert_equal({ status: "ok" }, HealthAPI.new.show)
6
+ describe '#show' do
7
+ it 'says the app is up' do
8
+ assert_equal({ status: 'ok' }, HealthAPI.new.show)
9
9
  end
10
10
  end
11
11
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "minitest/autorun"
4
- require "skyward"
5
- require "stringio"
3
+ require 'minitest/autorun'
4
+ require 'skyward'
5
+ require 'stringio'
6
6
 
7
7
  # A database of the suite's own, migrated from empty each run, unless
8
8
  # TEST_DATABASE_URL names another, so the tests never run against the
9
9
  # DATABASE_URL the app uses.
10
- ENV["DATABASE_URL"] = ENV.fetch("TEST_DATABASE_URL", "sqlite://:memory:")
10
+ ENV['DATABASE_URL'] = ENV.fetch('TEST_DATABASE_URL', 'sqlite://:memory:')
11
11
 
12
12
  # App logs every request to the $stdout it boots with, which would bury the
13
13
  # test report, so it boots with one of its own. Its boot.rb connects with the
@@ -15,9 +15,9 @@ ENV["DATABASE_URL"] = ENV.fetch("TEST_DATABASE_URL", "sqlite://:memory:")
15
15
  # Skyward.migrate.
16
16
  stdout = $stdout
17
17
  $stdout = StringIO.new
18
- Skyward::ORM::Connection::SESSION.without_check { require_relative "../app" }
18
+ Skyward::ORM::Connection::SESSION.without_check { require_relative '../app' }
19
19
  $stdout = stdout
20
- Skyward.migrate(File.expand_path("../db/migrate", __dir__))
20
+ Skyward.migrate(File.expand_path('../db/migrate', __dir__))
21
21
 
22
22
  # Every test, App's HTTP tests too, runs in a transaction that's rolled back
23
23
  # after it. The test client calls App on the test's fiber, so its requests run
@@ -7,7 +7,7 @@ module Skyward::Generator::CLI::New::Template
7
7
 
8
8
  # Every file there ends in it, so none of the tools that read the gem's own
9
9
  # Ruby, signatures and Steepfile takes the app's for the gem's.
10
- SUFFIX = ".tt" #: String
10
+ SUFFIX = '.tt' #: String
11
11
 
12
12
  PLACEHOLDER = /\{\{\w+\}\}/ #: Regexp
13
13
 
@@ -20,7 +20,7 @@ module Skyward::Generator::CLI::New::Template
20
20
  # @rbs name: String
21
21
  # @rbs return: Hash[String, String]
22
22
  def files(name)
23
- values = { "{{name}}" => name, "{{title}}" => title(name), "{{version}}" => Skyward::VERSION }
23
+ values = { '{{name}}' => name, '{{title}}' => title(name), '{{version}}' => Skyward::VERSION }
24
24
  FILES.transform_values { |content| content.gsub(PLACEHOLDER) { |key| values.fetch(key) } }
25
25
  end
26
26
 
@@ -28,5 +28,5 @@ module Skyward::Generator::CLI::New::Template
28
28
 
29
29
  # @rbs name: String
30
30
  # @rbs return: String
31
- def title(name) = name.split("_").map(&:capitalize).join
31
+ def title(name) = name.split('_').map(&:capitalize).join
32
32
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "fileutils"
3
+ require 'fileutils'
4
4
 
5
5
  module Skyward::Generator::CLI::New
6
6
  extend self
7
7
 
8
- SKIP_BUNDLE = "--skip-bundle" #: String
8
+ SKIP_BUNDLE = '--skip-bundle' #: String
9
9
 
10
10
  # Lowercase, so it names one directory on every filesystem, and a constant
11
11
  # once camelized.
@@ -24,11 +24,11 @@ module Skyward::Generator::CLI::New
24
24
  file = File.join(app, path)
25
25
  FileUtils.mkdir_p(File.dirname(file))
26
26
  File.write(file, content)
27
- File.chmod(0o755, file) if path.start_with?("bin/")
27
+ File.chmod(0o755, file) if path.start_with?('bin/')
28
28
  out.write("Wrote #{File.join(name, path)}\n")
29
29
  end
30
30
  # system merges env into this process's environment unless told to replace it.
31
- unless args.include?(SKIP_BUNDLE) || kernel.system(env, "bundle", "install", chdir: app, unsetenv_others: true)
31
+ unless args.include?(SKIP_BUNDLE) || kernel.system(env, 'bundle', 'install', chdir: app, unsetenv_others: true)
32
32
  return kernel.abort("skyward: bundle install failed in #{name}. Fix what it printed, then run bin/setup there.")
33
33
  end
34
34
 
@@ -47,7 +47,7 @@ module Skyward::Generator::CLI::New
47
47
  end
48
48
  unless name.match?(NAME)
49
49
  return "skyward: #{name} can't name an app. Use lowercase letters, digits and underscores, " \
50
- "starting with a letter, as in my_app."
50
+ 'starting with a letter, as in my_app.'
51
51
  end
52
52
 
53
53
  app = File.join(directory, name)
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "skyward/generator"
3
+ require 'skyward/generator'
4
4
 
5
5
  Skyward::Core::CLI.register(
6
- "new",
7
- "Write a new app in NAME/ and install its gems, unless given --skip-bundle"
6
+ 'new',
7
+ 'Write a new app in NAME/ and install its gems, unless given --skip-bundle'
8
8
  ) do |args|
9
9
  # Under bundle exec, the app's bundle install would otherwise read the
10
10
  # Gemfile skyward runs under, not the app's.
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "skyward/core"
4
- require "zeitwerk"
5
- require_relative "version"
3
+ require 'skyward/core'
4
+ require 'zeitwerk'
5
+ require_relative 'version'
6
6
 
7
7
  loader = Zeitwerk::Loader.for_gem_extension(Skyward)
8
- loader.inflector.inflect("cli" => "CLI")
8
+ loader.inflector.inflect('cli' => 'CLI')
9
9
  # The skyward executable loads it, and it defines no constant.
10
10
  loader.ignore("#{__dir__}/generator/commands.rb")
11
11
  # It defines Skyward::VERSION, not the Skyward::Version its name means to the loader.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Skyward
4
- VERSION = "0.4.0" #: String
4
+ VERSION = '0.4.2' #: String
5
5
  end
data/lib/skyward.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "skyward/version"
4
- require "skyward/api"
5
- require "skyward/orm"
3
+ require_relative 'skyward/version'
4
+ require 'skyward/api'
5
+ require 'skyward/orm'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skyward
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Bottrall
@@ -15,42 +15,42 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.4.0
18
+ version: 0.4.2
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.4.0
25
+ version: 0.4.2
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: skyward-core
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - '='
31
31
  - !ruby/object:Gem::Version
32
- version: 0.4.0
32
+ version: 0.4.2
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 0.4.0
39
+ version: 0.4.2
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: skyward-orm
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 0.4.0
46
+ version: 0.4.2
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 0.4.0
53
+ version: 0.4.2
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: zeitwerk
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -71,6 +71,7 @@ executables: []
71
71
  extensions: []
72
72
  extra_rdoc_files: []
73
73
  files:
74
+ - LICENSE
74
75
  - README.md
75
76
  - lib/skyward.rb
76
77
  - lib/skyward/generator.rb