caramelize 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.editorconfig +30 -0
- data/.github/dependabot.yml +1 -1
- data/.github/workflows/main.yml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile +6 -11
- data/Gemfile.lock +85 -90
- data/LICENSE.md +1 -1
- data/Rakefile +3 -3
- data/bin/caramelize +2 -3
- data/caramelize.gemspec +24 -20
- data/lib/caramelize/caramel.rb +23 -23
- data/lib/caramelize/content_transferer.rb +18 -18
- data/lib/caramelize/database_connector.rb +6 -6
- data/lib/caramelize/filters/camel_case_to_wiki_links.rb +2 -2
- data/lib/caramelize/filters/mediawiki_to_markdown.rb +4 -4
- data/lib/caramelize/filters/swap_wiki_links.rb +2 -2
- data/lib/caramelize/filters/wikka_to_markdown.rb +2 -2
- data/lib/caramelize/health_check.rb +1 -1
- data/lib/caramelize/health_checks/home_page_check.rb +2 -2
- data/lib/caramelize/health_checks/orphaned_pages_check.rb +1 -1
- data/lib/caramelize/health_checks/page.rb +2 -2
- data/lib/caramelize/input_wiki/media_wiki.rb +17 -17
- data/lib/caramelize/input_wiki/redmine_wiki.rb +23 -23
- data/lib/caramelize/input_wiki/wiki.rb +1 -1
- data/lib/caramelize/input_wiki/wikka_wiki.rb +15 -15
- data/lib/caramelize/output_wiki/gollum.rb +3 -3
- data/lib/caramelize/page.rb +11 -11
- data/lib/caramelize/services/page_builder.rb +4 -4
- data/lib/caramelize/version.rb +1 -1
- data/lib/caramelize.rb +16 -16
- data/samples/media_wiki.rb +4 -4
- data/spec/lib/caramelize/content_transferer_spec.rb +4 -4
- data/spec/lib/caramelize/filter_processor_spec.rb +7 -7
- data/spec/lib/caramelize/filters/add_newline_to_page_end_spec.rb +7 -7
- data/spec/lib/caramelize/filters/camel_case_to_wiki_links_spec.rb +17 -19
- data/spec/lib/caramelize/filters/mediawiki_to_markdown_spec.rb +4 -4
- data/spec/lib/caramelize/filters/remove_table_tab_line_endings_spec.rb +15 -17
- data/spec/lib/caramelize/filters/swap_wiki_links_spec.rb +23 -25
- data/spec/lib/caramelize/filters/wikka_to_markdown_spec.rb +82 -84
- data/spec/lib/caramelize/input_wiki/media_wiki_spec.rb +3 -3
- data/spec/lib/caramelize/input_wiki/wiki_spec.rb +21 -21
- data/spec/lib/caramelize/input_wiki/wikka_wiki_spec.rb +3 -3
- data/spec/lib/caramelize/output_wiki/gollum_spec.rb +39 -39
- data/spec/lib/caramelize/page_spec.rb +30 -30
- data/spec/lib/caramelize/services/page_builder_spec.rb +12 -12
- data/spec/spec_helper.rb +2 -3
- metadata +62 -9
- data/.rubocop.yml +0 -31
- data/.rubocop_todo.yml +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9e5e9161ca684e44ce2385309d05bc46083ab2fb690eee7dfd660bee88809b0
|
4
|
+
data.tar.gz: 9b50bf2e5f0317db47769e855d70a82aedd0147c8b3d87e63a6ebce9642c652b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e16b9a6cc698c2dbc03ef1012a191b9a220cad2ed4222bb4f67c5d4fc2983f939c0c4db643c845e0861198fa0eb79692e24453f015e574b536b968c8f1489f35
|
7
|
+
data.tar.gz: a7c246cdbe61b5547819945c31be6a9e3d38919c5ec979bd59d5632eb012a330f5943dd65ef55a95a493e66515a99668eaa2075d2d11f48c7570ac751cf6dbca
|
data/.editorconfig
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
root = true
|
2
|
+
|
3
|
+
[*]
|
4
|
+
end_of_line = lf
|
5
|
+
indent_size = 2
|
6
|
+
indent_style = space
|
7
|
+
insert_final_newline = true
|
8
|
+
tab_width = 4
|
9
|
+
trim_trailing_whitespace = true
|
10
|
+
|
11
|
+
[*.bat]
|
12
|
+
end_of_line = crlf
|
13
|
+
|
14
|
+
[*.gemspec]
|
15
|
+
indent_size = 2
|
16
|
+
|
17
|
+
[*.rb]
|
18
|
+
indent_size = 2
|
19
|
+
|
20
|
+
[*.yml]
|
21
|
+
indent_size = 2
|
22
|
+
|
23
|
+
[{*[Mm]akefile*,*.mak,*.mk,depend}]
|
24
|
+
indent_style = tab
|
25
|
+
|
26
|
+
[enc/*]
|
27
|
+
indent_size = 2
|
28
|
+
|
29
|
+
[reg*.[ch]]
|
30
|
+
indent_size = 2
|
data/.github/dependabot.yml
CHANGED
data/.github/workflows/main.yml
CHANGED
@@ -15,7 +15,7 @@ jobs:
|
|
15
15
|
uses: ruby/setup-ruby@v1
|
16
16
|
with:
|
17
17
|
bundler-cache: true
|
18
|
-
ruby-version: 3.1
|
18
|
+
ruby-version: 3.4.1
|
19
19
|
|
20
20
|
- name: Configure sysctl limits
|
21
21
|
run: |
|
@@ -36,13 +36,13 @@ jobs:
|
|
36
36
|
uses: ruby/setup-ruby@v1
|
37
37
|
with:
|
38
38
|
bundler-cache: true
|
39
|
-
ruby-version: 3.1
|
39
|
+
ruby-version: 3.4.1
|
40
40
|
# - name: Security audit dependencies
|
41
41
|
# uses: andrewmcodes/bundler-audit-action@main
|
42
42
|
# - name: Security audit application code
|
43
43
|
# uses: devmasx/brakeman-linter-action@v1.0.0
|
44
44
|
# env:
|
45
45
|
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
46
|
-
- name:
|
47
|
-
|
46
|
+
- name: Standard Ruby
|
47
|
+
uses: standardrb/standard-ruby-action@v1
|
48
48
|
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.4.1
|
data/Gemfile
CHANGED
@@ -1,17 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in testgem.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
12
|
-
gem
|
13
|
-
gem 'rspec'
|
14
|
-
gem 'rubocop'
|
15
|
-
gem 'rubocop-performance'
|
16
|
-
gem 'rubocop-rake'
|
17
|
-
gem 'rubocop-rspec'
|
8
|
+
gem "bundler", "~> 2.1"
|
9
|
+
gem "rake"
|
10
|
+
gem "rspec"
|
11
|
+
gem "standard"
|
12
|
+
gem "ruby-lsp"
|
data/Gemfile.lock
CHANGED
@@ -1,25 +1,30 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
caramelize (1.3.
|
4
|
+
caramelize (1.3.2)
|
5
|
+
base64
|
6
|
+
bigdecimal
|
5
7
|
commander
|
6
8
|
gollum-lib
|
7
9
|
mysql2
|
10
|
+
ostruct
|
8
11
|
paru
|
12
|
+
rdoc
|
9
13
|
ruby-progressbar
|
10
14
|
|
11
15
|
GEM
|
12
16
|
remote: https://rubygems.org/
|
13
17
|
specs:
|
14
|
-
ast (2.4.
|
15
|
-
|
16
|
-
|
18
|
+
ast (2.4.3)
|
19
|
+
base64 (0.3.0)
|
20
|
+
bigdecimal (3.2.2)
|
17
21
|
commander (5.0.0)
|
18
22
|
highline (~> 3.0.0)
|
19
23
|
crass (1.0.6)
|
20
|
-
|
21
|
-
|
22
|
-
|
24
|
+
csv (3.3.5)
|
25
|
+
date (3.4.1)
|
26
|
+
diff-lcs (1.6.2)
|
27
|
+
erb (5.0.1)
|
23
28
|
gemojione (4.3.3)
|
24
29
|
json
|
25
30
|
github-markup (4.0.2)
|
@@ -34,125 +39,115 @@ GEM
|
|
34
39
|
gollum-rugged_adapter (3.0)
|
35
40
|
mime-types (~> 3.4)
|
36
41
|
rugged (~> 1.5)
|
37
|
-
guard (2.18.1)
|
38
|
-
formatador (>= 0.2.4)
|
39
|
-
listen (>= 2.7, < 4.0)
|
40
|
-
lumberjack (>= 1.0.12, < 2.0)
|
41
|
-
nenv (~> 0.1)
|
42
|
-
notiffany (~> 0.0)
|
43
|
-
pry (>= 0.13.0)
|
44
|
-
shellany (~> 0.0)
|
45
|
-
thor (>= 0.18.1)
|
46
|
-
guard-compat (1.2.1)
|
47
|
-
guard-rspec (4.7.3)
|
48
|
-
guard (~> 2.1)
|
49
|
-
guard-compat (~> 1.1)
|
50
|
-
rspec (>= 2.99.0, < 4.0)
|
51
42
|
highline (3.0.1)
|
52
|
-
json (2.
|
53
|
-
language_server-protocol (3.17.0.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
loofah (2.22.0)
|
43
|
+
json (2.12.2)
|
44
|
+
language_server-protocol (3.17.0.5)
|
45
|
+
lint_roller (1.1.0)
|
46
|
+
logger (1.7.0)
|
47
|
+
loofah (2.24.1)
|
58
48
|
crass (~> 1.0.2)
|
59
49
|
nokogiri (>= 1.12.0)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
mini_portile2 (2.8.5)
|
50
|
+
mime-types (3.7.0)
|
51
|
+
logger
|
52
|
+
mime-types-data (~> 3.2025, >= 3.2025.0507)
|
53
|
+
mime-types-data (3.2025.0617)
|
54
|
+
mini_portile2 (2.8.9)
|
66
55
|
mysql2 (0.5.6)
|
67
|
-
|
68
|
-
nokogiri (1.16.2)
|
56
|
+
nokogiri (1.18.8)
|
69
57
|
mini_portile2 (~> 2.8.2)
|
70
58
|
racc (~> 1.4)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
parallel (1.24.0)
|
75
|
-
parser (3.3.0.5)
|
59
|
+
ostruct (0.6.2)
|
60
|
+
parallel (1.27.0)
|
61
|
+
parser (3.3.8.0)
|
76
62
|
ast (~> 2.4.1)
|
77
63
|
racc
|
78
|
-
paru (1.2
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
64
|
+
paru (1.4.2)
|
65
|
+
csv (~> 3.3)
|
66
|
+
prism (1.4.0)
|
67
|
+
psych (5.2.6)
|
68
|
+
date
|
69
|
+
stringio
|
70
|
+
racc (1.8.1)
|
83
71
|
rainbow (3.1.1)
|
84
|
-
rake (13.
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
72
|
+
rake (13.3.0)
|
73
|
+
rbs (3.9.4)
|
74
|
+
logger
|
75
|
+
rdoc (6.14.0)
|
76
|
+
erb
|
77
|
+
psych (>= 4.0.0)
|
78
|
+
regexp_parser (2.10.0)
|
90
79
|
rouge (3.30.0)
|
91
|
-
rspec (3.13.
|
80
|
+
rspec (3.13.1)
|
92
81
|
rspec-core (~> 3.13.0)
|
93
82
|
rspec-expectations (~> 3.13.0)
|
94
83
|
rspec-mocks (~> 3.13.0)
|
95
|
-
rspec-core (3.13.
|
84
|
+
rspec-core (3.13.4)
|
96
85
|
rspec-support (~> 3.13.0)
|
97
|
-
rspec-expectations (3.13.
|
86
|
+
rspec-expectations (3.13.5)
|
98
87
|
diff-lcs (>= 1.2.0, < 2.0)
|
99
88
|
rspec-support (~> 3.13.0)
|
100
|
-
rspec-mocks (3.13.
|
89
|
+
rspec-mocks (3.13.5)
|
101
90
|
diff-lcs (>= 1.2.0, < 2.0)
|
102
91
|
rspec-support (~> 3.13.0)
|
103
|
-
rspec-support (3.13.
|
104
|
-
rubocop (1.
|
92
|
+
rspec-support (3.13.4)
|
93
|
+
rubocop (1.75.8)
|
105
94
|
json (~> 2.3)
|
106
|
-
language_server-protocol (
|
95
|
+
language_server-protocol (~> 3.17.0.2)
|
96
|
+
lint_roller (~> 1.1.0)
|
107
97
|
parallel (~> 1.10)
|
108
98
|
parser (>= 3.3.0.2)
|
109
99
|
rainbow (>= 2.2.2, < 4.0)
|
110
|
-
regexp_parser (>=
|
111
|
-
|
112
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
100
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
101
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
113
102
|
ruby-progressbar (~> 1.7)
|
114
|
-
unicode-display_width (>= 2.4.0, <
|
115
|
-
rubocop-ast (1.
|
116
|
-
parser (>= 3.3.
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
rubocop (
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
rubocop (~> 1.40)
|
128
|
-
rubocop-capybara (~> 2.17)
|
129
|
-
rubocop-factory_bot (~> 2.22)
|
103
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
104
|
+
rubocop-ast (1.45.1)
|
105
|
+
parser (>= 3.3.7.2)
|
106
|
+
prism (~> 1.4)
|
107
|
+
rubocop-performance (1.25.0)
|
108
|
+
lint_roller (~> 1.1)
|
109
|
+
rubocop (>= 1.75.0, < 2.0)
|
110
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
111
|
+
ruby-lsp (0.24.1)
|
112
|
+
language_server-protocol (~> 3.17.0)
|
113
|
+
prism (>= 1.2, < 2.0)
|
114
|
+
rbs (>= 3, < 5)
|
115
|
+
sorbet-runtime (>= 0.5.10782)
|
130
116
|
ruby-progressbar (1.13.0)
|
131
|
-
rugged (1.
|
132
|
-
|
133
|
-
|
117
|
+
rugged (1.9.0)
|
118
|
+
sorbet-runtime (0.5.12189)
|
119
|
+
standard (1.50.0)
|
120
|
+
language_server-protocol (~> 3.17.0.2)
|
121
|
+
lint_roller (~> 1.0)
|
122
|
+
rubocop (~> 1.75.5)
|
123
|
+
standard-custom (~> 1.0.0)
|
124
|
+
standard-performance (~> 1.8)
|
125
|
+
standard-custom (1.0.2)
|
126
|
+
lint_roller (~> 1.0)
|
127
|
+
rubocop (~> 1.50)
|
128
|
+
standard-performance (1.8.0)
|
129
|
+
lint_roller (~> 1.1)
|
130
|
+
rubocop-performance (~> 1.25.0)
|
131
|
+
stringio (3.1.7)
|
134
132
|
twitter-text (1.14.7)
|
135
133
|
unf (~> 0.1.0)
|
136
134
|
unf (0.1.4)
|
137
135
|
unf_ext
|
138
136
|
unf_ext (0.0.9.1)
|
139
|
-
unicode-display_width (
|
137
|
+
unicode-display_width (3.1.4)
|
138
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
139
|
+
unicode-emoji (4.0.4)
|
140
140
|
|
141
141
|
PLATFORMS
|
142
142
|
ruby
|
143
143
|
|
144
144
|
DEPENDENCIES
|
145
|
-
bundler (~> 2)
|
146
|
-
byebug
|
145
|
+
bundler (~> 2.1)
|
147
146
|
caramelize!
|
148
|
-
guard
|
149
|
-
guard-rspec
|
150
147
|
rake
|
151
148
|
rspec
|
152
|
-
|
153
|
-
|
154
|
-
rubocop-rake
|
155
|
-
rubocop-rspec
|
149
|
+
ruby-lsp
|
150
|
+
standard
|
156
151
|
|
157
152
|
BUNDLED WITH
|
158
|
-
2.5.
|
153
|
+
2.5.23
|
data/LICENSE.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2015 Daniel Senff
|
1
|
+
Copyright (c) 2015-2024 Daniel Senff
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
4
|
|
data/Rakefile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "rspec/core/rake_task"
|
4
|
+
require "bundler/gem_tasks"
|
5
5
|
|
6
6
|
# Default directory to look in is `/specs`
|
7
7
|
# Run with `rake spec`
|
8
8
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
9
|
-
task.rspec_opts = [
|
9
|
+
task.rspec_opts = ["--color", "--format", "documentation"]
|
10
10
|
end
|
11
11
|
|
12
12
|
task default: :spec
|
data/bin/caramelize
CHANGED
@@ -22,10 +22,9 @@ command :new do |c|
|
|
22
22
|
c.example 'Create a fresh config file as "caramel.rb"', 'caramelize create'
|
23
23
|
c.example 'Create a fresh config file as "config.rb"', 'caramelize create --config config.rb'
|
24
24
|
c.action do |_args, options|
|
25
|
-
target_file || options.config || 'caramel.rb'
|
26
25
|
options.default({ config: 'caramel.rb' })
|
27
|
-
FileUtils.cp("#{File.dirname(__FILE__)}/../lib/caramelize
|
28
|
-
|
26
|
+
FileUtils.cp("#{File.dirname(__FILE__)}/../lib/caramelize/caramel.rb",
|
27
|
+
options.config)
|
29
28
|
say "Created new configuration file: #{options.config}"
|
30
29
|
end
|
31
30
|
end
|
data/caramelize.gemspec
CHANGED
@@ -1,29 +1,33 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
5
|
+
require "caramelize/version"
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.license =
|
11
|
-
spec.authors
|
12
|
-
spec.email
|
13
|
-
spec.homepage
|
14
|
-
spec.summary
|
15
|
-
spec.description =
|
8
|
+
spec.name = "caramelize"
|
9
|
+
spec.version = Caramelize::VERSION
|
10
|
+
spec.license = "MIT"
|
11
|
+
spec.authors = ["Daniel Senff"]
|
12
|
+
spec.email = ["mail@danielsenff.de"]
|
13
|
+
spec.homepage = "http://github.com/Dahie/caramelize"
|
14
|
+
spec.summary = "Flexible and modular wiki conversion tool"
|
15
|
+
spec.description = "With Caramelize you can migrate any wiki to git-based Gollum wiki repositories."
|
16
16
|
|
17
|
-
spec.files
|
18
|
-
spec.executables
|
19
|
-
spec.require_paths = [
|
20
|
-
spec.required_ruby_version =
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
spec.required_ruby_version = ">= 3"
|
21
21
|
|
22
|
-
spec.add_dependency(
|
23
|
-
spec.add_dependency(
|
24
|
-
spec.add_dependency(
|
25
|
-
spec.add_dependency(
|
26
|
-
spec.add_dependency(
|
22
|
+
spec.add_dependency("base64")
|
23
|
+
spec.add_dependency("bigdecimal")
|
24
|
+
spec.add_dependency("commander")
|
25
|
+
spec.add_dependency("gollum-lib")
|
26
|
+
spec.add_dependency("mysql2")
|
27
|
+
spec.add_dependency("ostruct")
|
28
|
+
spec.add_dependency("paru")
|
29
|
+
spec.add_dependency("rdoc")
|
30
|
+
spec.add_dependency("ruby-progressbar")
|
27
31
|
|
28
|
-
spec.metadata[
|
32
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
29
33
|
end
|
data/lib/caramelize/caramel.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "caramelize/input_wiki/media_wiki"
|
4
|
+
require "caramelize/input_wiki/redmine_wiki"
|
5
|
+
require "caramelize/input_wiki/wikka_wiki"
|
6
6
|
|
7
7
|
## Example caramelize configuration file
|
8
8
|
|
@@ -13,27 +13,27 @@ require 'caramelize/input_wiki/wikka_wiki'
|
|
13
13
|
def customized_wiki
|
14
14
|
# This example is a reimplementation of the WikkaWiki-Connector.
|
15
15
|
# To connect to WikkaWiki, I suggest to use the predefined Connector below.
|
16
|
-
options = {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
options = {host: "localhost",
|
17
|
+
username: "user",
|
18
|
+
database: "database_name",
|
19
|
+
password: "Picard-Delta-5",
|
20
|
+
markup: :wikka}
|
21
21
|
wiki = Caramelize::InputWiki::Wiki.new(options)
|
22
22
|
wiki.instance_eval do
|
23
23
|
def read_pages
|
24
|
-
sql =
|
24
|
+
sql = "SELECT id, tag, body, time, latest, user, note FROM wikka_pages ORDER BY time;"
|
25
25
|
results = database.query(sql)
|
26
26
|
results.each do |row|
|
27
|
-
titles << row[
|
28
|
-
author = @authors[row[
|
29
|
-
properties = {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
titles << row["tag"]
|
28
|
+
author = @authors[row["user"]]
|
29
|
+
properties = {id: row["id"],
|
30
|
+
title: row["tag"],
|
31
|
+
body: row["body"],
|
32
|
+
markup: "wikka",
|
33
|
+
latest: row["latest"] == "Y",
|
34
|
+
time: row["time"],
|
35
|
+
message: row["note"],
|
36
|
+
author:}
|
37
37
|
page = Page.new(properties)
|
38
38
|
revisions << page
|
39
39
|
end
|
@@ -66,10 +66,10 @@ def predefined_wiki
|
|
66
66
|
# For connection to a Redmine-Database use this Connector
|
67
67
|
# Additional options:
|
68
68
|
# :create_namespace_overview => true/false (Default: true) - Creates a new wikipage at /home as root page for Gollum wiki
|
69
|
-
options = {
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
options = {host: "localhost",
|
70
|
+
username: "root",
|
71
|
+
password: "root",
|
72
|
+
database: "redmine_development"}
|
73
73
|
Caramelize::InputWiki::RedmineWiki.new(options)
|
74
74
|
end
|
75
75
|
|
@@ -1,27 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "ruby-progressbar"
|
4
4
|
|
5
5
|
module Caramelize
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
6
|
+
require "caramelize/page"
|
7
|
+
require "caramelize/content_transferer"
|
8
|
+
require "caramelize/output_wiki/gollum"
|
9
|
+
require "caramelize/input_wiki/media_wiki"
|
10
|
+
require "caramelize/input_wiki/redmine_wiki"
|
11
|
+
require "caramelize/input_wiki/wikka_wiki"
|
12
12
|
|
13
13
|
class ContentTransferer
|
14
14
|
attr_reader :input_wiki, :options
|
15
15
|
|
16
|
-
DEFAULT_GOLLUM_HOME_TITLE =
|
17
|
-
DEFAULT_AUTHOR_NAME =
|
18
|
-
DEFAULT_AUTHOR_EMAIL =
|
16
|
+
DEFAULT_GOLLUM_HOME_TITLE = "Home"
|
17
|
+
DEFAULT_AUTHOR_NAME = "Caramelize"
|
18
|
+
DEFAULT_AUTHOR_EMAIL = "caramelize@example.com"
|
19
19
|
|
20
20
|
def initialize(input_wiki, options)
|
21
21
|
@input_wiki = input_wiki
|
22
22
|
@options = options
|
23
23
|
|
24
|
-
options[:default_author] = options.fetch(:default_author,
|
24
|
+
options[:default_author] = options.fetch(:default_author, "Caramelize")
|
25
25
|
options[:markup] = target_markup
|
26
26
|
end
|
27
27
|
|
@@ -78,24 +78,24 @@ module Caramelize
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def create_overview_page_of_namespaces
|
81
|
-
puts
|
81
|
+
puts "Create Namespace Overview" if verbose?
|
82
82
|
output_wiki.commit_namespace_overview(input_wiki.namespaces)
|
83
83
|
end
|
84
84
|
|
85
85
|
def migrate_markup_progress_bar
|
86
86
|
@migrate_markup_progress_bar ||=
|
87
|
-
ProgressBar.create(title:
|
88
|
-
|
87
|
+
ProgressBar.create(title: "Markup filters",
|
88
|
+
total: latest_revisions_count)
|
89
89
|
end
|
90
90
|
|
91
91
|
def commit_history_progress_bar
|
92
92
|
@commit_history_progress_bar ||=
|
93
|
-
ProgressBar.create(title:
|
94
|
-
|
93
|
+
ProgressBar.create(title: "Revisions",
|
94
|
+
total: revisions_count)
|
95
95
|
end
|
96
96
|
|
97
97
|
def migrate_markup_of_latest_revisions
|
98
|
-
puts
|
98
|
+
puts "Convert latest revisions:" if verbose?
|
99
99
|
input_wiki.latest_revisions.each do |revision|
|
100
100
|
convert_markup_of_revision(revision)
|
101
101
|
end
|
@@ -151,7 +151,7 @@ module Caramelize
|
|
151
151
|
|
152
152
|
def build_revision_metadata(revision, body_new)
|
153
153
|
revision.body = body_new
|
154
|
-
revision.author = {
|
154
|
+
revision.author = {name: DEFAULT_AUTHOR_NAME, email: DEFAULT_AUTHOR_EMAIL}
|
155
155
|
revision.time = Time.zone.now
|
156
156
|
|
157
157
|
revision
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "mysql2"
|
4
4
|
|
5
5
|
module Caramelize
|
6
6
|
module DatabaseConnector
|
7
7
|
def database
|
8
|
-
@options[:socket] = [
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
@options[:socket] = ["/tmp/mysqld.sock",
|
9
|
+
"/tmp/mysql.sock",
|
10
|
+
"/var/run/mysqld/mysqld.sock",
|
11
|
+
"/opt/local/var/run/mysql5/mysqld.sock",
|
12
|
+
"/var/lib/mysql/mysql.sock"].detect { |socket| File.exist?(socket) }
|
13
13
|
@client ||= Mysql2::Client.new(@options)
|
14
14
|
@client
|
15
15
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "paru/pandoc"
|
4
4
|
|
5
5
|
module Caramelize
|
6
6
|
class MediawikiToMarkdown
|
@@ -12,9 +12,9 @@ module Caramelize
|
|
12
12
|
|
13
13
|
def run
|
14
14
|
Paru::Pandoc.new do
|
15
|
-
from
|
16
|
-
to
|
17
|
-
markdown_headings
|
15
|
+
from "mediawiki"
|
16
|
+
to "markdown"
|
17
|
+
markdown_headings "atx"
|
18
18
|
end << source_body.dup
|
19
19
|
end
|
20
20
|
end
|