caramelize 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +11 -0
  3. data/.github/workflows/main.yml +48 -0
  4. data/.rubocop.yml +29 -0
  5. data/Gemfile +12 -0
  6. data/Gemfile.lock +37 -25
  7. data/README.md +2 -3
  8. data/Rakefile +3 -1
  9. data/bin/caramelize +6 -5
  10. data/caramelize.gemspec +14 -19
  11. data/lib/caramelize/caramel.rb +32 -32
  12. data/lib/caramelize/content_transferer.rb +55 -32
  13. data/lib/caramelize/database_connector.rb +8 -8
  14. data/lib/caramelize/filter_processor.rb +2 -0
  15. data/lib/caramelize/filters/add_newline_to_page_end.rb +22 -0
  16. data/lib/caramelize/filters/camel_case_to_wiki_links.rb +26 -0
  17. data/lib/caramelize/filters/remove_table_tab_line_endings.rb +3 -2
  18. data/lib/caramelize/filters/swap_wiki_links.rb +5 -3
  19. data/lib/caramelize/filters/wikka_to_markdown.rb +26 -20
  20. data/lib/caramelize/health_check.rb +6 -68
  21. data/lib/caramelize/health_checks/home_page_check.rb +23 -0
  22. data/lib/caramelize/health_checks/orphaned_pages_check.rb +56 -0
  23. data/lib/caramelize/health_checks/page.rb +28 -0
  24. data/lib/caramelize/input_wiki/redmine_wiki.rb +18 -15
  25. data/lib/caramelize/input_wiki/wiki.rb +11 -5
  26. data/lib/caramelize/input_wiki/wikkawiki.rb +23 -14
  27. data/lib/caramelize/output_wiki/gollum.rb +10 -10
  28. data/lib/caramelize/page.rb +14 -10
  29. data/lib/caramelize/services/page_builder.rb +11 -8
  30. data/lib/caramelize/version.rb +3 -1
  31. data/lib/caramelize.rb +5 -0
  32. data/spec/lib/caramelize/content_transferer_spec.rb +3 -1
  33. data/spec/lib/caramelize/filter_processor_spec.rb +9 -4
  34. data/spec/lib/caramelize/filters/add_newline_to_page_end_spec.rb +29 -0
  35. data/spec/lib/caramelize/filters/camel_case_to_wiki_links_spec.rb +46 -0
  36. data/spec/lib/caramelize/filters/remove_table_tab_line_endings_spec.rb +19 -12
  37. data/spec/lib/caramelize/filters/swap_wiki_links_spec.rb +19 -14
  38. data/spec/lib/caramelize/filters/wikka2markdown_spec.rb +265 -0
  39. data/spec/lib/caramelize/input_wiki/wiki_spec.rb +24 -23
  40. data/spec/lib/caramelize/output_wiki/gollum_spec.rb +36 -34
  41. data/spec/lib/caramelize/page_spec.rb +34 -26
  42. data/spec/lib/caramelize/services/page_builder_spec.rb +41 -0
  43. data/spec/spec_helper.rb +4 -2
  44. metadata +19 -121
  45. data/.travis.yml +0 -5
  46. data/spec/lib/caramelize/filters/wikka_to_markdown_spec.rb +0 -198
  47. data/spec/lib/caramelize/services/page_builder.rb +0 -29
