lib/discourse_theme/uploader.rb in discourse_theme-0.4.1 vs lib/discourse_theme/uploader.rb in discourse_theme-0.5.0
- old
+ new
@@ -32,13 +32,13 @@
def diagnose_errors(json)
count = 0
json["theme"]["theme_fields"].each do |row|
if (error = row["error"]) && error.length > 0
count += 1
- Cli.error ""
- Cli.error "Error in #{row["target"]} #{row["name"]}: #{row["error"]}"
- Cli.error ""
+ UI.error ""
+ UI.error "Error in #{row["target"]} #{row["name"]}: #{row["error"]}"
+ UI.error ""
end
end
count
end
@@ -57,11 +57,11 @@
}
response = @client.update_theme(@theme_id, args)
json = JSON.parse(response.body)
if diagnose_errors(json) != 0
- Cli.error "(end of errors)"
+ UI.error "(end of errors)"
end
end
def upload_full_theme
filename = "#{Pathname.new(Dir.tmpdir).realpath}/bundle_#{SecureRandom.hex}.tar.gz"
@@ -71,10 +71,10 @@
response = @client.upload_full_theme(tgz, theme_id: @theme_id, components: @components)
json = JSON.parse(response.body)
@theme_id = json["theme"]["id"]
if diagnose_errors(json) != 0
- Cli.error "(end of errors)"
+ UI.error "(end of errors)"
end
@theme_id
end
ensure
FileUtils.rm_f filename