Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
can import files from git into packages now
Browse files Browse the repository at this point in the history
  • Loading branch information
mkloubert committed Jan 10, 2018
1 parent 01217cd commit 80b0910
Show file tree
Hide file tree
Showing 13 changed files with 507 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
[![Share via Facebook](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Facebook.png)](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&quote=vscode-deploy-reloaded) [![Share via Twitter](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Twitter.png)](https://twitter.com/intent/tweet?source=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&text=vscode-deploy-reloaded:%20https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&via=mjkloubert) [![Share via Google+](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Google+.png)](https://plus.google.com/share?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded) [![Share via Pinterest](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Pinterest.png)](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&media=https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo1.gif&description=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.) [![Share via Reddit](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Reddit.png)](https://www.reddit.com/submit?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&title=vscode-deploy-reloaded) [![Share via LinkedIn](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/LinkedIn.png)](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&title=vscode-deploy-reloaded&summary=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.&source=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded) [![Share via Wordpress](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Wordpress.png)](https://wordpress.com/press-this.php?u=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&quote=vscode-deploy-reloaded&s=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.&i=https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo1.gif) [![Share via Email](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Email.png)](mailto:?subject=vscode-deploy-reloaded&body=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20'vs-deploy'%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.:%20https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded)


## 0.28.0 (January 10th, 2018; import git files to packages)

* can [import files from git](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/import_git_files_to_packages) into a [package](https://github.com/mkloubert/vscode-deploy-reloaded/wiki#packages-) now

![Demo Import git files into package](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo15.gif)

## 0.27.0 (January 8th, 2018; zip target)

* added `fileName` for [zip targets](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_zip), which can define a custom output filename, s. [issue #12](https://github.com/mkloubert/vscode-deploy-reloaded/issues/12)
Expand Down
Binary file added img/demo15.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 30 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-deploy-reloaded",
"displayName": "Deploy (Reloaded)",
"description": "Deploys files of a workspace to a destination.",
"version": "0.27.0",
"version": "0.28.0",
"publisher": "mkloubert",
"engines": {
"vscode": "^1.19.0"
Expand Down Expand Up @@ -633,6 +633,35 @@
"type": "string"
}
},
"git": {
"oneOf": [
{
"type": "string",
"description": "Short settings for importing files from git. Format: 'BRANCH:FROM_HASH:TO_HASH'"
},
{
"type": "object",
"description": "Settings for importing files from git.",
"properties": {
"branch": {
"type": "string",
"description": "The custom branch to use.",
"default": "master"
},
"from": {
"type": "string",
"description": "The hash from where to start (youngest).",
"pattern": "([a-f|A-F|0-9]{7})([a-f|A-F|0-9]{33})?"
},
"to": {
"type": "string",
"description": "The hash where to stop (oldest).",
"pattern": "([a-f|A-F|0-9]{7})([a-f|A-F|0-9]{33})?"
}
}
}
]
},
"if": {
"description": "(JavaScript) Code, which indicates, if entry is available or not.",
"type": "string"
Expand Down
12 changes: 11 additions & 1 deletion src/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,17 @@ export async function deletePackage(pkg: deploy_packages.Package,
exclude = undefined;
}

const RELOADER = async () => await ME.findFilesByFilter(pkg);
const RELOADER = async () => {
const FILES_FROM_FILTER = await ME.findFilesByFilter(pkg);

await deploy_packages.importPackageFilesFromGit(
pkg,
deploy_contracts.DeployOperation.Delete,
FILES_FROM_FILTER,
);

return FILES_FROM_FILTER;
};

const FILES_TO_DELETE = await RELOADER();
if (FILES_TO_DELETE.length < 1) {
Expand Down
12 changes: 11 additions & 1 deletion src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,17 @@ export async function deployPackage(pkg: deploy_packages.Package) {
deploy_packages.getPackageName(pkg), ME.name));
}

const RELOADER = async () => await ME.findFilesByFilter(pkg);
const RELOADER = async () => {
const FILES_FROM_FILTER = await ME.findFilesByFilter(pkg);

await deploy_packages.importPackageFilesFromGit(
pkg,
deploy_contracts.DeployOperation.Deploy,
FILES_FROM_FILTER,
);

return FILES_FROM_FILTER;
};

const FILES_TO_DEPLOY = await RELOADER();
if (FILES_TO_DEPLOY.length < 1) {
Expand Down
22 changes: 22 additions & 0 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,28 @@ function parseVersion(raw: string): string {
return raw.replace(/^git version /, '');
}

/**
* Normalizes a git hash.
*
* @param {string} hash The input value.
* @param {TDefault} [defaultValue] The custom default value.
*
* @return {string|TDefault} The normalized hash or the default value.
*/
export function normalizeGitHash<TDefault = null>(hash: string, defaultValue?: TDefault): string | TDefault {
hash = deploy_helpers.normalizeString(hash);

if (hash.length > 7) {
hash = hash.substr(0, 7).trim();
}

if (hash.length < 1) {
return defaultValue;
}

return hash;
}

async function runCommand(command: string, args: any[]) {
return (await deploy_helpers.execFile(command, args)).stdOut;
}
Expand Down
13 changes: 13 additions & 0 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,19 @@ export function isFunc<TFunc extends Function = Function>(val: any): val is TFun
return 'function' === typeof val;
}

/**
* Checks if a value represents a hex string.
*
* @param {any} val The value to check.
*
* @return {boolean} Represents a hex string or not.
*/
export function isHex(val: any) {
return (/^([a-f|0-9]+)$/i).test(
normalizeString(val)
);
}

/**
* Checks if a value is (null) or (undefined).
*
Expand Down
3 changes: 3 additions & 0 deletions src/i18.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,11 @@ export interface Translation {
}
};
errors?: {
cannotDetectGitClient?: string;
cannotDetectMappedPathInfoForFile?: string;
cannotDetectPathInfoForFile?: string;
cannotFindBranch?: string;
cannotFindScmHash?: string;
cannotUseTargetForFile?: string;
initNodeModulesFailed?: string;
notInitialized?: string;
Expand Down
3 changes: 3 additions & 0 deletions src/lang/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,11 @@ export const translation: Translation = {
}
},
errors: {
cannotDetectGitClient: "git-Client konnte nicht für{0:trim,surround,leading_space} gefunden werden!",
cannotDetectMappedPathInfoForFile: "Gemappte Pfad-Informationen konnten für die Datei{0:trim,surround,leading_space} nicht ermittelt werden!",
cannotDetectPathInfoForFile: "Pfad-Informationen konnten für die Datei{0:trim,surround,leading_space} nicht ermittelt werden!",
cannotFindBranch: "Konnte Branch{0:trim,surround,leading_space} in{1:trim,surround,leading_space} nicht finden!",
cannotFindScmHash: "Konnte Hash{0:trim,surround,leading_space} in{1:trim,surround,leading_space} nicht finden!",
cannotUseTargetForFile: "Kann das Ziel{0:trim,surround,leading_space} nicht für die Datei{1:trim,surround,leading_space} verwenden!",
initNodeModulesFailed: "Der Aufruf von 'npm install' ist fehlgeschlagen:{0:trim,surround,leading_space}",
notInitialized: "Der Arbeitsbereich{0:trim,surround,leading_space} wurde nicht initialisiert!",
Expand Down
3 changes: 3 additions & 0 deletions src/lang/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,11 @@ export const translation: Translation = {
}
},
errors: {
cannotDetectGitClient: "Could not find git client for{0:trim,surround,leading_space}!",
cannotDetectMappedPathInfoForFile: "Cannot detect mapped path information for file{0:trim,surround,leading_space}!",
cannotDetectPathInfoForFile: "Cannot detect path information for file{0:trim,surround,leading_space}!",
cannotFindBranch: "Cannot find branch{0:trim,surround,leading_space} in{1:trim,surround,leading_space}!",
cannotFindScmHash: "Cannot find hash{0:trim,surround,leading_space} in{1:trim,surround,leading_space}!",
cannotUseTargetForFile: "Cannot use target{0:trim,surround,leading_space} for file{1:trim,surround,leading_space}!",
initNodeModulesFailed: "Execution of 'npm install' failed:{0:trim,surround,leading_space}",
notInitialized: "Workspace{0:trim,surround,leading_space} has not been initialized!",
Expand Down
Loading

0 comments on commit 80b0910

Please sign in to comment.