class Object
Constants
- ATTACH_SH
- BUILD_SH
- COMMAND_WHITELIST
- CONTRACT_TEMPLATE
- GEMFILE_TEMPLATE
- GENESIS_TEMPLATE
- HELP_MESSAGE
- IMPORT_KEYS_SH
- IMPORT_SH
- INIT_SH
- KEYS_TEMPLATE
- PRIVATE_BLOCKCHAIN_SH
- RAKE_FILE
- SOLC_HELPER_TEMPLATE
- TEST_SH
- TEST_TEMPLATE
Public Instance Methods
build()
click to toggle source
# File bin/ether-fly, line 359 def build system("./bin/build.sh") end
console()
click to toggle source
# File bin/ether-fly, line 370 def console system("./bin/attach.sh") end
generate()
click to toggle source
# File bin/ether-fly, line 325 def generate name = ARGV.shift if name contract = CONTRACT_TEMPLATE.result(binding) puts "Create #{name.capitalize}.sol contract file..." File.open("contracts/#{name.capitalize}.sol", "w+") { |f| f.write(contract) } test = TEST_TEMPLATE.result(binding) puts "Create #{name}_test.rb test file..." File.open("tests/#{name.capitalize}_test.rb", "w+") { |f| f.write(test) } puts "You are flying..." else puts "Need contract name!" end end
geth_test()
click to toggle source
# File bin/ether-fly, line 374 def geth_test system("./bin/test.sh") end
help()
click to toggle source
# File bin/ether-fly, line 378 def help write_help_message end
import_keys()
click to toggle source
# File bin/ether-fly, line 355 def import_keys system("./bin/import_keys.sh") end
init()
click to toggle source
# File bin/ether-fly, line 351 def init system("./bin/init.sh") end
migrate()
click to toggle source
# File bin/ether-fly, line 367 def migrate end
new()
click to toggle source
# File bin/ether-fly, line 289 def new name = ARGV.shift if name puts "Creating project #{name}..." system("mkdir #{name} && cd #{name} && mkdir private_keys && mkdir builds && mkdir contracts && mkdir bin && mkdir tests") gemfile = GEMFILE_TEMPLATE.result(binding) File.open("#{name}/Gemfile", "w+") { |f| f.write(gemfile) } system("cd #{name} && bundle install") File.open("#{name}/genesis.json", "w+") { |f| f.write(GENESIS_TEMPLATE) } KEYS_TEMPLATE.each do |k, v| File.open("#{name}/private_keys/#{k}.key", "w+") { |f| f.write(v) } end File.open("#{name}/rakefile", "w+") { |f| f.write(RAKE_FILE) } File.open("#{name}/bin/attach.sh", "w+", 0777) { |f| f.write(ATTACH_SH) } File.open("#{name}/bin/build.sh", "w+", 0777) { |f| f.write(BUILD_SH) } File.open("#{name}/bin/import_keys.sh", "w+", 0777) { |f| f.write(IMPORT_KEYS_SH) } File.open("#{name}/bin/init.sh", "w+", 0777) { |f| f.write(INIT_SH) } File.open("#{name}/bin/private_blockchain.sh", "w+", 0777) { |f| f.write(PRIVATE_BLOCKCHAIN_SH) } File.open("#{name}/bin/test.sh", "w+", 0777) { |f| f.write(TEST_SH) } File.open("#{name}/private_keys/import.sh", "w+", 0777) { |f| f.write(IMPORT_SH) } File.open("#{name}/bin/solc_helper.rb", "w+", 0777) { |f| f.write(SOLC_HELPER_TEMPLATE) } puts "You are flying..." else puts "Need project name" end end
parse_command(command)
click to toggle source
# File bin/ether-fly, line 386 def parse_command(command) case command when "--help", "-h" "help" else command end end
run_command!(command)
click to toggle source
# File bin/ether-fly, line 395 def run_command!(command) command = parse_command(command) if COMMAND_WHITELIST.include?(command) send(command) else help end end
server()
click to toggle source
# File bin/ether-fly, line 363 def server system("./bin/private_blockchain.sh") end
test()
click to toggle source
# File bin/ether-fly, line 340 def test name = ARGV.shift if name puts "Test #{name.capitalize} contract..." system("bundle exec ruby -Ilib:test tests/#{name}_test.rb") else puts "Test all contracts..." system("bundle exec rake") end end
write_help_message()
click to toggle source
# File bin/ether-fly, line 382 def write_help_message puts HELP_MESSAGE end