soybean 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/soybean +12 -4
- data/lib/soybean.rb +7 -4
- data/lib/soybean/complex_type.rb +46 -0
- data/lib/soybean/encoded_mapping_registry_creator.rb +32 -0
- data/lib/soybean/generators/base_generator.rb +11 -0
- data/lib/soybean/generators/class_generator.rb +100 -0
- data/lib/soybean/generators/interface_generator.rb +31 -0
- data/lib/soybean/generators/mapping_generator.rb +105 -0
- data/lib/soybean/generators/model_generator.rb +23 -0
- data/lib/soybean/generators/service_generator.rb +48 -0
- data/lib/soybean/generators/types_generator.rb +202 -0
- data/lib/soybean/literal_mapping_registry_creator.rb +32 -0
- data/soybean.gemspec +18 -4
- data/spec/services/interfaces/get_registrars_interface.rb +16 -0
- data/spec/services/mappings/base.rb +2328 -0
- data/spec/services/mappings/get_registrars.rb +62 -0
- data/spec/services/models/get_registrars_service.rb +2 -0
- data/spec/services/types/get_registrars.rb +19 -0
- data/spec/services/types/type.rb +947 -0
- data/vendor/soap4r/soap/rpc/element.rb +2 -2
- data/vendor/soap4r/wsdl/soap/wsdl2ruby.rb +178 -178
- data/vendor/soap4r/xsd/codegen/classdef.rb +2 -2
- metadata +35 -21
- data/bin/xsd2ruby +0 -90
- data/lib/soybean/actions/generate_classes.rb +0 -33
data/bin/xsd2ruby
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$:.unshift File.absolute_path('.')
|
3
|
-
require 'getoptlong'
|
4
|
-
require 'logger'
|
5
|
-
require 'vendor/wsdl/xmlSchema/xsd2ruby'
|
6
|
-
|
7
|
-
class XSD2RubyApp < Logger::Application
|
8
|
-
private
|
9
|
-
|
10
|
-
OptSet = [
|
11
|
-
['--xsd', '-x', GetoptLong::REQUIRED_ARGUMENT],
|
12
|
-
['--module_path', '-m', GetoptLong::REQUIRED_ARGUMENT],
|
13
|
-
['--classdef', '-e', GetoptLong::OPTIONAL_ARGUMENT],
|
14
|
-
['--mapping_registry', '-r', GetoptLong::NO_ARGUMENT],
|
15
|
-
['--mapper', '-p', GetoptLong::NO_ARGUMENT],
|
16
|
-
['--force', '-f', GetoptLong::NO_ARGUMENT],
|
17
|
-
['--quiet', '-q', GetoptLong::NO_ARGUMENT],
|
18
|
-
]
|
19
|
-
|
20
|
-
def initialize
|
21
|
-
super('app')
|
22
|
-
STDERR.sync = true
|
23
|
-
WSDL::SOAP::ClassNameCreator
|
24
|
-
self.level = Logger::FATAL
|
25
|
-
end
|
26
|
-
|
27
|
-
def run
|
28
|
-
@worker = WSDL::XMLSchema::XSD2Ruby.new
|
29
|
-
@worker.logger = @log
|
30
|
-
location, opt = parse_opt(GetoptLong.new(*OptSet))
|
31
|
-
usage_exit unless location
|
32
|
-
@worker.location = location
|
33
|
-
if opt['quiet']
|
34
|
-
self.level = Logger::FATAL
|
35
|
-
else
|
36
|
-
self.level = Logger::INFO
|
37
|
-
end
|
38
|
-
@worker.opt.update(opt)
|
39
|
-
@worker.run
|
40
|
-
0
|
41
|
-
end
|
42
|
-
|
43
|
-
def usage_exit
|
44
|
-
puts <<__EOU__
|
45
|
-
Usage: #{ $0 } --xsd xsd_location [options]
|
46
|
-
xsd_location: filename or URL
|
47
|
-
|
48
|
-
Example:
|
49
|
-
#{ $0 } --xsd myapp.xsd --classdef foo
|
50
|
-
|
51
|
-
Options:
|
52
|
-
--xsd xsd_location
|
53
|
-
--classdef [filenameprefix]
|
54
|
-
--mapping_registry
|
55
|
-
--mapper
|
56
|
-
--module_path [Module::Path::Name]
|
57
|
-
--force
|
58
|
-
--quiet
|
59
|
-
__EOU__
|
60
|
-
exit 1
|
61
|
-
end
|
62
|
-
|
63
|
-
def parse_opt(getoptlong)
|
64
|
-
opt = {}
|
65
|
-
xsd = nil
|
66
|
-
begin
|
67
|
-
getoptlong.each do |name, arg|
|
68
|
-
case name
|
69
|
-
when "--xsd"
|
70
|
-
xsd = arg
|
71
|
-
when "--module_path"
|
72
|
-
opt['module_path'] = arg
|
73
|
-
when "--classdef", "--mapping_registry", "--mapper"
|
74
|
-
opt[name.sub(/^--/, '')] = arg.empty? ? nil : arg
|
75
|
-
when "--force"
|
76
|
-
opt['force'] = true
|
77
|
-
when "--quiet"
|
78
|
-
opt['quiet'] = true
|
79
|
-
else
|
80
|
-
raise ArgumentError.new("Unknown type #{ arg }")
|
81
|
-
end
|
82
|
-
end
|
83
|
-
rescue
|
84
|
-
usage_exit
|
85
|
-
end
|
86
|
-
return xsd, opt
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
XSD2RubyApp.new.start
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/string/inflections'
|
2
|
-
|
3
|
-
module Soybean
|
4
|
-
module Actions
|
5
|
-
|
6
|
-
class GenerateClasses < Thor::Actions::CreateFile
|
7
|
-
|
8
|
-
# @param base [Thor::Base] A Thor::Base instance
|
9
|
-
# @param location [String|Pathname] Path to xsd file
|
10
|
-
# @param destination [String|Pathname] Path to generated file with ruby classes
|
11
|
-
# @param config [Hash] config
|
12
|
-
# @option config [Boolean] :force Override destination file
|
13
|
-
# @option config [Boolean] :verbose Be verbosely
|
14
|
-
def initialize(base, location, destination, config={})
|
15
|
-
@location = location
|
16
|
-
super(base, "#{destination}.rb", class_definitions, config)
|
17
|
-
end
|
18
|
-
|
19
|
-
protected
|
20
|
-
|
21
|
-
# @return [WSDL::SOAP::ClassDefCreator] Generate ruby classes from xsd
|
22
|
-
def class_definitions
|
23
|
-
@definitions ||= WSDL::SOAP::ClassDefCreator.new(xsd, WSDL::SOAP::ClassNameCreator.new).dump
|
24
|
-
end
|
25
|
-
|
26
|
-
# @return [WSDL::XMLSchema::Importer] Parse xsd
|
27
|
-
def xsd
|
28
|
-
@xsd ||= WSDL::XMLSchema::Importer.import(@location)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|