lib/octopress-ink/plugin.rb in octopress-ink-1.0.0.alpha.43 vs lib/octopress-ink/plugin.rb in octopress-ink-1.0.0.alpha.44
- old
+ new
@@ -10,12 +10,12 @@
attr_reader :name, :type, :assets_path, :local, :website, :description, :version,
:layouts_dir, :stylesheets_dir, :javascripts_dir, :files_dir, :includes_dir, :images_dir,
:layouts, :includes, :images, :fonts, :files, :pages, :docs
- def initialize
- DEFAULT_CONFIG.merge(configuration).each { |k,v| set_config(k,v) }
+ def initialize(options={})
+ DEFAULT_CONFIG.merge(options || configuration).each { |k,v| set_config(k,v) }
@layouts_dir = 'layouts'
@files_dir = 'files'
@pages_dir = 'pages'
@docs_dir = 'docs'
@@ -154,38 +154,50 @@
}
end
def info(options={})
if options['minimal']
- message = " #{@name}"
- message += " (theme)" if @type == 'theme'
- message += " - v#{@version}" if @version
- if @description
- message = "#{message.ljust(30)} #{@description}"
- end
- message += "\n"
+ minimal_info
else
- asset_info = assets_info(options)
- return '' if asset_info.empty?
+ detailed_info(options)
+ end
+ end
- name = "Plugin: #{@name}"
- name += " (theme)" if @type == 'theme'
- name += " - v#{@version}" if @version
- name = name
- message = name
- message += "\nSlug: #{slug}"
+ def minimal_info
+ message = " #{@name}"
+ message += " (#{slug})"
+ message += " - v#{@version}" if @version
+ if @description && !@description.empty?
+ message = "#{message.ljust(30)} - #{@description}"
+ end
+ message += "\n"
+ end
- if @description
- message += "\n#{@description}"
- end
+ def detailed_info(options)
+ asset_info = assets_info(options)
+ return '' if asset_info.empty?
- lines = ''
- 80.times { lines += '=' }
+ name = "Plugin: #{@name}"
+ name += " (theme)" if @type == 'theme'
+ name += " - v#{@version}" if @version
+ name = name
+ message = name
+ message += "\nSlug: #{slug}"
- message = "\n#{message}\n#{lines}\n"
- message += asset_info
- message += "\n"
+ if @description && !@description.empty?
+ message += "\n#{@description}"
end
+
+ if @website && !@website.empty?
+ message += "\n#{@website}"
+ end
+
+ lines = ''
+ 80.times { lines += '=' }
+
+ message = "\n#{message}\n#{lines}\n"
+ message += asset_info
+ message += "\n"
end
def pad_line(line)
line = "| #{line.ljust(76)} |"
end