caramelize 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +11 -0
- data/.github/workflows/main.yml +48 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +14 -14
- data/caramelize.gemspec +0 -9
- data/lib/caramelize/caramel.rb +6 -2
- data/lib/caramelize/content_transferer.rb +7 -3
- data/lib/caramelize/filters/add_newline_to_page_end.rb +22 -0
- data/lib/caramelize/health_checks/home_page_check.rb +1 -1
- data/lib/caramelize/health_checks/orphaned_pages_check.rb +1 -1
- data/lib/caramelize/input_wiki/redmine_wiki.rb +4 -2
- data/lib/caramelize/input_wiki/wiki.rb +3 -3
- data/lib/caramelize/input_wiki/wikkawiki.rb +3 -3
- data/lib/caramelize/page.rb +1 -1
- data/lib/caramelize/version.rb +1 -1
- data/spec/lib/caramelize/filter_processor_spec.rb +5 -3
- data/spec/lib/caramelize/filters/{add_newline_on_page_end_spec.rb → add_newline_to_page_end_spec.rb} +3 -1
- data/spec/lib/caramelize/filters/camel_case_to_wiki_links_spec.rb +3 -1
- data/spec/lib/caramelize/filters/remove_table_tab_line_endings_spec.rb +5 -3
- data/spec/lib/caramelize/filters/swap_wiki_links_spec.rb +3 -1
- data/spec/lib/caramelize/filters/{wikka_to_markdown_spec.rb → wikka2markdown_spec.rb} +12 -10
- data/spec/lib/caramelize/input_wiki/wiki_spec.rb +13 -13
- data/spec/lib/caramelize/output_wiki/gollum_spec.rb +9 -7
- metadata +7 -130
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1f1a5ad803a7cb1d2b0492ef8608748f1d929dc87964ca5d57b41ca97e02866
|
4
|
+
data.tar.gz: ab3996a5e628285a09651362295f4939855f22a8a1c3fbfc08e7f234a95bfd22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b6c3ddbf3c8283671a1f63e7bd235b8da9ceb39604ec738700d311526f89e174fab2bd6256e740ddebacf0fe20363a7a81963b8b642bd9c1a77dbf2ba11cbdd
|
7
|
+
data.tar.gz: '09de5bfa96bfa3156cbb1e047e9d9678997def63108afc467b5b80aace63ba0a736cca803061f2b2d3ad96b8bbd1a515871c2f5a5c481380850e7a6fb83d2295'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
3
|
+
# Please see the documentation for all configuration options:
|
4
|
+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
5
|
+
|
6
|
+
version: 2
|
7
|
+
updates:
|
8
|
+
- package-ecosystem: "bundler" # See documentation for possible values
|
9
|
+
directory: "/" # Location of package manifests
|
10
|
+
schedule:
|
11
|
+
interval: "weekly"
|
@@ -0,0 +1,48 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v3
|
12
|
+
# - name: Set up Redis
|
13
|
+
# uses: zhulik/redis-action@1.1.0
|
14
|
+
- name: Install Ruby and gems
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
bundler-cache: true
|
18
|
+
ruby-version: 3.1.3
|
19
|
+
|
20
|
+
- name: Configure sysctl limits
|
21
|
+
run: |
|
22
|
+
sudo swapoff -a
|
23
|
+
sudo sysctl -w vm.swappiness=1
|
24
|
+
sudo sysctl -w fs.file-max=262144
|
25
|
+
sudo sysctl -w vm.max_map_count=262144
|
26
|
+
- name: Setup DB, Run tests
|
27
|
+
run: |
|
28
|
+
bundle exec rspec
|
29
|
+
|
30
|
+
lint:
|
31
|
+
runs-on: ubuntu-latest
|
32
|
+
steps:
|
33
|
+
- name: Checkout code
|
34
|
+
uses: actions/checkout@v3
|
35
|
+
- name: Install Ruby and gems
|
36
|
+
uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
bundler-cache: true
|
39
|
+
ruby-version: 3.1.3
|
40
|
+
# - name: Security audit dependencies
|
41
|
+
# uses: andrewmcodes/bundler-audit-action@main
|
42
|
+
# - name: Security audit application code
|
43
|
+
# uses: devmasx/brakeman-linter-action@v1.0.0
|
44
|
+
# env:
|
45
|
+
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
46
|
+
- name: Lint Ruby files
|
47
|
+
run: bundle exec rubocop --parallel
|
48
|
+
|
data/Gemfile
CHANGED
@@ -4,3 +4,13 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in testgem.gemspec
|
6
6
|
gemspec
|
7
|
+
|
8
|
+
gem 'bundler', '~> 2'
|
9
|
+
gem 'byebug'
|
10
|
+
gem 'guard'
|
11
|
+
gem 'guard-rspec'
|
12
|
+
gem 'rake'
|
13
|
+
gem 'rspec'
|
14
|
+
gem 'rubocop'
|
15
|
+
gem 'rubocop-rake'
|
16
|
+
gem 'rubocop-rspec'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
caramelize (1.2.
|
4
|
+
caramelize (1.2.1)
|
5
5
|
commander
|
6
6
|
gollum-lib
|
7
7
|
mysql2
|
@@ -62,9 +62,9 @@ GEM
|
|
62
62
|
mime-types-data (~> 3.2015)
|
63
63
|
mime-types-data (3.2023.1205)
|
64
64
|
mini_portile2 (2.8.5)
|
65
|
-
mysql2 (0.5.
|
65
|
+
mysql2 (0.5.6)
|
66
66
|
nenv (0.3.0)
|
67
|
-
nokogiri (1.16.
|
67
|
+
nokogiri (1.16.2)
|
68
68
|
mini_portile2 (~> 2.8.2)
|
69
69
|
racc (~> 1.4)
|
70
70
|
notiffany (0.1.3)
|
@@ -86,19 +86,19 @@ GEM
|
|
86
86
|
regexp_parser (2.9.0)
|
87
87
|
rexml (3.2.6)
|
88
88
|
rouge (3.30.0)
|
89
|
-
rspec (3.
|
90
|
-
rspec-core (~> 3.
|
91
|
-
rspec-expectations (~> 3.
|
92
|
-
rspec-mocks (~> 3.
|
93
|
-
rspec-core (3.
|
94
|
-
rspec-support (~> 3.
|
95
|
-
rspec-expectations (3.
|
89
|
+
rspec (3.13.0)
|
90
|
+
rspec-core (~> 3.13.0)
|
91
|
+
rspec-expectations (~> 3.13.0)
|
92
|
+
rspec-mocks (~> 3.13.0)
|
93
|
+
rspec-core (3.13.0)
|
94
|
+
rspec-support (~> 3.13.0)
|
95
|
+
rspec-expectations (3.13.0)
|
96
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
97
|
-
rspec-support (~> 3.
|
98
|
-
rspec-mocks (3.
|
97
|
+
rspec-support (~> 3.13.0)
|
98
|
+
rspec-mocks (3.13.0)
|
99
99
|
diff-lcs (>= 1.2.0, < 2.0)
|
100
|
-
rspec-support (~> 3.
|
101
|
-
rspec-support (3.
|
100
|
+
rspec-support (~> 3.13.0)
|
101
|
+
rspec-support (3.13.0)
|
102
102
|
rubocop (1.60.2)
|
103
103
|
json (~> 2.3)
|
104
104
|
language_server-protocol (>= 3.17.0)
|
data/caramelize.gemspec
CHANGED
@@ -24,14 +24,5 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency('mysql2')
|
25
25
|
spec.add_dependency('ruby-progressbar')
|
26
26
|
|
27
|
-
spec.add_development_dependency 'bundler', '~> 2'
|
28
|
-
spec.add_development_dependency 'byebug'
|
29
|
-
spec.add_development_dependency 'guard'
|
30
|
-
spec.add_development_dependency 'guard-rspec'
|
31
|
-
spec.add_development_dependency 'rake'
|
32
|
-
spec.add_development_dependency 'rspec'
|
33
|
-
spec.add_development_dependency 'rubocop'
|
34
|
-
spec.add_development_dependency 'rubocop-rake'
|
35
|
-
spec.add_development_dependency 'rubocop-rspec'
|
36
27
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
37
28
|
end
|
data/lib/caramelize/caramel.rb
CHANGED
@@ -9,7 +9,8 @@ require 'caramelize/input_wiki/redmine_wiki'
|
|
9
9
|
# not supported by default in this software
|
10
10
|
|
11
11
|
# Note, if you want to activate this, you need to uncomment the line below.
|
12
|
-
|
12
|
+
# rubocop:todo Metrics/MethodLength
|
13
|
+
def customized_wiki # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
|
13
14
|
# This example is a reimplementation of the WikkaWiki-Connector.
|
14
15
|
# To connect to WikkaWiki, I suggest to use the predefined Connector below.
|
15
16
|
options = { host: 'localhost',
|
@@ -19,7 +20,8 @@ def customized_wiki
|
|
19
20
|
markup: :wikka }
|
20
21
|
wiki = Caramelize::InputWiki::Wiki.new(options)
|
21
22
|
wiki.instance_eval do
|
22
|
-
|
23
|
+
# rubocop:todo Metrics/MethodLength
|
24
|
+
def read_pages # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
|
23
25
|
sql = 'SELECT id, tag, body, time, latest, user, note FROM wikka_pages ORDER BY time;'
|
24
26
|
results = database.query(sql)
|
25
27
|
results.each do |row|
|
@@ -39,10 +41,12 @@ def customized_wiki
|
|
39
41
|
titles.uniq!
|
40
42
|
revisions
|
41
43
|
end
|
44
|
+
# rubocop:enable Metrics/MethodLength
|
42
45
|
end
|
43
46
|
|
44
47
|
wiki
|
45
48
|
end
|
49
|
+
# rubocop:enable Metrics/MethodLength
|
46
50
|
|
47
51
|
# if you want to use one of the preset Wiki-Connectors uncomment the connector
|
48
52
|
# and edit the database logins accordingly.
|
@@ -10,7 +10,7 @@ module Caramelize
|
|
10
10
|
require 'caramelize/input_wiki/redmine_wiki'
|
11
11
|
require 'caramelize/input_wiki/wikkawiki'
|
12
12
|
|
13
|
-
class ContentTransferer
|
13
|
+
class ContentTransferer # rubocop:todo Metrics/ClassLength
|
14
14
|
attr_reader :input_wiki, :options
|
15
15
|
|
16
16
|
DEFAULT_GOLLUM_HOME_TITLE = 'Home'
|
@@ -94,7 +94,8 @@ module Caramelize
|
|
94
94
|
total: revisions_count)
|
95
95
|
end
|
96
96
|
|
97
|
-
|
97
|
+
# rubocop:todo Metrics/MethodLength
|
98
|
+
def migrate_markup_of_latest_revisions # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
|
98
99
|
puts 'Convert latest revisions:' if verbose?
|
99
100
|
input_wiki.latest_revisions.each do |revision|
|
100
101
|
if input_wiki.excluded_pages.include?(revision.title)
|
@@ -111,8 +112,10 @@ module Caramelize
|
|
111
112
|
migrate_markup_of_revision(revision)
|
112
113
|
end
|
113
114
|
end
|
115
|
+
# rubocop:enable Metrics/MethodLength
|
114
116
|
|
115
|
-
|
117
|
+
# rubocop:todo Metrics/MethodLength
|
118
|
+
def commit_history # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
|
116
119
|
output_wiki.commit_history(revisions, options) do |page, index|
|
117
120
|
if input_wiki.excluded_pages.include?(page.title)
|
118
121
|
puts "Exclude Page: #{page.title}" if verbose?
|
@@ -126,6 +129,7 @@ module Caramelize
|
|
126
129
|
end
|
127
130
|
end
|
128
131
|
end
|
132
|
+
# rubocop:enable Metrics/MethodLength
|
129
133
|
|
130
134
|
def migrate_markup_of_revision(revision)
|
131
135
|
body_new = filter_processor.run(revision.body)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Caramelize
|
4
|
+
module Filter
|
5
|
+
class AddNewlineToPageEnd
|
6
|
+
def initialize(body)
|
7
|
+
@body = body
|
8
|
+
end
|
9
|
+
|
10
|
+
# take an input stream and convert all wikka syntax to markdown syntax
|
11
|
+
def run
|
12
|
+
return @body if @body[@body.length - 1] == "\n"
|
13
|
+
|
14
|
+
migrated_body = @body.dup
|
15
|
+
|
16
|
+
migrated_body << "\n"
|
17
|
+
|
18
|
+
migrated_body
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -42,7 +42,8 @@ module Caramelize
|
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
|
-
|
45
|
+
# rubocop:todo Metrics/MethodLength
|
46
|
+
def build_page(row_page) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
|
46
47
|
results_contents = database.query(single_page_query(row_page['id']))
|
47
48
|
|
48
49
|
wiki = wikis.select { |row| row['id'] == row_page['wiki_id'] }.first
|
@@ -62,6 +63,7 @@ module Caramelize
|
|
62
63
|
revisions << page
|
63
64
|
end
|
64
65
|
end
|
66
|
+
# rubocop:enable Metrics/MethodLength
|
65
67
|
|
66
68
|
def add_projects_as_namespaces
|
67
69
|
projects.each do |row_project|
|
@@ -103,7 +105,7 @@ module Caramelize
|
|
103
105
|
@wikis ||= database.query(wikis_query)
|
104
106
|
end
|
105
107
|
|
106
|
-
def build_properties(title, row_content)
|
108
|
+
def build_properties(title, row_content) # rubocop:todo Metrics/MethodLength
|
107
109
|
author = authors.fetch(row_content['author_id'], nil)
|
108
110
|
{
|
109
111
|
id: row_content['id'],
|
@@ -25,7 +25,7 @@ module Caramelize
|
|
25
25
|
[]
|
26
26
|
end
|
27
27
|
|
28
|
-
def namespaces
|
28
|
+
def namespaces # rubocop:todo Lint/DuplicateMethods
|
29
29
|
@namespaces ||= {}
|
30
30
|
end
|
31
31
|
|
@@ -33,11 +33,11 @@ module Caramelize
|
|
33
33
|
@authors ||= {}
|
34
34
|
end
|
35
35
|
|
36
|
-
def revisions
|
36
|
+
def revisions # rubocop:todo Lint/DuplicateMethods
|
37
37
|
@revisions ||= []
|
38
38
|
end
|
39
39
|
|
40
|
-
def titles
|
40
|
+
def titles # rubocop:todo Lint/DuplicateMethods
|
41
41
|
@titles ||= []
|
42
42
|
end
|
43
43
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'caramelize/database_connector'
|
4
|
-
require 'caramelize/filters/
|
4
|
+
require 'caramelize/filters/add_newline_to_page_end'
|
5
5
|
require 'caramelize/filters/camel_case_to_wiki_links'
|
6
6
|
require 'caramelize/filters/wikka_to_markdown'
|
7
7
|
|
@@ -12,7 +12,7 @@ module Caramelize
|
|
12
12
|
|
13
13
|
SQL_PAGES = 'SELECT id, tag, body, time, latest, user, note FROM wikka_pages ORDER BY time;'
|
14
14
|
SQL_AUTHORS = 'SELECT name, email FROM wikka_users;'
|
15
|
-
FUNCTION_PAGES = %w[AdminBadWords AdminPages AdminUsers AdminSpamLog
|
15
|
+
FUNCTION_PAGES = %w[AdminBadWords AdminPages AdminUsers AdminSpamLog CategoryAdmin CategoryCategory CategoryWiki DatabaseInfo FormattingRules HighScores InterWiki MyChanges MyPages OrphanedPages OwnedPages PageIndex PasswordForgotten RecentChanges RecentlyCommented Sandbox SysInfo TableMarkup TableMarkupReference TextSearch TextSearchExpanded UserSettings WantedPages WikiCategory WikkaInstaller WikkaConfig WikkaDocumentation WikkaMenulets WikkaReleaseNotes].freeze
|
16
16
|
|
17
17
|
def initialize(options = {})
|
18
18
|
super(options)
|
@@ -60,7 +60,7 @@ module Caramelize
|
|
60
60
|
@pages ||= database.query(pages_query)
|
61
61
|
end
|
62
62
|
|
63
|
-
def build_properties(row)
|
63
|
+
def build_properties(row) # rubocop:todo Metrics/MethodLength
|
64
64
|
author = authors[row['user']]
|
65
65
|
{
|
66
66
|
id: row['id'],
|
data/lib/caramelize/page.rb
CHANGED
data/lib/caramelize/version.rb
CHANGED
@@ -6,18 +6,20 @@ describe Caramelize::FilterProcessor do
|
|
6
6
|
subject(:processor) { described_class.new(input_wiki) }
|
7
7
|
|
8
8
|
let(:filters) { [] }
|
9
|
-
let(:input_wiki) { double(filters:) }
|
9
|
+
let(:input_wiki) { double(filters:) } # rubocop:todo RSpec/VerifiedDoubles
|
10
10
|
let(:body) { 'body' }
|
11
11
|
|
12
|
-
|
12
|
+
# rubocop:todo RSpec/LeakyConstantDeclaration
|
13
|
+
class ReverseFilter # rubocop:todo Lint/ConstantDefinitionInBlock, RSpec/LeakyConstantDeclaration
|
13
14
|
def initialize(body)
|
14
15
|
@body = body
|
15
16
|
end
|
16
17
|
|
17
18
|
def run
|
18
|
-
@body.reverse
|
19
|
+
@body.reverse # rubocop:todo RSpec/InstanceVariable
|
19
20
|
end
|
20
21
|
end
|
22
|
+
# rubocop:enable RSpec/LeakyConstantDeclaration
|
21
23
|
|
22
24
|
describe '#run' do
|
23
25
|
context 'without any filters' do
|
data/spec/lib/caramelize/filters/{add_newline_on_page_end_spec.rb → add_newline_to_page_end_spec.rb}
RENAMED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
5
|
+
# rubocop:todo RSpec/SpecFilePathFormat
|
6
|
+
describe Caramelize::Filter::AddNewlineToPageEnd do # rubocop:todo RSpec/FilePath, RSpec/SpecFilePathFormat
|
7
|
+
# rubocop:enable RSpec/SpecFilePathFormat
|
6
8
|
describe '#run' do
|
7
9
|
subject(:run) { filter.run }
|
8
10
|
|
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
5
|
+
# rubocop:todo RSpec/SpecFilePathFormat
|
6
|
+
describe Caramelize::CamelCaseToWikiLinks do # rubocop:todo RSpec/FilePath, RSpec/SpecFilePathFormat
|
7
|
+
# rubocop:enable RSpec/SpecFilePathFormat
|
6
8
|
describe '#run' do
|
7
9
|
subject(:run) { filter.run }
|
8
10
|
|
@@ -2,13 +2,15 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
5
|
+
# rubocop:todo RSpec/SpecFilePathFormat
|
6
|
+
describe Caramelize::RemoveTableTabLineEndings do # rubocop:todo RSpec/FilePath, RSpec/SpecFilePathFormat
|
7
|
+
# rubocop:enable RSpec/SpecFilePathFormat
|
6
8
|
subject(:run) { filter.run }
|
7
9
|
|
8
10
|
let(:filter) { described_class.new(body) }
|
9
11
|
|
10
12
|
describe '#run' do
|
11
|
-
context 'table with tabs at unix line-endings' do
|
13
|
+
context 'table with tabs at unix line-endings' do # rubocop:todo RSpec/ContextWording
|
12
14
|
let(:body) { "cell1\t|cell2\t|\t\t\n" }
|
13
15
|
|
14
16
|
it 'removes tabs at end of line' do
|
@@ -23,7 +25,7 @@ describe Caramelize::RemoveTableTabLineEndings do
|
|
23
25
|
expect(run).to eq "cell1\t|cell2\t|\n"
|
24
26
|
end
|
25
27
|
|
26
|
-
context 'replace in full file' do
|
28
|
+
context 'replace in full file' do # rubocop:todo RSpec/ContextWording
|
27
29
|
let(:body) do
|
28
30
|
File.read(File.join(['spec', 'fixtures', 'markup', 'table-tab-line-endings-input.textile']))
|
29
31
|
end
|
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
5
|
+
# rubocop:todo RSpec/SpecFilePathFormat
|
6
|
+
describe Caramelize::SwapWikiLinks do # rubocop:todo RSpec/FilePath, RSpec/SpecFilePathFormat
|
7
|
+
# rubocop:enable RSpec/SpecFilePathFormat
|
6
8
|
describe '#run' do
|
7
9
|
subject(:run) { filter.run }
|
8
10
|
|
@@ -2,13 +2,15 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
5
|
+
# rubocop:todo RSpec/SpecFilePathFormat
|
6
|
+
describe Caramelize::Wikka2Markdown do # rubocop:todo RSpec/FilePath, RSpec/SpecFilePathFormat
|
7
|
+
# rubocop:enable RSpec/SpecFilePathFormat
|
6
8
|
let(:filter) { described_class.new(body) }
|
7
9
|
|
8
10
|
describe '#run' do
|
9
11
|
subject { filter.run }
|
10
12
|
|
11
|
-
xcontext 'when keep line breaks' do
|
13
|
+
xcontext 'when keep line breaks' do # rubocop:todo RSpec/PendingWithoutReason
|
12
14
|
let(:body) { "line1\nline2" }
|
13
15
|
|
14
16
|
it { is_expected.to eq "line1 \nline2" }
|
@@ -180,7 +182,7 @@ describe Caramelize::Wikka2Markdown do
|
|
180
182
|
|
181
183
|
context 'when code block' do
|
182
184
|
let(:body) do
|
183
|
-
<<~
|
185
|
+
<<~CPP
|
184
186
|
Text before
|
185
187
|
|
186
188
|
%%
|
@@ -195,10 +197,10 @@ describe Caramelize::Wikka2Markdown do
|
|
195
197
|
++stat[input];
|
196
198
|
%%
|
197
199
|
|
198
|
-
|
200
|
+
CPP
|
199
201
|
end
|
200
202
|
let(:expected_result) do
|
201
|
-
<<~
|
203
|
+
<<~CPP
|
202
204
|
Text before
|
203
205
|
|
204
206
|
```
|
@@ -213,7 +215,7 @@ describe Caramelize::Wikka2Markdown do
|
|
213
215
|
++stat[input];
|
214
216
|
```
|
215
217
|
|
216
|
-
|
218
|
+
CPP
|
217
219
|
end
|
218
220
|
|
219
221
|
it { is_expected.to eq expected_result }
|
@@ -221,7 +223,7 @@ describe Caramelize::Wikka2Markdown do
|
|
221
223
|
|
222
224
|
context 'when code block with language' do
|
223
225
|
let(:body) do
|
224
|
-
<<~
|
226
|
+
<<~CPP
|
225
227
|
Text before
|
226
228
|
|
227
229
|
%%(php)
|
@@ -236,10 +238,10 @@ describe Caramelize::Wikka2Markdown do
|
|
236
238
|
++stat[input];
|
237
239
|
%%
|
238
240
|
|
239
|
-
|
241
|
+
CPP
|
240
242
|
end
|
241
243
|
let(:expected_result) do
|
242
|
-
<<~
|
244
|
+
<<~CPP
|
243
245
|
Text before
|
244
246
|
|
245
247
|
```php
|
@@ -254,7 +256,7 @@ describe Caramelize::Wikka2Markdown do
|
|
254
256
|
++stat[input];
|
255
257
|
```
|
256
258
|
|
257
|
-
|
259
|
+
CPP
|
258
260
|
end
|
259
261
|
|
260
262
|
it { is_expected.to eq expected_result }
|
@@ -6,9 +6,9 @@ describe Caramelize::InputWiki::Wiki do
|
|
6
6
|
subject(:wiki) { described_class.new }
|
7
7
|
|
8
8
|
describe '#latest_revisions' do
|
9
|
-
let(:page1) { double }
|
10
|
-
let(:page2) { double }
|
11
|
-
let(:page3) { double }
|
9
|
+
let(:page1) { double } # rubocop:todo RSpec/IndexedLet
|
10
|
+
let(:page2) { double } # rubocop:todo RSpec/IndexedLet
|
11
|
+
let(:page3) { double } # rubocop:todo RSpec/IndexedLet
|
12
12
|
|
13
13
|
context 'without pages' do
|
14
14
|
it 'return empty array' do
|
@@ -17,11 +17,11 @@ describe Caramelize::InputWiki::Wiki do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context 'with pages with revisions' do
|
20
|
-
it 'returns list of latest pages' do
|
20
|
+
it 'returns list of latest pages' do # rubocop:todo RSpec/ExampleLength
|
21
21
|
wiki.titles = %w[allosaurus brachiosaurus]
|
22
|
-
allow(wiki).to receive(:revisions_by_title)
|
22
|
+
allow(wiki).to receive(:revisions_by_title) # rubocop:todo RSpec/SubjectStub
|
23
23
|
.with('allosaurus').and_return([page1, page2])
|
24
|
-
allow(wiki).to receive(:revisions_by_title)
|
24
|
+
allow(wiki).to receive(:revisions_by_title) # rubocop:todo RSpec/SubjectStub
|
25
25
|
.with('brachiosaurus').and_return([page3])
|
26
26
|
|
27
27
|
expect(wiki.latest_revisions).to eq([page2, page3])
|
@@ -33,7 +33,7 @@ describe Caramelize::InputWiki::Wiki do
|
|
33
33
|
context 'with revisions is empty' do
|
34
34
|
context 'with titles is empty' do
|
35
35
|
it 'returns empty array' do
|
36
|
-
allow(wiki).to receive(:titles).and_return []
|
36
|
+
allow(wiki).to receive(:titles).and_return [] # rubocop:todo RSpec/SubjectStub
|
37
37
|
expect(wiki.revisions_by_title('title')).to eq []
|
38
38
|
end
|
39
39
|
end
|
@@ -41,15 +41,15 @@ describe Caramelize::InputWiki::Wiki do
|
|
41
41
|
|
42
42
|
context 'with revisions are given' do
|
43
43
|
context 'with title given' do
|
44
|
-
it 'returns empty array' do
|
44
|
+
it 'returns empty array' do # rubocop:todo RSpec/ExampleLength
|
45
45
|
pages = []
|
46
|
-
home1 = double(title: 'Home', time: Time.parse('2015-01-23'))
|
46
|
+
home1 = double(title: 'Home', time: Time.parse('2015-01-23')) # rubocop:todo RSpec/VerifiedDoubles
|
47
47
|
pages << home1
|
48
|
-
pages << double(title: 'Example', time: Time.parse('2015-01-20'))
|
49
|
-
pages << double(title: 'Authors', time: Time.parse('2015-01-30'))
|
50
|
-
home2 = double(title: 'Home', time: Time.parse('2014-01-23'))
|
48
|
+
pages << double(title: 'Example', time: Time.parse('2015-01-20')) # rubocop:todo RSpec/VerifiedDoubles
|
49
|
+
pages << double(title: 'Authors', time: Time.parse('2015-01-30')) # rubocop:todo RSpec/VerifiedDoubles
|
50
|
+
home2 = double(title: 'Home', time: Time.parse('2014-01-23')) # rubocop:todo RSpec/VerifiedDoubles
|
51
51
|
pages << home2
|
52
|
-
allow(wiki).to receive(:revisions).and_return pages
|
52
|
+
allow(wiki).to receive(:revisions).and_return pages # rubocop:todo RSpec/SubjectStub
|
53
53
|
expect(wiki.revisions_by_title('Home')).to eq [home2, home1]
|
54
54
|
end
|
55
55
|
end
|
@@ -10,7 +10,7 @@ describe Caramelize::OutputWiki::Gollum do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '#commit_revision' do
|
13
|
-
subject(:gollum) { double(:gollum) }
|
13
|
+
subject(:gollum) { double(:gollum) } # rubocop:todo RSpec/VerifiedDoubles
|
14
14
|
|
15
15
|
let(:title) { 'title' }
|
16
16
|
let(:author) { { name: 'Steven Universe', email: 'steven@example.com' } }
|
@@ -22,7 +22,7 @@ describe Caramelize::OutputWiki::Gollum do
|
|
22
22
|
title:,
|
23
23
|
path: title)
|
24
24
|
end
|
25
|
-
let(:gollum_page) { double(:gollum_page, name: 'title', format: :markdown) }
|
25
|
+
let(:gollum_page) { double(:gollum_page, name: 'title', format: :markdown) } # rubocop:todo RSpec/VerifiedDoubles
|
26
26
|
|
27
27
|
before do
|
28
28
|
allow(Gollum::Wiki).to receive(:new).and_return(gollum)
|
@@ -30,24 +30,26 @@ describe Caramelize::OutputWiki::Gollum do
|
|
30
30
|
|
31
31
|
context 'when page exists' do
|
32
32
|
before do
|
33
|
-
allow(gollum).to receive(:page).with(title).and_return(gollum_page)
|
33
|
+
allow(gollum).to receive(:page).with(title).and_return(gollum_page) # rubocop:todo RSpec/SubjectStub
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'updates page' do
|
37
|
-
|
37
|
+
# rubocop:todo RSpec/SubjectStub
|
38
|
+
expect(gollum).to receive(:update_page).once.and_return(true) # rubocop:todo RSpec/MessageSpies, RSpec/SubjectStub
|
39
|
+
# rubocop:enable RSpec/SubjectStub
|
38
40
|
gollum_output.commit_revision(input_page, :markdown)
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
44
|
context 'when page does not exist yet' do
|
43
45
|
before do
|
44
|
-
allow(gollum).to receive(:page).with(title).and_return(nil)
|
46
|
+
allow(gollum).to receive(:page).with(title).and_return(nil) # rubocop:todo RSpec/SubjectStub
|
45
47
|
end
|
46
48
|
|
47
49
|
it 'creates page' do
|
48
|
-
allow(gollum).to receive(:write_page)
|
50
|
+
allow(gollum).to receive(:write_page) # rubocop:todo RSpec/SubjectStub
|
49
51
|
gollum_output.commit_revision(input_page, :markdown)
|
50
|
-
expect(gollum).to have_received(:write_page).once
|
52
|
+
expect(gollum).to have_received(:write_page).once # rubocop:todo RSpec/SubjectStub
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caramelize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Senff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -66,132 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: bundler
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: byebug
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: guard
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: guard-rspec
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rake
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rspec
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: rubocop
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: rubocop-rake
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - ">="
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: rubocop-rspec
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - ">="
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
195
69
|
description: With Caramelize you can migrate any wiki to git-based Gollum wiki repositories.
|
196
70
|
email:
|
197
71
|
- mail@danielsenff.de
|
@@ -200,6 +74,8 @@ executables:
|
|
200
74
|
extensions: []
|
201
75
|
extra_rdoc_files: []
|
202
76
|
files:
|
77
|
+
- ".github/dependabot.yml"
|
78
|
+
- ".github/workflows/main.yml"
|
203
79
|
- ".gitignore"
|
204
80
|
- ".rubocop.yml"
|
205
81
|
- CODE_OF_CONDUCT.md
|
@@ -215,6 +91,7 @@ files:
|
|
215
91
|
- lib/caramelize/content_transferer.rb
|
216
92
|
- lib/caramelize/database_connector.rb
|
217
93
|
- lib/caramelize/filter_processor.rb
|
94
|
+
- lib/caramelize/filters/add_newline_to_page_end.rb
|
218
95
|
- lib/caramelize/filters/camel_case_to_wiki_links.rb
|
219
96
|
- lib/caramelize/filters/remove_table_tab_line_endings.rb
|
220
97
|
- lib/caramelize/filters/swap_wiki_links.rb
|
@@ -236,11 +113,11 @@ files:
|
|
236
113
|
- spec/fixtures/markup/table-tab-line-endings-output.textile
|
237
114
|
- spec/lib/caramelize/content_transferer_spec.rb
|
238
115
|
- spec/lib/caramelize/filter_processor_spec.rb
|
239
|
-
- spec/lib/caramelize/filters/
|
116
|
+
- spec/lib/caramelize/filters/add_newline_to_page_end_spec.rb
|
240
117
|
- spec/lib/caramelize/filters/camel_case_to_wiki_links_spec.rb
|
241
118
|
- spec/lib/caramelize/filters/remove_table_tab_line_endings_spec.rb
|
242
119
|
- spec/lib/caramelize/filters/swap_wiki_links_spec.rb
|
243
|
-
- spec/lib/caramelize/filters/
|
120
|
+
- spec/lib/caramelize/filters/wikka2markdown_spec.rb
|
244
121
|
- spec/lib/caramelize/input_wiki/wiki_spec.rb
|
245
122
|
- spec/lib/caramelize/output_wiki/gollum_spec.rb
|
246
123
|
- spec/lib/caramelize/page_spec.rb
|