ether-fly 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +23 -0
- data/bin/ether-fly +116 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 265d020e75eee2fd6b4cf9f5a46cd6da896d1f31
|
4
|
+
data.tar.gz: 4bfdfa91dfd05eb816dea169f0d3bba2f8d28ecd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bcf213765e38178af13a7fd015e8da963cee22a3299a289016b88b46ff011a6a88022cfa43e1237d7673179eb93affd4ff3c018fe85c945f4c7c94f453405673
|
7
|
+
data.tar.gz: 35bc1001e740579782fe76be69f127d64ee083e48b89f8d645e21d6053585b58c8e8565586e138b7231a91705b68b5d9c74e5946c82f11ec3262c3cc7d48dec9
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 YaNing Zhang
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
## Install
|
2
|
+
```shell
|
3
|
+
bundle install ether-fly
|
4
|
+
```
|
5
|
+
## How to use
|
6
|
+
|
7
|
+
Help command:
|
8
|
+
```
|
9
|
+
$ ether-fly
|
10
|
+
```
|
11
|
+
Create a new Smart Contract application
|
12
|
+
```
|
13
|
+
$ ether-fly n project
|
14
|
+
$ cd project
|
15
|
+
```
|
16
|
+
Generate new Smart Contract and test file
|
17
|
+
```
|
18
|
+
$ ether-fly g game
|
19
|
+
```
|
20
|
+
Run tests
|
21
|
+
```
|
22
|
+
$ ether-fly t game
|
23
|
+
```
|
data/bin/ether-fly
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'erb'
|
4
|
+
|
5
|
+
ARGV << "--help" if ARGV.empty?
|
6
|
+
|
7
|
+
aliases = {
|
8
|
+
"g" => "generate",
|
9
|
+
"t" => "test",
|
10
|
+
"n" => "new"
|
11
|
+
}
|
12
|
+
|
13
|
+
command = ARGV.shift
|
14
|
+
command = aliases[command] || command
|
15
|
+
|
16
|
+
HELP_MESSAGE = <<-EOF
|
17
|
+
Usage: eth-fly COMMAND [ARGS]
|
18
|
+
The most common eth-fly commands are:
|
19
|
+
generate Generate new Smart Contract and test file (short-cut alias: "g")
|
20
|
+
test Run tests (short-cut alias: "t")
|
21
|
+
new Create a new Smart Contract application. "eth-fly new my_app" creates a
|
22
|
+
new application called MyApp in "./my_app"
|
23
|
+
All commands can be run with -h (or --help) for more information.
|
24
|
+
EOF
|
25
|
+
|
26
|
+
COMMAND_WHITELIST = %w(generate new help test)
|
27
|
+
|
28
|
+
CONTRACT_TEMPLATE = ERB.new <<-EOF
|
29
|
+
contract <%= name.capitalize %> {
|
30
|
+
}
|
31
|
+
EOF
|
32
|
+
|
33
|
+
TEST_TEMPLATE = ERB.new <<-EOF
|
34
|
+
require 'minitest/autorun'
|
35
|
+
require 'ethereum'
|
36
|
+
require 'json'
|
37
|
+
|
38
|
+
class <%=name.capitalize%>Test < Minitest::Test
|
39
|
+
include Ethereum
|
40
|
+
|
41
|
+
def setup
|
42
|
+
@state = Tester::State.new
|
43
|
+
@solidity_code = File.read('./contracts/<%= name.capitalize %>.sol')
|
44
|
+
@c = @state.abi_contract @solidity_code, language: :solidity
|
45
|
+
end
|
46
|
+
end
|
47
|
+
EOF
|
48
|
+
|
49
|
+
GEMFILE_TEMPLATE = ERB.new <<-EOF
|
50
|
+
gem 'ether-fly', '>= 0.0.1'
|
51
|
+
EOF
|
52
|
+
|
53
|
+
def run_command!(command)
|
54
|
+
command = parse_command(command)
|
55
|
+
|
56
|
+
if COMMAND_WHITELIST.include?(command)
|
57
|
+
send(command)
|
58
|
+
else
|
59
|
+
help
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def new
|
64
|
+
name = ARGV.shift
|
65
|
+
if name
|
66
|
+
puts "Creating project #{name}..."
|
67
|
+
system("mkdir #{name}")
|
68
|
+
gemfile = GEMFILE_TEMPLATE.result(binding)
|
69
|
+
File.open("#{name}/Gemfile", "w+") {|f| f.write(gemfile) }
|
70
|
+
system("cd #{name} && mkdir contracts && mkdir tests && bundle install")
|
71
|
+
puts "You are flying..."
|
72
|
+
else
|
73
|
+
puts "Need project name"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def generate
|
78
|
+
name = ARGV.shift
|
79
|
+
if name
|
80
|
+
contract = CONTRACT_TEMPLATE.result(binding)
|
81
|
+
puts "Create #{name.capitalize}.sol contract file..."
|
82
|
+
File.open("contracts/#{name.capitalize}.sol", "w+") {|f| f.write(contract) }
|
83
|
+
test = TEST_TEMPLATE.result(binding)
|
84
|
+
puts "Create #{name}_test.rb test file..."
|
85
|
+
File.open("tests/#{name.capitalize}_test.rb", "w+") {|f| f.write(test) }
|
86
|
+
puts "You are flying..."
|
87
|
+
else
|
88
|
+
puts "Need contract name!"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def test
|
93
|
+
name = ARGV.shift
|
94
|
+
puts "Test #{name.capitalize} contract..."
|
95
|
+
system("bundle exec ruby -Ilib:test tests/#{name}_test.rb")
|
96
|
+
puts "You are flying..."
|
97
|
+
end
|
98
|
+
|
99
|
+
def help
|
100
|
+
write_help_message
|
101
|
+
end
|
102
|
+
|
103
|
+
def write_help_message
|
104
|
+
puts HELP_MESSAGE
|
105
|
+
end
|
106
|
+
|
107
|
+
def parse_command(command)
|
108
|
+
case command
|
109
|
+
when "--help", "-h"
|
110
|
+
"help"
|
111
|
+
else
|
112
|
+
command
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
run_command!(command)
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ether-fly
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Zhang YaNing
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ruby-ethereum
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.8'
|
41
|
+
description: EtherFly is a Ethereum smart contract test framework in ruby.I provide
|
42
|
+
test in ruby EVM and geth test two styles.
|
43
|
+
email:
|
44
|
+
- zhangyaning1985@gmail.com
|
45
|
+
executables:
|
46
|
+
- ether-fly
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- LICENSE
|
51
|
+
- README.md
|
52
|
+
- bin/ether-fly
|
53
|
+
homepage: https://github.com/u2/ether-fly
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 2.4.5
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: Ethereum smart contract test framework.
|
77
|
+
test_files: []
|
78
|
+
has_rdoc:
|