Skip to content

Commit

Permalink
Better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Brice Sanchez committed Nov 4, 2016
1 parent a2f9fdb commit 1bf0080
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/middleman-refinery.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'refinery/api'
require 'middleman-refinery/version'
require 'middleman-refinery/status'
require 'middleman-refinery/commands/refinery'

module MiddlemanRefinery
Expand Down
9 changes: 2 additions & 7 deletions lib/middleman-refinery/commands/refinery.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
require 'middleman-cli'

require 'yaml'
require 'json'
require 'fileutils'
require 'logger'
require 'pry'

module Middleman
module Cli

class Refinery < Thor::Group
include Thor::Actions
include ::MiddlemanRefinery::Status

# Path where Middleman expects the local data to be stored
MIDDLEMAN_LOCAL_DATA_FOLDER = 'data'
Expand Down Expand Up @@ -69,7 +68,7 @@ def refinery
end

Middleman::Cli::Build.new.build if options[:rebuild]
logger.info 'Refinery content import: Done!'
say_status 'Refinery content import: Done!'

# available_documents = []
# response.each {|d| available_documents << d.type}
Expand Down Expand Up @@ -97,10 +96,6 @@ def refinery

private

def logger
::Middleman::Logger.singleton
end

def options
MiddlemanRefinery.options
end
Expand Down
9 changes: 9 additions & 0 deletions lib/middleman-refinery/status.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'ansi/code'

module MiddlemanRefinery
module Status
def say_status(status)
puts "#{ANSI.green{:refinery.to_s.rjust(12)}} #{status}"
end
end
end

0 comments on commit 1bf0080

Please sign in to comment.