From 64628cdf6e8d9cf149cede0aae834075b05b4a07 Mon Sep 17 00:00:00 2001 From: shy Date: Wed, 24 Jul 2024 12:27:13 +0800 Subject: [PATCH] add init --- LICENSE | 21 +++++++++++++++++++++ Makefile | 12 ++++++++++++ README.md | 19 +++++++++++++++++++ etc/exit.shy | 1 + etc/init.shy | 2 ++ etc/miss.sh | 15 +++++++++++++++ go.mod | 5 +++++ go.sum | 13 +++++++++++++ src/hi/hi.go | 15 +++++++++++++++ src/main.go | 10 ++++++++++ src/main.shy | 1 + 11 files changed, 114 insertions(+) create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 etc/exit.shy create mode 100644 etc/init.shy create mode 100644 etc/miss.sh create mode 100644 go.mod create mode 100644 go.sum create mode 100644 src/hi/hi.go create mode 100644 src/main.go create mode 100644 src/main.shy diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1017b0f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 shylinux + +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. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5a0c2bb --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +binarys = bin/ice.bin +version = src/version.go +binpack = src/binpack.go +flags = -ldflags "-w -s" -v + +all: def + @date +"%Y-%m-%d %H:%M:%S" + go build ${flags} -o ${binarys} src/main.go ${version} ${binpack} && ./${binarys} forever restart &>/dev/null + +def: + @[ -f ${version} ] || echo "package main">${version} + @[ -f ${binpack} ] || echo "package main">${binpack} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c121437 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Contexts +Contexts 通过模块化、集群化、自动化的方式,只用一个 20M 大小的程序文件,就可以在各种设备上,一键启动完整的云计算服务与云研发环境。 + +## 源码安装 +### 克隆编译 +```sh +git clone https://shylinux.com/x/contexts +cd contexts; source etc/miss.sh +``` + +### 启动服务 +```sh +ish_miss_serve +``` + +### 访问网页 +```sh +open http://localhost:9020 +``` \ No newline at end of file diff --git a/etc/exit.shy b/etc/exit.shy new file mode 100644 index 0000000..a142f20 --- /dev/null +++ b/etc/exit.shy @@ -0,0 +1 @@ +~ssh diff --git a/etc/init.shy b/etc/init.shy new file mode 100644 index 0000000..6de1689 --- /dev/null +++ b/etc/init.shy @@ -0,0 +1,2 @@ +~ssh + source local.shy diff --git a/etc/miss.sh b/etc/miss.sh new file mode 100644 index 0000000..55e537d --- /dev/null +++ b/etc/miss.sh @@ -0,0 +1,15 @@ +#! /bin/sh + +export ctx_shy=${ctx_shy:=https://shylinux.com} +if [ -f $PWD/.ish/plug.sh ]; then source $PWD/.ish/plug.sh; elif [ -f $HOME/.ish/plug.sh ]; then source $HOME/.ish/plug.sh; else + temp=$(mktemp); if curl -h &>/dev/null; then curl -o $temp -fsSL $ctx_shy; else wget -O $temp -q $ctx_shy; fi; source $temp intshell +fi; require conf.sh; require miss.sh + +ish_miss_prepare_compile +ish_miss_prepare_develop +ish_miss_prepare_project + +ish_miss_prepare_contexts +ish_miss_prepare_resource + +ish_miss_make; [ -z "$*" ] || ish_miss_serve "$@" \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..4cdb696 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module 2024-contexts.shylinux.com/x/education + +go 1.13 + +require shylinux.com/x/ice v1.5.40 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..d11212a --- /dev/null +++ b/go.sum @@ -0,0 +1,13 @@ +shylinux.com/x/go-git/v5 v5.6.7 h1:WD5QSco7m3QooPCgdvQ6/GyGIFPun8C+hex5N41LYlk= +shylinux.com/x/go-git/v5 v5.6.7/go.mod h1:Qb0lA+uIrofZg8NQerhYcJHgGWixFqvS6p3aJ/L5Nlk= +shylinux.com/x/go-qrcode v0.0.3 h1:RMo+Vidbgq3HatLBj7DDXcTbTLFUwzis5K7TqBkD38U= +shylinux.com/x/go-qrcode v0.0.3/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po= +shylinux.com/x/ice v1.5.40 h1:OC++Fb1CxOU1R0Vlrfm+J9pf1mg5uH1n1trXFIHQHaw= +shylinux.com/x/ice v1.5.40/go.mod h1:nYLBfYfOacaxvIRgD4ryknBJTqUIZD0zkV72it7iHqU= +shylinux.com/x/icebergs v1.9.38 h1:LS4n8KE3qV8uvdpWwnrgStgkU90f6Ww6prSpv7Eztyw= +shylinux.com/x/icebergs v1.9.38/go.mod h1:zLsVvLKuFEyFRwKoa3li75nSqbJo/GVIYacAQVdTsxA= +shylinux.com/x/toolkits v0.7.10/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q= +shylinux.com/x/toolkits v1.0.12 h1:dwskBNtOLBfis1XtjEGfJhrjBXiwga3M/wNCERsXsyo= +shylinux.com/x/toolkits v1.0.12/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q= +shylinux.com/x/websocket v0.0.4 h1:AJpwblePoOpiE6C8NrvgNYpKTotXMLrDDX2chTvx44Q= +shylinux.com/x/websocket v0.0.4/go.mod h1:3UGWkjTu3ie5NAZen7J+uLPBrO7DFeKloj6Jxo13Oiw= diff --git a/src/hi/hi.go b/src/hi/hi.go new file mode 100644 index 0000000..984efba --- /dev/null +++ b/src/hi/hi.go @@ -0,0 +1,15 @@ +package hi + +import "shylinux.com/x/ice" + +type hi struct { + ice.Hash + + list string `name:"list hash auto" help:"hi"` +} + +func (s hi) List(m *ice.Message, arg ...string) { + s.Hash.List(m, arg...) +} + +func init() { ice.Cmd("web.chat.hi.hi", hi{}) } \ No newline at end of file diff --git a/src/main.go b/src/main.go new file mode 100644 index 0000000..5f4b28e --- /dev/null +++ b/src/main.go @@ -0,0 +1,10 @@ +package main + +import ( + _ "2024-contexts.shylinux.com/x/education/src/hi" + "shylinux.com/x/ice" +) + +func main() { print(ice.Run()) } + +func init() { ice.Info.Titles = "ContextOS" } diff --git a/src/main.shy b/src/main.shy new file mode 100644 index 0000000..e0a65f9 --- /dev/null +++ b/src/main.shy @@ -0,0 +1 @@ +title "20240724-education"