fresco 0.0.1 → 0.0.3
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 +4 -4
- data/README.md +169 -0
- data/lib/fresco/cli/new.rb +1 -1
- data/lib/fresco/generators/app/.gitignore +6 -0
- data/lib/fresco/generators/app/.rubocop.yml +20 -0
- data/lib/fresco/generators/app/db/migrations/.keep +0 -0
- data/lib/fresco/version.rb +1 -1
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 96b93d566a20abf860f206f125b6de7cb4a8cdc079ac728336de53fdd5079037
|
|
4
|
+
data.tar.gz: 7c1957106146bfb12a0ea92d1da5e1ac22ff8a1ddb193da1d0620716b24467e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 382422c87387db4558b624ae46c16fb580f2f24964e4fa1a414f8f875aa244552ee241df90700291de506ae97b268da2ffe6e94bdaed20811be252058554761e
|
|
7
|
+
data.tar.gz: 7e11baa9149d08133ce3b2afcc1ff932183e7d1bddfa66eab199b7ba2ca8e237f81e7ee634562b2357243cd35f47fd22e0804e29de508be493e1fe58346f7793
|
data/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Fresco
|
|
2
|
+
|
|
3
|
+
An application framework for Ruby that compiles to a static binary via
|
|
4
|
+
[Spinel][spinel]. Two modes from the same source tree:
|
|
5
|
+
|
|
6
|
+
- **Dev**: CRuby with auto-reload — `bin/dev`.
|
|
7
|
+
- **Release**: a single static binary, no Ruby on the host — `bin/release`
|
|
8
|
+
produces `build/app`.
|
|
9
|
+
|
|
10
|
+
A build-time DSL (routes, schema, models, migrations) is captured under
|
|
11
|
+
CRuby and codegen'd into `generated/`. The generated tree is what Spinel
|
|
12
|
+
AOT-compiles for release; CRuby loads the same tree for dev.
|
|
13
|
+
|
|
14
|
+
For a runnable tour of the framework, see
|
|
15
|
+
[afomera/fresco-example][fresco-example].
|
|
16
|
+
|
|
17
|
+
[spinel]: https://github.com/matz/spinel
|
|
18
|
+
[fresco-example]: https://github.com/afomera/fresco-example
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
gem install fresco
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or in a Gemfile:
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
gem "fresco"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Requires Ruby `>= 3.0` for the dev loop. The release binary has no Ruby
|
|
33
|
+
runtime dependency on the host machine.
|
|
34
|
+
|
|
35
|
+
## Installing Spinel
|
|
36
|
+
|
|
37
|
+
`fresco dev` runs under CRuby and does **not** need Spinel. `fresco
|
|
38
|
+
release` shells out to a `spinel` binary to AOT-compile your app, so you
|
|
39
|
+
need Spinel installed before you ship a build.
|
|
40
|
+
|
|
41
|
+
Spinel doesn't ship a prebuilt binary today — clone and build it from
|
|
42
|
+
source:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
# Pick a checkout location. We'll symlink the resulting binary into your
|
|
46
|
+
# Fresco app, so anywhere on disk is fine.
|
|
47
|
+
git clone https://github.com/matz/spinel.git
|
|
48
|
+
cd spinel
|
|
49
|
+
|
|
50
|
+
make deps # fetch and build Spinel's vendored dependencies
|
|
51
|
+
make all # build the spinel binary
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
That produces a `spinel` executable in the repo root. `fresco release`
|
|
55
|
+
looks for it in this order:
|
|
56
|
+
|
|
57
|
+
1. `./spinel` in the Fresco app directory (symlink or copy)
|
|
58
|
+
2. `./vendor/spinel/bin/spinel`
|
|
59
|
+
3. `spinel` on `$PATH`
|
|
60
|
+
|
|
61
|
+
The simplest setup is a symlink at the app root:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
cd path/to/your-fresco-app
|
|
65
|
+
ln -s /absolute/path/to/spinel/spinel ./spinel
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`.gitignore` the symlink — the binary is per-machine.
|
|
69
|
+
|
|
70
|
+
### macOS Postgres note
|
|
71
|
+
|
|
72
|
+
If your app uses the Postgres adapter, `fresco release` auto-detects
|
|
73
|
+
Homebrew's keg-only `libpq` (`/opt/homebrew/opt/libpq`,
|
|
74
|
+
`/usr/local/opt/libpq`) and `Postgres.app`, and prepends their
|
|
75
|
+
`include/` and `lib/` to `CPATH` / `LIBRARY_PATH` so Spinel's compile of
|
|
76
|
+
the libpq shim resolves `libpq-fe.h` and `-lpq` without manual export.
|
|
77
|
+
SQLite builds need no extra setup.
|
|
78
|
+
|
|
79
|
+
## Quick start
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
fresco new bookshelf
|
|
83
|
+
cd bookshelf
|
|
84
|
+
bundle install
|
|
85
|
+
bin/dev
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Open <http://localhost:3030/>.
|
|
89
|
+
|
|
90
|
+
To build a release binary:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
ln -s /path/to/spinel/spinel ./spinel
|
|
94
|
+
bin/release
|
|
95
|
+
./build/app
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Commands
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
fresco new <name> Scaffold a new app in ./<name>/
|
|
102
|
+
fresco build Regenerate generated/* from config + app/
|
|
103
|
+
fresco dev Run the CRuby dev loop (build + watch + serve)
|
|
104
|
+
fresco release Build a Spinel-compiled binary at ./build/app
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The scaffolded app's `bin/dev`, `bin/build`, and `bin/release` are thin
|
|
108
|
+
wrappers around `bundle exec fresco <subcommand>`.
|
|
109
|
+
|
|
110
|
+
### `fresco new` flags
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
--fresco-path <dir> Pin the generated Gemfile to a path-installed
|
|
114
|
+
fresco (useful when co-developing fresco itself).
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## App layout
|
|
118
|
+
|
|
119
|
+
A Fresco app generated by `fresco new` looks like:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
app/
|
|
123
|
+
action.rb # base class
|
|
124
|
+
actions/ # request handlers
|
|
125
|
+
models/ # build-time model declarations
|
|
126
|
+
views/ # ERB templates (compiled at build time)
|
|
127
|
+
config/
|
|
128
|
+
app.rb # framework config
|
|
129
|
+
database.rb # adapter + DSN (omit for no DB)
|
|
130
|
+
routes.rb # route table
|
|
131
|
+
db/
|
|
132
|
+
schema.rb # table declarations
|
|
133
|
+
migrations/ # versioned SQL migrations
|
|
134
|
+
bin/
|
|
135
|
+
dev, build, release # wrappers for `bundle exec fresco …`
|
|
136
|
+
app.rb # Spinel entry point
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
`generated/` and `build/` are produced by the toolchain and should be
|
|
140
|
+
gitignored.
|
|
141
|
+
|
|
142
|
+
## How dev and release stay in sync
|
|
143
|
+
|
|
144
|
+
Both modes load the same `generated/` tree. `fresco dev` re-runs the
|
|
145
|
+
build step on file changes; `fresco release` runs it once and hands the
|
|
146
|
+
result to Spinel. There is no separate "production codepath" to drift —
|
|
147
|
+
if a route works in dev, it works in the compiled binary (modulo Spinel's
|
|
148
|
+
Ruby subset, which `rubocop_spinel` lints for at build time when present
|
|
149
|
+
in your Gemfile).
|
|
150
|
+
|
|
151
|
+
## Development of the gem itself
|
|
152
|
+
|
|
153
|
+
```sh
|
|
154
|
+
bundle install
|
|
155
|
+
bundle exec rake build # → pkg/fresco-<version>.gem
|
|
156
|
+
bundle exec rake install # build + install locally
|
|
157
|
+
bundle exec rake release # tag + push to rubygems.org
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
When iterating on `fresco` alongside an app, scaffold the app against
|
|
161
|
+
your working copy:
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
fresco new myapp --fresco-path ../fresco
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT.
|
data/lib/fresco/cli/new.rb
CHANGED
|
@@ -64,7 +64,7 @@ module Fresco
|
|
|
64
64
|
locals = {
|
|
65
65
|
app_name: app_name,
|
|
66
66
|
module_name: camelize(app_name),
|
|
67
|
-
fresco_source: fresco_path ? ", path: #{File.expand_path(fresco_path).inspect}" : "",
|
|
67
|
+
fresco_source: fresco_path ? ", path: #{File.expand_path(fresco_path).inspect}" : ", source: \"https://rubygems.org\"",
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
FileUtils.mkdir_p(target)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Fresco: rubocop config. Runs ONLY the Spinel-subset cops — no
|
|
2
|
+
# stylistic noise. `fresco build` invokes this against app/ (covers
|
|
3
|
+
# app/action.rb + app/actions/ + anything else under app/ that
|
|
4
|
+
# Spinel will eventually compile).
|
|
5
|
+
|
|
6
|
+
plugins:
|
|
7
|
+
- rubocop_spinel
|
|
8
|
+
|
|
9
|
+
AllCops:
|
|
10
|
+
NewCops: disable
|
|
11
|
+
DisabledByDefault: true
|
|
12
|
+
TargetRubyVersion: 3.3
|
|
13
|
+
Exclude:
|
|
14
|
+
- "generated/**/*"
|
|
15
|
+
|
|
16
|
+
Spinel/Unsupported:
|
|
17
|
+
Enabled: true
|
|
18
|
+
|
|
19
|
+
Layout/ExtraSpacing:
|
|
20
|
+
Enabled: true
|
|
File without changes
|
data/lib/fresco/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fresco
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrea Fomera
|
|
@@ -46,6 +46,7 @@ executables:
|
|
|
46
46
|
extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
|
48
48
|
files:
|
|
49
|
+
- README.md
|
|
49
50
|
- exe/fresco
|
|
50
51
|
- lib/fresco.rb
|
|
51
52
|
- lib/fresco/application.rb
|
|
@@ -56,6 +57,8 @@ files:
|
|
|
56
57
|
- lib/fresco/cli/new.rb
|
|
57
58
|
- lib/fresco/cli/release.rb
|
|
58
59
|
- lib/fresco/database_config.rb
|
|
60
|
+
- lib/fresco/generators/app/.gitignore
|
|
61
|
+
- lib/fresco/generators/app/.rubocop.yml
|
|
59
62
|
- lib/fresco/generators/app/Gemfile.tt
|
|
60
63
|
- lib/fresco/generators/app/README.md.tt
|
|
61
64
|
- lib/fresco/generators/app/app.rb.tt
|
|
@@ -69,6 +72,7 @@ files:
|
|
|
69
72
|
- lib/fresco/generators/app/config/app.rb.tt
|
|
70
73
|
- lib/fresco/generators/app/config/database.rb
|
|
71
74
|
- lib/fresco/generators/app/config/routes.rb
|
|
75
|
+
- lib/fresco/generators/app/db/migrations/.keep
|
|
72
76
|
- lib/fresco/generators/app/db/schema.rb
|
|
73
77
|
- lib/fresco/generators/app/public/404.html
|
|
74
78
|
- lib/fresco/generators/app/public/500.html
|