lib/rails/crud/tools/cli.rb in rails-crud-tools-0.4.0 vs lib/rails/crud/tools/cli.rb in rails-crud-tools-0.4.1
- old
+ new
@@ -109,9 +109,13 @@
sheet.change_column_width(col_index, max_length + 2)
end
# ファイルを保存
crud_file = config.crud_file_path
+ base_dir = File.dirname(crud_file)
+
+ # base_dirが存在しなければ作成
+ FileUtils.mkdir_p(base_dir) unless Dir.exist?(base_dir)
workbook.write(crud_file)
puts "Output: #{crud_file}"
end