nesta 0.11.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/tests.yml +21 -0
- data/.gitmodules +0 -0
- data/CHANGES +44 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +73 -55
- data/LICENSE +1 -1
- data/README.md +7 -14
- data/RELEASING.md +10 -9
- data/Rakefile +20 -3
- data/bin/nesta +1 -1
- data/config/deploy.rb.sample +1 -1
- data/lib/nesta/app.rb +4 -8
- data/lib/nesta/commands/demo/content.rb +28 -12
- data/lib/nesta/commands/edit.rb +2 -6
- data/lib/nesta/commands/new.rb +9 -11
- data/lib/nesta/commands/plugin/create.rb +7 -9
- data/lib/nesta/commands/template.rb +20 -0
- data/lib/nesta/commands/theme/create.rb +8 -8
- data/lib/nesta/commands/theme/enable.rb +3 -5
- data/lib/nesta/commands/theme/install.rb +12 -14
- data/lib/nesta/commands.rb +8 -0
- data/lib/nesta/config_file.rb +25 -0
- data/lib/nesta/helpers.rb +14 -0
- data/lib/nesta/models.rb +26 -22
- data/lib/nesta/navigation.rb +1 -1
- data/lib/nesta/system_command.rb +15 -0
- data/lib/nesta/version.rb +1 -1
- data/lib/nesta.rb +6 -1
- data/nesta.gemspec +11 -12
- data/templates/config/config.yml +1 -1
- data/{spec → test}/fixtures/nesta-plugin-test/Gemfile +0 -0
- data/{spec → test}/fixtures/nesta-plugin-test/Rakefile +0 -0
- data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test/init.rb +0 -0
- data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test/version.rb +0 -0
- data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test.rb +0 -0
- data/{spec → test}/fixtures/nesta-plugin-test/nesta-plugin-test.gemspec +0 -0
- data/test/integration/atom_feed_test.rb +178 -0
- data/test/integration/commands/demo/content_test.rb +33 -0
- data/test/integration/commands/edit_test.rb +21 -0
- data/test/integration/commands/new_test.rb +91 -0
- data/test/integration/commands/plugin/create_test.rb +131 -0
- data/test/integration/commands/theme/create_test.rb +41 -0
- data/test/integration/commands/theme/enable_test.rb +28 -0
- data/test/integration/commands/theme/install_test.rb +66 -0
- data/test/integration/default_theme_test.rb +220 -0
- data/test/integration/overrides_test.rb +118 -0
- data/test/integration/route_handlers_test.rb +96 -0
- data/test/integration/sitemap_test.rb +85 -0
- data/test/integration_test_helper.rb +61 -0
- data/test/support/model_factory.rb +169 -0
- data/test/support/temporary_files.rb +33 -0
- data/test/support/test_configuration.rb +19 -0
- data/test/test_helper.rb +26 -0
- data/test/unit/config_test.rb +138 -0
- data/test/unit/file_model_test.rb +71 -0
- data/test/unit/menu_test.rb +82 -0
- data/test/unit/page_test.rb +571 -0
- data/test/unit/path_test.rb +41 -0
- data/test/unit/plugin_test.rb +47 -0
- data/test/unit/system_command_test.rb +20 -0
- data/views/master.sass +1 -1
- metadata +90 -89
- data/.hound.yml +0 -2
- data/.rspec +0 -1
- data/.travis.yml +0 -6
- data/lib/nesta/commands/command.rb +0 -58
- data/smoke-test.sh +0 -107
- data/spec/atom_spec.rb +0 -141
- data/spec/commands/demo/content_spec.rb +0 -65
- data/spec/commands/edit_spec.rb +0 -27
- data/spec/commands/new_spec.rb +0 -88
- data/spec/commands/plugin/create_spec.rb +0 -97
- data/spec/commands/system_spec.rb +0 -25
- data/spec/commands/theme/create_spec.rb +0 -41
- data/spec/commands/theme/enable_spec.rb +0 -44
- data/spec/commands/theme/install_spec.rb +0 -56
- data/spec/config_spec.rb +0 -127
- data/spec/model_factory.rb +0 -92
- data/spec/models_spec.rb +0 -700
- data/spec/overrides_spec.rb +0 -132
- data/spec/page_spec.rb +0 -560
- data/spec/path_spec.rb +0 -28
- data/spec/plugin_spec.rb +0 -51
- data/spec/sitemap_spec.rb +0 -105
- data/spec/spec_helper.rb +0 -114
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nesta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Graham Ashton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.1'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '6.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '3.1'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '6.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: haml-contrib
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +48,16 @@ dependencies:
|
|
42
48
|
name: rack
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '2.0'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - "
|
58
|
+
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '2.0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rdiscount
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,117 +87,131 @@ dependencies:
|
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: '4.2'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
90
|
+
name: sassc
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
93
|
- - ">="
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
95
|
+
version: '2.2'
|
90
96
|
type: :runtime
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
100
|
- - ">="
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
102
|
+
version: '2.2'
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: sinatra
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
100
106
|
requirements:
|
101
107
|
- - "~>"
|
102
108
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
109
|
+
version: '2.0'
|
104
110
|
type: :runtime
|
105
111
|
prerelease: false
|
106
112
|
version_requirements: !ruby/object:Gem::Requirement
|
107
113
|
requirements:
|
108
114
|
- - "~>"
|
109
115
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
116
|
+
version: '2.0'
|
111
117
|
- !ruby/object:Gem::Dependency
|
112
118
|
name: tilt
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
114
120
|
requirements:
|
115
121
|
- - "~>"
|
116
122
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
123
|
+
version: '2.0'
|
118
124
|
type: :runtime
|
119
125
|
prerelease: false
|
120
126
|
version_requirements: !ruby/object:Gem::Requirement
|
121
127
|
requirements:
|
122
128
|
- - "~>"
|
123
129
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
130
|
+
version: '2.0'
|
125
131
|
- !ruby/object:Gem::Dependency
|
126
132
|
name: mr-sparkle
|
127
133
|
requirement: !ruby/object:Gem::Requirement
|
128
134
|
requirements:
|
129
135
|
- - ">="
|
130
136
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0
|
137
|
+
version: '0'
|
132
138
|
type: :development
|
133
139
|
prerelease: false
|
134
140
|
version_requirements: !ruby/object:Gem::Requirement
|
135
141
|
requirements:
|
136
142
|
- - ">="
|
137
143
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0
|
144
|
+
version: '0'
|
139
145
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
146
|
+
name: byebug
|
141
147
|
requirement: !ruby/object:Gem::Requirement
|
142
148
|
requirements:
|
143
|
-
- -
|
149
|
+
- - ">="
|
144
150
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0
|
151
|
+
version: '0'
|
146
152
|
type: :development
|
147
153
|
prerelease: false
|
148
154
|
version_requirements: !ruby/object:Gem::Requirement
|
149
155
|
requirements:
|
150
|
-
- -
|
156
|
+
- - ">="
|
151
157
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0
|
158
|
+
version: '0'
|
153
159
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
160
|
+
name: capybara
|
155
161
|
requirement: !ruby/object:Gem::Requirement
|
156
162
|
requirements:
|
157
163
|
- - "~>"
|
158
164
|
- !ruby/object:Gem::Version
|
159
|
-
version: 2.
|
165
|
+
version: '2.0'
|
160
166
|
type: :development
|
161
167
|
prerelease: false
|
162
168
|
version_requirements: !ruby/object:Gem::Requirement
|
163
169
|
requirements:
|
164
170
|
- - "~>"
|
165
171
|
- !ruby/object:Gem::Version
|
166
|
-
version: 2.
|
172
|
+
version: '2.0'
|
167
173
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
174
|
+
name: minitest
|
169
175
|
requirement: !ruby/object:Gem::Requirement
|
170
176
|
requirements:
|
171
|
-
- -
|
177
|
+
- - "~>"
|
172
178
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
179
|
+
version: '5.0'
|
174
180
|
type: :development
|
175
181
|
prerelease: false
|
176
182
|
version_requirements: !ruby/object:Gem::Requirement
|
177
183
|
requirements:
|
178
|
-
- -
|
184
|
+
- - "~>"
|
179
185
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
186
|
+
version: '5.0'
|
181
187
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
188
|
+
name: minitest-reporters
|
183
189
|
requirement: !ruby/object:Gem::Requirement
|
184
190
|
requirements:
|
185
|
-
- - "
|
191
|
+
- - ">="
|
186
192
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0
|
193
|
+
version: '0'
|
188
194
|
type: :development
|
189
195
|
prerelease: false
|
190
196
|
version_requirements: !ruby/object:Gem::Requirement
|
191
197
|
requirements:
|
192
|
-
- - "
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: rake
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
208
|
+
type: :development
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - ">="
|
193
213
|
- !ruby/object:Gem::Version
|
194
|
-
version: 0
|
214
|
+
version: '0'
|
195
215
|
description: |
|
196
216
|
Nesta is a lightweight Content Management System, written in Ruby using
|
197
217
|
the Sinatra web framework. Nesta has the simplicity of a static site
|
@@ -211,10 +231,9 @@ executables:
|
|
211
231
|
extensions: []
|
212
232
|
extra_rdoc_files: []
|
213
233
|
files:
|
234
|
+
- ".github/workflows/tests.yml"
|
214
235
|
- ".gitignore"
|
215
|
-
- ".
|
216
|
-
- ".rspec"
|
217
|
-
- ".travis.yml"
|
236
|
+
- ".gitmodules"
|
218
237
|
- CHANGES
|
219
238
|
- Gemfile
|
220
239
|
- Gemfile.lock
|
@@ -229,18 +248,19 @@ files:
|
|
229
248
|
- lib/nesta.rb
|
230
249
|
- lib/nesta/app.rb
|
231
250
|
- lib/nesta/commands.rb
|
232
|
-
- lib/nesta/commands/command.rb
|
233
251
|
- lib/nesta/commands/demo.rb
|
234
252
|
- lib/nesta/commands/demo/content.rb
|
235
253
|
- lib/nesta/commands/edit.rb
|
236
254
|
- lib/nesta/commands/new.rb
|
237
255
|
- lib/nesta/commands/plugin.rb
|
238
256
|
- lib/nesta/commands/plugin/create.rb
|
257
|
+
- lib/nesta/commands/template.rb
|
239
258
|
- lib/nesta/commands/theme.rb
|
240
259
|
- lib/nesta/commands/theme/create.rb
|
241
260
|
- lib/nesta/commands/theme/enable.rb
|
242
261
|
- lib/nesta/commands/theme/install.rb
|
243
262
|
- lib/nesta/config.rb
|
263
|
+
- lib/nesta/config_file.rb
|
244
264
|
- lib/nesta/env.rb
|
245
265
|
- lib/nesta/helpers.rb
|
246
266
|
- lib/nesta/models.rb
|
@@ -248,34 +268,10 @@ files:
|
|
248
268
|
- lib/nesta/overrides.rb
|
249
269
|
- lib/nesta/path.rb
|
250
270
|
- lib/nesta/plugin.rb
|
271
|
+
- lib/nesta/system_command.rb
|
251
272
|
- lib/nesta/version.rb
|
252
273
|
- nesta.gemspec
|
253
274
|
- scripts/import-from-mephisto
|
254
|
-
- smoke-test.sh
|
255
|
-
- spec/atom_spec.rb
|
256
|
-
- spec/commands/demo/content_spec.rb
|
257
|
-
- spec/commands/edit_spec.rb
|
258
|
-
- spec/commands/new_spec.rb
|
259
|
-
- spec/commands/plugin/create_spec.rb
|
260
|
-
- spec/commands/system_spec.rb
|
261
|
-
- spec/commands/theme/create_spec.rb
|
262
|
-
- spec/commands/theme/enable_spec.rb
|
263
|
-
- spec/commands/theme/install_spec.rb
|
264
|
-
- spec/config_spec.rb
|
265
|
-
- spec/fixtures/nesta-plugin-test/Gemfile
|
266
|
-
- spec/fixtures/nesta-plugin-test/Rakefile
|
267
|
-
- spec/fixtures/nesta-plugin-test/lib/nesta-plugin-test.rb
|
268
|
-
- spec/fixtures/nesta-plugin-test/lib/nesta-plugin-test/init.rb
|
269
|
-
- spec/fixtures/nesta-plugin-test/lib/nesta-plugin-test/version.rb
|
270
|
-
- spec/fixtures/nesta-plugin-test/nesta-plugin-test.gemspec
|
271
|
-
- spec/model_factory.rb
|
272
|
-
- spec/models_spec.rb
|
273
|
-
- spec/overrides_spec.rb
|
274
|
-
- spec/page_spec.rb
|
275
|
-
- spec/path_spec.rb
|
276
|
-
- spec/plugin_spec.rb
|
277
|
-
- spec/sitemap_spec.rb
|
278
|
-
- spec/spec_helper.rb
|
279
275
|
- templates/Gemfile
|
280
276
|
- templates/Rakefile
|
281
277
|
- templates/config.ru
|
@@ -295,6 +291,36 @@ files:
|
|
295
291
|
- templates/themes/views/layout.haml
|
296
292
|
- templates/themes/views/master.sass
|
297
293
|
- templates/themes/views/page.haml
|
294
|
+
- test/fixtures/nesta-plugin-test/Gemfile
|
295
|
+
- test/fixtures/nesta-plugin-test/Rakefile
|
296
|
+
- test/fixtures/nesta-plugin-test/lib/nesta-plugin-test.rb
|
297
|
+
- test/fixtures/nesta-plugin-test/lib/nesta-plugin-test/init.rb
|
298
|
+
- test/fixtures/nesta-plugin-test/lib/nesta-plugin-test/version.rb
|
299
|
+
- test/fixtures/nesta-plugin-test/nesta-plugin-test.gemspec
|
300
|
+
- test/integration/atom_feed_test.rb
|
301
|
+
- test/integration/commands/demo/content_test.rb
|
302
|
+
- test/integration/commands/edit_test.rb
|
303
|
+
- test/integration/commands/new_test.rb
|
304
|
+
- test/integration/commands/plugin/create_test.rb
|
305
|
+
- test/integration/commands/theme/create_test.rb
|
306
|
+
- test/integration/commands/theme/enable_test.rb
|
307
|
+
- test/integration/commands/theme/install_test.rb
|
308
|
+
- test/integration/default_theme_test.rb
|
309
|
+
- test/integration/overrides_test.rb
|
310
|
+
- test/integration/route_handlers_test.rb
|
311
|
+
- test/integration/sitemap_test.rb
|
312
|
+
- test/integration_test_helper.rb
|
313
|
+
- test/support/model_factory.rb
|
314
|
+
- test/support/temporary_files.rb
|
315
|
+
- test/support/test_configuration.rb
|
316
|
+
- test/test_helper.rb
|
317
|
+
- test/unit/config_test.rb
|
318
|
+
- test/unit/file_model_test.rb
|
319
|
+
- test/unit/menu_test.rb
|
320
|
+
- test/unit/page_test.rb
|
321
|
+
- test/unit/path_test.rb
|
322
|
+
- test/unit/plugin_test.rb
|
323
|
+
- test/unit/system_command_test.rb
|
298
324
|
- views/analytics.haml
|
299
325
|
- views/atom.haml
|
300
326
|
- views/categories.haml
|
@@ -332,33 +358,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
358
|
- !ruby/object:Gem::Version
|
333
359
|
version: '0'
|
334
360
|
requirements: []
|
335
|
-
|
336
|
-
rubygems_version: 2.4.5
|
361
|
+
rubygems_version: 3.3.7
|
337
362
|
signing_key:
|
338
363
|
specification_version: 4
|
339
364
|
summary: Ruby CMS, written in Sinatra
|
340
|
-
test_files:
|
341
|
-
- spec/atom_spec.rb
|
342
|
-
- spec/commands/demo/content_spec.rb
|
343
|
-
- spec/commands/edit_spec.rb
|
344
|
-
- spec/commands/new_spec.rb
|
345
|
-
- spec/commands/plugin/create_spec.rb
|
346
|
-
- spec/commands/system_spec.rb
|
347
|
-
- spec/commands/theme/create_spec.rb
|
348
|
-
- spec/commands/theme/enable_spec.rb
|
349
|
-
- spec/commands/theme/install_spec.rb
|
350
|
-
- spec/config_spec.rb
|
351
|
-
- spec/fixtures/nesta-plugin-test/Gemfile
|
352
|
-
- spec/fixtures/nesta-plugin-test/Rakefile
|
353
|
-
- spec/fixtures/nesta-plugin-test/lib/nesta-plugin-test.rb
|
354
|
-
- spec/fixtures/nesta-plugin-test/lib/nesta-plugin-test/init.rb
|
355
|
-
- spec/fixtures/nesta-plugin-test/lib/nesta-plugin-test/version.rb
|
356
|
-
- spec/fixtures/nesta-plugin-test/nesta-plugin-test.gemspec
|
357
|
-
- spec/model_factory.rb
|
358
|
-
- spec/models_spec.rb
|
359
|
-
- spec/overrides_spec.rb
|
360
|
-
- spec/page_spec.rb
|
361
|
-
- spec/path_spec.rb
|
362
|
-
- spec/plugin_spec.rb
|
363
|
-
- spec/sitemap_spec.rb
|
364
|
-
- spec/spec_helper.rb
|
365
|
+
test_files: []
|
data/.hound.yml
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/.travis.yml
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
module Nesta
|
2
|
-
module Commands
|
3
|
-
class UsageError < RuntimeError; end
|
4
|
-
|
5
|
-
module Command
|
6
|
-
def run_process(*args)
|
7
|
-
system(*args)
|
8
|
-
if ! $?.success?
|
9
|
-
message = if $?.exitstatus == 127
|
10
|
-
"#{args[0]} not found"
|
11
|
-
else
|
12
|
-
"'#{args.join(' ')}' failed with status #{$?.exitstatus}"
|
13
|
-
end
|
14
|
-
$stderr.puts "Error: #{message}"
|
15
|
-
exit 1
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def fail(message)
|
20
|
-
$stderr.puts "Error: #{message}"
|
21
|
-
exit 1
|
22
|
-
end
|
23
|
-
|
24
|
-
def template_root
|
25
|
-
File.expand_path('../../../templates', File.dirname(__FILE__))
|
26
|
-
end
|
27
|
-
|
28
|
-
def copy_template(src, dest)
|
29
|
-
FileUtils.mkdir_p(File.dirname(dest))
|
30
|
-
template = ERB.new(File.read(File.join(template_root, src)), nil, "-")
|
31
|
-
File.open(dest, 'w') { |file| file.puts template.result(binding) }
|
32
|
-
end
|
33
|
-
|
34
|
-
def copy_templates(templates)
|
35
|
-
templates.each { |src, dest| copy_template(src, dest) }
|
36
|
-
end
|
37
|
-
|
38
|
-
def update_config_yaml(pattern, replacement)
|
39
|
-
configured = false
|
40
|
-
File.open(Nesta::Config.yaml_path, 'r+') do |file|
|
41
|
-
output = ''
|
42
|
-
file.each_line do |line|
|
43
|
-
if configured
|
44
|
-
output << line
|
45
|
-
else
|
46
|
-
output << line.sub(pattern, replacement)
|
47
|
-
configured = true if line =~ pattern
|
48
|
-
end
|
49
|
-
end
|
50
|
-
output << "#{replacement}\n" unless configured
|
51
|
-
file.pos = 0
|
52
|
-
file.print(output)
|
53
|
-
file.truncate(file.pos)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
data/smoke-test.sh
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
# This script just makes it easy to test that Nesta can install a new
|
4
|
-
# site, launch it, and that it runs properly on supported versions of
|
5
|
-
# Ruby.
|
6
|
-
#
|
7
|
-
# It assumes you've got the relevant versions of Ruby installed locally
|
8
|
-
# via chruby.
|
9
|
-
|
10
|
-
|
11
|
-
source /usr/local/opt/chruby/share/chruby/chruby.sh
|
12
|
-
|
13
|
-
RUBIES="ruby-2.0.0-p598 ruby-2.1.5 ruby-2.2.1"
|
14
|
-
|
15
|
-
|
16
|
-
## Functions
|
17
|
-
|
18
|
-
log()
|
19
|
-
{
|
20
|
-
cat <<-EOF
|
21
|
-
|
22
|
-
###############################################################################
|
23
|
-
##
|
24
|
-
## $1
|
25
|
-
##
|
26
|
-
###############################################################################
|
27
|
-
|
28
|
-
EOF
|
29
|
-
}
|
30
|
-
|
31
|
-
nesta_version()
|
32
|
-
{
|
33
|
-
grep VERSION lib/nesta/version.rb | sed -e 's/ //g' | cut -f 2 -d "'"
|
34
|
-
}
|
35
|
-
|
36
|
-
gem_file()
|
37
|
-
{
|
38
|
-
echo "nesta-$(nesta_version).gem"
|
39
|
-
}
|
40
|
-
|
41
|
-
run_with_ruby()
|
42
|
-
{
|
43
|
-
chruby-exec $RUBY_VERSION -- $@
|
44
|
-
}
|
45
|
-
|
46
|
-
get_ruby()
|
47
|
-
{
|
48
|
-
# Why not just use RUBY_VERSION? Because tmux can prevent child
|
49
|
-
# processes from changing the local version if the RBENV_VERSION
|
50
|
-
# variable is set in another session. If we don't notice we'll think
|
51
|
-
# we've been testing Nesta under multiple versions, but in fact
|
52
|
-
# we'll just have been testing it under the same copy of Ruby every
|
53
|
-
# time.
|
54
|
-
run_with_ruby ruby --version | cut -f 2 -d ' '
|
55
|
-
}
|
56
|
-
|
57
|
-
run_tests()
|
58
|
-
{
|
59
|
-
run_with_ruby bundle install
|
60
|
-
run_with_ruby bundle exec rake spec
|
61
|
-
}
|
62
|
-
|
63
|
-
build_and_install()
|
64
|
-
{
|
65
|
-
echo rm -f pkg/$(gem_file)
|
66
|
-
run_with_ruby bundle exec rake install
|
67
|
-
}
|
68
|
-
|
69
|
-
site_folder()
|
70
|
-
{
|
71
|
-
echo "test-site-${RUBY_VERSION}"
|
72
|
-
}
|
73
|
-
|
74
|
-
create_and_test_new_site()
|
75
|
-
{
|
76
|
-
run_with_ruby bundle exec nesta new $(site_folder)
|
77
|
-
cd $(site_folder)
|
78
|
-
run_with_ruby bundle install
|
79
|
-
run_with_ruby bundle exec nesta demo:content
|
80
|
-
|
81
|
-
log "Starting server in $(site_folder)"
|
82
|
-
set +e
|
83
|
-
run_with_ruby bundle exec mr-sparkle
|
84
|
-
set -e
|
85
|
-
|
86
|
-
cd - >/dev/null
|
87
|
-
rm -rf $(site_folder)
|
88
|
-
}
|
89
|
-
|
90
|
-
|
91
|
-
## Main program
|
92
|
-
|
93
|
-
set -e
|
94
|
-
[ "$DEBUG" ] && set -x
|
95
|
-
|
96
|
-
for RUBY_VERSION in $RUBIES; do
|
97
|
-
log "Rebuilding nesta gem with Ruby $(get_ruby)"
|
98
|
-
|
99
|
-
run_tests
|
100
|
-
build_and_install
|
101
|
-
create_and_test_new_site
|
102
|
-
|
103
|
-
read -p "Was Ruby ${RUBY_VERSION} okay? Press return to continue..."
|
104
|
-
done
|
105
|
-
|
106
|
-
rm -f .ruby-version
|
107
|
-
log "Reset Ruby version to $(get_ruby)"
|
data/spec/atom_spec.rb
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
2
|
-
require File.expand_path('model_factory', File.dirname(__FILE__))
|
3
|
-
|
4
|
-
describe "atom feed" do
|
5
|
-
include ModelFactory
|
6
|
-
include RequestSpecHelper
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
stub_configuration
|
10
|
-
stub_config_key("author", {
|
11
|
-
"name" => "Fred Bloggs",
|
12
|
-
"uri" => "http://fredbloggs.com",
|
13
|
-
"email" => "fred@fredbloggs.com"
|
14
|
-
})
|
15
|
-
get "/articles.xml"
|
16
|
-
end
|
17
|
-
|
18
|
-
after(:each) do
|
19
|
-
remove_temp_directory
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should render successfully" do
|
23
|
-
last_response.should be_ok
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should use Atom's XML namespace" do
|
27
|
-
assert_xpath("//feed[@xmlns='http://www.w3.org/2005/Atom']")
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should have an ID element" do
|
31
|
-
assert_selector("id:contains('tag:example.org,2009:/')")
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should have an alternate link element" do
|
35
|
-
assert_xpath("//feed/link[@rel='alternate'][@href='http://example.org/']")
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should have a self link element" do
|
39
|
-
assert_xpath(
|
40
|
-
"//feed/link[@rel='self'][@href='http://example.org/articles.xml']")
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should have title and subtitle" do
|
44
|
-
assert_xpath("//feed/title[@type='text']", content: "My blog")
|
45
|
-
assert_xpath("//feed/subtitle[@type='text']", content: "about stuff")
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should include the author details" do
|
49
|
-
assert_xpath("//feed/author/name", content: "Fred Bloggs")
|
50
|
-
assert_xpath("//feed/author/uri", content: "http://fredbloggs.com")
|
51
|
-
assert_xpath("//feed/author/email", content: "fred@fredbloggs.com")
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "for article" do
|
55
|
-
before(:each) do
|
56
|
-
@heading = "Heading"
|
57
|
-
@articles = []
|
58
|
-
@category = create_category
|
59
|
-
11.times do |i|
|
60
|
-
@articles << create_article(
|
61
|
-
heading: "Article #{i + 1}",
|
62
|
-
path: "article-#{i + 1}",
|
63
|
-
metadata: {
|
64
|
-
"categories" => @category.path,
|
65
|
-
"date" => "#{i + 1} January 2009"
|
66
|
-
},
|
67
|
-
content: "Blah blah\n\n## #{@heading}\n\n[link](/foo)"
|
68
|
-
)
|
69
|
-
end
|
70
|
-
@article = @articles.last
|
71
|
-
get "/articles.xml"
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should set title" do
|
75
|
-
assert_xpath("//entry/title", content: "Article 11")
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should link to the HTML version" do
|
79
|
-
url = "http://example.org/#{@article.path}"
|
80
|
-
assert_xpath(
|
81
|
-
"//entry/link[@href='#{url}'][@rel='alternate'][@type='text/html']")
|
82
|
-
end
|
83
|
-
|
84
|
-
it "should define unique ID" do
|
85
|
-
assert_xpath(
|
86
|
-
"//entry/id",
|
87
|
-
content: "tag:example.org,2009-01-11:#{@article.abspath}"
|
88
|
-
)
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should specify date published" do
|
92
|
-
assert_xpath("//entry/published", content: "2009-01-11T00:00:00+00:00")
|
93
|
-
end
|
94
|
-
|
95
|
-
it "should specify article categories" do
|
96
|
-
assert_xpath("//category[@term='#{@category.permalink}']")
|
97
|
-
end
|
98
|
-
|
99
|
-
it "should have article content" do
|
100
|
-
assert_xpath "//entry/content[@type='html']" do |a|
|
101
|
-
a.should contain "<h2>#{@heading}</h2>"
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
it "should include hostname in URLs" do
|
106
|
-
assert_xpath("//entry/content") do |c|
|
107
|
-
c.should contain 'http://example.org/foo'
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should not include article heading in content" do
|
112
|
-
body.should_not have_selector("summary:contains('#{@article.heading}')")
|
113
|
-
end
|
114
|
-
|
115
|
-
it "should list the latest 10 articles" do
|
116
|
-
assert_selector("entry", count: 10)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe "page with no date" do
|
121
|
-
before(:each) do
|
122
|
-
create_category(path: "no-date")
|
123
|
-
get "/articles.xml"
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should not appear in feed" do
|
127
|
-
body.should_not have_selector("entry id:contains('no-date')")
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
describe "article with atom ID" do
|
132
|
-
it "should use pre-defined ID" do
|
133
|
-
create_article(metadata: {
|
134
|
-
"date" => "1 January 2009",
|
135
|
-
"atom id" => "use-this-id"
|
136
|
-
})
|
137
|
-
get "/articles.xml"
|
138
|
-
assert_xpath("//entry/id", content: "use-this-id")
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|