Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature oleg 1528683448315 #291

Merged
merged 17 commits into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .docker.r2g/README.md

This file was deleted.

23 changes: 0 additions & 23 deletions .docker.r2g/config.js

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ test/.suman/.meta
*.tgz

### files
path
assert
yarn.lock
*.DS_Store

Expand Down
5 changes: 3 additions & 2 deletions npm-link-up.json → .nlu.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"npm-link-up": true,
"linkToItself": true,
"alwaysReinstall": false,
"alwaysRelink": false,
"searchRoots": [
"$HOME/WebstormProjects/oresoftware"
],
"ignore": [
"/node_modules/",
"/.git/"
],

"comments": [
"put any comment you want here"
],
Expand All @@ -22,7 +24,6 @@
"poolio",
"freeze-existing-props",
"json-stdio",

"suman-r",
"suman-types",
"suman-browser",
Expand Down
45 changes: 45 additions & 0 deletions .r2g/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'use strict';

const path = require('path');

if (!path.isAbsolute(process.env.MY_DOCKER_R2G_SEARCH_ROOT || '')) {
throw new Error('Please set the env var "MY_DOCKER_R2G_SEARCH_ROOT" to an absolute path.');
}

exports.default = {

searchRoot: path.resolve(process.env.MY_DOCKER_R2G_SEARCH_ROOT),

// the following packages will be installed in the Docker container using this pattern:
// npm install /r2g_shared_dir/Users/you/

tests: '',

packages: {
'residence': true,
'vamoot': true,
'proxy-mcproxy': true,
'prepend-transform': true,
'log-prepend': true,
'pragmatik': true,
'frankenstop': true,
'poolio': true,
'freeze-existing-props': true,
'json-stdio': true,
'suman-r': true,
'suman-types': true,
'suman-browser': true,
'suman-watch': true,
'suman-shell': true,
'suman-utils': true,
'suman-events': true,
'suman-daemon': true,
'suman-browser-polyfills': true,
'suman-watch-plugins': true,
'suman-run-plugins': true,
'suman-transform-plugins': true,
'suman-reporters': true,
'suman-interactive': true
}

};
17 changes: 14 additions & 3 deletions .docker.r2g/exec.sh → .r2g/exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@ docker rm "$container" || echo "no container with name $container could be remov
tag="docker_r2g_image/$name";


docker build -f Dockerfile.r2g -t "$tag" --build-arg CACHEBUST="$(date +%s)" .
docker build \
-f Dockerfile.r2g \
-t "$tag" \
--build-arg CACHEBUST="$(date +%s)" .

#docker run \
# -v "$search_root:$shared:ro" \
# -e docker_r2g_fs_map="$map" \
# --name "$container" "$tag"


docker run \
-v "$search_root:$shared:ro" \
-e docker_r2g_fs_map="$map" \
-e MY_DOCKER_R2G_SEARCH_ROOT="/dev/null" \
--name "$container" "$tag"
-e r2g_container_id="$container" \
--entrypoint "dkr2g" \
--name "$container" "$tag" \
run --allow-unknown $@
Empty file added .r2g/fixtures/readme.md
Empty file.
1 change: 1 addition & 0 deletions .docker.r2g/smoke-test.js → .r2g/tests/smoke-test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env node

const suman = require('suman');
const Test = suman.init(module);
Expand Down
25 changes: 14 additions & 11 deletions Dockerfile.r2g
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
FROM node:10

RUN apt-get -y update
RUN apt-get -y install sudo
RUN sudo apt-get -y update
RUN apt-get install -y netcat
RUN apt-get install -y rsync
ENV ores_bash_utils https://raw.githubusercontent.com/oresoftware/npm.bash.utils
RUN curl -sS -o- $ores_bash_utils/master/assets/install-basics.sh | bash

ENV FORCE_COLOR=1
ENV docker_r2g_in_container=yes
ENV MY_DOCKER_R2G_SEARCH_ROOT="/home/node"

RUN sudo echo "node ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

