class Middleman::Cli::Export
This class provides an “medium_export” command for the middleman CLI.
@usage bundle exec middleman medium_export
@usage bundle exec middleman medium_export
–help @usage bundle exec middleman medium_export
–mode last @usage bundle exec middleman medium_export
–mode interactive
Public Instance Methods
medium_export()
click to toggle source
# File lib/middleman-medium_export/commands/export.rb, line 37 def medium_export articles = blog.data.articles.sort_by { |a| -a.date.to_i } filtered_articles = MediumExport::ArticlesFilter. new(articles: articles, shell: shell). public_send(options.mode) content = filtered_articles.map do |article| MediumExport::Content.new(article: article, template: export_extension.template) end MediumExport::Publisher.new( api_client: export_extension.api_client, content: content, shell: shell).call end
Private Instance Methods
app()
click to toggle source
# File lib/middleman-medium_export/commands/export.rb, line 58 def app @app ||= ::Middleman::Application.new end
blog()
click to toggle source
# File lib/middleman-medium_export/commands/export.rb, line 62 def blog @blog ||= if options[:blog] app.extensions[:blog].find { | k, v | v.options[:name] == options[ :blog ] }.last else app.extensions[:blog].values.first end end
export_extension()
click to toggle source
# File lib/middleman-medium_export/commands/export.rb, line 54 def export_extension @export_extension ||= app.extensions[:medium_export] end