lib/repl.rb in runeblog-0.1.23 vs lib/repl.rb in runeblog-0.1.24
- old
+ new
@@ -30,11 +30,11 @@
def cmd_version(arg, testing = false)
reset_output
check_empty(arg)
output RuneBlog::VERSION
- puts RuneBlog::VERSION unless testing
+ puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red) unless testing
[false, @out]
end
def cmd_config(arg, testing = false)
check_empty(arg)
@@ -77,16 +77,29 @@
unless @blog.view.can_publish?
puts "Can't publish without entries in #{@blog.view.name}/publish" unless testing
output! "Can't publish without entries in #{@blog.view.name}/publish"
return [false, @out]
end
- ret = RubyText.spinner(label: "Publishing... ") { @blog.view.publish }
+ # Need to check dirty/clean status first
+ dirty, all, assets = @blog.view.publishable_files
+ files = dirty
+ if dirty.empty?
+ puts fx("\n No files are out of date." + " "*20, :bold)
+ print " Publish anyway? "
+ yn = RubyText.gets.chomp
+ files = all if yn == "y"
+ end
+ return if files.empty?
+
+ ret = RubyText.spinner(label: " Publishing... ") do
+ @blog.view.publisher.publish(files, assets) # FIXME weird?
+ end
return [false, @out] unless ret
vdir = @blog.view.dir
dump("fix this later", "#{vdir}/last_published")
if ! testing || ! ret
- puts " ...finished.\n "
+ puts " ...finished.\n "
output! "...finished.\n"
end
return [false, @out]
end
@@ -121,9 +134,10 @@
return [false, @out]
else
if @blog.view?(arg)
@blog.view = arg # reads config
output red("View: ") + bold(@blog.view.name.to_s) # FIXME?
+ puts "\n ", fx(arg, :bold), "\n" unless testing
end
end
return [false, @out]
end