USER node
RUN mkdir -p /home/node/app/node_modules
RUN mkdir -p /home/node/.docker_r2g_cache
ENV USER="node"
ENV HOME="/home/node"
ENV MY_DOCKER_R2G_SEARCH_ROOT "$HOME"
WORKDIR /home/node/app

RUN sudo chmod -R 777 /home/node
RUN sudo chown -R $(whoami) $(npm config get prefix)/lib
RUN sudo chown -R $(whoami) $(npm config get prefix)/lib/node_modules
RUN sudo chown -R $(whoami) $(npm config get prefix)/bin
RUN sudo chown -R $(whoami) $(npm config get prefix)/share
RUN sudo chown -R $(whoami) /usr/local/lib
RUN sudo chown -R $(whoami) /usr/local/etc

RUN curl -sS -o- $ores_bash_utils/master/assets/run-non-root-chown.sh | bash
RUN curl -sS -o- $ores_bash_utils/master/assets/run-npm-config-settings.sh | bash

#COPY package.json .
#COPY .r2g .r2g
#RUN npm install --loglevel=warn -g \
# "https://raw.githubusercontent.com/oresoftware/tarballs/master/tgz/oresoftware/npm.cache.tgz?$(date +%s)"
#RUN update_npm_cache

ARG CACHEBUST=1

Expand Down
27 changes: 0 additions & 27 deletions browser/package.json

This file was deleted.

57 changes: 40 additions & 17 deletions cli/suman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#set -e;

if ! [[ -z "${LOCAL_SUMAN_ALREADY_FOUND+x}" ]]; then
if [[ -n "${LOCAL_SUMAN_ALREADY_FOUND+x}" ]]; then
echo " => \$LOCAL_SUMAN_ALREADY_FOUND ? => $LOCAL_SUMAN_ALREADY_FOUND"
fi

Expand Down Expand Up @@ -31,35 +31,58 @@ fi


echo " [suman] Original path of Suman executable => \"$0\""
DIRN="$(dirname "$0")"
RL="$(readlink "$0")";
EXECDIR="$(dirname $(dirname "$RL"))";
MYPATH="$DIRN/$EXECDIR";
X="$(cd $(dirname ${MYPATH}) && pwd)/$(basename ${MYPATH})"
NEW_NODE_PATH="${NODE_PATH}":"$HOME/.suman/global/node_modules"
NEW_PATH="${PATH}":"$HOME/.suman/global/node_modules/.bin"
dir_name="$(dirname "$0")"
read_link="$(readlink "$0")";
exec_dir="$(dirname $(dirname "$read_link"))";
my_path="$dir_name/$exec_dir";
suman_root="$(cd $(dirname ${my_path}) && pwd)/$(basename ${my_path})"
new_node_path="${NODE_PATH}":"$HOME/.suman/global/node_modules"
new_path="${PATH}":"$HOME/.suman/global/node_modules/.bin"

if [[ "${LOCAL_SUMAN_ALREADY_FOUND}" == "yes" ]]; then
# we know that this directory contains the local version of suman we want to use
echo " [suman] local suman version already found.";
NODE_PATH="${NEW_NODE_PATH}" PATH="${NEW_PATH}" SUMAN_EXTRANEOUS_EXECUTABLE="yes" \
node "${X}/dist/cli.js" "$@"
NODE_PATH="${new_node_path}" PATH="${new_path}" SUMAN_EXTRANEOUS_EXECUTABLE="yes" \
node "${suman_root}/dist/cli.js" "$@"
else

# we are probably in the global install space, so let's find the local installation given pwd/cwd
LOCAL_SUMAN="$(node ${X}/scripts/find-local-suman-executable.js)"

if [[ -z "$LOCAL_SUMAN" ]]; then
project_root="$(node ${suman_root}/scripts/find-project-root.js)"

if [[ -z "$project_root" ]]; then
echo >&2 " [suman] Could not find your project root given your current working directory:";
echo >&2 " [suman] Your pwd: '$PWD'";
exit 1;
fi

