Compare commits
12 Commits
master
...
dev-langif
Author | SHA1 | Date |
---|---|---|
Matthew Butterick | 1eed433d14 | 6 years ago |
Matthew Butterick | 92691c3df6 | 6 years ago |
Matthew Butterick | ba676b5182 | 6 years ago |
Matthew Butterick | a3eaf95da3 | 6 years ago |
Matthew Butterick | 4c642a9c3b | 6 years ago |
Matthew Butterick | 0051034553 | 6 years ago |
Matthew Butterick | 61c14eb198 | 6 years ago |
Matthew Butterick | 631ff162ca | 6 years ago |
Matthew Butterick | 13a827a3cb | 6 years ago |
Matthew Butterick | bfe5cde340 | 6 years ago |
Matthew Butterick | e4963c765e | 6 years ago |
Matthew Butterick | a80e6dcab1 | 6 years ago |
@ -1 +0,0 @@
|
||||
custom: https://mbtype.com
|
@ -1,43 +0,0 @@
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
name: "Build using Racket '${{ matrix.racket-version }}' (${{ matrix.racket-variant }})"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
racket-version: ["6.6", "6.7", "6.8", "6.9", "6.10.1", "6.11", "6.12", "7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "7.7", "7.8", "7.9", "current"]
|
||||
racket-variant: ["BC", "CS"]
|
||||
# CS builds are only provided for versions 7.4 and up so avoid
|
||||
# running the job for prior versions.
|
||||
exclude:
|
||||
- {racket-version: "6.6", racket-variant: "CS"}
|
||||
- {racket-version: "6.7", racket-variant: "CS"}
|
||||
- {racket-version: "6.8", racket-variant: "CS"}
|
||||
- {racket-version: "6.9", racket-variant: "CS"}
|
||||
- {racket-version: "6.10.1", racket-variant: "CS"}
|
||||
- {racket-version: "6.11", racket-variant: "CS"}
|
||||
- {racket-version: "6.12", racket-variant: "CS"}
|
||||
- {racket-version: "7.0", racket-variant: "CS"}
|
||||
- {racket-version: "7.1", racket-variant: "CS"}
|
||||
- {racket-version: "7.2", racket-variant: "CS"}
|
||||
- {racket-version: "7.3", racket-variant: "CS"}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- uses: Bogdanp/setup-racket@v0.11
|
||||
with:
|
||||
distribution: 'full'
|
||||
version: ${{ matrix.racket-version }}
|
||||
variant: ${{ matrix.racket-variant }}
|
||||
|
||||
- name: Install Pollen and its dependencies
|
||||
run: raco pkg install --auto --batch
|
||||
|
||||
- name: Run the tests
|
||||
run: xvfb-run raco test -j 4 -p pollen
|
@ -0,0 +1,47 @@
|
||||
# adapted from
|
||||
# https://github.com/greghendershott/travis-racket/blob/master/.travis.yml
|
||||
# Thanks Greg!
|
||||
|
||||
language: c
|
||||
sudo: false
|
||||
|
||||
env:
|
||||
global:
|
||||
- RACKET_DIR=~/racket
|
||||
matrix:
|
||||
- RACKET_VERSION=6.0
|
||||
- RACKET_VERSION=6.1
|
||||
- RACKET_VERSION=6.2
|
||||
- RACKET_VERSION=6.3
|
||||
- RACKET_VERSION=6.4
|
||||
- RACKET_VERSION=6.5
|
||||
- RACKET_VERSION=6.6
|
||||
- RACKET_VERSION=6.7
|
||||
- RACKET_VERSION=6.8
|
||||
- RACKET_VERSION=6.9
|
||||
- RACKET_VERSION=6.10
|
||||
- RACKET_VERSION=6.11
|
||||
- RACKET_VERSION=6.12
|
||||
- RACKET_VERSION=HEAD
|
||||
|
||||
# You may want to test against certain versions of Racket, without
|
||||
# having them count against the overall success/failure.
|
||||
matrix:
|
||||
allow_failures:
|
||||
# - env: RACKET_VERSION=HEAD
|
||||
# Fast finish: Overall build result is determined as soon as any of
|
||||
# its rows have failed, or, all of its rows that aren't allowed to
|
||||
# fail have succeeded.
|
||||
fast_finish: true
|
||||
|
||||
before_install:
|
||||
- "export DISPLAY=:99.0" # needed for testing with `racket/gui`
|
||||
- "sh -e /etc/init.d/xvfb start" # needed for testing with `racket/gui`
|
||||
- git clone https://github.com/mbutterick/travis-racket.git
|
||||
- cat travis-racket/install-racket.sh | bash # pipe to bash not sh!
|
||||
- export PATH="${RACKET_DIR}/bin:${PATH}" #install-racket.sh can't set for us
|
||||
|
||||
script:
|
||||
- cd .. # Travis did a cd into the dir. Back up, for the next:
|
||||
- travis_retry raco pkg install --deps search-auto --link pollen
|
||||
- raco test -p pollen
|
@ -1,134 +0,0 @@
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
mb@mbtype.com (= Matthew Butterick).
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
|
||||
at [https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
|
@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
@ -1,9 +0,0 @@
|
||||
MIT License for Pollen
|
||||
|
||||
© 2013-2019 Matthew Butterick
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,23 +0,0 @@
|
||||
#lang racket/base
|
||||
(provide (prefix-out pollen- (all-defined-out)))
|
||||
(define main-export 'doc) ; don't forget to change fallback template too
|
||||
(define meta-export 'metas)
|
||||
(define meta-tag-name 'meta)
|
||||
(define define-meta-name 'define-meta)
|
||||
(define preproc-source-ext 'pp)
|
||||
(define markup-source-ext 'pm)
|
||||
(define markdown-source-ext 'pmd)
|
||||
(define null-source-ext 'p)
|
||||
(define pagetree-source-ext 'ptree)
|
||||
(define template-source-ext 'pt)
|
||||
(define scribble-source-ext 'scrbl)
|
||||
(define poly-source-ext 'poly) ; extension that signals source can be used for multiple output targets
|
||||
(define cache-dir-name "compiled")
|
||||
(define cache-subdir-name "pollen")
|
||||
(define template-prefix "template")
|
||||
(define fallback-template-prefix "fallback")
|
||||
(define template-meta-key "template")
|
||||
(define old-cache-names '("pollen.cache" "pollen-cache"))
|
||||
(define splicing-tag '@)
|
||||
(define here-path-key 'here-path)
|
||||
(define extension-escape-char #\_)
|
@ -1,10 +0,0 @@
|
||||
#lang info
|
||||
|
||||
;; 210309
|
||||
;; for unknown reason "mode-indentation.rkt"
|
||||
;; started causing CI failures since 210215
|
||||
;; consistently on 6.7, 6.8, 6.9, 7.7CS, 7.8CS, 7.9CS
|
||||
;; I assume it has something to do with the fact that
|
||||
;; it imports `framework` and `racket/gui`,
|
||||
;; OTOH why does it fail in these?
|
||||
(define test-omit-paths '("mode-indentation.rkt"))
|
@ -0,0 +1,65 @@
|
||||
#lang racket/base
|
||||
(require (for-syntax racket/base
|
||||
syntax/parse)
|
||||
version/utils
|
||||
scribble/base
|
||||
scribble/core
|
||||
scribble/private/manual-sprop
|
||||
scribble/private/manual-ex
|
||||
scribble/private/manual-style)
|
||||
|
||||
#|
|
||||
Need this to make pollen docs buildable on v6.0.
|
||||
`history` not added to scribble/manual till v6.1.
|
||||
|#
|
||||
|
||||
(provide pollen-history)
|
||||
|
||||
(struct history-entry (what vers vers-stx expl))
|
||||
|
||||
(begin-for-syntax
|
||||
(define-splicing-syntax-class clause
|
||||
#:attributes (e)
|
||||
[pattern (~seq #:added vers)
|
||||
#:attr e #'(history-entry "Added" vers (quote-syntax vers) '("."))]
|
||||
[pattern (~seq #:changed vers content)
|
||||
#:attr e #'(history-entry "Changed" vers (quote-syntax vers)
|
||||
(list ": " content))]))
|
||||
|
||||
(define-syntax (pollen-history stx)
|
||||
(syntax-parse stx
|
||||
[(_ c:clause ...)
|
||||
#'(make-history (list c.e ...))]))
|
||||
|
||||
(define (make-history es)
|
||||
(for ([e (in-list es)])
|
||||
(define vers (history-entry-vers e))
|
||||
(unless (valid-version? vers)
|
||||
(raise-syntax-error 'history
|
||||
(format "not a valid version: ~e"
|
||||
vers)
|
||||
(history-entry-vers-stx e))))
|
||||
(delayed-block
|
||||
(lambda (renderer p ri)
|
||||
(define pkg
|
||||
(let ([from (resolve-get/tentative p ri '(exporting-packages #f))])
|
||||
(and from
|
||||
(pair? from)
|
||||
(car from))))
|
||||
(para
|
||||
#:style (style "SHistory" (list scheme-properties))
|
||||
(for/list ([e (in-list (sort es (lambda (a b) (version<? a b))
|
||||
#:key history-entry-vers))]
|
||||
[i (in-naturals)])
|
||||
(define vers (history-entry-vers e))
|
||||
(list (if (zero? i)
|
||||
null
|
||||
(list null ; needed to avoid " " dropped as whitespace
|
||||
" "))
|
||||
(history-entry-what e)
|
||||
" in version "
|
||||
vers
|
||||
(if (and pkg (zero? i))
|
||||
(list " of package " (tt pkg))
|
||||
null)
|
||||
(history-entry-expl e)))))))
|
@ -1,78 +1,40 @@
|
||||
#lang racket/base
|
||||
(require racket/async-channel
|
||||
racket/runtime-path
|
||||
#lang web-server/base
|
||||
(require racket/list
|
||||
web-server/servlet-env
|
||||
web-server/dispatch
|
||||
web-server/web-server
|
||||
web-server/servlet-dispatch
|
||||
web-server/private/mime-types
|
||||
(prefix-in files: web-server/dispatchers/dispatch-files)
|
||||
(prefix-in sequencer: web-server/dispatchers/dispatch-sequencer)
|
||||
web-server/dispatchers/filesystem-map
|
||||
net/sendurl
|
||||
"project-server-routes.rkt"
|
||||
"log.rkt"
|
||||
"../setup.rkt"
|
||||
"../file.rkt"
|
||||
"../cache.rkt"
|
||||
"version.rkt")
|
||||
|
||||
(provide start-server)
|
||||
|
||||
(define-runtime-path mime-types "server-extras/mime.types")
|
||||
|
||||
(define (make-static-dispatcher-sequence . pths)
|
||||
(apply sequencer:make
|
||||
(for/list ([pth (in-list pths)])
|
||||
(files:make
|
||||
#:path->mime-type (make-path->mime-type mime-types)
|
||||
#:url->path (make-url->path (path->string pth))))))
|
||||
|
||||
(define-values (pollen-servlet _)
|
||||
(dispatch-rules
|
||||
;; last element of a "/"-terminated url is ""
|
||||
[((string-arg) ... "") route-index]
|
||||
[((string-arg) ... (? pagetree-source?)) route-dashboard]
|
||||
[((string-arg) ... "in" (string-arg) ...) route-in]
|
||||
[((string-arg) ... "out" (string-arg) ...) route-out]
|
||||
[else route-default]))
|
||||
|
||||
(define (start-server servlet-path [open-browser-window? #false] #:return [return? #false])
|
||||
(define (start-server servlet-path [open-browser-window? #f])
|
||||
(define-values (pollen-servlet _)
|
||||
(dispatch-rules
|
||||
[((string-arg) ... (? (λ (x) (string=? "" x)))) route-index] ; last element of a "/"-terminated url is ""
|
||||
[((string-arg) ... (? pagetree-source?)) route-dashboard]
|
||||
[((string-arg) ... "in" (string-arg) ...) route-in]
|
||||
[((string-arg) ... "out" (string-arg) ...) route-out]
|
||||
[else route-default]))
|
||||
|
||||
(define server-name (format "http://localhost:~a" (current-server-port)))
|
||||
|
||||
(message (format "welcome to Pollen ~a (Racket ~a)" pollen:version (version)))
|
||||
(message (format "project root is ~a" (current-project-root)))
|
||||
|
||||
(define server-name (format "http://localhost:~a" (current-server-port)))
|
||||
(message (format "project server is ~a (Ctrl+C to exit)" server-name))
|
||||
(message (format "project dashboard is ~a/~a" server-name (setup:main-pagetree)))
|
||||
(message (let ([clsi (current-server-listen-ip)])
|
||||
(if clsi
|
||||
(format "project server permitting access only to ~a"
|
||||
(case clsi
|
||||
[("127.0.0.1") "localhost"]
|
||||
[else clsi]))
|
||||
"project server permitting access to all clients")))
|
||||
(define ch (make-async-channel))
|
||||
(define stop-func
|
||||
(parameterize ([error-print-width 1000])
|
||||
(serve
|
||||
#:confirmation-channel ch
|
||||
#:dispatch (sequencer:make
|
||||
(dispatch/servlet pollen-servlet)
|
||||
(make-static-dispatcher-sequence
|
||||
(current-project-root)
|
||||
(current-server-extras-path))
|
||||
(dispatch/servlet route-404))
|
||||
#:listen-ip (current-server-listen-ip)
|
||||
#:port (current-server-port))))
|
||||
(define exn-or-port
|
||||
(sync ch))
|
||||
(when (exn? exn-or-port)
|
||||
(message "project server failed to start")
|
||||
(sync (system-idle-evt))
|
||||
(exit 1))
|
||||
(message "ready to rock")
|
||||
(when open-browser-window?
|
||||
(send-url (string-append server-name servlet-path)))
|
||||
(if return?
|
||||
stop-func
|
||||
(with-handlers ([exn:break? (λ (e) (stop-func) (message "project server stopped"))])
|
||||
(do-not-return))))
|
||||
|
||||
(parameterize ([error-print-width 1000])
|
||||
(serve/servlet pollen-servlet
|
||||
#:launch-browser? open-browser-window?
|
||||
#:servlet-path servlet-path
|
||||
#:port (current-server-port)
|
||||
#:listen-ip (current-server-listen-ip)
|
||||
#:servlet-regexp #rx"" ; respond to top level
|
||||
#:command-line? #t
|
||||
#:file-not-found-responder route-404
|
||||
#:extra-files-paths (list (current-server-extras-path) (current-project-root)))))
|
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
||||
1710316839
|
||||
1541112008
|
||||
|
@ -1,20 +0,0 @@
|
||||
\newcommand{\terminal}[1]{#1}
|
||||
\newcommand{\browser}[1]{#1}
|
||||
\newcommand{\foreignCode}[1]{#1}
|
||||
|
||||
\newenvironment{fileblock}{}{}
|
||||
|
||||
\definecolor{fileboxborder}{gray}{0.5}
|
||||
\definecolor{fileboxbackground}{gray}{0.9}
|
||||
\definecolor{noskipbackground}{gray}{0.5}
|
||||
\definecolor{noskipforeground}{gray}{1}
|
||||
|
||||
\newcommand{\fileblockFiletitle}[1]{\fcolorbox{fileboxborder}{fileboxbackground}{\makebox[\textwidth][r]{#1}}}
|
||||
\newcommand{\fileblockFilename}[1]{#1}
|
||||
|
||||
\newenvironment{fileblockFilecontent}{}{}
|
||||
|
||||
\newenvironment{noskip}{}{}
|
||||
|
||||
% pdflatex chokes on emoji. Use ∇ in place of the guitar in setup.scrbl
|
||||
\DeclareUnicodeCharacter{1F3B8}{$\nabla$}
|
@ -0,0 +1,44 @@
|
||||
#lang scribble/manual
|
||||
|
||||
@title{Getting more help}
|
||||
|
||||
|
||||
@section{Bugs and feature requests}
|
||||
|
||||
Can be submitted as @link["https://github.com/mbutterick/pollen/issues"]{GitHub issues}.
|
||||
|
||||
@section{Mailing list}
|
||||
|
||||
For general tips and how-to questions, use the @link["https://groups.google.com/forum/#!forum/pollenpub"]{Pollen discussion group} at @link["mailto:pollenpub@googlegroups.com"]{pollenpub@"@"googlegroups.com}. I'll also use that list to post major changes and new features.
|
||||
|
||||
@section{Utilities & libraries}
|
||||
|
||||
@link["https://github.com/malcolmstill/pollen-count"]{pollen-count}: enumeration and cross-referencing library by Malcolm Still
|
||||
|
||||
@link["https://github.com/lijunsong/pollen-mode"]{pollen-mode}: Emacs mode for Pollen by Junsong Li
|
||||
|
||||
@link["https://github.com/basus/pollen-mode"]{Pollen mode}: Emacs mode for Pollen by Shrutarshi Basu
|
||||
|
||||
@link["https://docs.racket-lang.org/pollen-component/"]{Pollen Component}: Component-based development for Pollen by Leandro Facchinetti
|
||||
|
||||
@link["https://docs.racket-lang.org/css-expr/"]{CSS-expressions}: S-expression-based CSS by Leandro Facchinetti
|
||||
|
||||
@link["https://github.com/lijunsong/pollen-rock"]{Pollen Rock}: rendering server and an in-browser editor for Pollen
|
||||
|
||||
|
||||
@section{Can I see the source for Practical Typography or Typography for Lawyers?}
|
||||
|
||||
Yes, the source for @link["http://typographyforlawyers.com/"]{Typography for Lawyers} is available. In terms of content, TFL was originally the basis of Practical Typography. But in terms of code, this new TFL website is essentially a clone of Practical Typography, but rewritten to be clearer and more instructive, with extensive source comments. [@link["https://github.com/mbutterick/pollen-tfl"]{source}]
|
||||
|
||||
@section{More projects & guides}
|
||||
|
||||
|
||||
@link["http://mstill.io"]{mstill.io blog} by Malcolm Still [@link["https://github.com/malcolmstill/mstill.io"]{source}]
|
||||
|
||||
@link["https://thelocalyarn.com/excursus/secretary"]{Secretary of Foreign Relations} by Joel Dueck [@link["https://github.com/otherjoel/try-pollen"]{source}]
|
||||
|
||||
@link["https://github.com/fasiha/pollen-guide"]{A Poor Guide to Pollen} by Ahmed Fasih
|
||||
|
||||
@link["https://youtu.be/20GGVNBykaw"]{The World's Most Dangerous Racket Programmer} and @link["https://youtu.be/IMz09jYOgoc"]{Like a Blind Squirrel in a Ferrari}: short talks about Pollen that I gave at RacketCons 2013 and 2014, respectively.
|
||||
|
||||
@link["https://www.leafac.com/"]{Leandro Facchinetti's personal website} [@link["https://github.com/leafac/www.leafac.com/tree/pollen"]{source}]
|
@ -0,0 +1,170 @@
|
||||
// Common functionality for PLT documentation pages
|
||||
|
||||
// Page Parameters ------------------------------------------------------------
|
||||
|
||||
var page_query_string = location.search.substring(1);
|
||||
|
||||
var page_args =
|
||||
((function(){
|
||||
if (!page_query_string) return [];
|
||||
var args = page_query_string.split(/[&;]/);
|
||||
for (var i=0; i<args.length; i++) {
|
||||
var a = args[i];
|
||||
var p = a.indexOf('=');
|
||||
if (p >= 0) args[i] = [a.substring(0,p), a.substring(p+1)];
|
||||
else args[i] = [a, false];
|
||||
}
|
||||
return args;
|
||||
})());
|
||||
|
||||
function GetPageArg(key, def) {
|
||||
for (var i=0; i<page_args.length; i++)
|
||||
if (page_args[i][0] == key) return decodeURIComponent(page_args[i][1]);
|
||||
return def;
|
||||
}
|
||||
|
||||
function MergePageArgsIntoLink(a) {
|
||||
if (page_args.length == 0 ||
|
||||
(!a.attributes["data-pltdoc"]) || (a.attributes["data-pltdoc"].value == ""))
|
||||
return;
|
||||
a.href = MergePageArgsIntoUrl(a.href);
|
||||
}
|
||||
|
||||
function MergePageArgsIntoUrl(href) {
|
||||
var mtch = href.match(/^([^?#]*)(?:\?([^#]*))?(#.*)?$/);
|
||||
if (mtch == undefined) { // I think this never happens
|
||||
return "?" + page_query_string;
|
||||
}
|
||||
if (!mtch[2]) {
|
||||
return mtch[1] + "?" + page_query_string + (mtch[3] || "");
|
||||
}
|
||||
// need to merge here, precedence to arguments that exist in `a'
|
||||
var i, j;
|
||||
var prefix = mtch[1], str = mtch[2] || "", suffix = mtch[3] || "";
|
||||
var args = str.split(/[&;]/);
|
||||
for (i=0; i<args.length; i++) {
|
||||
j = args[i].indexOf('=');
|
||||
if (j) args[i] = args[i].substring(0,j);
|
||||
}
|
||||
var additions = "";
|
||||
for (i=0; i<page_args.length; i++) {
|
||||
var exists = false;
|
||||
for (j=0; j<args.length; j++)
|
||||
if (args[j] == page_args[i][0]) { exists = true; break; }
|
||||
if (!exists) str += "&" + page_args[i][0] + "=" + page_args[i][1];
|
||||
}
|
||||
return prefix + "?" + str + suffix;
|
||||
}
|
||||
|
||||
// Cookies --------------------------------------------------------------------
|
||||
|
||||
// Actually, try localStorage (a la HTML 5), first.
|
||||
|
||||
function GetCookie(key, def) {
|
||||
try {
|
||||
var v = localStorage[key];
|
||||
if (!v) v = def;
|
||||
return v;
|
||||
} catch (e) {
|
||||
var i, cookiestrs;
|
||||
try {
|
||||
if (document.cookie.length <= 0) return def;
|
||||
cookiestrs = document.cookie.split(/; */);
|
||||
} catch (e) { return def; }
|
||||
for (i = 0; i < cookiestrs.length; i++) {
|
||||
var cur = cookiestrs[i];
|
||||
var eql = cur.indexOf('=');
|
||||
if (eql >= 0 && cur.substring(0,eql) == key)
|
||||
return unescape(cur.substring(eql+1));
|
||||
}
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
function SetCookie(key, val) {
|
||||
try {
|
||||
localStorage[key] = val;
|
||||
} catch(e) {
|
||||
var d = new Date();
|
||||
d.setTime(d.getTime()+(365*24*60*60*1000));
|
||||
try {
|
||||
document.cookie =
|
||||
key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/";
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
// note that this always stores a directory name, ending with a "/"
|
||||
function SetPLTRoot(ver, relative) {
|
||||
var root = location.protocol + "//" + location.host
|
||||
+ NormalizePath(location.pathname.replace(/[^\/]*$/, relative));
|
||||
SetCookie("PLT_Root."+ver, root);
|
||||
}
|
||||
|
||||
// adding index.html works because of the above
|
||||
function GotoPLTRoot(ver, relative) {
|
||||
var u = GetCookie("PLT_Root."+ver, null);
|
||||
if (u == null) return true; // no cookie: use plain up link
|
||||
// the relative path is optional, default goes to the toplevel start page
|
||||
if (!relative) relative = "index.html";
|
||||
location = u + relative;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Utilities ------------------------------------------------------------------
|
||||
|
||||
var normalize_rxs = [/\/\/+/g, /\/\.(\/|$)/, /\/[^\/]*\/\.\.(\/|$)/];
|
||||
function NormalizePath(path) {
|
||||
var tmp, i;
|
||||
for (i = 0; i < normalize_rxs.length; i++)
|
||||
while ((tmp = path.replace(normalize_rxs[i], "/")) != path) path = tmp;
|
||||
return path;
|
||||
}
|
||||
|
||||
// `noscript' is problematic in some browsers (always renders as a
|
||||
// block), use this hack instead (does not always work!)
|
||||
// document.write("<style>mynoscript { display:none; }</style>");
|
||||
|
||||
// Interactions ---------------------------------------------------------------
|
||||
|
||||
function DoSearchKey(event, field, ver, top_path) {
|
||||
var val = field.value;
|
||||
if (event && event.keyCode == 13) {
|
||||
var u = GetCookie("PLT_Root."+ver, null);
|
||||
if (u == null) u = top_path; // default: go to the top path
|
||||
u += "search/index.html?q=" + encodeURIComponent(val);
|
||||
u = MergePageArgsIntoUrl(u);
|
||||
location = u;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function TocviewToggle(glyph, id) {
|
||||
var s = document.getElementById(id).style;
|
||||
var expand = s.display == "none";
|
||||
s.display = expand ? "block" : "none";
|
||||
glyph.innerHTML = expand ? "▼" : "►";
|
||||
}
|
||||
|
||||
// Page Init ------------------------------------------------------------------
|
||||
|
||||
// Note: could make a function that inspects and uses window.onload to chain to
|
||||
// a previous one, but this file needs to be required first anyway, since it
|
||||
// contains utilities for all other files.
|
||||
var on_load_funcs = [];
|
||||
function AddOnLoad(fun) { on_load_funcs.push(fun); }
|
||||
window.onload = function() {
|
||||
for (var i=0; i<on_load_funcs.length; i++) on_load_funcs[i]();
|
||||
};
|
||||
|
||||
AddOnLoad(function(){
|
||||
var links = document.getElementsByTagName("a");
|
||||
for (var i=0; i<links.length; i++) MergePageArgsIntoLink(links[i]);
|
||||
var label = GetPageArg("ctxtname",false);
|
||||
if (!label) return;
|
||||
var indicator = document.getElementById("contextindicator");
|
||||
if (!indicator) return;
|
||||
indicator.innerHTML = label;
|
||||
indicator.style.display = "block";
|
||||
});
|
@ -1,3 +0,0 @@
|
||||
#lang pollen
|
||||
|
||||
this is bar
|
@ -1,3 +0,0 @@
|
||||
#lang pollen
|
||||
|
||||
this is foo
|
@ -1,4 +0,0 @@
|
||||
#lang pollen/ptree
|
||||
|
||||
foo.txt
|
||||
bar.txt
|
@ -1,5 +0,0 @@
|
||||
#lang racket/base
|
||||
|
||||
(module setup racket/base
|
||||
(provide poly-targets)
|
||||
(define poly-targets '(html txt)))
|
@ -1,3 +0,0 @@
|
||||
#lang pollen
|
||||
|
||||
hello world
|
@ -1,2 +1,2 @@
|
||||
◊(require racket/list)
|
||||
◊(local-require racket/list)
|
||||
◊(apply string-append (filter string? (flatten doc)))
|
@ -1,3 +0,0 @@
|
||||
#lang pollen
|
||||
|
||||
Hello!
|
@ -1,6 +0,0 @@
|
||||
#lang racket/base
|
||||
|
||||
(module setup racket/base
|
||||
(provide (all-defined-out))
|
||||
(define project-server-port
|
||||
9876))
|
@ -1,2 +1,2 @@
|
||||
◊(require racket/list)
|
||||
◊(local-require racket/list)
|
||||
◊(apply string-append (filter string? (flatten doc)))
|
@ -1,12 +0,0 @@
|
||||
#lang at-exp racket/base
|
||||
(require rackunit
|
||||
racket/runtime-path
|
||||
pollen/file)
|
||||
|
||||
(define-runtime-path example "data/ext/example.html")
|
||||
(define-runtime-path example-pm "data/ext/example.html.pm")
|
||||
(define-runtime-path another "data/ext/sub/another.html")
|
||||
(define-runtime-path another-pm "data/ext/sub/another.html.pm")
|
||||
|
||||
(check-equal? (get-markup-source example) example-pm)
|
||||
(check-equal? (get-markup-source another) another-pm)
|
@ -0,0 +1,44 @@
|
||||
#lang at-exp racket/base
|
||||
(require rackunit racket/port racket/system racket/runtime-path compiler/find-exe pollen/setup)
|
||||
|
||||
;; define-runtime-path only allowed at top level
|
||||
(define-runtime-path override-dir "data/override")
|
||||
(define-runtime-path test.ptree "data/override/test.ptree")
|
||||
(define-runtime-path test.html.pm "data/override/test.html.pm")
|
||||
(define-runtime-path test.html.pmd "data/override/test.html.pmd")
|
||||
(define-runtime-path test.html.pp "data/override/test.html.pp")
|
||||
|
||||
(define-runtime-path test.ptreeover "data/override/test.ptreeover")
|
||||
(define-runtime-path test.html.pmover "data/override/test.html.pmover")
|
||||
(define-runtime-path test.html.pmdover "data/override/test.html.pmdover")
|
||||
(define-runtime-path test.html.ppover "data/override/test.html.ppover")
|
||||
(define-runtime-path test-cmd.html.ppover "data/override/test-cmd.html.ppover")
|
||||
(define-runtime-path test-exports.html.ppover "data/override/test-exports.html.ppover")
|
||||
(define-runtime-path test-require.html.pmover "data/override/test-require.html.pmover")
|
||||
|
||||
|
||||
;; `find-exe` avoids reliance on $PATH of the host system
|
||||
(define racket-path (find-exe))
|
||||
;; parameterize needed to pick up override file
|
||||
(parameterize ([current-directory override-dir]
|
||||
[current-project-root override-dir])
|
||||
(when racket-path
|
||||
(define (run path)
|
||||
(define cmd-string (format "'~a' ~a" racket-path path))
|
||||
(with-output-to-string (λ () (system cmd-string))))
|
||||
;; raco is in same dir as racket
|
||||
(define path-to-raco (path->string (simplify-path (build-path (find-exe) 'up "raco"))))
|
||||
;; files with ordinary extensions will not be recognized in override dir, and thus behave like preproc
|
||||
(check-equal? (run test.ptree) "test\n====")
|
||||
(check-equal? (run test.html.pm) "test\n====")
|
||||
(check-equal? (run test.html.pmd) "test\n====")
|
||||
(check-equal? (run test.html.pp) "test\n====")
|
||||
|
||||
(check-equal? (run test.ptreeover) "'(pagetree-root test ====)")
|
||||
(check-equal? (run test.html.pmover) "'(rootover \"test\" \"\\n\" \"====\")")
|
||||
(check-equal? (run test.html.pmdover) "'(rootover (h1 ((id \"test\")) \"test\"))")
|
||||
(check-equal? (run test.html.ppover) "test\n====")
|
||||
(check-equal? (run test-cmd.html.ppover) "2")
|
||||
(check-equal? (dynamic-require test-exports.html.ppover 'docover) "2")
|
||||
(check-equal? (hash-ref (dynamic-require test-exports.html.ppover 'metasover) 'dog) "Roxy")
|
||||
(check-equal? (dynamic-require test-require.html.pmover 'docover) '(rootover "foobar"))))
|
@ -1,27 +0,0 @@
|
||||
#lang at-exp racket/base
|
||||
(require rackunit racket/runtime-path pollen/render racket/file pollen/setup)
|
||||
|
||||
;; define-runtime-path only allowed at top level
|
||||
(define-runtime-path dir "data/pagetree-output")
|
||||
(define-runtime-path index.ptree "data/pagetree-output/index.ptree")
|
||||
(define-runtime-path foo.txt.pp "data/pagetree-output/foo.txt.pp")
|
||||
(define-runtime-path foo.txt "data/pagetree-output/foo.txt")
|
||||
(define-runtime-path bar.txt.pp "data/pagetree-output/bar.txt.pp")
|
||||
(define-runtime-path bar.txt "data/pagetree-output/bar.txt")
|
||||
(define-runtime-path pollen-cache "data/pagetree-output/compiled")
|
||||
|
||||
(parameterize ([current-output-port (open-output-string)]
|
||||
[current-directory dir]
|
||||
[current-project-root dir])
|
||||
|
||||
;; passing "index.ptree" as argument should work
|
||||
(for ([parallel? (list #true #false)])
|
||||
(render-batch #:parallel parallel? index.ptree)
|
||||
(check-true (file-exists? foo.txt))
|
||||
(check-equal? (file->string foo.txt) "this is foo")
|
||||
(delete-file foo.txt)
|
||||
(check-true (file-exists? bar.txt))
|
||||
(check-equal? (file->string bar.txt) "this is bar")
|
||||
(delete-file bar.txt)))
|
||||
|
||||
(delete-directory/files pollen-cache)
|
@ -1,30 +0,0 @@
|
||||
#lang at-exp racket/base
|
||||
(require rackunit racket/runtime-path pollen/render racket/file pollen/setup txexpr xml)
|
||||
|
||||
;; define-runtime-path only allowed at top level
|
||||
(define-runtime-path poly-output-path-dir "data/poly-output-path")
|
||||
(define-runtime-path pollen.rkt "data/poly-output-path/pollen.rkt")
|
||||
(define-runtime-path test.poly.pm "data/poly-output-path/test.poly.pm")
|
||||
(define-runtime-path test.txt "data/poly-output-path/test.txt")
|
||||
(define-runtime-path test.html "data/poly-output-path/test.html")
|
||||
(define-runtime-path pollen-cache "data/poly-output-path/compiled")
|
||||
|
||||
(parameterize ([current-output-port (open-output-string)]
|
||||
[current-directory poly-output-path-dir]
|
||||
[current-project-root poly-output-path-dir])
|
||||
|
||||
(for ([parallel? (list #true #false)])
|
||||
;; passing "text.txt" as argument should force use of `txt` rendering
|
||||
(render-batch #:parallel parallel? test.txt)
|
||||
(check-equal? (file->string test.txt) "(root hello world)")
|
||||
(delete-file test.txt)
|
||||
(check-false (file-exists? test.html))
|
||||
;; passing poly source as argument should result in default (html) rendering
|
||||
(render-batch #:parallel parallel? test.poly.pm)
|
||||
(check-txexprs-equal?
|
||||
(string->xexpr (file->string test.html))
|
||||
(string->xexpr "<html><head><meta charset=\"UTF-8\"/></head><body><root>hello world</root></body></html>"))
|
||||
(delete-file test.html)
|
||||
(check-false (file-exists? test.txt))))
|
||||
|
||||
(delete-directory/files pollen-cache)
|
@ -1,51 +0,0 @@
|
||||
#lang racket/base
|
||||
|
||||
(require racket/port
|
||||
racket/runtime-path
|
||||
racket/tcp
|
||||
rackunit)
|
||||
|
||||
(define-runtime-path project-port-dir "data/project-port")
|
||||
|
||||
(define the-port
|
||||
(dynamic-require
|
||||
`(submod ,(build-path project-port-dir "pollen.rkt") setup)
|
||||
'project-server-port))
|
||||
|
||||
(define-values (in out)
|
||||
(make-pipe))
|
||||
|
||||
(define thd
|
||||
(parameterize ([current-output-port out]
|
||||
[current-error-port out]
|
||||
[current-directory project-port-dir]
|
||||
[current-command-line-arguments (vector "start")]
|
||||
[exit-handler (lambda (code)
|
||||
(fail (format "abnormal exit from raco command~n code: ~a" code))
|
||||
(kill-thread thd))])
|
||||
(thread
|
||||
(lambda ()
|
||||
(dynamic-require '(submod pollen/private/command raco) #f)))))
|
||||
|
||||
(dynamic-wind
|
||||
void
|
||||
(lambda ()
|
||||
(sync
|
||||
(handle-evt
|
||||
(regexp-match-evt #rx"ready to rock" in)
|
||||
void)
|
||||
(handle-evt
|
||||
(alarm-evt (+ (current-inexact-milliseconds) 5000))
|
||||
(lambda (_)
|
||||
(fail "timed out while waiting for server to start"))))
|
||||
|
||||
(with-handlers ([exn:fail?
|
||||
(lambda (e)
|
||||
(fail (format "failed to connect to server: ~a" (exn-message e))))])
|
||||
(define-values (cin cout)
|
||||
(tcp-connect "127.0.0.1" the-port))
|
||||
(close-output-port cout)
|
||||
(close-input-port cin)))
|
||||
(lambda ()
|
||||
(break-thread thd)
|
||||
(thread-wait thd)))
|
@ -1,13 +0,0 @@
|
||||
#lang racket/base
|
||||
(require racket/runtime-path rackunit)
|
||||
|
||||
(module m pollen
|
||||
(require racket/runtime-path)
|
||||
(define-runtime-path x "x")
|
||||
(provide x))
|
||||
|
||||
(require (submod "." m))
|
||||
|
||||
(define-runtime-path y "x")
|
||||
|
||||
(check-equal? x y)
|
@ -1,16 +1,11 @@
|
||||
#lang racket/base
|
||||
(require (for-syntax racket/base pollen/setup) pollen/tag)
|
||||
(require (for-syntax racket/base) pollen/tag)
|
||||
(provide def/c (rename-out (top~ #%top)))
|
||||
|
||||
(define-syntax (top~ stx)
|
||||
(syntax-case stx ()
|
||||
[(_ . ID)
|
||||
(setup:allow-unbound-ids?)
|
||||
#'(#%app make-default-tag-function 'ID)]
|
||||
[(_ . ID)
|
||||
#'(def/c ID)]))
|
||||
(define-syntax-rule (top~ . ID)
|
||||
(#%app make-default-tag-function 'ID))
|
||||
|
||||
(define-syntax (def/c stx)
|
||||
(syntax-case stx ()
|
||||
[(_ ID) (identifier-binding #'ID) #'ID]
|
||||
[(_ ID) #'(#%top . ID)]))
|
||||
[(_ X) (identifier-binding #'X) #'X]
|
||||
[(_ X) #'(#%top . X)]))
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue