peto 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/peto +3 -1
- data/lib/peto/master.rb +3 -3
- metadata +7 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/bin/peto
CHANGED
@@ -4,6 +4,8 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
4
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
5
|
require "peto"
|
6
6
|
|
7
|
+
Version = IO.read(File.join(File.dirname(__FILE__), '..', "VERSION"))
|
8
|
+
|
7
9
|
require "optparse"
|
8
10
|
options = {}
|
9
11
|
OptionParser.new do |opt|
|
@@ -21,5 +23,5 @@ options[:output] = File.dirname(input) if options[:output].nil?
|
|
21
23
|
|
22
24
|
peto = Peto::Master.new
|
23
25
|
peto.load(input)
|
24
|
-
peto.generate
|
26
|
+
peto.generate(options[:output])
|
25
27
|
|
data/lib/peto/master.rb
CHANGED
@@ -6,7 +6,7 @@ module Peto
|
|
6
6
|
TEMPLATE_DIR = File::dirname(File::expand_path( __FILE__ )) + "/../templates"
|
7
7
|
class Master
|
8
8
|
def load(filename)
|
9
|
-
@
|
9
|
+
@filename = filename
|
10
10
|
@contract = YAML.load(IO.read(Pathname(filename)))
|
11
11
|
end
|
12
12
|
attr_reader :contract
|
@@ -17,9 +17,9 @@ module Peto
|
|
17
17
|
}.merge!(Generator.new(@contract).generate_procedure(TEMPLATE_DIR + "/rb_procedures.erb"))
|
18
18
|
end
|
19
19
|
|
20
|
-
def generate
|
20
|
+
def generate(output_dir=nil)
|
21
21
|
parse.each do |name, content|
|
22
|
-
filepath = File.join(@
|
22
|
+
filepath = File.join(output_dir||File::dirname(@filename), "#{name}.rb")
|
23
23
|
write(filepath, content)
|
24
24
|
end
|
25
25
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Toshiyuki Hirooka
|
@@ -25,6 +26,7 @@ dependencies:
|
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
28
30
|
segments:
|
29
31
|
- 0
|
30
32
|
version: "0"
|
@@ -73,6 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
75
|
requirements:
|
74
76
|
- - ">="
|
75
77
|
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
76
79
|
segments:
|
77
80
|
- 0
|
78
81
|
version: "0"
|
@@ -81,6 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
84
|
requirements:
|
82
85
|
- - ">="
|
83
86
|
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
84
88
|
segments:
|
85
89
|
- 0
|
86
90
|
version: "0"
|
@@ -92,5 +96,5 @@ signing_key:
|
|
92
96
|
specification_version: 3
|
93
97
|
summary: contract code generator
|
94
98
|
test_files:
|
95
|
-
- test/helper.rb
|
96
99
|
- test/test_peto.rb
|
100
|
+
- test/helper.rb
|