class MediaWiktory::Generator
@private Used only by mediawiktory-gen, should not be necessary to read :)
Public Class Methods
new(url)
click to toggle source
# File lib/mediawiktory/generator.rb, line 71 def initialize(url) @api = Api.from_url(url) @url = url end
Public Instance Methods
generate(path:, namespace:)
click to toggle source
# File lib/mediawiktory/generator.rb, line 76 def generate(path:, namespace:) opts = { namespace: namespace, version: VERSION, source: @url, friendly_date: Time.now.strftime('%B %d, %Y') } FileUtils.rm_rf path FileUtils.mkdir_p path BaseAction.new(@api).render_to(File.join(path, 'actions/base.rb'), opts) Client.new.render_to(File.join(path, 'client.rb'), opts) Response.new.render_to(File.join(path, 'response.rb'), opts) @api.render_to(File.join(path, 'api.rb'), opts) @api.render_to(File.join(path, 'actions.rb'), opts.merge(template: 'actions.rb')) @api.actions.each do |a| a.render_to(File.join(path, "actions/#{a.name}.rb"), opts) end @api.non_actions.each do |a| a.render_to( File.join(path, "modules/#{a.name}.rb"), opts.merge(template: 'module_class.rb') ) end end