Embark 0.4.0 (0.4.2)
New to Embark?
If you are new to Embark, see the Quick Guide or consult the wiki for a more complete documentation.
To Update to 0.4.0
npm update -g embark-framework
And install pyethereum and ethertdd.py to use the new spec functionality.
Note: 0.4.2 has been released and is compatible with geth 0.9.33
In this release
Test Driven Development
You can run specs with embark spec
, it will run any files ending *_spec.js under spec/
.
Embark includes a testing lib to fastly run & test your contracts in a EVM.
# spec/contracts/simple_storage_spec.js
EmbarkSpec = require('embark-framework').Tests;
describe("SimpleStorage", function() {
beforeAll(function() {
// equivalent to initializing SimpleStorage with param 150
SimpleStorage = EmbarkSpec.request("SimpleStorage", [150]);
});
it("should set constructor value", function() {
expect(SimpleStorage.storedData()).toEqual('150');
});
it("set storage value", function() {
SimpleStorage.set(100);
expect(SimpleStorage.get()).toEqual('100');
});
})
Embark uses Jasmine by default, but you can use any testing framework you want.
Contracts configuration
Embark now allows you to:
- configure gas costs per contract and per environment
- configure arguments to initialize a contract
- specify other contracts as arguments to contracts
e.g specify gas costs and arguments:
# config/contracts.yml
development:
SimpleStorage:
gas_limit: 500000
gas_price: 10000000000000
args:
- 100
...
e.g specify a contract as an argument to another contract. Embark will automatically use the up to date contract address.
# config/contracts.yml
development:
SimpleStorage:
args:
- 100
- $MyStorage
MyStorage:
args:
- "initial string"
MyMainContract:
args:
- $SimpleStorage
...
Update guide
See "embark demo" for differences. It's best to just start "embark new", in future versions there will be an "embark update" option. However, at the moment if you need to update an existing app without starting over, then the following should work:
in package.json for the depedencies
update to embark 0.4.0- update to embark 0.4.2
followed by npm install. You'll also need to add contracts.yml to your config folder.
Future updates
There is still a long road ahead! Upcoming updates will focus on integration with Meteor, further improving the deployment, and addressing technical debt. Please keep the feedback coming, it's appreciated! :)
Thanks
Special thanks to Ryan Casey, Viktor Tron and Christian Reitwiessne