local_suman="$(node ${suman_root}/scripts/find-local-suman-executable.js)"

if [[ -z "$local_suman" ]]; then

# symlink the global suman installation to the local project

if true; then
echo "major foo.";
echo "Symlinking global suman installation to local project.";
mkdir -p "${project_root}/node_modules/suman"
rm -rf "${project_root}/node_modules/suman";
ln -sf "$suman_root" "$project_root/node_modules/suman"
fi

# no local version found, so we fallback on the version in this directory, global or not

echo " [suman] => No local Suman executable could be found, given the current directory => $PWD"
echo " [suman] => Attempting to run installed version of Suman here => '${X}/dist/cli.js'"
echo " [suman] => Attempting to run installed version of Suman here => '${suman_root}/dist/cli.js'"

GLOBAL_MODULES="${suman_global_npm_modules_path:-"$(npm root -g)"}"
NODE_PATH="${NEW_NODE_PATH}":"${GLOBAL_MODULES}" PATH="${NEW_PATH}" SUMAN_EXTRANEOUS_EXECUTABLE="yes" \
node "${X}/dist/cli.js" "$@"
NODE_PATH="${new_node_path}":"${GLOBAL_MODULES}" PATH="${new_path}" SUMAN_EXTRANEOUS_EXECUTABLE="yes" \
node "${suman_root}/dist/cli.js" "$@"

else
# local version found, so we run it
NODE_PATH="${NEW_NODE_PATH}" PATH="${NEW_PATH}" SUMAN_EXTRANEOUS_EXECUTABLE="yes" \
node "${LOCAL_SUMAN}" "$@"
NODE_PATH="${new_node_path}" PATH="${new_path}" SUMAN_EXTRANEOUS_EXECUTABLE="yes" \
node "${local_suman}" "$@"
fi

fi
39 changes: 39 additions & 0 deletions dev-scripts/git/tools/checkout-new-branch-from-integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

set -e;

branch_type="${1:-feature}";
arr=( 'feature' 'bugfix' 'release' );

contains() {

local seeking="$1"
shift 1;
local arr=( "$@" )

for v in "${arr[@]}"; do
if [ "$v" == "$seeking" ]; then
return 0;
fi
done
return 1;
}

if ! contains "$branch_type" "${arr[@]}"; then
echo "Branch type needs to be either 'feature', 'bugfix' or 'release'."
echo "The branch type you passed was: $branch_type"
exit 1;
fi


git fetch origin dev;

time_seconds=`node -e 'console.log(String(Date.now()).slice(0,-3))'`;

echo "You are checking out a new $branch_type branch from the dev branch"
new_branch="${USER}/${branch_type}/${time_seconds}"

echo "New branch name: $new_branch";

git checkout -b "${new_branch}" "origin/dev"
git push -u origin HEAD # makes sure git is tracking this branch on the primary remote
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash


green='\033[1;32m'
red='\e[31m'
no_color='\033[0m'


branch="${1:-HEAD}"

branch_name=`git rev-parse --abbrev-ref "$branch"`;

git fetch origin dev master;


merge_base=`git merge-base origin/dev "$branch"`
merge_source_current_commit=`git rev-parse "$branch"`


if [ "$merge_base" != "$merge_source_current_commit" ]; then
echo -e "${red}Branch with name '$branch_name' is not completely merged with origin/dev.${no_color}";
exit 1;
else
echo -e "${green}Branch with name '$branch_name' is merged with origin/dev, now checking against origin/master${no_color}";
fi

merge_base="$(git merge-base origin/master $branch)"

if [ "$merge_base" != "$merge_source_current_commit" ]; then
echo -e "${red}Branch with name '$branch_name' is not completely merged with orign/master.${no_color}";
exit 1;
fi


echo -e "${green}branch with name '$branch_name' is completely merged with origin/dev and origin/master.${no_color}"

echo "To delete this branch run: git branch -d '$branch_name'"
Loading