mirror of
https://github.com/discourse/discourse.git
synced 2024-12-27 08:00:34 +08:00
93c96cf6fa
To match discourse_theme CLI behavior, we should skip hidden files/directories (e.g. `.git`), and two regular directories: `node_modules/` and `src/`. Without these excludes, it's very easy for a theme to hit the file count limit. e.g. when trying this with discourse-kanban-board, I got: > The number of files (20366) in the theme has exceeded the maximum allowed number of files (1024)
18 lines
412 B
Ruby
18 lines
412 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ThemeStore
|
|
class DirectoryImporter < BaseImporter
|
|
def initialize(theme_dir)
|
|
@theme_dir = theme_dir
|
|
end
|
|
|
|
def import!
|
|
FileUtils.mkdir_p(temp_folder)
|
|
Dir.glob("*", base: @theme_dir) do |entry|
|
|
next if %w[node_modules src spec].include?(entry)
|
|
FileUtils.cp_r(File.join(@theme_dir, entry), temp_folder)
|
|
end
|
|
end
|
|
end
|
|
end
|