Software /
code /
prosody
Annotate
tools/migration/prosody-migrator.lua @ 8666:57780ba1938f
util.startup: Move original_logging_config to a local variable
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 22 Mar 2018 21:46:55 +0000 |
parent | 8062:739bb455cafd |
child | 10003:4d702f0c6273 |
rev | line source |
---|---|
4216
ff80a8471e86
tools/migration/*: Numerous changes and restructuring, and the addition of a Makefile
Matthew Wild <mwild1@gmail.com>
parents:
4211
diff
changeset
|
1 #!/usr/bin/env lua |
ff80a8471e86
tools/migration/*: Numerous changes and restructuring, and the addition of a Makefile
Matthew Wild <mwild1@gmail.com>
parents:
4211
diff
changeset
|
2 |
ff80a8471e86
tools/migration/*: Numerous changes and restructuring, and the addition of a Makefile
Matthew Wild <mwild1@gmail.com>
parents:
4211
diff
changeset
|
3 CFG_SOURCEDIR=os.getenv("PROSODY_SRCDIR"); |
ff80a8471e86
tools/migration/*: Numerous changes and restructuring, and the addition of a Makefile
Matthew Wild <mwild1@gmail.com>
parents:
4211
diff
changeset
|
4 CFG_CONFIGDIR=os.getenv("PROSODY_CFGDIR"); |
ff80a8471e86
tools/migration/*: Numerous changes and restructuring, and the addition of a Makefile
Matthew Wild <mwild1@gmail.com>
parents:
4211
diff
changeset
|
5 |
4239
69fe5fd861e7
tools/migration: Support for ~/ in paths
Matthew Wild <mwild1@gmail.com>
parents:
4235
diff
changeset
|
6 -- Substitute ~ with path to home directory in paths |
69fe5fd861e7
tools/migration: Support for ~/ in paths
Matthew Wild <mwild1@gmail.com>
parents:
4235
diff
changeset
|
7 if CFG_CONFIGDIR then |
7893 | 8 CFG_CONFIGDIR = CFG_CONFIGDIR:gsub("^~", os.getenv("HOME")); |
4239
69fe5fd861e7
tools/migration: Support for ~/ in paths
Matthew Wild <mwild1@gmail.com>
parents:
4235
diff
changeset
|
9 end |
69fe5fd861e7
tools/migration: Support for ~/ in paths
Matthew Wild <mwild1@gmail.com>
parents:
4235
diff
changeset
|
10 |
69fe5fd861e7
tools/migration: Support for ~/ in paths
Matthew Wild <mwild1@gmail.com>
parents:
4235
diff
changeset
|
11 if CFG_SOURCEDIR then |
7893 | 12 CFG_SOURCEDIR = CFG_SOURCEDIR:gsub("^~", os.getenv("HOME")); |
4239
69fe5fd861e7
tools/migration: Support for ~/ in paths
Matthew Wild <mwild1@gmail.com>
parents:
4235
diff
changeset
|
13 end |
69fe5fd861e7
tools/migration: Support for ~/ in paths
Matthew Wild <mwild1@gmail.com>
parents:
4235
diff
changeset
|
14 |
4216
ff80a8471e86
tools/migration/*: Numerous changes and restructuring, and the addition of a Makefile
Matthew Wild <mwild1@gmail.com>
parents:
4211
diff
changeset
|
15 local default_config = (CFG_CONFIGDIR or ".").."/migrator.cfg.lua"; |
4211
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
16 |
4210
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
17 -- Command-line parsing |
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
18 local options = {}; |
7894 | 19 local i = 1; |
20 while arg[i] do | |
4210
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
21 if arg[i]:sub(1,2) == "--" then |
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
22 local opt, val = arg[i]:match("([%w-]+)=?(.*)"); |
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
23 if opt then |
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
24 options[(opt:sub(3):gsub("%-", "_"))] = #val > 0 and val or true; |
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
25 end |
7894 | 26 table.remove(arg, i); |
4210
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
27 else |
7894 | 28 i = i + 1; |
4210
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
29 end |
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
30 end |
4166
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
31 |
5021
85b2689dbcfe
Eliminate direct setfenv usage
Florian Zeitz <florob@babelmonkeys.de>
parents:
4240
diff
changeset
|
32 if CFG_SOURCEDIR then |
85b2689dbcfe
Eliminate direct setfenv usage
Florian Zeitz <florob@babelmonkeys.de>
parents:
4240
diff
changeset
|
33 package.path = CFG_SOURCEDIR.."/?.lua;"..package.path; |
85b2689dbcfe
Eliminate direct setfenv usage
Florian Zeitz <florob@babelmonkeys.de>
parents:
4240
diff
changeset
|
34 package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath; |
85b2689dbcfe
Eliminate direct setfenv usage
Florian Zeitz <florob@babelmonkeys.de>
parents:
4240
diff
changeset
|
35 else |
85b2689dbcfe
Eliminate direct setfenv usage
Florian Zeitz <florob@babelmonkeys.de>
parents:
4240
diff
changeset
|
36 package.path = "../../?.lua;"..package.path |
85b2689dbcfe
Eliminate direct setfenv usage
Florian Zeitz <florob@babelmonkeys.de>
parents:
4240
diff
changeset
|
37 package.cpath = "../../?.so;"..package.cpath |
85b2689dbcfe
Eliminate direct setfenv usage
Florian Zeitz <florob@babelmonkeys.de>
parents:
4240
diff
changeset
|
38 end |
85b2689dbcfe
Eliminate direct setfenv usage
Florian Zeitz <florob@babelmonkeys.de>
parents:
4240
diff
changeset
|
39 |
85b2689dbcfe
Eliminate direct setfenv usage
Florian Zeitz <florob@babelmonkeys.de>
parents:
4240
diff
changeset
|
40 local envloadfile = require "util.envload".envloadfile; |
85b2689dbcfe
Eliminate direct setfenv usage
Florian Zeitz <florob@babelmonkeys.de>
parents:
4240
diff
changeset
|
41 |
4211
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
42 local config_file = options.config or default_config; |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
43 local from_store = arg[1] or "input"; |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
44 local to_store = arg[2] or "output"; |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
45 |
4166
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
46 config = {}; |
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
47 local config_env = setmetatable({}, { __index = function(t, k) return function(tbl) config[k] = tbl; end; end }); |
7880
1d998891c967
migrator: Remove wrapper around envloadfile since envloadfile does the right thing in a compatible way
Kim Alvefur <zash@zash.se>
parents:
5776
diff
changeset
|
48 local config_chunk, err = envloadfile(config_file, config_env); |
4211
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
49 if not config_chunk then |
7895 | 50 print("There was an error loading the config file, check that the file exists"); |
4211
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
51 print("and that the syntax is correct:"); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
52 print("", err); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
53 os.exit(1); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
54 end |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
55 |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
56 config_chunk(); |
4166
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
57 |
4211
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
58 local have_err; |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
59 if #arg > 0 and #arg ~= 2 then |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
60 have_err = true; |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
61 print("Error: Incorrect number of parameters supplied."); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
62 end |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
63 if not config[from_store] then |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
64 have_err = true; |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
65 print("Error: Input store '"..from_store.."' not found in the config file."); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
66 end |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
67 if not config[to_store] then |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
68 have_err = true; |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
69 print("Error: Output store '"..to_store.."' not found in the config file."); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
70 end |
4235
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
71 |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
72 function load_store_handler(name) |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
73 local store_type = config[name].type; |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
74 if not store_type then |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
75 print("Error: "..name.." store type not specified in the config file"); |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
76 return false; |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
77 else |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
78 local ok, err = pcall(require, "migrator."..store_type); |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
79 if not ok then |
8062
739bb455cafd
migrator: Remove broken distinction between a load error or a missing storage handler (worked with module()?)
Kim Alvefur <zash@zash.se>
parents:
7895
diff
changeset
|
80 print(("Error: Failed to initialize '%s' store:\n\t%s") |
739bb455cafd
migrator: Remove broken distinction between a load error or a missing storage handler (worked with module()?)
Kim Alvefur <zash@zash.se>
parents:
7895
diff
changeset
|
81 :format(name, err)); |
4235
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
82 return false; |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
83 end |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
84 end |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
85 return true; |
4211
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
86 end |
4235
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
87 |
899ffc1674b5
tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors they throw
Matthew Wild <mwild1@gmail.com>
parents:
4229
diff
changeset
|
88 have_err = have_err or not(load_store_handler(from_store, "input") and load_store_handler(to_store, "output")); |
4210
4583473dcce4
tools/migration/main.lua: Add command-line parsing, including --config=CONFIG_FILE, and the ability to specify to/from stores to migrate
Matthew Wild <mwild1@gmail.com>
parents:
4166
diff
changeset
|
89 |
4211
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
90 if have_err then |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
91 print(""); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
92 print("Usage: "..arg[0].." FROM_STORE TO_STORE"); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
93 print("If no stores are specified, 'input' and 'output' are used."); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
94 print(""); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
95 print("The available stores in your migrator config are:"); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
96 print(""); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
97 for store in pairs(config) do |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
98 print("", store); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
99 end |
4216
ff80a8471e86
tools/migration/*: Numerous changes and restructuring, and the addition of a Makefile
Matthew Wild <mwild1@gmail.com>
parents:
4211
diff
changeset
|
100 print(""); |
4211
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
101 os.exit(1); |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
102 end |
5776
bd0ff8ae98a8
Remove all trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents:
5021
diff
changeset
|
103 |
4211
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
104 local itype = config[from_store].type; |
9a12fc2baa37
tools/migration/*.lua: Rename config to migrator.cfg.lua, add error handling for config and command-line parameters
Matthew Wild <mwild1@gmail.com>
parents:
4210
diff
changeset
|
105 local otype = config[to_store].type; |
4216
ff80a8471e86
tools/migration/*: Numerous changes and restructuring, and the addition of a Makefile
Matthew Wild <mwild1@gmail.com>
parents:
4211
diff
changeset
|
106 local reader = require("migrator."..itype).reader(config[from_store]); |
ff80a8471e86
tools/migration/*: Numerous changes and restructuring, and the addition of a Makefile
Matthew Wild <mwild1@gmail.com>
parents:
4211
diff
changeset
|
107 local writer = require("migrator."..otype).writer(config[to_store]); |
4166
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
108 |
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
109 local json = require "util.json"; |
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
110 |
4240
b3d9063aad4d
tools/migration/prosody-migrator.lua: Add messages to show when migration is in progress
Matthew Wild <mwild1@gmail.com>
parents:
4239
diff
changeset
|
111 io.stderr:write("Migrating...\n"); |
4166
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
112 for x in reader do |
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
113 --print(json.encode(x)) |
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
114 writer(x); |
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
115 end |
3ac90743039b
tools/migration/*.lua: Convert to unix line endings
Matthew Wild <mwild1@gmail.com>
parents:
4162
diff
changeset
|
116 writer(nil); -- close |
4240
b3d9063aad4d
tools/migration/prosody-migrator.lua: Add messages to show when migration is in progress
Matthew Wild <mwild1@gmail.com>
parents:
4239
diff
changeset
|
117 io.stderr:write("Done!\n"); |