-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ba-st/extract
Extract
- Loading branch information
Showing
43 changed files
with
1,622 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.st linguist-language=Smalltalk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
'srcDirectory' : 'source' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
SmalltalkCISpec { | ||
#loading : [ | ||
SCIMetacelloLoadSpec { | ||
#baseline : 'Stargate', | ||
#directory : 'source', | ||
#load : [ 'Development' ], | ||
#platforms : [ #pharo ] | ||
} | ||
], | ||
#testing : { | ||
#coverage : { | ||
#packages : [ 'Stargate*' ] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
language: smalltalk | ||
sudo: false | ||
os: | ||
- linux | ||
smalltalk: | ||
- Pharo64-7.0 | ||
- Pharo-7.0 | ||
- Pharo-6.1 | ||
matrix: | ||
allow_failures: | ||
- smalltalk: Pharo64-7.0 | ||
- smalltalk: Pharo-7.0 | ||
fast_finish: true | ||
before_deploy: | ||
- cp "${SMALLTALK_CI_IMAGE}" "Stargate.image" | ||
- cp "${SMALLTALK_CI_CHANGES}" "Stargate.changes" | ||
- zip -q "${TRAVIS_BRANCH}-${TRAVIS_SMALLTALK_VERSION}.zip" "Stargate.image" "Stargate.changes" | ||
deploy: | ||
provider: releases | ||
api_key: | ||
secure: TwpzX3XVrSLLzCMAWmTJyA1qBXdutY/adojcQX1RXb86jTbAhMJwi3Iv8xDhAT5Aa5lKpNOLBqIfS8GG8W0lt++f5RnI2S8RHSm4HtctjTc9uRhBK4qsnlU24WsyFgsvhURsA/NaPnWAqSnJBivoYKzob7b5rzAsElr7ofelisT+pQthzamNqkNg/NQW4nCJpkkMRbAAig1O3l8jA7l0DE/2XTXTzS87LTIi5wlmfX4N94dG5F3vmj9i1DSZGFURNgZxdUV80uNmabmZxtAscrwEJJgAcEBbPvSu9cLgUg/2vqFXDaY+ksD0euEsd6bOkcadBUSc28i9YZ5GX7PM/FJgXB2wfylb/PnqTiRkte7xIByGndBgIJcE9EujjNfxQl0j4GmTfK7dyHd5wxXS/n2Zbz/t3UutNaI3AqWb5BA8rEw3ri37Vh+sCiEEU60RzSocq6bOSXHXH8+HfcCnX26WYwQEgoe7Hbe9kGCmCt6prDQUUtC8St1DUac5ri+uc/7+g8HrBemps3miK3hxzTHDFbo4T322OTYniE7CkuXuUU/WzvFbyrjU+AJ0c1EqyTY8VJhii2U1zmNPkG2SYQyKm0gRvht8wjj07QGe+Ml62CHj9QIUuaSVrVAyZQYBfjfAJ7j8jS8kBl7ywqw7yM0v8Qr7Dytspw4qA1Hs50I= | ||
file: "${TRAVIS_BRANCH}-${TRAVIS_SMALLTALK_VERSION}.zip" | ||
skip_cleanup: true | ||
on: | ||
repo: ba-st/Stargate | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Contributing | ||
============ | ||
|
||
There's several ways to contribute to the project: reporting bugs, sending feedback, proposing ideas for new features, fixing or adding documentation, promoting the project, or even contributing code. | ||
|
||
## Reporting issues | ||
|
||
You can report issues [here](https://github.com/ba-st/Stargate/issues/new) | ||
|
||
## Contributing Code | ||
- This project is MIT licensed, so any code contribution MUST be under the same license. | ||
- This project uses [Semantic Versioning](http://semver.org/), so keep it in mind when you make backwards-incompatible changes. If some backwards incompatible change is made the major version MUST be increased. | ||
- The source code is hosted in this repository using the Tonel format in the `source` folder. | ||
- The master branch contains the latest changes and should always be in a releasable state. | ||
- Feel free to send pull requests or fork the project. | ||
- Code contributions without test cases have a lower probability of being merged into the main branch. | ||
|
||
### Using Iceberg | ||
1. Download a [Pharo Image and VM](https://get.pharo.org/64) | ||
2. Clone the project or your fork using Iceberg | ||
3. Open the Working Copy and using the contextual menu select `Metacello -> Install baseline...` | ||
4. Input `Development` | ||
5. This will load the base code and the test cases | ||
6. Create a new branch to host your code changes | ||
7. Do the changes | ||
8. Run the test cases | ||
9. Commit and push your changes to the branch using the Iceberg UI | ||
10. Create a Pull Request against the master branch | ||
|
||
## Contributing documentation | ||
|
||
The project documentation is maintained in this repository in the `docs` folder and licensed under CC BY-SA 4.0. To contribute some documentation or improve the existing, feel free to create a branch or fork this repository, make your changes and send a pull request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,37 @@ | ||
# Stargate | ||
<p align="center"><img src="assets/logos/128x128.png"> | ||
<h1 align="center">Stargate</h1> | ||
<p align="center"> | ||
What is this thing? “the motto” and the goals. The vision. | ||
<br> | ||
<a href="docs/"><strong>Explore the docs »</strong></a> | ||
<br> | ||
<br> | ||
<a href="https://github.com/ba-st/Stargate/issues/new?labels=Type%3A+Defect">Report a defect</a> | ||
| | ||
<a href="https://github.com/ba-st/Stargate/issues/new?labels=Type%3A+Feature">Request feature</a> | ||
</p> | ||
</p> | ||
|
||
[![GitHub release](https://img.shields.io/github/release/ba-st/Stargate.svg)](https://github.com/ba-st/Stargate/releases/latest) | ||
[![Build Status](https://travis-ci.org/ba-st/Stargate.svg?branch=master)](https://travis-ci.org/ba-st/Stargate) | ||
[![Coverage Status](https://coveralls.io/repos/github/ba-st/Stargate/badge.svg?branch=master)](https://coveralls.io/github/ba-st/Stargate?branch=master) | ||
|
||
Why would I care about this thing? When to use, for whom is designed, when not to use. | ||
|
||
## License | ||
- The code is licensed under [MIT](LICENSE). | ||
- The documentation is licensed under [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/). | ||
|
||
## Quick Start | ||
|
||
- Download the latest [Pharo 32](https://get.pharo.org/) or [64 bits VM](https://get.pharo.org/64/). | ||
- Download a ready to use image from the [release page](https://github.com/ba-st/Stargate/releases/latest) | ||
- Explore the [documentation](docs/) | ||
|
||
## Installation | ||
|
||
To load the project in a Pharo image, or declare it as a dependency of your own project follow this [instructions](docs/Installation.md). | ||
|
||
## Contributing | ||
|
||
Check the [Contribution Guidelines](CONTRIBUTING.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Installation | ||
|
||
## Basic Installation | ||
|
||
You can load **Stargate** evaluating: | ||
```smalltalk | ||
Metacello new | ||
baseline: 'Stargate'; | ||
repository: 'github://ba-st/Stargate:master/source'; | ||
load. | ||
``` | ||
> Change `master` to some released version if you want a pinned version | ||
## Using as dependency | ||
|
||
In order to include **Stargate** as part of your project, you should reference the package in your product baseline: | ||
|
||
```smalltalk | ||
setUpDependencies: spec | ||
spec | ||
baseline: 'Stargate' | ||
with: [ spec | ||
repository: 'github://ba-st/Stargate:v{XX}/source'; | ||
loads: #('Deployment') ]; | ||
import: 'Stargate'. | ||
``` | ||
> Replace `{XX}` with the version you want to depend on | ||
```smalltalk | ||
baseline: spec | ||
<baseline> | ||
spec | ||
for: #common | ||
do: [ self setUpDependencies: spec. | ||
spec package: 'My-Package' with: [ spec requires: #('Stargate') ] ] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
#format : #tonel | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Class { | ||
#name : #BaselineOfStargate, | ||
#superclass : #BaselineOf, | ||
#category : #BaselineOfStargate | ||
} | ||
|
||
{ #category : #baselines } | ||
BaselineOfStargate >> baseline: spec [ | ||
|
||
<baseline> | ||
spec | ||
for: #common | ||
do: [ self setUpDependencies: spec. | ||
spec package: 'Stargate-REST-API' with: [ spec requires: #('Buoy' 'Teapot') ]. | ||
spec package: 'Stargate-REST-API-Tests' with: [ spec requires: #('Stargate-REST-API') ]. | ||
spec | ||
group: 'Deployment' with: #('Stargate-REST-API'); | ||
group: 'Development' with: #('Deployment' 'Stargate-REST-API-Tests'); | ||
group: 'default' with: #('Deployment') ] | ||
] | ||
|
||
{ #category : #baselines } | ||
BaselineOfStargate >> setUpDependencies: spec [ | ||
|
||
spec | ||
baseline: 'Buoy' with: [ spec repository: 'github://ba-st/Buoy:v4/source' ]; | ||
import: 'Buoy'. | ||
|
||
spec | ||
configuration: 'Teapot' | ||
with: [ spec | ||
versionString: #stable; | ||
repository: 'http://smalltalkhub.com/mc/zeroflag/Teapot/main/' ] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package { #name : #BaselineOfStargate } |
21 changes: 21 additions & 0 deletions
21
source/Stargate-REST-API-Tests/CrossOriginResourceSharingHandlerTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Class { | ||
#name : #CrossOriginResourceSharingHandlerTest, | ||
#superclass : #TestCase, | ||
#category : #'Stargate-REST-API-Tests' | ||
} | ||
|
||
{ #category : #tests } | ||
CrossOriginResourceSharingHandlerTest >> testValue [ | ||
|
||
| handler response | | ||
|
||
handler := CrossOriginResourceSharingHandler allowing: #('GET' 'POST'). | ||
response := handler value: (ZnRequest options: 'url'). | ||
|
||
self | ||
assert: response code equals: 204; | ||
assert: (response headers at: 'Access-Control-Max-Age') equals: '86400'; | ||
assert: (response headers at: 'Access-Control-Allow-Headers') | ||
equals: 'Access-Control-Allow-Origin, Content-Type, Accept'; | ||
assert: (response headers at: 'Access-Control-Allow-Methods') equals: 'GET, POST' | ||
] |
32 changes: 32 additions & 0 deletions
32
source/Stargate-REST-API-Tests/DynamicDecoderTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Class { | ||
#name : #DynamicDecoderTest, | ||
#superclass : #TestCase, | ||
#category : #'Stargate-REST-API-Tests' | ||
} | ||
|
||
{ #category : #tests } | ||
DynamicDecoderTest >> testDecoding [ | ||
|
||
| decoder aJson decoded | | ||
|
||
decoder := (DynamicDecoder determiningDecoderBy: #type) | ||
decoding: #number applying: [ :json | (json at: #amount) asNumber ]; | ||
decoding: #string applying: [ :json | json at: #name ]; | ||
yourself. | ||
|
||
aJson := '{ | ||
"type" : "number", | ||
"amount" : "5" | ||
}'. | ||
|
||
decoded := decoder value: (STONJSON fromString: aJson). | ||
self assert: decoded equals: 5. | ||
|
||
aJson := '{ | ||
"type" : "string", | ||
"name" : "a string" | ||
}'. | ||
|
||
decoded := decoder value: (STONJSON fromString: aJson). | ||
self assert: decoded equals: 'a string' | ||
] |
44 changes: 44 additions & 0 deletions
44
source/Stargate-REST-API-Tests/HTTPClientErrorTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
" | ||
A HTTPClientErrorTest is a test class for testing the behavior of HTTPClientError | ||
" | ||
Class { | ||
#name : #HTTPClientErrorTest, | ||
#superclass : #TestCase, | ||
#category : #'Stargate-REST-API-Tests' | ||
} | ||
|
||
{ #category : #tests } | ||
HTTPClientErrorTest >> test404 [ | ||
|
||
self | ||
should: [ HTTPClientError signalNotFound ] | ||
raise: HTTPClientError | ||
withExceptionDo: [ :signal | | ||
self | ||
assert: signal code equals: 404; | ||
assert: signal messageText equals: 'Not found' ] | ||
] | ||
|
||
{ #category : #tests } | ||
HTTPClientErrorTest >> test409 [ | ||
|
||
self | ||
should: [ HTTPClientError signalConflict: 'Sigmund Freud' ] | ||
raise: HTTPClientError | ||
withExceptionDo: [ :signal | | ||
self | ||
assert: signal code equals: 409; | ||
assert: signal messageText equals: 'Sigmund Freud' ] | ||
] | ||
|
||
{ #category : #tests } | ||
HTTPClientErrorTest >> testCode [ | ||
|
||
self | ||
should: [ HTTPClientError signal: 404 describedBy: 'Not Found' ] | ||
raise: HTTPClientError | ||
withExceptionDo: [ :signal | | ||
self | ||
assert: signal code equals: 404; | ||
assert: signal messageText equals: 'Not Found' ] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Class { | ||
#name : #IsUUIDTest, | ||
#superclass : #TestCase, | ||
#category : #'Stargate-REST-API-Tests' | ||
} | ||
|
||
{ #category : #tests } | ||
IsUUIDTest >> testMatches [ | ||
|
||
self | ||
assert: (IsUUID matchesTo: '3wkyfiioh6vu12497yj6g20p2'); | ||
assert: (IsUUID matchesTo: '5l0vw3e9434a49gz49hqz1xig'); | ||
deny: (IsUUID matchesTo: 'ContainsCaps'); | ||
deny: (IsUUID matchesTo: '-containsInvalidChars') | ||
] | ||
|
||
{ #category : #tests } | ||
IsUUIDTest >> testParseString [ | ||
|
||
| first second | | ||
|
||
first := UUID fromString: '0608b9dc-02e4-4dd0-9f8a-ea45160df641'. | ||
second := UUID fromString: 'e85ae7ba-3ca3-4bae-9f62-cc2ce51c525e'. | ||
|
||
self | ||
assert: (IsUUID parseString: first asString36) equals: first; | ||
assert: (IsUUID parseString: second asString36) equals: second | ||
] |
Oops, something went wrong.