-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into mixmix/DOCS
- Loading branch information
Showing
12 changed files
with
255 additions
and
105 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 |
---|---|---|
@@ -1,48 +1,81 @@ | ||
import { dirname, join } from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import { execFileSync } from 'child_process'; | ||
import { WebSocket } from 'ws'; | ||
import { promisify } from 'util' | ||
|
||
const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
const moduleRoot = join(__dirname, '..') | ||
|
||
// NOTE: you need to edit your /etc/hosts file to use these. See dev/README.md | ||
|
||
export async function spinNetworkUp (networkType = 'two-nodes') { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
execFileSync( | ||
'dev/bin/spin-up.sh', | ||
[networkType], | ||
{ | ||
shell: true, | ||
cwd: moduleRoot, | ||
stdio: 'inherit' | ||
} // Use shell's search path. | ||
) | ||
resolve(true) | ||
try { | ||
execFileSync('dev/bin/spin-up.sh', [networkType], { | ||
shell: true, | ||
cwd: moduleRoot, | ||
stdio: 'inherit' | ||
}) | ||
} catch (err) { | ||
console.log('spin up failed', err) | ||
return Promise.reject(err) | ||
} | ||
|
||
} catch (err) { | ||
reject(err) | ||
} | ||
}) | ||
// TODO: pull all the endpoints we want to test from the networkType | ||
const endpoint = 'ws://127.0.0.1:9944' | ||
return retryUntil(() => isWebSocketReady(endpoint)) | ||
} | ||
|
||
export async function spinNetworkDown (networkType = 'two-nodes') { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
execFileSync( | ||
'dev/bin/spin-down.sh', | ||
[networkType], | ||
{ | ||
shell: true, | ||
cwd: moduleRoot, | ||
stdio: 'inherit' | ||
} // Use shell's search path. | ||
) | ||
resolve(true) | ||
async function retryUntil (fn, isSuccess = Boolean, opts = {}) { | ||
const { | ||
triesRemaining = process.env.GITHUB_WORKSPACE ? 30 : 10, | ||
timeout = 1000 | ||
} = opts | ||
return fn() | ||
.then(result => { | ||
if (isSuccess(result)) return result | ||
else throw Error('retry failed') | ||
}) | ||
.catch(async (err) => { | ||
// out of tries, do not recurse | ||
if (triesRemaining === 1) throw err | ||
await promisify(setTimeout)(timeout) | ||
|
||
return retryUntil(fn, isSuccess, { | ||
triesRemaining: triesRemaining - 1, | ||
timeout | ||
}) | ||
}) | ||
} | ||
|
||
async function isWebSocketReady (endpoint) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
const ws = new WebSocket(endpoint) | ||
ws.on('error', (ev) => { | ||
ws.close() | ||
reject(Error(ev.message)) | ||
}) | ||
ws.on('open', () => { | ||
// NOTE: seems to be a sufficient test for our purposes! | ||
resolve(true) | ||
}) | ||
} catch (err) { | ||
console.log('ws error', err.message) | ||
reject(err) | ||
} | ||
|
||
}) | ||
} | ||
|
||
export async function spinNetworkDown (networkType = 'two-nodes') { | ||
try { | ||
execFileSync('dev/bin/spin-down.sh', [networkType], { | ||
shell: true, | ||
cwd: moduleRoot, | ||
stdio: 'inherit' | ||
}) | ||
} catch (err) { | ||
return Promise.reject(err) | ||
} | ||
} |
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,47 @@ | ||
# Entropy Js SYSTEM OF BELIEF | ||
|
||
### Definition SYSTEM OF BELIEF: | ||
|
||
> According to Wikipedia, a belief system is a set of mutually supportive beliefs | ||
> that can be religious, philosophical, political, ideological, or a combination | ||
> of these. A belief system can also refer to a religion or a worldview. | ||
> Beliefs can be categorized as basic or derived. Basic beliefs are not dependent | ||
> on other beliefs for justification, but rather on something outside of the realm | ||
> of belief. Derived beliefs depend on one or more basic beliefs for their validity. | ||
> Belief system theory views personality structure as an organization of beliefs, | ||
> attitudes, and values concerning the self and others. | ||
> Some examples of belief systems include: | ||
> Religious: Deals with morality, the existence of a god or gods, and the afterlife | ||
> Philosophical: Discusses the human experience, such as the nature of knowledge | ||
> and thought, what it means to exist, and the definition of reality | ||
> Some estimates suggest that there are roughly 4,200 religions, churches, | ||
> denominations, religious bodies, faith groups, tribes, cultures, movements, | ||
> or ultimate concerns. | ||
This document has two purposes it serves as a on boarding doc and | ||
a place for us to agree on are values and motivation. | ||
|
||
## Mission Statement: | ||
|
||
> To have a healthy `entropy-*.js` community that delivers account management solutions and distributed signing while practicing solar punk values. | ||
## SYSTEM OF BELIEF: | ||
|
||
Personal and coding practices to live by: | ||
|
||
- Take at least an "hour of joy" every day whatever that means to you just not writing more code | ||
go out side and hug a tree or something like that. A well rounded developer is one that participates in life. | ||
|
||
- Commit often and always | ||
`wips: [context_here]` are great things it allows others to see what you are doing. | ||
|
||
- Push up your branch At the end of your day and always look to see what should be pulled in the morning | ||
`git pull origin` :yellow_heart: | ||
|
||
> Git pull vs fetch: What's the difference? | ||
> The key difference between git fetch and pull is that git pull merges changes from a remote repository directly into your working directory, while git fetch only copies changes into your local memory of remote branches. | ||
if you are going to `fetch` don't forget the context your missing. | ||
|
||
- Always add to the CHANGELOG.md file | ||
- there's a `meta` section! if you don't feel comfortable adding to the meta section then please add to the `dev/README.md` or here to the `manifesto/README.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
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
Oops, something went wrong.