Skip to content

Commit

Permalink
Clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
cymerrad committed Jan 31, 2019
1 parent 9eed8bf commit db79bdb
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"browsertest": "sleep 5 && npm run nightwatch_local",
"csslint": "csslint --ignore=order-alphabetical --errors='errors,duplicate-properties,empty-rules' --exclude-list='assets/css/font-awesome.min.css' assets/css/",
"downloadsolc_root": "wget --no-check-certificate https://solc-bin.ethereum.org/bin/soljson-v0.5.1+commit.c8a2cb62.js -O soljson.js",
"lint": "standard --fix | notify-error",
"lint": "standard | notify-error",
"make-mock-compiler": "node ci/makeMockCompiler.js",
"minify": "uglifyjs --in-source-map inline --source-map-inline -c warnings=false",
"nightwatch_local": "nightwatch --config nightwatch.js --env local",
Expand Down
12 changes: 6 additions & 6 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ class App {
self._components.filesProviders['localhost'] = new SharedFolder(remixd)
self._components.filesProviders['gist'] = new NotPersistedExplorer('gist')
self._components.readOnly = new ReadOnlyFileProvider()
self._components.filesProviders['swarm'] = self._components.readOnly // new BasicReadOnlyExplorer('swarm')
self._components.filesProviders['github'] = self._components.readOnly // new BasicReadOnlyExplorer('github')
self._components.filesProviders['ipfs'] = self._components.readOnly // new BasicReadOnlyExplorer('ipfs')
self._components.filesProviders['https'] = self._components.readOnly // new BasicReadOnlyExplorer('https')
self._components.filesProviders['http'] = self._components.readOnly // new BasicReadOnlyExplorer('http')
self._components.filesProviders['external'] = self._components.readOnly // hack
self._components.filesProviders['swarm'] = self._components.readOnly // proof of concept, awaiting acceptance before digging deeper
self._components.filesProviders['github'] = self._components.readOnly
self._components.filesProviders['ipfs'] = self._components.readOnly
self._components.filesProviders['https'] = self._components.readOnly
self._components.filesProviders['http'] = self._components.readOnly
self._components.filesProviders['external'] = self._components.readOnly
registry.put({api: self._components.filesProviders['localhost'], name: 'fileproviders/localhost'})
registry.put({api: self._components.filesProviders['swarm'], name: 'fileproviders/swarm'})
registry.put({api: self._components.filesProviders['github'], name: 'fileproviders/github'})
Expand Down
6 changes: 3 additions & 3 deletions src/app/compiler/compiler-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ module.exports = class CompilerImports {
.resolve(uri)
.then(result => {
if (!result) {
cb('Unable to import "' + uri + '"')
return Promise.reject('Just no.')
var errMsg = 'Unable to import "' + uri + '"'
cb(errMsg)
return Promise.reject(errMsg)
} else {
loadingCb('Loading ' + uri + ' ...')
console.log(`Resolved to ${result}`)
return resolver.require(uri)
}
})
Expand Down
1 change: 0 additions & 1 deletion src/app/files/browser-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function Files (storage) {
var readonly = {}
this.type = 'browser'

window['bro'] = this
this.storage = storage

this.exists = function (path, cb) {
Expand Down
11 changes: 0 additions & 11 deletions src/app/files/fileManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,23 +187,12 @@ class FileManager {
cb(`provider for path ${path} not found`)
}

// fileProviderOf (file) {
// var provider = this._fileProviderOf(file)
// console.log(`Provider of ${file} is ${provider && provider.type ? provider.type : 'unknown'}`)
// return provider
// }

fileProviderOf (file) {
if (!file) return null
var provider = file.match(/[^/]*/)
if (provider !== null && this._deps.filesProviders[provider[0]]) {
return this._deps.filesProviders[provider[0]]
} else {
// for (var handler of this._components.compilerImport.handlers()) {
// if (handler.match.exec(file)) {
// return this._deps.filesProviders[handler.type]
// }
// }
return this._deps.readOnly
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/app/files/readOnlyFileProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class ReadOnlyFileProvider {
this.normalizedNames = {} // contains the raw url associated with the displayed path
this.type = readOnlyFileProviderType
this.readonly = true

window['ext'] = this
}

close (cb) {
Expand Down Expand Up @@ -79,7 +77,6 @@ class ReadOnlyFileProvider {
this.paths[this.type][split] = { isDirectory: folder }
this.files[procuredPath] = content
this.normalizedNames[rawPath] = procuredPath
console.log('Added', path)
this.event.trigger('fileAdded', [procuredPath, true])
return true
}
Expand Down
7 changes: 3 additions & 4 deletions src/app/tabs/compile-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,9 @@ module.exports = class CompileTab {
if (provider) {
provider.get(target, (error, content) => {
if (error) {
console.log('runCompiler', error)
console.log(error)
} else {
sources[target] = { content }
console.log('sources', sources)
self._components.compiler.compile(sources, target)
}
})
Expand All @@ -502,10 +501,10 @@ module.exports = class CompileTab {
(loadingMsg) => {
addTooltip(loadingMsg)
},
(error, content, cleanUrl, type, url) => { // these two lines
(error, content, cleanUrl, type, url) => {
if (!error) {
if (self._deps.fileProviders[type]) {
self._deps.fileProviders[type].addReadOnly(cleanUrl, content, url, type) // for eventual changes
self._deps.fileProviders[type].addReadOnly(cleanUrl, content, url, type)
}
cb(null, content)
} else {
Expand Down

0 comments on commit db79bdb

Please sign in to comment.