@@ -1,198 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Caramelize::Wikka2Markdown do
4
- let(:filter) { described_class.new(body) }
5
-
6
- describe '#run' do
7
- subject { filter.run }
8
-
9
- xcontext 'keep line breaks' do
10
- let(:body) { "line1\nline2" }
11
-
12
- it { is_expected.to eq "line1 \nline2" }
13
- end
14
-
15
- context 'headline h1' do
16
- let(:body) { '======Headline======' }
17
-
18
- it { is_expected.to eq '# Headline' }
19
- end
20
-
21
- context 'headline h2' do
22
- let(:body) { '=====Headline=====' }
23
-
24
- it { is_expected.to eq '## Headline' }
25
- end
26
-
27
- context 'headline h3' do
28
- let(:body) { '====Headline===='}
29
-
30
- it { is_expected.to eq '### Headline' }
31
- end
32
-
33
- context 'headline h4' do
34
- let(:body) { '===Headline===' }
35
-
36
- it { is_expected.to eq '#### Headline' }
37
- end
38
-
39
- context 'headline h5' do
40
- let(:body) { '==Headline==' }
41
-
42
- it { is_expected.to eq '##### Headline' }
43
- end
44
-
45
- context 'bold' do
46
- let(:body) { '**Text is bold**' }
47
-
48
- it { is_expected.to eq '**Text is bold**' }
49
- end
50
-
51
- context 'italic' do
52
- let(:body) { '//Text is italic//' }
53
-
54
- it { is_expected.to eq '*Text is italic*' }
55
- end
56
-
57
- context 'underline' do
58
- let(:body) { '__Text is underlined__' }
59
-
60
- it { is_expected.to eq '<u>Text is underlined</u>' }
61
- end
62
-
63
- context 'line break' do
64
- let(:body) { 'Text is---\nbroken to two lines.' }
65
-
66
- it { is_expected.to eq 'Text is \nbroken to two lines.' }
67
- end
68
-
69
- context 'unordered list entry' do
70
- context 'tab based' do
71
- let(:body) { "\t-unordered list entry" }
72
-
73
- it { is_expected.to eq '* unordered list entry' }
74
- end
75
-
76
- context 'also tab based' do
77
- let(:body) { "~-unordered list entry" }
78
-
79
- it { is_expected.to eq '* unordered list entry' }
80
- end
81
-
82
- context 'space based' do
83
- let(:body) { " -unordered list entry" }
84
-
85
- it { is_expected.to eq '* unordered list entry' }
86
- end
87
-
88
- context 'tab based with space' do
89
- let(:body) { "\t- unordered list entry" }
90
-
91
- it { is_expected.to eq '* unordered list entry' }
92
- end
93
-
94
- context 'also tab based with space' do
95
- let(:body) { "~- unordered list entry" }
96
-
97
- it { is_expected.to eq '* unordered list entry' }
98
- end
99
-
100
- context 'space based with space' do
101
- let(:body) { " - unordered list entry" }
102
-
103
- it { is_expected.to eq '* unordered list entry' }
104
- end
105
- end
106
-
107
- context 'ordered list entry' do
108
- context 'without space' do
109
- let(:body) { "~1)ordered list entry" }
110
-
111
- it { is_expected.to eq '1. ordered list entry' }
112
- end
113
-
114
- context 'with space' do
115
- let(:body) { "~1) ordered list entry" }
116
-
117
- it { is_expected.to eq '1. ordered list entry' }
118
- end
119
- end
120
-
121
- context 'wikilink' do
122
- context 'only url' do
123
- let(:body) { '[[LemmaLemma]]' }
124
-
125
- it { is_expected.to eq '[[LemmaLemma]]' }
126
- end
127
-
128
- context 'url and pipe title' do
129
- let(:body) { '[[SandBox|Test your formatting skills]]' }
130
-
131
- it { is_expected.to eq '[[Test your formatting skills|SandBox]]' }
132
- end
133
-
134
- context 'url and title' do
135
- let(:body) { '[[SandBox Test your formatting skills]]' }
136
-
137
- it { is_expected.to eq '[[Test your formatting skills|SandBox]]' }
138
- end
139
- end
140
-
141
- context 'hyperlink' do
142
- context 'only url' do
143
- let(:body) { '[[http://target]]' }
144
-
145
- it { is_expected.to eq '<http://target>' }
146
- end
147
-
148
- context 'url with title' do
149
- let(:body) { '[[http://target Title]]' }
150
-
151
- it { is_expected.to eq '[Title](http://target)' }
152
- end
153
-
154
- context 'url with pipe' do
155
- let(:body) { '[[http://target|Title]]' }
156
-
157
- it { is_expected.to eq '[Title](http://target)' }
158
- end
159
- end
160
-
161
- context 'code block' do
162
- let(:body) do
163
- <<-EOS
164
- Text before
165
-
166
- %%
167
- std::cin >> input;
168
- ++stat[input];
169
- %%
170
-
171
- Text after
172
-
173
- %%
174
- std::cin >> input;
175
- ++stat[input];
176
- %%
177
-
178
- EOS
179
- end
180
- let(:expected_result) do
181
- <<-EOS
182
- Text before
183
-
184
- std::cin >> input;
185
- ++stat[input];
186
-
187
- Text after
188
-
189
- std::cin >> input;
190
- ++stat[input];
191
-
192
- EOS
193
- end
194
-
195
- it { is_expected.to eq expected_result }
196
- end
197
- end
198
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Caramelize::Service::Pagebuilder do
4
- describe '.build_namespace_overview' do
5
- let(:body) do
6
- "## Overview of namespaces\n\n* [[Velociraptor|velociraptors/Wiki]] \n* [[Allosaurus|allosaurus/Wiki]] \n"
7
- end
8
- let(:expected_page) do
9
- Caramelize::Page.new(title: 'Home',
10
- body: body,
11
- message: 'Create Namespace Overview',
12
- latest: true)
13
- end
14
- let(:namespaces) do
15
- [
16
- OpenStruct.new(identifier: 'velociraptors', name: 'Velociraptor'),
17
- OpenStruct.new(identifier: 'allosaurus', name: 'Allosaurus')
18
- ]
19
- end
20
-
21
- it 'returns page with expected attributes' do
22
- page = described_class.build_namespace_overview
23
- expected(page.title).to eql(expected_page.title)
24
- expected(page.body).to eql(expected_page.body)
25
- expected(page.latest).to eql(expected_page.latest)
26
- expected(page.message).to eql(expected_page.message)
27
- end
28
- end
29
- end