forked from teambit/bit
-
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.
# Conflicts: # Jenkinsfile
- Loading branch information
Showing
32 changed files
with
294 additions
and
61 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 |
---|---|---|
|
@@ -16,4 +16,4 @@ suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe | |
unsafe.enable_getters_and_setters=true | ||
|
||
[version] | ||
0.37.4 | ||
0.36.0 |
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,8 +1,7 @@ | ||
node { | ||
properties([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [[$class: 'ChoiceParameterDefinition', choices: 'stage\nproduction', description: '', name: 'environment']]]]) | ||
|
||
checkout scm | ||
def releaseServer = "${env.BIT_STAGE_SERVER}" | ||
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'b0cc61f6-f63c-44ce-b004-c7ce63415d3f', url: '[email protected]:core/bit.git']]]) | ||
def releaseServer = "${env.BIT_STAGE_SERVER}" | ||
def assets = "${env.BIT_ASSETS}" | ||
print releaseServer | ||
def env = "${environment}" | ||
|
@@ -13,7 +12,7 @@ node { | |
def uploadfolder = "gs://bit-assets/release/${currentVersion}/" | ||
|
||
stage 'remove old zip files ' | ||
sh("rm -rf *.tar.gz && rm -rf ./distribution ") | ||
sh("rm -rf *.tar.gz && rm -rf ./distribution && rm -rf ./node_modules") | ||
|
||
stage 'Running tar' | ||
sh('cd ./scripts && ./build-tar.sh tar') | ||
|
@@ -22,9 +21,13 @@ node { | |
sh("cd ./scripts && ./build-brew.sh ") | ||
|
||
|
||
stage 'Running deb' | ||
sh('cd ./scripts && ./build-deb.sh') | ||
|
||
|
||
stage 'export to google storage' | ||
sh("gsutil -m cp -a public-read ./distribution/brew_pkg/${bundleName}_brew.tar.gz ${uploadfolder}") | ||
//sh("gsutil -m cp -a public-read ./distribution/debian_pkg/${bundleName}_deb.deb ${uploadfolder}") | ||
sh("gsutil -m cp -a public-read ./distribution/debian_pkg/${bundleName}_deb.deb ${uploadfolder}") | ||
|
||
|
||
|
||
|
@@ -35,6 +38,9 @@ node { | |
sh("cd ./scripts && ./generate-formula.sh ${assets}/${currentVersion}/${bundleName}_brew.tar.gz") | ||
sh("cd ./distribution && gsutil -m cp bit.rb ${uploadfolder}") | ||
|
||
sh("curl -X PURGE http://assets.bitsrc.io/release/${currentVersion}/bit_${currentVersion}_brew.tar.gz") | ||
|
||
|
||
} | ||
import groovy.json.JsonOutput | ||
def notifyReleaseServer(version,url) { | ||
|
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** @flow */ | ||
import BitObject from './object'; | ||
import Repository from './repository'; | ||
import Ref from './ref'; | ||
|
||
export { | ||
BitObject, | ||
Ref, | ||
Repository | ||
}; |
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,31 @@ | ||
/** @flow */ | ||
import { deflate, inflate, sha1 } from '../utils'; | ||
import { NULL_BYTE, SPACE_DELIMITER } from '../constants'; | ||
|
||
export default class BitObject { | ||
/** | ||
* indexing method | ||
*/ | ||
hash(): string { | ||
return sha1(this.id()); | ||
} | ||
|
||
compress(): Promise<Buffer> { | ||
return deflate(this.serialize()); | ||
} | ||
|
||
serialize(): Buffer { | ||
const contents = this.toBuffer(); | ||
const header = `${this.constructor.name} ${contents.toString().length}${NULL_BYTE}$`; | ||
return Buffer.concat([new Buffer(header), contents]); | ||
} | ||
|
||
static parse(fileContents: Buffer, types: {[string]: Function}): Promise<BitObject> { | ||
return inflate(fileContents) | ||
.then((buffer) => { | ||
const [headers, contents] = buffer.toString().split(NULL_BYTE); | ||
const [type, ] = headers.split(SPACE_DELIMITER); | ||
return types[type].parse(contents); | ||
}); | ||
} | ||
} |
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,9 @@ | ||
/** @flow */ | ||
|
||
export default class Ref { | ||
hash: string; | ||
|
||
constructor(hash: string) { | ||
this.hash = hash; | ||
} | ||
} |
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,56 @@ | ||
/** @flow */ | ||
import path from 'path'; | ||
import BitObject from './object'; | ||
import Ref from './ref'; | ||
import { OBJECTS_DIR } from '../constants'; | ||
import { mkdirp, writeFile, allSettled, readFile } from '../utils'; | ||
import { Scope } from '../scope'; | ||
|
||
export default class Repository { | ||
objects: BitObject[] = []; | ||
scope: Scope; | ||
types: {[string]: Function}; | ||
|
||
constructor(scope: Scope, objectTypes: Function[] = []) { | ||
this.scope = scope; | ||
this.types = objectTypes.reduce((map, objectType) => { | ||
map[objectType.name] = objectType; | ||
return map; | ||
}, {}); | ||
} | ||
|
||
ensureDir() { | ||
return mkdirp(this.getPath()); | ||
} | ||
|
||
getPath() { | ||
return path.join(this.scope.getPath(), OBJECTS_DIR); | ||
} | ||
|
||
objectPath(hash: string): string { | ||
return path.join(this.getPath(), hash.slice(0, 2), hash.slice(2)); | ||
} | ||
|
||
load(ref: Ref): Promise<BitObject> { | ||
return readFile(this.objectPath(ref.hash)) | ||
.then(fileContents => BitObject.parse(fileContents, this.types)); | ||
} | ||
|
||
add(object: BitObject): Repository { | ||
this.objects.push(object); | ||
return this; | ||
} | ||
|
||
persist(): Promise<> { | ||
// @TODO handle failures | ||
return allSettled(this.objects.map(object => this.persistOne(object))); | ||
} | ||
|
||
persistOne(object: BitObject): Promise<> { | ||
return object.compress() | ||
.then((contents) => { | ||
return writeFile(this.objectPath(object.hash()), contents); | ||
}); | ||
} | ||
} | ||
|
Empty file.
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,22 @@ | ||
import { BitObject } from '../../objects'; | ||
|
||
export default class Source extends BitObject { | ||
contents: Buffer; | ||
|
||
constructor(contents: Buffer) { | ||
super(); | ||
this.contents = contents; | ||
} | ||
|
||
id() { | ||
return this.toString(); | ||
} | ||
|
||
toBuffer() { | ||
return this.contents; | ||
} | ||
|
||
static parse(contents: string): Source { | ||
return new Source(new Buffer(contents)); | ||
} | ||
} |
Empty file.
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,8 @@ | ||
/** @flow */ | ||
import Source from './models/source'; | ||
|
||
export default function types() { | ||
return [ | ||
Source | ||
]; | ||
} |
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.