caramelize 1.0.0 → 1.1.0
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/README.md +5 -0
- data/bin/caramelize +17 -0
- data/caramelize.gemspec +2 -2
- data/lib/caramelize.rb +1 -0
- data/lib/caramelize/content_transferer.rb +1 -1
- data/lib/caramelize/filter_processor.rb +0 -3
- data/lib/caramelize/filters/swap_wiki_links.rb +11 -11
- data/lib/caramelize/health_check.rb +85 -0
- data/lib/caramelize/input_wiki/redmine_wiki.rb +26 -11
- data/lib/caramelize/input_wiki/wiki.rb +3 -5
- data/lib/caramelize/input_wiki/wikkawiki.rb +13 -5
- data/lib/caramelize/output_wiki/gollum.rb +4 -2
- data/lib/caramelize/page.rb +10 -5
- data/lib/caramelize/services/page_builder.rb +1 -1
- data/lib/caramelize/version.rb +1 -1
- data/spec/fixtures/markup/swap-links-output.textile +19 -19
- data/spec/lib/caramelize/filters/swap_wiki_links_spec.rb +4 -4
- data/spec/lib/caramelize/input_wiki/wiki_spec.rb +1 -1
- data/spec/lib/caramelize/output_wiki/gollum_spec.rb +2 -1
- data/spec/lib/caramelize/page_spec.rb +19 -1
- metadata +10 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 033fa149f2fd6a1823143125c966ea4ce7ea45b4106dec98762f4764db0b3c09
|
|
4
|
+
data.tar.gz: 80c47ef70453d79d01979f9fada6987d4f91cc4101aae488d4b5cba21841016e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aed7b973e815bc6680210aef38f3519e6d46d45c10efd095126cce67edcd6d64cbd46bfd31b03cc68abf0f60bd8be57bf948d687f874a78fc8e37cb9a4a812a1
|
|
7
|
+
data.tar.gz: f9e3d0d1c1ba24c73d7f13699f71fb9d1abfb0022c9b42a5ed94a241bd88a09aab93f43bb69ba622f8e03a0ba1d85b92b97c7be1a7545a50886ce06536891203
|
data/README.md
CHANGED
|
@@ -24,6 +24,11 @@ Creates a template configuration file "caramel.rb". This includes documentation
|
|
|
24
24
|
|
|
25
25
|
Will start the wiki migration based on the configuration file. These are either found in predefined paths (./caramel.rb, ./config.rb, …), or passed as argument, as below.
|
|
26
26
|
|
|
27
|
+
$ caramelize doctor
|
|
28
|
+
|
|
29
|
+
Can be used to assess the quality of your wiki conversion. It'll help you see
|
|
30
|
+
how many wiki links may be broken and how many pages were orphaned.
|
|
31
|
+
|
|
27
32
|
$ caramelize help
|
|
28
33
|
|
|
29
34
|
Returns help information.
|
data/bin/caramelize
CHANGED
|
@@ -56,3 +56,20 @@ command :run do |c|
|
|
|
56
56
|
say "Time required: #{Time.now - time_start} s"
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
|
+
|
|
60
|
+
command :doctor do |c|
|
|
61
|
+
c.syntax = 'caramelize doctor [options]'
|
|
62
|
+
c.summary = 'Run wiki transfer'
|
|
63
|
+
c.description = 'Run health-check'
|
|
64
|
+
c.option '--target STRING', String, 'The target path to Gollum git repository (default: wiki-export)'
|
|
65
|
+
c.example 'Run transfer for "caramel.rb"', 'caramelize doctor'
|
|
66
|
+
c.action do |args, options|
|
|
67
|
+
options.default(target: 'wiki-export')
|
|
68
|
+
|
|
69
|
+
if File.exists?(options.target)
|
|
70
|
+
Caramelize::HealthCheck.new(options.target).execute
|
|
71
|
+
else
|
|
72
|
+
say("No wiki repositry found in directory #{options.target}")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
data/caramelize.gemspec
CHANGED
|
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
19
|
spec.require_paths = ["lib"]
|
|
20
20
|
|
|
21
|
-
spec.add_dependency('mysql2')
|
|
22
21
|
spec.add_dependency('commander')
|
|
23
|
-
spec.add_dependency('ruby-progressbar')
|
|
24
22
|
spec.add_dependency('gollum-lib')
|
|
23
|
+
spec.add_dependency('mysql2')
|
|
24
|
+
spec.add_dependency('ruby-progressbar')
|
|
25
25
|
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.6"
|
|
27
27
|
spec.add_development_dependency "rake"
|
data/lib/caramelize.rb
CHANGED
|
@@ -3,6 +3,7 @@ require 'caramelize/page'
|
|
|
3
3
|
require 'caramelize/content_transferer'
|
|
4
4
|
require 'caramelize/filter_processor'
|
|
5
5
|
require 'caramelize/database_connector'
|
|
6
|
+
require 'caramelize/health_check'
|
|
6
7
|
require 'caramelize/output_wiki/gollum'
|
|
7
8
|
require 'caramelize/services/page_builder'
|
|
8
9
|
require 'caramelize/input_wiki/wiki'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module Caramelize
|
|
2
2
|
class SwapWikiLinks
|
|
3
|
-
|
|
4
3
|
def initialize(body)
|
|
5
4
|
@body = body
|
|
6
5
|
end
|
|
@@ -9,18 +8,19 @@ module Caramelize
|
|
|
9
8
|
def run
|
|
10
9
|
migrated_body = @body.dup
|
|
11
10
|
|
|
12
|
-
migrated_body.gsub!(/\[\[(\S+)\|(.+?)\]\]
|
|
13
|
-
migrated_body.gsub!(/\[\[([\w\s
|
|
14
|
-
if $1
|
|
15
|
-
s = $1
|
|
16
|
-
t = $1.dup
|
|
17
|
-
t.gsub!(' ', '_')
|
|
18
|
-
t.gsub!(/\./, '')
|
|
19
|
-
s = "[[#{s}|#{t}]]"
|
|
20
|
-
end
|
|
21
|
-
end
|
|
11
|
+
migrated_body.gsub!(/\[\[(\S+)\|(.+?)\]\]/) { format_link($2, $1) }
|
|
12
|
+
migrated_body.gsub!(/\[\[([\w\s\-\.]*)\]\]/) { format_link($1, $1.dup) }
|
|
22
13
|
|
|
23
14
|
migrated_body
|
|
24
15
|
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def format_link(label, link)
|
|
20
|
+
link.downcase!
|
|
21
|
+
link.gsub!(' ', '_')
|
|
22
|
+
link.gsub!(/\./, '')
|
|
23
|
+
"[[#{label}|#{link}]]"
|
|
24
|
+
end
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
module Caramelize
|
|
2
|
+
class HealthCheck
|
|
3
|
+
attr_reader :wiki_path, :options
|
|
4
|
+
|
|
5
|
+
DEFAULT_GOLLUM_HOME_TITLE = 'Home'.freeze
|
|
6
|
+
|
|
7
|
+
def initialize(wiki_path, options={})
|
|
8
|
+
@wiki_path = wiki_path
|
|
9
|
+
@options = options
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def execute
|
|
13
|
+
#puts page_paths.sort.inspect
|
|
14
|
+
|
|
15
|
+
check_pages
|
|
16
|
+
|
|
17
|
+
#puts intra_wiki_paths.sort.inspect
|
|
18
|
+
|
|
19
|
+
puts "\n # Pages not linked within Wiki:"
|
|
20
|
+
puts page_paths_without_intra_wiki_path.sort.inspect
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def files
|
|
26
|
+
@files ||= Dir.glob([wiki_path, '**/*.md'].join('/'))
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def file_names
|
|
30
|
+
files.map do |file|
|
|
31
|
+
file.gsub("#{wiki_path}/", '').split('.').first
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def check_pages
|
|
36
|
+
pages.each do |page|
|
|
37
|
+
puts "\n## #{page.path}"
|
|
38
|
+
check_page(page)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def check_page(page)
|
|
43
|
+
intra_wiki_links = intra_wiki_links(page.text_data)
|
|
44
|
+
available = 0
|
|
45
|
+
intra_wiki_links.each do |link|
|
|
46
|
+
intra_wiki_link = page.path.split('/').first == page.path ? link : [page.path.split('/').first, link].join('/')
|
|
47
|
+
if !page_paths.include?(intra_wiki_link)
|
|
48
|
+
puts "#{intra_wiki_link} expected, but missing"
|
|
49
|
+
else
|
|
50
|
+
available += 1
|
|
51
|
+
intra_wiki_paths << intra_wiki_link
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
puts "#{available}/#{intra_wiki_links.count} available"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def intra_wiki_links(body)
|
|
58
|
+
body.scan(/\[\[(.+\|)?(\S+)\]\]/).map { |match| match[1] }.uniq
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def pages
|
|
62
|
+
gollum.pages
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def page_paths
|
|
66
|
+
pages.map(&:path).map { |path| path.split('.').first }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def intra_wiki_paths
|
|
70
|
+
@intra_wiki_paths ||= []
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def page_paths_without_intra_wiki_path
|
|
74
|
+
page_paths - intra_wiki_paths
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def check_home_page
|
|
78
|
+
puts "Home.md missing" if File.exist?('wiki-export/Home.md')
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def gollum
|
|
82
|
+
@gollum ||= ::Gollum::Wiki.new(wiki_path)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -23,16 +23,13 @@ module Caramelize
|
|
|
23
23
|
build_page(row_page)
|
|
24
24
|
end
|
|
25
25
|
titles.uniq!
|
|
26
|
-
@latest_revisions.each { |rev| rev[1].set_latest }
|
|
27
26
|
revisions.sort! { |a,b| a.time <=> b.time }
|
|
28
27
|
|
|
29
|
-
# TODO find latest revision for each limit
|
|
30
|
-
|
|
31
28
|
revisions
|
|
32
29
|
end
|
|
33
30
|
|
|
34
31
|
def read_authors
|
|
35
|
-
results = database.query(
|
|
32
|
+
results = database.query(authors_query)
|
|
36
33
|
results.each do |row|
|
|
37
34
|
authors[row["id"]] = OpenStruct.new(id: row["id"],
|
|
38
35
|
name: row["login"],
|
|
@@ -44,7 +41,7 @@ module Caramelize
|
|
|
44
41
|
private
|
|
45
42
|
|
|
46
43
|
def build_page(row_page)
|
|
47
|
-
results_contents = database.query(
|
|
44
|
+
results_contents = database.query(single_page_query(row_page['id']))
|
|
48
45
|
|
|
49
46
|
wiki = wikis.select{ |row| row['id'] == row_page['wiki_id'] }.first
|
|
50
47
|
|
|
@@ -58,11 +55,9 @@ module Caramelize
|
|
|
58
55
|
title = project_identifier + row_page['title']
|
|
59
56
|
titles << title
|
|
60
57
|
|
|
61
|
-
@latest_revisions = {}
|
|
62
58
|
results_contents.each do |row_content|
|
|
63
59
|
page = Page.new(build_properties(title, row_content))
|
|
64
60
|
revisions << page
|
|
65
|
-
@latest_revisions[title] = page
|
|
66
61
|
end
|
|
67
62
|
end
|
|
68
63
|
|
|
@@ -74,20 +69,40 @@ module Caramelize
|
|
|
74
69
|
end
|
|
75
70
|
end
|
|
76
71
|
|
|
72
|
+
def authors_query
|
|
73
|
+
'SELECT id, login, mail FROM users;'
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def single_page_query(page_id)
|
|
77
|
+
"SELECT * FROM wiki_content_versions WHERE page_id='#{page_id}' ORDER BY updated_on;"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def projects_query
|
|
81
|
+
'SELECT id, identifier, name FROM projects;'
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def pages_query
|
|
85
|
+
'SELECT id, title, wiki_id FROM wiki_pages;'
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def wikis_query
|
|
89
|
+
'SELECT id, project_id FROM wikis;'
|
|
90
|
+
end
|
|
91
|
+
|
|
77
92
|
def pages
|
|
78
|
-
@pages ||= database.query(
|
|
93
|
+
@pages ||= database.query(pages_query)
|
|
79
94
|
end
|
|
80
95
|
|
|
81
96
|
def projects
|
|
82
|
-
@projects ||= database.query(
|
|
97
|
+
@projects ||= database.query(projects_query)
|
|
83
98
|
end
|
|
84
99
|
|
|
85
100
|
def wikis
|
|
86
|
-
@wikis ||= database.query(
|
|
101
|
+
@wikis ||= database.query(wikis_query)
|
|
87
102
|
end
|
|
88
103
|
|
|
89
104
|
def build_properties(title, row_content)
|
|
90
|
-
author = authors
|
|
105
|
+
author = authors.fetch(row_content["author_id"], nil)
|
|
91
106
|
{
|
|
92
107
|
id: row_content['id'],
|
|
93
108
|
title: title,
|
|
@@ -14,9 +14,8 @@ module Caramelize
|
|
|
14
14
|
def revisions_by_title(title)
|
|
15
15
|
# new array only containing pages by this name sorted by time asc
|
|
16
16
|
# this does not support renamed pages
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.sort { |x,y| x.time <=> y.time }
|
|
17
|
+
revisions.select { |revision| revision.title == title }
|
|
18
|
+
.sort { |x,y| x.time <=> y.time }
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
# return an empty array in case this action was not overridden
|
|
@@ -49,13 +48,12 @@ module Caramelize
|
|
|
49
48
|
end
|
|
50
49
|
|
|
51
50
|
def latest_revisions
|
|
52
|
-
titles.map { |title| revisions_by_title(title).last }.compact
|
|
51
|
+
@latest_revisions ||= titles.map { |title| revisions_by_title(title).last }.compact
|
|
53
52
|
end
|
|
54
53
|
|
|
55
54
|
def markup
|
|
56
55
|
@options[:markup]
|
|
57
56
|
end
|
|
58
|
-
|
|
59
57
|
end
|
|
60
58
|
end
|
|
61
59
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require 'caramelize/input_wiki/wiki'
|
|
2
1
|
require 'caramelize/database_connector'
|
|
3
2
|
require 'caramelize/filters/wikka_to_markdown'
|
|
4
3
|
|
|
@@ -7,6 +6,9 @@ module Caramelize
|
|
|
7
6
|
class WikkaWiki < Wiki
|
|
8
7
|
include DatabaseConnector
|
|
9
8
|
|
|
9
|
+
SQL_PAGES = 'SELECT id, tag, body, time, latest, user, note FROM wikka_pages ORDER BY time;'.freeze
|
|
10
|
+
SQL_AUTHORS = 'SELECT name, email FROM wikka_users;'.freeze
|
|
11
|
+
|
|
10
12
|
def initialize(options = {})
|
|
11
13
|
super(options)
|
|
12
14
|
@options[:markup] = :wikka
|
|
@@ -27,8 +29,7 @@ module Caramelize
|
|
|
27
29
|
end
|
|
28
30
|
|
|
29
31
|
def read_authors
|
|
30
|
-
|
|
31
|
-
results = database.query(sql)
|
|
32
|
+
results = database.query(authors_query)
|
|
32
33
|
results.each do |row|
|
|
33
34
|
authors[row['name']] = OpenStruct.new(name: row['name'],
|
|
34
35
|
email: row['email'] )
|
|
@@ -37,9 +38,16 @@ module Caramelize
|
|
|
37
38
|
|
|
38
39
|
private
|
|
39
40
|
|
|
41
|
+
def pages_query
|
|
42
|
+
SQL_PAGES
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def authors_query
|
|
46
|
+
SQL_AUTHORS
|
|
47
|
+
end
|
|
48
|
+
|
|
40
49
|
def pages
|
|
41
|
-
|
|
42
|
-
@pages ||= database.query(sql)
|
|
50
|
+
@pages ||= database.query(pages_query)
|
|
43
51
|
end
|
|
44
52
|
|
|
45
53
|
def build_properties(row)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'gollum-lib'
|
|
2
|
+
|
|
1
3
|
module Caramelize
|
|
2
4
|
module OutputWiki
|
|
3
5
|
class Gollum
|
|
@@ -17,12 +19,12 @@ module Caramelize
|
|
|
17
19
|
# Commit the given page into the gollum-wiki-repository.
|
|
18
20
|
# Make sure the target markup is correct before calling this method.
|
|
19
21
|
def commit_revision(page, markup)
|
|
20
|
-
gollum_page = gollum.page(page.
|
|
22
|
+
gollum_page = gollum.page(page.path)
|
|
21
23
|
|
|
22
24
|
if gollum_page
|
|
23
25
|
gollum.update_page(gollum_page, gollum_page.name, gollum_page.format, page.body, build_commit(page))
|
|
24
26
|
else
|
|
25
|
-
gollum.write_page(page.
|
|
27
|
+
gollum.write_page(page.path, markup, page.body, build_commit(page))
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
|
data/lib/caramelize/page.rb
CHANGED
|
@@ -4,14 +4,14 @@ module Caramelize
|
|
|
4
4
|
attr_accessor :title, :body, :id, :markup, :latest, :time, :message,
|
|
5
5
|
:author, :author_name
|
|
6
6
|
|
|
7
|
-
def initialize(page={})
|
|
7
|
+
def initialize(page = {})
|
|
8
8
|
@id = page[:id]
|
|
9
|
-
@title = page
|
|
10
|
-
@body = page
|
|
9
|
+
@title = page.fetch(:title, '')
|
|
10
|
+
@body = page.fetch(:body, '')
|
|
11
11
|
@syntax = page[:markup]
|
|
12
12
|
@latest = page[:latest] || false
|
|
13
|
-
@time = page
|
|
14
|
-
@message = page
|
|
13
|
+
@time = page.fetch(:time, Time.now)
|
|
14
|
+
@message = page.fetch(:message, '')
|
|
15
15
|
@author = page[:author]
|
|
16
16
|
@author_name = page[:author_name]
|
|
17
17
|
end
|
|
@@ -33,6 +33,11 @@ module Caramelize
|
|
|
33
33
|
@latest
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
def path
|
|
37
|
+
return @title unless @title.index('/')
|
|
38
|
+
@title.split('/').first + '/' + @title.split('/').last.downcase
|
|
39
|
+
end
|
|
40
|
+
|
|
36
41
|
def set_latest
|
|
37
42
|
@latest = true
|
|
38
43
|
end
|
|
@@ -7,7 +7,7 @@ module Caramelize
|
|
|
7
7
|
namespaces.each do |namespace|
|
|
8
8
|
# TODO change wiki as configurable default home
|
|
9
9
|
# TODO support other markup syntaxes
|
|
10
|
-
body << "* [[#{namespace[:name]}|#{namespace[:identifier]}/
|
|
10
|
+
body << "* [[#{namespace[:name]}|#{namespace[:identifier]}/wiki]] \n"
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
Page.new(title: "Home",
|
data/lib/caramelize/version.rb
CHANGED
|
@@ -6,13 +6,13 @@ h2. The 1994 Formula One Season
|
|
|
6
6
|
*[[Race by Race|race-by-race]]*
|
|
7
7
|
*[[Technical Regulations|technical-regulations]]*
|
|
8
8
|
*[[Technical Rule Changes|technical-rules]]*
|
|
9
|
-
*[[HD Rear Wing Configurations|
|
|
9
|
+
*[[HD Rear Wing Configurations|hd-rear-wings]]*
|
|
10
10
|
*[[Helmet variants|helmets]]*
|
|
11
11
|
|
|
12
12
|
h2. Development
|
|
13
13
|
|
|
14
|
-
*[[Review Process F1 1994|
|
|
15
|
-
*[[Credits|
|
|
14
|
+
*[[Review Process F1 1994|review_process_f1_1994]]*
|
|
15
|
+
*[[Credits|credits]]*
|
|
16
16
|
|
|
17
17
|
h2. Season data
|
|
18
18
|
|
|
@@ -22,36 +22,36 @@ Early season package
|
|
|
22
22
|
Driver list from Brazil: "Discussion here":http://forum.ctdp.net/viewtopic.php?f=214&t=62989
|
|
23
23
|
|
|
24
24
|
|_.Nr|_.Driver |_.Team|
|
|
25
|
-
|0|Damon Hill |/2.[[Williams-Renault|
|
|
25
|
+
|0|Damon Hill |/2.[[Williams-Renault|williams]]|
|
|
26
26
|
|2|Ayrton Senna |
|
|
27
|
-
|3|Ukyo Katayama |/2.[[Tyrrell-Yamaha|
|
|
27
|
+
|3|Ukyo Katayama |/2.[[Tyrrell-Yamaha|tyrrell]]|
|
|
28
28
|
|4|Mark Blundell |
|
|
29
|
-
|5|Michael Schumacher|/2.[[Benetton-Ford|
|
|
29
|
+
|5|Michael Schumacher|/2.[[Benetton-Ford|benetton]]|
|
|
30
30
|
|6|Jos Verstappen |
|
|
31
|
-
|7|Mika Häkkinen |/2.[[McLaren-Peugeot|
|
|
31
|
+
|7|Mika Häkkinen |/2.[[McLaren-Peugeot|mclaren]]|
|
|
32
32
|
|8|Martin Brundle |
|
|
33
|
-
|9|Christian Fittipaldi|/2.[[Footwork-Ford|
|
|
33
|
+
|9|Christian Fittipaldi|/2.[[Footwork-Ford|footwork]]|
|
|
34
34
|
|10|Gianni Morbidelli|
|
|
35
|
-
|11|Pedro Lamy |/2.[[Lotus-Mugen-Honda|
|
|
35
|
+
|11|Pedro Lamy |/2.[[Lotus-Mugen-Honda|lotus]]|
|
|
36
36
|
|12|Johnny Herbert |
|
|
37
|
-
|14|Rubens Barrichello|/2.[[Jordan-Hart|
|
|
37
|
+
|14|Rubens Barrichello|/2.[[Jordan-Hart|jordan]]|
|
|
38
38
|
|15|Eddie Irvine |
|
|
39
|
-
|19|Olivier Beretta |/2.[[Larrousse-Ford|
|
|
39
|
+
|19|Olivier Beretta |/2.[[Larrousse-Ford|larrousse]]|
|
|
40
40
|
|20|Érik Comas |
|
|
41
|
-
|23|Pierluigi Martini|/2.[[Minardi-Ford|
|
|
41
|
+
|23|Pierluigi Martini|/2.[[Minardi-Ford|minardi]]|
|
|
42
42
|
|24|Michele Alboreto |
|
|
43
|
-
|25|Éric Bernard |/2.[[Ligier-Renault|
|
|
43
|
+
|25|Éric Bernard |/2.[[Ligier-Renault|ligier]]|
|
|
44
44
|
|26|Olivier Panis |
|
|
45
|
-
|27|Jean Alesi |/2.[[Ferrari|
|
|
45
|
+
|27|Jean Alesi |/2.[[Ferrari|ferrari]]|
|
|
46
46
|
|28|Gerhard Berger |
|
|
47
|
-
|29|Karl Wendlinger |/2.[[Sauber-Mercedes|
|
|
47
|
+
|29|Karl Wendlinger |/2.[[Sauber-Mercedes|sauber]]|
|
|
48
48
|
|30|Heinz-Harald Frentzen|
|
|
49
|
-
|31|David Brabham |/2.[[Simtek-Ford|
|
|
49
|
+
|31|David Brabham |/2.[[Simtek-Ford|simtek]]|
|
|
50
50
|
|32|Roland Ratzenberger|
|
|
51
|
-
|33|Paul Belmondo |/2.[[Pacific-Ilmor|
|
|
51
|
+
|33|Paul Belmondo |/2.[[Pacific-Ilmor|pacific]]|
|
|
52
52
|
|34|Bertrand Gachot |
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
[[Getting new people|
|
|
55
|
+
[[Getting new people|getting_new_people]]
|
|
56
56
|
|
|
57
|
-
[[Contact form|
|
|
57
|
+
[[Contact form|contact_form]]
|
|
@@ -17,15 +17,15 @@ describe Caramelize::SwapWikiLinks do
|
|
|
17
17
|
let(:body) { '[[Release 1 0]]' }
|
|
18
18
|
|
|
19
19
|
it 'replaces space with dashes' do
|
|
20
|
-
is_expected.to eq '[[Release 1 0|
|
|
20
|
+
is_expected.to eq '[[Release 1 0|release_1_0]]'
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
context 'wiki title with dashes' do
|
|
25
|
-
let(:body) { '[[Release
|
|
25
|
+
let(:body) { '[[Release-1.0]]' }
|
|
26
26
|
|
|
27
27
|
it 'removes dots' do
|
|
28
|
-
is_expected.to eq '[[Release
|
|
28
|
+
is_expected.to eq '[[Release-1.0|release-10]]'
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ describe Caramelize::SwapWikiLinks do
|
|
|
33
33
|
let(:body) { '[[Intra wiki link]]' }
|
|
34
34
|
|
|
35
35
|
it 'simples link to hyperlink' do
|
|
36
|
-
is_expected.to eq '[[Intra wiki link|
|
|
36
|
+
is_expected.to eq '[[Intra wiki link|intra_wiki_link]]'
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
context 'replace in full file' do
|
|
@@ -17,7 +17,7 @@ describe Caramelize::InputWiki::Wiki do
|
|
|
17
17
|
|
|
18
18
|
context 'pages with revisions' do
|
|
19
19
|
it 'returns list of latest pages' do
|
|
20
|
-
wiki.titles = [
|
|
20
|
+
wiki.titles = %w[allosaurus brachiosaurus]
|
|
21
21
|
allow(wiki).to receive(:revisions_by_title)
|
|
22
22
|
.with('allosaurus').and_return([page1, page2])
|
|
23
23
|
allow(wiki).to receive(:revisions_by_title)
|
|
@@ -4,8 +4,9 @@ describe Caramelize::Page do
|
|
|
4
4
|
|
|
5
5
|
let(:message) { 'Dinosaurs really had feathers, do not forget!' }
|
|
6
6
|
let(:author) { OpenStruct.new(name: 'Jeff Goldblum', email: 'jeff.g@example.com') }
|
|
7
|
+
let(:title){ 'Feathered Dinosaurs' }
|
|
7
8
|
subject(:page) do
|
|
8
|
-
Caramelize::Page.new(
|
|
9
|
+
Caramelize::Page.new(title: title,
|
|
9
10
|
message: message,
|
|
10
11
|
time: Time.parse('2015-02-12'),
|
|
11
12
|
body: 'Dinosaurs are awesome and have feathers!',
|
|
@@ -31,6 +32,23 @@ describe Caramelize::Page do
|
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
|
|
35
|
+
describe '#path' do
|
|
36
|
+
context "title is 'Home'" do
|
|
37
|
+
let(:title) { 'Home' }
|
|
38
|
+
it { expect(page.path).to eq 'Home'}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
context "title is 'Feathered Dinosaurs'" do
|
|
42
|
+
it { expect(page.path).to eq 'Feathered Dinosaurs'}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
context "title is 'Space/Feathered Dinosaurs'" do
|
|
46
|
+
let(:title) { 'Space/Feathered Dinosaurs' }
|
|
47
|
+
it { expect(page.path).to eq 'Space/feathered dinosaurs'}
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
|
|
34
52
|
describe '#commit_message' do
|
|
35
53
|
context 'page has message' do
|
|
36
54
|
it 'uses page.title' do
|
metadata
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: caramelize
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Senff
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-12-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: commander
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
@@ -25,7 +25,7 @@ dependencies:
|
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: gollum-lib
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
@@ -39,7 +39,7 @@ dependencies:
|
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
42
|
+
name: mysql2
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - ">="
|
|
@@ -53,7 +53,7 @@ dependencies:
|
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: ruby-progressbar
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - ">="
|
|
@@ -190,6 +190,7 @@ files:
|
|
|
190
190
|
- lib/caramelize/filters/remove_table_tab_line_endings.rb
|
|
191
191
|
- lib/caramelize/filters/swap_wiki_links.rb
|
|
192
192
|
- lib/caramelize/filters/wikka_to_markdown.rb
|
|
193
|
+
- lib/caramelize/health_check.rb
|
|
193
194
|
- lib/caramelize/input_wiki/redmine_wiki.rb
|
|
194
195
|
- lib/caramelize/input_wiki/wiki.rb
|
|
195
196
|
- lib/caramelize/input_wiki/wikkawiki.rb
|
|
@@ -215,7 +216,7 @@ homepage: http://github.com/Dahie/caramelize
|
|
|
215
216
|
licenses:
|
|
216
217
|
- MIT
|
|
217
218
|
metadata: {}
|
|
218
|
-
post_install_message:
|
|
219
|
+
post_install_message:
|
|
219
220
|
rdoc_options: []
|
|
220
221
|
require_paths:
|
|
221
222
|
- lib
|
|
@@ -231,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
231
232
|
version: '0'
|
|
232
233
|
requirements: []
|
|
233
234
|
rubygems_version: 3.0.8
|
|
234
|
-
signing_key:
|
|
235
|
+
signing_key:
|
|
235
236
|
specification_version: 4
|
|
236
237
|
summary: Flexible and modular wiki conversion tool
|
|
237
238
|
test_files:
|