-
Notifications
You must be signed in to change notification settings - Fork 490
Small fixes for plugin APIs #384
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c818326
test add config and contract and add test
jrainville 61be2c7
addFileToPipeline test and registerBeforeDeploy with new arg
jrainville e4566f9
add more registers but generation one fails in run
jrainville d046feb
fix a bug where upload cmd used plugin name
jrainville 797e43c
remove duplicated entry
jrainville 5de20c6
force zepplein version for travis
jrainville File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
10 changes: 10 additions & 0 deletions
10
test_apps/test_app/extensions/embark-service/contracts/pluginSimpleStorage.sol
This file contains hidden or 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 @@ | ||
| pragma solidity ^0.4.18; | ||
| contract PluginStorage { | ||
| address public simpleStorageAddress; | ||
| address simpleStorageAddress2; | ||
|
|
||
| function PluginStorage(address addr) public { | ||
| simpleStorageAddress = addr; | ||
| } | ||
|
|
||
| } |
This file contains hidden or 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 @@ | ||
| console.log('File added to the pipeline using embark.addFileToPipeline'); |
This file contains hidden or 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,12 +1,47 @@ | ||
| var Haml = require('haml'); | ||
| const Haml = require('haml'); | ||
|
|
||
| module.exports = function(embark) { | ||
| embark.registerServiceCheck('PluginService', function(cb) { | ||
| module.exports = function (embark) { | ||
| embark.registerServiceCheck('PluginService', function (cb) { | ||
| cb({name: "ServiceName", status: "on"}); | ||
| }); | ||
|
|
||
| embark.registerPipeline((embark.pluginConfig.files || ['**/*.haml']), function(opts) { | ||
| var source = opts.source; | ||
| return Haml.render(source); | ||
| embark.registerPipeline((embark.pluginConfig.files || ['**/*.haml']), function (opts) { | ||
| return Haml.render(opts.source); | ||
| }); | ||
|
|
||
| embark.registerContractConfiguration({ | ||
| "default": { | ||
| "contracts": { | ||
| "PluginStorage": { | ||
| "args": ["$SimpleStorage"] | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| embark.addContractFile("./contracts/pluginSimpleStorage.sol"); | ||
|
|
||
| embark.addFileToPipeline('./fileInPipeline.js'); | ||
| embark.addFileToPipeline('./fileInPipeline.js', 'js/fileInPipeline.js'); | ||
|
|
||
| embark.registerBeforeDeploy(function (options, callback) { | ||
| // Just calling register to prove it works. We don't actually want to change the contracts | ||
| callback({contractCode: options.contract.code}); | ||
| }); | ||
|
|
||
| embark.registerClientWeb3Provider(function(options) { | ||
| return "web3 = new Web3(new Web3.providers.HttpProvider('http://" + options.rpcHost + ":" + options.rpcPort + "'));"; | ||
| }); | ||
|
|
||
| embark.registerConsoleCommand((cmd) => { | ||
| if (cmd === "hello") { | ||
| return "hello there!"; | ||
| } | ||
| // continue to embark or next plugin; | ||
| return false; | ||
| }); | ||
|
|
||
| embark.events.on("contractsDeployed", function() { | ||
| embark.logger.info("plugin says: your contracts have been deployed"); | ||
| }); | ||
|
|
||
| }; |
This file contains hidden or 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 hidden or 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,26 @@ | ||
| /*global contract, before, EmbarkSpec, PluginStorage, SimpleStorage, it*/ | ||
| const assert = require('assert'); | ||
|
|
||
| contract("PluginSimpleStorage", function () { | ||
| this.timeout(0); | ||
|
|
||
| before((done) => { | ||
| const contractsConfig = { | ||
| "SimpleStorage": { | ||
| args: [100] | ||
| }, | ||
| "PluginStorage": { | ||
| args: ["$SimpleStorage"] | ||
| } | ||
| }; | ||
| EmbarkSpec.deployAll(contractsConfig, () => { | ||
| done(); | ||
| }); | ||
| }); | ||
|
|
||
| it("set SimpleStorage address", async function () { | ||
| let result = await PluginStorage.methods.simpleStorageAddress().call(); | ||
| assert.equal(result.toString(), SimpleStorage.options.address); | ||
| }); | ||
|
|
||
| }); |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we now have access to the
uploadCmdobject, we should probably refactor the below lines to useuploadCmd.cb()instead ofcmdPlugin.uploadCmds[0].cb():https://github.com/embark-framework/embark/blob/7ebaa7aacadc0f4fd4602c5124c84a9a4de36986/lib/index.js#L342