Mise à jour effectuée, merci de nous signaler tout dysfonctionnement ! | Upgrade done, please let us know about any dysfunction!

Commit 43beb0a4 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Init

parents
src/nw/lib
src/nw/locales
src/nw/node_modules
src/nw/pnacl
src/nw/nw*
src/nw/*.bin
src/nw/chromedriver
src/nw/credits.html
src/nw/*.dat
src/nw/*.pak
src/nw/nacl*
src/nw/minidump*
src/nw/payload*
src/nw/cesium/dist*
src/nw/cesium/fonts
src/nw/cesium/img
src/nw/cesium/lib
src/nw/cesium/config.js
src/nw/cesium/*.html
src/nw/cesium/manifest.json
arch/linux/.vagrant
arch/linux/cesium*
arch/linux/*.js*
arch/linux/yarn*
arch/linux/ubuntu*
arch/linux/nw*
arch/windows/.vagrant
arch/windows/cesium-*
arch/windows/*.js*
arch/windows/yarn*
arch/windows/ubuntu*
arch/windows/nw*
arch/windows/LICENSE.txt
.idea/
\ No newline at end of file
# Cesium Desktop packager
## Test a release
This script will run Cesium Desktop, taking care of installing Cesium + Nw.js if necessary.
./test_cesium.sh
## Produce new release
**Requires your GITHUB token with full access to `repo`** to be stored in clear in `$HOME/.config/duniter/.github` text file.
> You can create such a token at https://github.com/settings/tokens > "Generate a new token". Then copy the token and paste it in the file.
This script will produce for a given `TAG`:
* check that the `TAG` exists on remote GitHub repository
* eventually create the pre-release if it does not exist
* produce Linux and Windows releases of Cesium Desktop and upload them
To produce `TAG` 0.12.8:
./new_cesium.sh 0.12.8
\ No newline at end of file
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "https://s3.eu-central-1.amazonaws.com/duniter/vagrant/duniter_trusty64.box"
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
end
#!/bin/bash
# Yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# System tools
apt-get update
apt-get install --yes git curl yarn python-minimal zip
# User installation
sudo su vagrant -c "bash /vagrant/user-bootstrap.sh"
#!/bin/bash
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# Prepare
NVER=`node -v`
CESIUM_TAG=
ADDON_VERSION=48
NW_VERSION=0.22.3
NW_RELEASE="v${NW_VERSION}"
NW="nwjs-${NW_RELEASE}-linux-x64"
NW_GZ="${NW}.tar.gz"
# Folders
ROOT=`pwd`
DOWNLOADS="$ROOT/downloads"
RELEASES="$ROOT/releases"
mkdir -p "$DOWNLOADS"
# -----------
# Clean sources + releases
# -----------
rm -rf "$DOWNLOADS/cesium"
rm -rf "$DOWNLOADS/cesium_src"
rm -rf "$RELEASES"
rm -rf /vagrant/*.deb
rm -rf /vagrant/*.tar.gz
mkdir -p $DOWNLOADS/cesium
# -----------
# Downloads
# -----------
cd "$DOWNLOADS"
if [ ! -d "$DOWNLOADS/cesium_src" ]; then
git clone https://github.com/duniter/cesium.git cesium_src
fi
cd cesium_src
COMMIT=`git rev-list --tags --max-count=1`
CESIUM_TAG=`echo $(git describe --tags $COMMIT) | sed 's/^v//'`
cd ..
CESIUM_RELEASE="cesium-v$CESIUM_TAG-web"
echo "Checking that Cesium binary has been downloaded"
if [ ! -e "$DOWNLOADS/$CESIUM_RELEASE.zip" ]; then
echo "Have to download it"
cd cesium
wget "https://github.com/duniter/cesium/releases/download/v$CESIUM_TAG/$CESIUM_RELEASE.zip"
unzip $CESIUM_RELEASE.zip
rm $CESIUM_RELEASE.zip
cd ..
fi
CESIUM_DEB_VER=" $CESIUM_TAG"
CESIUM_TAG="v$CESIUM_TAG"
if [ ! -f "$DOWNLOADS/$NW_GZ" ]; then
wget https://dl.nwjs.io/${NW_RELEASE}/${NW_GZ}
tar xvzf ${NW_GZ}
fi
# -----------
# Releases
# -----------
rm -rf "$RELEASES"
mkdir -p "$RELEASES"
cp -r "$DOWNLOADS/cesium" "$RELEASES/cesium"
cd "$RELEASES"
# Releases builds
cd ${RELEASES}/cesium
# Remove git files
rm -Rf .git
# -------------------------------------------------
# Build Desktop version (Nw.js is embedded)
# -------------------------------------------------
## Install Nw.js
mkdir -p "$RELEASES/desktop_release"
# -------------------------------------------------
# Build Desktop version .tar.gz
# -------------------------------------------------
cp -r "$DOWNLOADS/${NW}" "$RELEASES/desktop_release/nw"
cp -r "$DOWNLOADS/cesium" "$RELEASES/desktop_release/nw/"
# Specific desktop files
cp -r /vagrant/package.json "$RELEASES/desktop_release/nw/"
cp -r /vagrant/yarn.lock "$RELEASES/desktop_release/nw/"
cp -r /vagrant/node.js "$RELEASES/desktop_release/nw/cesium"
# Injection
sed -i 's/<script src="config.js"><\/script>/<script src="config.js"><\/script><script src="node.js"><\/script>/' "$RELEASES/desktop_release/nw/cesium/index.html"
sed -i 's/<script src="config.js"><\/script>/<script src="config.js"><\/script><script src="node.js"><\/script>/' "$RELEASES/desktop_release/nw/cesium/debug.html"
# Specific desktop dependencies (for reading Duniter conf, ...)
cd "$RELEASES/desktop_release/nw"
yarn
# Releases
cp -R "$RELEASES/desktop_release" "$RELEASES/desktop_release_tgz"
cd "$RELEASES/desktop_release_tgz"
tar czf /vagrant/cesium-desktop-${CESIUM_TAG}-linux-x64.tar.gz * --exclude ".git" --exclude "coverage" --exclude "test"
# -------------------------------------------------
# Build Desktop version .deb
# -------------------------------------------------
# Create .deb tree + package it
cp -r "/vagrant/package" "$RELEASES/cesium-x64"
mkdir -p "$RELEASES/cesium-x64/opt/cesium/"
chmod 755 ${RELEASES}/cesium-x64/DEBIAN/post*
chmod 755 ${RELEASES}/cesium-x64/DEBIAN/pre*
sed -i "s/Version:.*/Version:$CESIUM_DEB_VER/g" ${RELEASES}/cesium-x64/DEBIAN/control
cd ${RELEASES}/desktop_release/nw
zip -qr ${RELEASES}/cesium-x64/opt/cesium/nw.nwb *
sed -i "s/Package: .*/Package: cesium-desktop/g" ${RELEASES}/cesium-x64/DEBIAN/control
cd ${RELEASES}/
fakeroot dpkg-deb --build cesium-x64
mv cesium-x64.deb /vagrant/cesium-desktop-${CESIUM_TAG}-linux-x64.deb
Package: cesium
Version: 1.3.2
Section: misc
Priority: optional
Architecture: all
Installed-Size: 235351
Maintainer: Benoit Lavenier <benoit.lavenier@e-is.pro>
Description: Cesium Wallet for Duniter Ğ1
#!/bin/bash
CESIUM_ROOT=/opt/cesium
CESIUM_NW=$CESIUM_ROOT/nw
if [[ -f $CESIUM_ROOT/nw.nwb ]]; then
unzip -q -d $CESIUM_NW $CESIUM_ROOT/nw.nwb
chmod +x $CESIUM_NW/nw $CESIUM_NW/lib $CESIUM_NW/locales
ln -s $CESIUM_NW/nw /usr/bin/cesium
fi
chmod +r -R $CESIUM_ROOT
#!/bin/bash
[[ -f /usr/bin/cesium ]] && rm /usr/bin/cesium
[[ -f /usr/bin/cesium-desktop ]] && rm -f /usr/bin/cesium-desktop
[[ -d /opt/cesium ]] && rm -Rf /opt/cesium
[Desktop Entry]
Name=Cesium
Exec=cesium
Icon=/opt/cesium/nw/cesium/img/logo.png
Type=Application
Categories=Utility
#!/bin/bash
# NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# Node.js
nvm install 6
# node-pre-gyp
npm install -g nw-gyp node-pre-gyp
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "https://s3.eu-central-1.amazonaws.com/duniter/vagrant/duniter_win7.box"
config.vm.provision :shell, path: "build.bat", run: 'always'
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
end
end
set NW_VERSION=0.22.3
set NW_RELEASE=v%NW_VERSION%
set NW=nwjs-%NW_RELEASE%-win-x64
set NW_GZ=%NW%.zip
echo %NW%
echo %NW_GZ%
echo %NW_RELEASE%
node -v
REM NPM
set PATH="C:\Users\vagrant\AppData\Roaming\npm";%PATH%
REM InnoSetup
set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%
cd C:\Users\vagrant
REM echo "Suppression des anciennes sources..."
rd /s /q cesium
rd /s /q cesium_release
echo "Clonage de Cesium..."
git clone https://github.com/duniter/cesium.git
cd cesium
for /f "delims=" %%a in ('git rev-list --tags --max-count=1') do @set CESIUM_REV=%%a
for /f "delims=" %%a in ('git describe --tags %CESIUM_REV%') do @set CESIUM_TAG=%%a
set CESIUM=cesium-%CESIUM_TAG%-web
set CESIUM_ZIP=%CESIUM%.zip
echo %CESIUM_TAG%
echo %CESIUM%
echo %CESIUM_ZIP%
cd ..
if not exist C:\vagrant\%NW_GZ% (
echo "Telechargement de %NW%.zip..."
REM powershell -Command "Invoke-WebRequest -Uri https://dl.nwjs.io/v%NW_VERSION%/%NW%.zip -OutFile C:\vagrant\%NW_GZ%"
powershell -Command "(New-Object System.Net.WebClient).DownloadFile(\"https://dl.nwjs.io/v%NW_VERSION%/%NW%.zip\", \"C:\vagrant\%NW_GZ%\")"
)
if not exist C:\vagrant\%CESIUM_ZIP% (
echo "Telechargement de %CESIUM_ZIP%..."
powershell -Command "(New-Object System.Net.WebClient).DownloadFile(\"https://github.com/duniter/cesium/releases/download/%CESIUM_TAG%/%CESIUM_ZIP%\", \"C:\vagrant\%CESIUM_ZIP%\")"
)
call 7z x C:\vagrant\%NW_GZ%
move %NW% cesium_release
cd cesium_release
mkdir cesium
cd cesium
call 7z x C:\vagrant\%CESIUM_ZIP%
cd ..
xcopy C:\vagrant\LICENSE.txt .\ /s /e
xcopy C:\vagrant\package.json .\ /s /e
xcopy C:\vagrant\node.js .\cesium\ /s /e
call npm install
cd C:\Users\vagrant\cesium_release\cesium
powershell -Command "(Get-Content C:\Users\vagrant\cesium_release\cesium\index.html) | foreach-object {$_ -replace '<script src=\"config.js\"></script>','<script src=\"config.js\"></script><script src=\"node.js\"></script>' } | Set-Content C:\Users\vagrant\cesium_release\cesium\index.txt"
powershell -Command "(Get-Content C:\Users\vagrant\cesium_release\cesium\debug.html) | foreach-object {$_ -replace '<script src=\"config.js\"></script>','<script src=\"config.js\"></script><script src=\"node.js\"></script>' } | Set-Content C:\Users\vagrant\cesium_release\cesium\debug.txt"
move index.txt index.html
move debug.txt debug.html
cd ..
iscc C:\vagrant\cesium.iss /DROOT_PATH=%cd%
move %cd%\Cesium.exe C:\vagrant\cesium-desktop-%CESIUM_TAG%-windows-x64.exe
echo "Build done: binary available at cesium-desktop-%CESIUM_TAG%-windows-x64.exe"
#define MyAppName "Cesium"
#define MyAppPublisher "Duniter team"
#define MyAppURL "http://g1.duniter.fr"
#define MyAppExeName "nw.exe"
#if !Defined(ROOT_PATH)
#define ROOT_PATH "."
#endif
#define MyAppSrc ROOT_PATH
#define MyAppExe ROOT_PATH + "\" + MyAppExeName
#pragma message MyAppSrc
#if !FileExists(MyAppExe)
#error "Unable to find MyAppExe"
#endif
#define MyAppVerStr "v0.12.7"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVerStr}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputDir={#ROOT_PATH}
OutputBaseFilename={#MyAppName}
Compression=lzma
SolidCompression=yes
UninstallDisplayIcon={app}\{#MyAppExeName}
ArchitecturesInstallIn64BitMode=x64
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "{#MyAppSrc}\*"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs
[Icons]
Name: "{group}\{#MyAppName}"; IconFilename: "{app}\cesium\img\favicon.ico"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; IconFilename: "{app}\cesium\img\favicon.ico"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{DA3E955D-F840-8274-DDD2-D3C099C306D2}
LicenseFile="{#MyAppSrc}\LICENSE.txt"
[Code]
//////////
// Code taken from http://stackoverflow.com/a/2099805
//////////
/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end;
/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString
// default return value
Result := 0;
// get the uninstall string of the old app
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;
/////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
UnInstallOldVersion();
end;
end;
end;
\ No newline at end of file
#!/bin/bash
TAG="$1"
TAG_NAME="v$1"
ARCH=`uname -m`
# Check that the tag exists remotely
if [[ -z $TAG ]]; then
echo "Wrong call to the command, syntax is:"
echo ""
echo " new_cesium.sh <tag>"
echo ""
echo "Examples:"
echo ""
echo " new_cesium.sh 1.2.3"
echo " new_cesium.sh 1.4.0"
echo " new_cesium.sh 1.4.1"
echo ""
exit 1
fi
echo "Checking that $TAG has been pushed to 'origin'..."
REMOTE_TAG=`node scripts/exists-tag.js "$TAG_NAME" | grep -Fo "$TAG_NAME"`
if [[ -z $REMOTE_TAG ]]; then
echo "The '$TAG' tag does not exist on 'origin' repository. Use command ./new_version.sh to create a new version and use 'git push origin --tags' to share the tag."
exit 2
fi
echo "Remote tag: $REMOTE_TAG"
echo "Creating the pre-release if it does not exist..."
ASSETS=`node ./scripts/create-release.js $REMOTE_TAG create`
EXPECTED_ASSETS="cesium-desktop-$REMOTE_TAG-linux-x64.deb
cesium-desktop-$REMOTE_TAG-linux-x64.tar.gz
cesium-desktop-$REMOTE_TAG-windows-x64.exe"
for asset in $EXPECTED_ASSETS; do
if [[ -z `echo $ASSETS | grep -F "$asset"` ]]; then
echo "Missing asset: $asset"
# Debian
if [[ $asset == *"linux-x64.deb" ]] || [[ $asset == *"linux-x64.tar.gz" ]]; then
if [[ $ARCH == "x86_64" ]]; then
echo "Starting Debian build..."
./scripts/build.sh make linux $TAG
DEB_PATH="$PWD/arch/linux/$asset"
node ./scripts/upload-release.js $REMOTE_TAG $DEB_PATH
else
echo "This computer cannot build this asset, required architecture is 'x86_64'. Skipping."
fi
fi
# Windows
if [[ $asset == *".exe" ]]; then
if [[ $ARCH == "x86_64" ]]; then
echo "Starting Windows build..."
./scripts/build.sh make win $TAG
WIN_PATH="$PWD/arch/windows/$asset"
node ./scripts/upload-release.js $REMOTE_TAG $WIN_PATH
else
echo "This computer cannot build this asset, required architecture is 'x86_64'. Skipping."
fi
fi
fi
done
echo "All the binaries have been uploaded."
\ No newline at end of file
{
"dependencies": {
"co": "^4.6.0",
"request": "^2.81.0",
"request-promise": "^4.2.1"
}
}
#!/bin/bash
TAG="$3"
case "$1" in
make)
case "$2" in
linux)
cd arch/linux
if [[ ! -f "cesium-desktop-v$TAG-linux-x64.deb" ]]; then
[[ $? -eq 0 ]] && echo ">> Copying Cesium Desktop sources..."
[[ $? -eq 0 ]] && cp ../../src/nw/yarn.lock ./
[[ $? -eq 0 ]] && cp ../../src/nw/package.json ./
[[ $? -eq 0 ]] && cp ../../src/nw/cesium/node.js ./
[[ $? -eq 0 ]] && echo ">> Starting Vagrant Ubuntu VM..."
[[ $? -eq 0 ]] && vagrant up
[[ $? -eq 0 ]] && echo ">> VM: building Cesium..."
[[ $? -eq 0 ]] && vagrant ssh -- 'bash -s' < ./build-deb.sh
if [ ! $? -eq 0 ]; then
echo ">> Something went wrong. Stopping build."
else
echo ">> Build success. Shutting the VM down."
fi
vagrant halt
echo ">> VM closed."
else
echo ">> Debian binaries already built. Ready for upload."
fi
;;
win)
cd arch/windows
if [[ ! -f "cesium-desktop-v$TAG-windows-x64.exe" ]]; then
[[ $? -eq 0 ]] && echo ">> Copying Cesium Desktop sources..."
[[ $? -eq 0 ]] && cp ../../src/nw/package.json ./
[[ $? -eq 0 ]] && cp ../../src/nw/LICENSE.txt ./
[[ $? -eq 0 ]] && cp ../../src/nw/cesium/node.js ./
[[ $? -eq 0 ]] && echo ">> Starting Vagrant Windows VM..."
[[ $? -eq 0 ]] && vagrant up
if [ ! $? -eq 0 ]; then
echo ">> Something went wrong. Stopping build."
fi
vagrant halt
echo ">> VM closed."
else
echo ">> Windows binary already built. Ready for upload."
fi
;;
*)
echo "Unknown binary « $2 »."
;;
esac
;;
*)
echo "Unknown task « $1 »."
;;
esac
"use strict";
const co = require('co');
const fs = require('fs');
const os = require('os');
const path = require('path');
const rp = require('request-promise');