lib/discourse_theme/cli.rb in discourse_theme-0.3.5 vs lib/discourse_theme/cli.rb in discourse_theme-0.4.0
- old
+ new
@@ -89,11 +89,16 @@
choice = Cli.select('Which theme would you like to sync with?', themes)
theme_id = extract_theme_id(choice)
theme = theme_list.find { |t| t["id"] == theme_id }
end
- if !theme || theme["component"] == false
+ about_json = JSON.parse(File.read(File.join(dir, 'about.json'))) rescue nil
+ already_uploaded = !!theme
+ is_component = theme&.[]("component")
+ component_count = about_json&.[]("components")&.length || 0
+
+ if !already_uploaded && !is_component && component_count > 0
options = {}
options["Yes"] = :sync
options["No"] = :none
options = options.sort_by { |_, b| b == components.to_sym ? 0 : 1 }.to_h if components
choice = Cli.select('Would you like to update child theme components?', options.keys)
@@ -104,9 +109,15 @@
Cli.progress "Uploading theme from #{dir}"
settings.theme_id = theme_id = uploader.upload_full_theme
Cli.success "Theme uploaded (id:#{theme_id})"
+ Cli.info "Preview: #{client.root}/?preview_theme_id=#{theme_id}"
+ if client.is_theme_creator
+ Cli.info "Manage: #{client.root}/my/themes"
+ else
+ Cli.info "Manage: #{client.root}/admin/customize/themes/#{theme_id}"
+ end
watcher = DiscourseTheme::Watcher.new(dir: dir, uploader: uploader)
Cli.progress "Watching for changes in #{dir}..."
watcher.watch