Class: RamlRubyClient::Generator
- Inherits:
-
Object
- Object
- RamlRubyClient::Generator
- Defined in:
- lib/raml_ruby_client/generator.rb,
lib/raml_ruby_client/generator/version.rb,
lib/raml_ruby_client/generator/template.rb
Defined Under Namespace
Modules: TemplateHelper Classes: Context, Template
Constant Summary collapse
- TEMP_DIR =
File.("../../../samples", __FILE__)
- LIBRARY_FILES =
%w{http.rb client.rb configuration.rb}
- VERSION =
"0.0.1"
- TEMPLATE_DIR =
File.("../templates", __FILE__)
Instance Method Summary collapse
Instance Method Details
#generate(raml_file, output) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/raml_ruby_client/generator.rb', line 15 def generate(raml_file, output) parser = Parser.new(raml_file) writer = Writer.new(output) writer.write_root_file('Gemfile', Template.load('Gemfile').render({})) writer.write_lib_file("#{parser.library_path}.rb", Template.load('class.rb').render(parser: parser)) LIBRARY_FILES.each do |template_name| writer.write_lib_file( File.join(parser.library_path, template_name), Template.load(template_name).render(parser: parser) ) end writer.flush end |