From e16537fa9f8588d35d11b460943d2565a44758d3 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Fri, 13 Oct 2023 15:38:12 +0200 Subject: [PATCH] DEV: Add initial structure for migrations-tooling --- migrations/README.md | 0 migrations/common/.gitkeep | 0 migrations/convert | 2 ++ migrations/converters/.gitkeep | 0 migrations/docs/.gitkeep | 0 migrations/import | 17 +++++++++++++++++ migrations/importer/.gitkeep | 0 migrations/importer/steps/.gitkeep | 0 migrations/spec/.gitkeep | 0 migrations/spec/import_spec.rb | 11 +++++++++++ 10 files changed, 30 insertions(+) create mode 100644 migrations/README.md create mode 100644 migrations/common/.gitkeep create mode 100755 migrations/convert create mode 100644 migrations/converters/.gitkeep create mode 100644 migrations/docs/.gitkeep create mode 100755 migrations/import create mode 100644 migrations/importer/.gitkeep create mode 100644 migrations/importer/steps/.gitkeep create mode 100644 migrations/spec/.gitkeep create mode 100644 migrations/spec/import_spec.rb diff --git a/migrations/README.md b/migrations/README.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/migrations/common/.gitkeep b/migrations/common/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/migrations/convert b/migrations/convert new file mode 100755 index 00000000000..1991ec67b38 --- /dev/null +++ b/migrations/convert @@ -0,0 +1,2 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true diff --git a/migrations/converters/.gitkeep b/migrations/converters/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/migrations/docs/.gitkeep b/migrations/docs/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/migrations/import b/migrations/import new file mode 100755 index 00000000000..d6fa7662439 --- /dev/null +++ b/migrations/import @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +puts "Loading application..." +require_relative "../config/environment" + +module Migrations + module Import + class << self + def run + puts "Importing into Discourse #{Discourse::VERSION::STRING}" + end + end + end +end + +Migrations::Import.run diff --git a/migrations/importer/.gitkeep b/migrations/importer/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/migrations/importer/steps/.gitkeep b/migrations/importer/steps/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/migrations/spec/.gitkeep b/migrations/spec/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/migrations/spec/import_spec.rb b/migrations/spec/import_spec.rb new file mode 100644 index 00000000000..683b2d32d0c --- /dev/null +++ b/migrations/spec/import_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe "Migrations::Import" do + subject(:cli) { system "migrations/import" } + + it "works" do + expect { cli }.to output( + include("Importing into Discourse #{Discourse::VERSION::STRING}"), + ).to_stdout_from_any_process + end +end