Merge branch 'master' of https://github.com/cantino/huginn into rspec-3-update

* 'master' of https://github.com/cantino/huginn:
  force-stopping services
  removed strip_cdata section from the docs
  stripping cdata should be the default behaviour
  Use String#b
  Switch faraday_middleware to the upstream master
  Switch tumblr_client to the upstream master
  stripping cdata from the value

# Conflicts:
# Gemfile
# Gemfile.lock

Dustin Miller преди 9 години
родител
ревизия
5f5a080b6d
променени са 8 файла, в които са добавени 305 реда и са изтрити 145 реда
  1. 2 2
      Gemfile
  2. 121 134
      Gemfile.lock
  3. 0 5
      app/concerns/web_request_concern.rb
  4. 1 1
      app/models/agents/ftpsite_agent.rb
  5. 8 1
      app/models/agents/website_agent.rb
  6. 6 1
      lib/tasks/production.rake
  7. 131 0
      spec/data_fixtures/cdata_rss.atom
  8. 36 1
      spec/models/agents/website_agent_spec.rb

+ 2 - 2
Gemfile

@@ -29,7 +29,7 @@ gem 'twitter-stream', github: 'cantino/twitter-stream', branch: 'huginn'
29 29
 gem 'omniauth-twitter'
30 30
 
31 31
 # Tumblr Agents
32
-gem 'tumblr_client', github: 'tumblr/tumblr_client', ref: '0c59b'
32
+gem 'tumblr_client', github: 'tumblr/tumblr_client', branch: 'master'  # '>= 0.8.5'
33 33
 gem 'omniauth-tumblr'
34 34
 
35 35
 # Dropbox Agents
@@ -67,7 +67,7 @@ gem 'devise', '~> 3.4.0'
67 67
 gem 'dotenv-rails', '~> 2.0.1'
68 68
 gem 'em-http-request', '~> 1.1.2'
69 69
 gem 'faraday', '~> 0.9.0'
70
-gem 'faraday_middleware', '>= 0.10.0'
70
+gem 'faraday_middleware', github: 'lostisland/faraday_middleware', branch: 'master'  # '>= 0.10.1'
71 71
 gem 'feed-normalizer'
72 72
 gem 'font-awesome-sass', '~> 4.3.2'
73 73
 gem 'foreman', '~> 0.63.0'

+ 121 - 134
Gemfile.lock

@@ -20,9 +20,17 @@ GIT
20 20
       rest-client (~> 1.8)
21 21
 
22 22
 GIT
23
+  remote: git://github.com/lostisland/faraday_middleware.git
24
+  revision: c5836ae55857272732b33eb0e0a98d60e995a376
25
+  branch: master
26
+  specs:
27
+    faraday_middleware (0.10.0)
28
+      faraday (>= 0.7.4, < 0.10)
29
+
30
+GIT
23 31
   remote: git://github.com/tumblr/tumblr_client.git
24 32
   revision: 0c59b04e49f2a8c89860613b18cf4e8f978d8dc7
25
-  ref: 0c59b
33
+  branch: master
26 34
   specs:
27 35
     tumblr_client (0.8.5)
28 36
       faraday (~> 0.9.0)
@@ -113,26 +121,28 @@ GEM
113 121
     capistrano-bundler (1.1.4)
114 122
       capistrano (~> 3.1)
115 123
       sshkit (~> 1.2)
116
-    capistrano-rails (1.1.5)
124
+    capistrano-rails (1.1.3)
117 125
       capistrano (~> 3.1)
118 126
       capistrano-bundler (~> 1.1)
127
+    celluloid (0.16.0)
128
+      timers (~> 4.0.0)
119 129
     chronic (0.10.2)
120 130
     coderay (1.1.0)
121 131
     coffee-rails (4.1.0)
122 132
       coffee-script (>= 2.2.0)
123 133
       railties (>= 4.0.0, < 5.0)
124
-    coffee-script (2.4.1)
134
+    coffee-script (2.3.0)
125 135
       coffee-script-source
126 136
       execjs
127
-    coffee-script-source (1.9.1.1)
137
+    coffee-script-source (1.9.1)
128 138
     colorize (0.7.7)
129 139
     cookiejar (0.3.2)
130
-    coveralls (0.8.3)
131
-      json (~> 1.8)
132
-      rest-client (>= 1.6.8, < 2)
133
-      simplecov (~> 0.10.0)
134
-      term-ansicolor (~> 1.3)
135
-      thor (~> 0.19.1)
140
+    coveralls (0.7.1)
141
+      multi_json (~> 1.3)
142
+      rest-client
143
+      simplecov (>= 0.7)
144
+      term-ansicolor
145
+      thor
136 146
     crack (0.4.2)
137 147
       safe_yaml (~> 1.0.0)
138 148
     daemons (1.1.9)
@@ -150,12 +160,11 @@ GEM
150 160
       warden (~> 1.2.3)
151 161
     diff-lcs (1.2.5)
152 162
     docile (1.1.5)
153
-    domain_name (0.5.25)
163
+    domain_name (0.5.24)
154 164
       unf (>= 0.0.5, < 1.0.0)
155
-    dotenv (2.0.2)
156
-    dotenv-rails (2.0.2)
157
-      dotenv (= 2.0.2)
158
-      railties (~> 4.0)
165
+    dotenv (2.0.1)
166
+    dotenv-rails (2.0.1)
167
+      dotenv (= 2.0.1)
159 168
     dropbox-api (0.4.2)
160 169
       hashie
161 170
       multi_json
@@ -166,7 +175,7 @@ GEM
166 175
       em-socksify (>= 0.3)
167 176
       eventmachine (>= 1.0.3)
168 177
       http_parser.rb (>= 0.6.0)
169
-    em-socksify (0.3.1)
178
+    em-socksify (0.3.0)
170 179
       eventmachine (>= 1.0.0.beta.4)
171 180
     em-websocket (0.5.1)
172 181
       eventmachine (>= 0.12.9)
@@ -175,23 +184,21 @@ GEM
175 184
     erector (0.10.0)
176 185
       treetop (>= 1.2.3)
177 186
     erubis (2.7.0)
178
-    ethon (0.8.0)
187
+    ethon (0.7.1)
179 188
       ffi (>= 1.3.0)
180
-    eventmachine (1.0.8)
189
+    eventmachine (1.0.7)
181 190
     evernote-thrift (1.25.1)
182 191
     evernote_oauth (0.2.3)
183 192
       evernote-thrift
184 193
       oauth (>= 0.4.1)
185
-    execjs (2.6.0)
194
+    execjs (2.3.0)
186 195
     extlib (0.9.16)
187
-    faraday (0.9.2)
196
+    faraday (0.9.1)
188 197
       multipart-post (>= 1.2, < 3)
189
-    faraday_middleware (0.10.0)
190
-      faraday (>= 0.7.4, < 0.10)
191 198
     feed-normalizer (1.5.2)
192 199
       hpricot (>= 0.6)
193 200
       simple-rss (>= 1.1)
194
-    ffi (1.9.10)
201
+    ffi (1.9.5)
195 202
     font-awesome-sass (4.3.2.1)
196 203
       sass (~> 3.2)
197 204
     forecast_io (2.0.0)
@@ -209,47 +216,35 @@ GEM
209 216
       rails (>= 3.0)
210 217
     globalid (0.3.6)
211 218
       activesupport (>= 4.1.0)
212
-    google-api-client (0.8.6)
213
-      activesupport (>= 3.2)
214
-      addressable (~> 2.3)
215
-      autoparse (~> 0.3)
216
-      extlib (~> 0.9)
217
-      faraday (~> 0.9)
218
-      googleauth (~> 0.3)
219
-      launchy (~> 2.4)
220
-      multi_json (~> 1.10)
221
-      retriable (~> 1.4)
222
-      signet (~> 0.6)
223
-    googleauth (0.4.2)
224
-      faraday (~> 0.9)
225
-      jwt (~> 1.4)
226
-      logging (~> 2.0)
227
-      memoist (~> 0.12)
228
-      multi_json (~> 1.11)
229
-      signet (~> 0.6)
230
-    guard (2.13.0)
219
+    google-api-client (0.7.1)
220
+      addressable (>= 2.3.2)
221
+      autoparse (>= 0.3.3)
222
+      extlib (>= 0.9.15)
223
+      faraday (>= 0.9.0)
224
+      jwt (>= 0.1.5)
225
+      launchy (>= 2.1.1)
226
+      multi_json (>= 1.0.0)
227
+      retriable (>= 1.4)
228
+      signet (>= 0.5.0)
229
+      uuidtools (>= 2.1.0)
230
+    guard (2.6.1)
231 231
       formatador (>= 0.2.4)
232
-      listen (>= 2.7, <= 4.0)
232
+      listen (~> 2.7)
233 233
       lumberjack (~> 1.0)
234
-      nenv (~> 0.1)
235
-      notiffany (~> 0.0)
236 234
       pry (>= 0.9.12)
237
-      shellany (~> 0.0)
238 235
       thor (>= 0.18.1)
239
-    guard-compat (1.2.1)
240
-    guard-livereload (2.5.0)
236
+    guard-livereload (2.2.0)
241 237
       em-websocket (~> 0.5)
242
-      guard (~> 2.8)
243
-      guard-compat (~> 1.0)
238
+      guard (~> 2.0)
244 239
       multi_json (~> 1.8)
245
-    guard-rspec (4.6.4)
240
+    guard-rspec (4.3.1)
246 241
       guard (~> 2.1)
247
-      guard-compat (~> 1.1)
248
-      rspec (>= 2.99.0, < 4.0)
242
+      rspec (>= 2.14, < 4.0)
249 243
     hashie (2.0.5)
250 244
     haversine (0.3.0)
251 245
     hipchat (1.2.0)
252 246
       httparty
247
+    hitimes (1.2.2)
253 248
     hpricot (0.8.6)
254 249
     httmultiparty (0.3.10)
255 250
       httparty (>= 0.7.3)
@@ -262,23 +257,22 @@ GEM
262 257
     httparty (0.13.1)
263 258
       json (~> 1.8)
264 259
       multi_xml (>= 0.5.2)
265
-    hypdf (1.0.8)
260
+    hypdf (1.0.7)
266 261
       httmultiparty (= 0.3.10)
267
-      httparty (= 0.13.1)
268 262
     i18n (0.7.0)
269
-    jquery-rails (3.1.4)
263
+    jquery-rails (3.1.3)
270 264
       railties (>= 3.0, < 5.0)
271 265
       thor (>= 0.14, < 2.0)
272 266
     json (1.8.3)
273 267
     jsonpath (0.5.7)
274 268
       multi_json
275
-    jwt (1.5.1)
276
-    kaminari (0.16.3)
269
+    jwt (1.4.1)
270
+    kaminari (0.16.1)
277 271
       actionpack (>= 3.0.0)
278 272
       activesupport (>= 3.0.0)
279
-    kgio (2.10.0)
273
+    kgio (2.9.3)
280 274
     kramdown (1.3.3)
281
-    launchy (2.4.3)
275
+    launchy (2.4.2)
282 276
       addressable (~> 2.3)
283 277
     letter_opener (1.4.1)
284 278
       launchy (~> 2.2)
@@ -286,15 +280,12 @@ GEM
286 280
       actionmailer (>= 3.2)
287 281
       letter_opener (~> 1.0)
288 282
       railties (>= 3.2)
289
-    libv8 (3.16.14.13)
283
+    libv8 (3.16.14.7)
290 284
     liquid (3.0.6)
291
-    listen (3.0.3)
285
+    listen (2.7.9)
286
+      celluloid (>= 0.15.2)
292 287
       rb-fsevent (>= 0.9.3)
293 288
       rb-inotify (>= 0.9)
294
-    little-plugger (1.1.4)
295
-    logging (2.0.0)
296
-      little-plugger (~> 1.1)
297
-      multi_json (~> 1.10)
298 289
     loofah (2.0.3)
299 290
       nokogiri (>= 1.5.9)
300 291
     lumberjack (1.0.9)
@@ -302,31 +293,26 @@ GEM
302 293
       systemu (~> 2.6.2)
303 294
     mail (2.6.3)
304 295
       mime-types (>= 1.16, < 3)
305
-    memoist (0.12.0)
306 296
     memoizable (0.4.2)
307 297
       thread_safe (~> 0.3, >= 0.3.1)
308 298
     method_source (0.8.2)
309
-    mime-types (2.6.2)
310
-    mini_magick (4.3.6)
299
+    mime-types (2.6.1)
300
+    mini_magick (4.2.3)
311 301
     mini_portile (0.6.2)
312
-    minitest (5.8.1)
302
+    minitest (5.8.0)
313 303
     mqtt (0.3.1)
314 304
     multi_json (1.11.2)
315 305
     multi_xml (0.5.5)
316 306
     multipart-post (2.0.0)
317
-    mysql2 (0.3.20)
318
-    naught (1.1.0)
319
-    nenv (0.2.0)
307
+    mysql2 (0.3.16)
308
+    naught (1.0.0)
320 309
     net-ftp-list (3.2.8)
321 310
     net-scp (1.2.1)
322 311
       net-ssh (>= 2.6.5)
323
-    net-ssh (3.0.1)
312
+    net-ssh (2.9.2)
324 313
     netrc (0.10.3)
325 314
     nokogiri (1.6.6.2)
326 315
       mini_portile (~> 0.6.0)
327
-    notiffany (0.0.8)
328
-      nenv (~> 0.1)
329
-      shellany (~> 0.0)
330 316
     oauth (0.4.7)
331 317
     oauth2 (0.9.4)
332 318
       faraday (>= 0.8, < 0.10)
@@ -346,7 +332,7 @@ GEM
346 332
       evernote-thrift
347 333
       multi_json (~> 1.0)
348 334
       omniauth-oauth (~> 1.0)
349
-    omniauth-oauth (1.1.0)
335
+    omniauth-oauth (1.0.1)
350 336
       oauth
351 337
       omniauth (~> 1.0)
352 338
     omniauth-oauth2 (1.1.2)
@@ -356,15 +342,15 @@ GEM
356 342
       omniauth (~> 1.2)
357 343
     omniauth-tumblr (1.1)
358 344
       omniauth-oauth (~> 1.0)
359
-    omniauth-twitter (1.2.1)
360
-      json (~> 1.3)
361
-      omniauth-oauth (~> 1.1)
345
+    omniauth-twitter (1.0.1)
346
+      multi_json (~> 1.3)
347
+      omniauth-oauth (~> 1.0)
362 348
     orm_adapter (0.5.0)
363
-    pg (0.18.3)
349
+    pg (0.17.1)
364 350
     polyglot (0.3.5)
365
-    protected_attributes (1.0.9)
351
+    protected_attributes (1.0.8)
366 352
       activemodel (>= 4.0.1, < 5.0)
367
-    pry (0.10.3)
353
+    pry (0.10.1)
368 354
       coderay (~> 1.1.0)
369 355
       method_source (~> 0.8.1)
370 356
       slop (~> 3.4)
@@ -398,52 +384,52 @@ GEM
398 384
       rails_serve_static_assets
399 385
       rails_stdout_logging
400 386
     rails_serve_static_assets (0.0.4)
401
-    rails_stdout_logging (0.0.4)
387
+    rails_stdout_logging (0.0.3)
402 388
     railties (4.2.4)
403 389
       actionpack (= 4.2.4)
404 390
       activesupport (= 4.2.4)
405 391
       rake (>= 0.8.7)
406 392
       thor (>= 0.18.1, < 2.0)
407
-    raindrops (0.15.0)
393
+    raindrops (0.13.0)
408 394
     rake (10.4.2)
409
-    rb-fsevent (0.9.6)
395
+    rb-fsevent (0.9.4)
410 396
     rb-inotify (0.9.5)
411 397
       ffi (>= 0.5.0)
412
-    ref (2.0.0)
398
+    ref (1.0.5)
413 399
     responders (2.1.0)
414 400
       railties (>= 4.2.0, < 5)
415 401
     rest-client (1.8.0)
416 402
       http-cookie (>= 1.0.2, < 2.0)
417 403
       mime-types (>= 1.16, < 3.0)
418 404
       netrc (~> 0.7)
419
-    retriable (1.4.1)
405
+    retriable (2.0.2)
420 406
     rr (1.1.2)
421
-    rspec (3.3.0)
422
-      rspec-core (~> 3.3.0)
423
-      rspec-expectations (~> 3.3.0)
424
-      rspec-mocks (~> 3.3.0)
407
+    rspec (3.2.0)
408
+      rspec-core (~> 3.2.0)
409
+      rspec-expectations (~> 3.2.0)
410
+      rspec-mocks (~> 3.2.0)
425 411
     rspec-collection_matchers (1.1.2)
426 412
       rspec-expectations (>= 2.99.0.beta1)
427
-    rspec-core (3.3.2)
428
-      rspec-support (~> 3.3.0)
429
-    rspec-expectations (3.3.1)
413
+    rspec-core (3.2.1)
414
+      rspec-support (~> 3.2.0)
415
+    rspec-expectations (3.2.0)
430 416
       diff-lcs (>= 1.2.0, < 2.0)
431
-      rspec-support (~> 3.3.0)
417
+      rspec-support (~> 3.2.0)
432 418
     rspec-html-matchers (0.7.0)
433 419
       nokogiri (~> 1)
434 420
       rspec (~> 3)
435
-    rspec-mocks (3.3.2)
421
+    rspec-mocks (3.2.1)
436 422
       diff-lcs (>= 1.2.0, < 2.0)
437
-      rspec-support (~> 3.3.0)
438
-    rspec-rails (3.3.3)
423
+      rspec-support (~> 3.2.0)
424
+    rspec-rails (3.2.1)
439 425
       actionpack (>= 3.0, < 4.3)
440 426
       activesupport (>= 3.0, < 4.3)
441 427
       railties (>= 3.0, < 4.3)
442
-      rspec-core (~> 3.3.0)
443
-      rspec-expectations (~> 3.3.0)
444
-      rspec-mocks (~> 3.3.0)
445
-      rspec-support (~> 3.3.0)
446
-    rspec-support (3.3.0)
428
+      rspec-core (~> 3.2.0)
429
+      rspec-expectations (~> 3.2.0)
430
+      rspec-mocks (~> 3.2.0)
431
+      rspec-support (~> 3.2.0)
432
+    rspec-support (3.2.2)
447 433
     rturk (2.12.1)
448 434
       erector
449 435
       nokogiri
@@ -453,38 +439,36 @@ GEM
453 439
     rufus-scheduler (3.0.9)
454 440
       tzinfo
455 441
     safe_yaml (1.0.4)
456
-    sass (3.4.19)
457
-    sass-rails (5.0.4)
442
+    sass (3.4.14)
443
+    sass-rails (5.0.3)
458 444
       railties (>= 4.0.0, < 5.0)
459 445
       sass (~> 3.1)
460 446
       sprockets (>= 2.8, < 4.0)
461 447
       sprockets-rails (>= 2.0, < 4.0)
462
-      tilt (>= 1.1, < 3)
448
+      tilt (~> 1.1)
463 449
     select2-rails (3.5.9.3)
464 450
       thor (~> 0.14)
465
-    shellany (0.0.1)
466
-    shoulda-matchers (3.0.0)
467
-      activesupport (>= 4.0.0)
468
-    signet (0.6.1)
469
-      addressable (~> 2.3)
470
-      extlib (~> 0.9)
471
-      faraday (~> 0.9)
472
-      jwt (~> 1.5)
473
-      multi_json (~> 1.10)
451
+    shoulda-matchers (2.8.0)
452
+      activesupport (>= 3.0.0)
453
+    signet (0.5.1)
454
+      addressable (>= 2.2.3)
455
+      faraday (>= 0.9.0.rc5)
456
+      jwt (>= 0.1.5)
457
+      multi_json (>= 1.0.0)
474 458
     simple-rss (1.3.1)
475 459
     simple_oauth (0.3.1)
476
-    simplecov (0.10.0)
460
+    simplecov (0.9.2)
477 461
       docile (~> 1.1.0)
478
-      json (~> 1.8)
479
-      simplecov-html (~> 0.10.0)
480
-    simplecov-html (0.10.0)
462
+      multi_json (~> 1.0)
463
+      simplecov-html (~> 0.9.0)
464
+    simplecov-html (0.9.0)
481 465
     slack-notifier (1.0.0)
482 466
     slop (3.6.0)
483
-    spectrum-rails (1.6.2)
467
+    spectrum-rails (1.3.4)
484 468
       railties (>= 3.1)
485
-    sprockets (3.4.0)
486
-      rack (> 1, < 3)
487
-    sprockets-rails (2.3.3)
469
+    sprockets (3.3.4)
470
+      rack (~> 1.0)
471
+    sprockets-rails (2.3.2)
488 472
       actionpack (>= 3.0)
489 473
       activesupport (>= 3.0)
490 474
       sprockets (>= 2.8, < 4.0)
@@ -493,17 +477,19 @@ GEM
493 477
       net-scp (>= 1.1.2)
494 478
       net-ssh (>= 2.8.0)
495 479
     string-scrub (0.0.5)
496
-    systemu (2.6.5)
497
-    term-ansicolor (1.3.2)
480
+    systemu (2.6.4)
481
+    term-ansicolor (1.3.0)
498 482
       tins (~> 1.0)
499 483
     therubyracer (0.12.2)
500 484
       libv8 (~> 3.16.14.0)
501 485
       ref
502 486
     thor (0.19.1)
503 487
     thread_safe (0.3.5)
504
-    tilt (2.0.1)
505
-    tins (1.6.0)
506
-    treetop (1.6.3)
488
+    tilt (1.4.1)
489
+    timers (4.0.1)
490
+      hitimes
491
+    tins (1.3.2)
492
+    treetop (1.5.3)
507 493
       polyglot (~> 0.3)
508 494
     twilio-ruby (3.11.6)
509 495
       builder (>= 2.1.2)
@@ -524,7 +510,7 @@ GEM
524 510
       ethon (>= 0.7.1)
525 511
     tzinfo (1.2.2)
526 512
       thread_safe (~> 0.1)
527
-    uglifier (2.7.2)
513
+    uglifier (2.7.0)
528 514
       execjs (>= 0.3.0)
529 515
       json (>= 1.8.0)
530 516
     unf (0.1.4)
@@ -534,9 +520,10 @@ GEM
534 520
       kgio (~> 2.6)
535 521
       rack
536 522
       raindrops (~> 0.7)
537
-    uuid (2.3.8)
523
+    uuid (2.3.7)
538 524
       macaddr (~> 1.0)
539
-    vcr (2.9.3)
525
+    uuidtools (2.1.5)
526
+    vcr (2.9.2)
540 527
     warden (1.2.3)
541 528
       rack (>= 1.0)
542 529
     webmock (1.17.4)
@@ -572,7 +559,7 @@ DEPENDENCIES
572 559
   em-http-request (~> 1.1.2)
573 560
   evernote_oauth
574 561
   faraday (~> 0.9.0)
575
-  faraday_middleware (>= 0.10.0)
562
+  faraday_middleware!
576 563
   feed-normalizer
577 564
   ffi (>= 1.9.4)
578 565
   font-awesome-sass (~> 4.3.2)

+ 0 - 5
app/concerns/web_request_concern.rb

@@ -123,11 +123,6 @@ module WebRequestConcern
123 123
 
124 124
       builder.use FaradayMiddleware::Gzip
125 125
 
126
-      unless builder.headers.any? { |key,| /\Aaccept[-_]encoding\z/i =~ key }
127
-        # Exclude `deflate` by default.  See #1018.
128
-        builder.headers[:accept_encoding] = 'gzip,identity'
129
-      end
130
-
131 126
       case backend = faraday_backend
132 127
         when :typhoeus
133 128
           require 'typhoeus/adapters/faraday'

+ 1 - 1
app/models/agents/ftpsite_agent.rb

@@ -196,7 +196,7 @@ module Agents
196 196
     end
197 197
 
198 198
     def uri_path_escape(string)
199
-      str = string.dup.force_encoding(Encoding::ASCII_8BIT)  # string.b in Ruby >=2.0
199
+      str = string.b
200 200
       str.gsub!(/([^A-Za-z0-9\-._~!$&()*+,=@]+)/) { |m|
201 201
         '%' + m.unpack('H2' * m.bytesize).join('%').upcase
202 202
       }

+ 8 - 1
app/models/agents/website_agent.rb

@@ -439,7 +439,14 @@ module Agents
439 439
         case nodes
440 440
         when Nokogiri::XML::NodeSet
441 441
           result = nodes.map { |node|
442
-            case value = node.xpath(extraction_details['value'] || '.')
442
+            value = node.xpath(extraction_details['value'] || '.')
443
+            if value.is_a?(Nokogiri::XML::NodeSet)
444
+              child = value.first
445
+              if child && child.cdata?
446
+                value = child.text
447
+              end
448
+            end
449
+            case value
443 450
             when Float
444 451
               # Node#xpath() returns any numeric value as float;
445 452
               # convert it to integer as appropriate.

+ 6 - 1
lib/tasks/production.rake

@@ -38,6 +38,11 @@ namespace :production do
38 38
     run_sv('start')
39 39
   end
40 40
 
41
+  task :force_stop => :check do
42
+    puts "Force stopping huginn ..."
43
+    run_sv('force-stop')
44
+  end
45
+
41 46
   task :status => :check do
42 47
     run_sv('status')
43 48
   end
@@ -91,4 +96,4 @@ rescue StandardError => e
91 96
   raise e
92 97
 else
93 98
   puts output
94
-end
99
+end

+ 131 - 0
spec/data_fixtures/cdata_rss.atom

@@ -0,0 +1,131 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
3
+  <link rel="self" type="application/atom+xml" href="http://rainmeter.net/forum/feed.php" />
4
+  <title>Rainmeter Forums</title>
5
+  <link href="http://rainmeter.net/forum/index.php" />
6
+  <updated>2015-10-11T14:52:35+00:00</updated>
7
+  <author>
8
+    <name><![CDATA[Rainmeter Forums]]></name>
9
+  </author>
10
+  <id>http://rainmeter.net/forum/feed.php</id>
11
+  <entry>
12
+    <author>
13
+      <name><![CDATA[supergergo]]></name>
14
+    </author>
15
+    <updated>2015-10-11T14:52:35+00:00</updated>
16
+    <published>2015-10-11T14:52:35+00:00</published>
17
+    <id>http://rainmeter.net/forum/viewtopic.php?t=21984&amp;p=116390#p116390</id>
18
+    <link href="http://rainmeter.net/forum/viewtopic.php?t=21984&amp;p=116390#p116390" />
19
+    <title type="html"><![CDATA[Help: Rainmeter Skins • Re: Cannot change font for Simple Launcher]]></title>
20
+    <category term="Help: Rainmeter Skins" scheme="http://rainmeter.net/forum/viewforum.php?f=5" label="Help: Rainmeter Skins" />
21
+    <content type="html" xml:base="http://rainmeter.net/forum/viewtopic.php?t=21984&amp;p=116390#p116390"><![CDATA[<div class="quotewrapper"><div class="quotetitle">jsmorley wrote:</div><div class="quotecontent"><br />You don't use the file name of the font, you use the internal font name.<br /><br /><span style="background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #869AA8; color: #2E8B57; display: inline; font-family: Monaco,'Andale Mono','Courier New',Courier,monospace; font-size: 1em; font-style: normal; line-height: 1.3em; padding: 0 3px;">FontFace=ITC Avant Garde Pro XLt</span><br /><br /><div class="attachwrapper">1.jpg</div><br /></div></div><br /><br />Thank you!!<p>Statistics: Posted by <a href="http://rainmeter.net/forum/memberlist.php?mode=viewprofile&amp;u=35297">supergergo</a> — 29 minutes ago</p><hr />]]></content>
22
+  </entry>
23
+  <entry>
24
+    <author>
25
+      <name><![CDATA[redsaph]]></name>
26
+    </author>
27
+    <updated>2015-10-11T13:51:44+00:00</updated>
28
+    <published>2015-10-11T13:51:44+00:00</published>
29
+    <id>http://rainmeter.net/forum/viewtopic.php?t=21411&amp;p=116389#p116389</id>
30
+    <link href="http://rainmeter.net/forum/viewtopic.php?t=21411&amp;p=116389#p116389" />
31
+    <title type="html"><![CDATA[Plugins &amp; Addons • Re: Plugin: ColorExtract]]></title>
32
+    <category term="Plugins &amp; Addons" scheme="http://rainmeter.net/forum/viewforum.php?f=18" label="Plugins &amp; Addons" />
33
+    <content type="html" xml:base="http://rainmeter.net/forum/viewtopic.php?t=21411&amp;p=116389#p116389"><![CDATA[This is pretty great! The things we can do with this plugin...  <img src="http://rainmeter.net/forum/images/smilies/yikes.gif" alt=":o" title="Shocked" /><p>Statistics: Posted by <a href="http://rainmeter.net/forum/memberlist.php?mode=viewprofile&amp;u=28432">redsaph</a> — Today, 1:51 pm</p><hr />]]></content>
34
+  </entry>
35
+  <entry>
36
+    <author>
37
+      <name><![CDATA[jsmorley]]></name>
38
+    </author>
39
+    <updated>2015-10-11T13:36:51+00:00</updated>
40
+    <published>2015-10-11T13:36:51+00:00</published>
41
+    <id>http://rainmeter.net/forum/viewtopic.php?t=21984&amp;p=116388#p116388</id>
42
+    <link href="http://rainmeter.net/forum/viewtopic.php?t=21984&amp;p=116388#p116388" />
43
+    <title type="html"><![CDATA[Help: Rainmeter Skins • Re: Cannot change font for Simple Launcher]]></title>
44
+    <category term="Help: Rainmeter Skins" scheme="http://rainmeter.net/forum/viewforum.php?f=5" label="Help: Rainmeter Skins" />
45
+    <content type="html" xml:base="http://rainmeter.net/forum/viewtopic.php?t=21984&amp;p=116388#p116388"><![CDATA[You don't use the file name of the font, you use the internal font name.<br /><br /><span style="background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #869AA8; color: #2E8B57; display: inline; font-family: Monaco,'Andale Mono','Courier New',Courier,monospace; font-size: 1em; font-style: normal; line-height: 1.3em; padding: 0 3px;">FontFace=ITC Avant Garde Pro XLt</span><br /><br /><div class="attachwrapper">1.jpg</div><p>Statistics: Posted by <a href="http://rainmeter.net/forum/memberlist.php?mode=viewprofile&amp;u=85">jsmorley</a> — Today, 1:36 pm</p><hr />]]></content>
46
+  </entry>
47
+  <entry>
48
+    <author>
49
+      <name><![CDATA[xlr8r_]]></name>
50
+    </author>
51
+    <updated>2015-10-11T13:35:15+00:00</updated>
52
+    <published>2015-10-11T13:35:15+00:00</published>
53
+    <id>http://rainmeter.net/forum/viewtopic.php?t=21939&amp;p=116387#p116387</id>
54
+    <link href="http://rainmeter.net/forum/viewtopic.php?t=21939&amp;p=116387#p116387" />
55
+    <title type="html"><![CDATA[Tips &amp; Tricks • Re: Working with the HWiNFO plugin]]></title>
56
+    <category term="Tips &amp; Tricks" scheme="http://rainmeter.net/forum/viewforum.php?f=15" label="Tips &amp; Tricks" />
57
+    <content type="html" xml:base="http://rainmeter.net/forum/viewtopic.php?t=21939&amp;p=116387#p116387"><![CDATA[again: one more<p>Statistics: Posted by <a href="http://rainmeter.net/forum/memberlist.php?mode=viewprofile&amp;u=35276">xlr8r_</a> — Today, 1:35 pm</p><hr />]]></content>
58
+  </entry>
59
+  <entry>
60
+    <author>
61
+      <name><![CDATA[supergergo]]></name>
62
+    </author>
63
+    <updated>2015-10-11T13:27:56+00:00</updated>
64
+    <published>2015-10-11T13:27:56+00:00</published>
65
+    <id>http://rainmeter.net/forum/viewtopic.php?t=21984&amp;p=116386#p116386</id>
66
+    <link href="http://rainmeter.net/forum/viewtopic.php?t=21984&amp;p=116386#p116386" />
67
+    <title type="html"><![CDATA[Help: Rainmeter Skins • Cannot change font for Simple Launcher]]></title>
68
+    <category term="Help: Rainmeter Skins" scheme="http://rainmeter.net/forum/viewforum.php?f=5" label="Help: Rainmeter Skins" />
69
+    <content type="html" xml:base="http://rainmeter.net/forum/viewtopic.php?t=21984&amp;p=116386#p116386"><![CDATA[Hi,<br />I simply cannot change the font for this skin. I tried the @Resources folder in the skin's root, but nothing, I also tried to install the font, but still, nothing. <br /><br />Here is a snip of my code:<br />[APP1]<br />Meter=STRING<br />X=0<br />Y=0<br />FontColor=255, 255, 255, 1000<br />FontSize=40<br />FontFace=ITCAvantGardePro-XLt<br />SolidColor=0,0,0,1<br />StringStyle=NORMAL<br />StringAlign=LEFT<br />AntiAlias=1<br />Text=&quot;University&quot;<br />LeftMouseUpAction=!Execute [&quot;C:\Users\G\Documents\Uni&quot;]<br /><br />I also tried to use other variations of the font, but still nothing happens when I save and hit refresh. Even if it says the font's name at FontFace, it does not change.<br /><br />Link for the launcher: <!-- m --><a class="postlink" href="http://danieliop.deviantart.com/art/Simple-RM-Launcher-216478809">http://danieliop.deviantart.com/art/Sim ... -216478809</a><!-- m --><p>Statistics: Posted by <a href="http://rainmeter.net/forum/memberlist.php?mode=viewprofile&amp;u=35297">supergergo</a> — Today, 1:27 pm</p><hr />]]></content>
70
+  </entry>
71
+  <entry>
72
+    <author>
73
+      <name><![CDATA[balala]]></name>
74
+    </author>
75
+    <updated>2015-10-11T08:27:55+00:00</updated>
76
+    <published>2015-10-11T08:27:55+00:00</published>
77
+    <id>http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116381#p116381</id>
78
+    <link href="http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116381#p116381" />
79
+    <title type="html"><![CDATA[Help: Rainmeter Skins • Re: Test if Today is Between 2 Dates]]></title>
80
+    <category term="Help: Rainmeter Skins" scheme="http://rainmeter.net/forum/viewforum.php?f=5" label="Help: Rainmeter Skins" />
81
+    <content type="html" xml:base="http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116381#p116381"><![CDATA[If I'm not wrong your bangs are wrong, because you want to show/hide a group of meters. For that, you have to use the !ShowMeterGroup/!HideMeterGroup bangs, instead of !ShowGroup/!HideGroup. The last pair will show/hide a group of active skins, while the !ShowMeterGroup/!HideMeterGroup will show/hide a group of meters. On your posted code, One is a group of meters (it contains the [Boo] meter). So, replace the [MeasureDate] measure with something like this:<br /><div><div class="codetitle"><b>Code:</b> </div><div class="codecontent"><code>&#91;MeasureDate&#93;<br />Measure=Time<br />Format=%#m.%d<br />IfCondition=(MeasureDate &gt;= 12.02) &amp;&amp; (MeasureDate &lt;= 12.25)<br />IfTrueAction=&#91;!ShowMeterGroup One&#93;<br />IfFalseAction=&#91;!HideMeterGroup One&#93;</code></div></div><p>Statistics: Posted by <a href="http://rainmeter.net/forum/memberlist.php?mode=viewprofile&amp;u=7491">balala</a> — Today, 8:27 am</p><hr />]]></content>
82
+  </entry>
83
+  <entry>
84
+    <author>
85
+      <name><![CDATA[bill98]]></name>
86
+    </author>
87
+    <updated>2015-10-11T14:02:43+00:00</updated>
88
+    <published>2015-10-11T07:36:57+00:00</published>
89
+    <id>http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116380#p116380</id>
90
+    <link href="http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116380#p116380" />
91
+    <title type="html"><![CDATA[Help: Rainmeter Skins • Re: Test if Today is Between 2 Dates]]></title>
92
+    <category term="Help: Rainmeter Skins" scheme="http://rainmeter.net/forum/viewforum.php?f=5" label="Help: Rainmeter Skins" />
93
+    <content type="html" xml:base="http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116380#p116380"><![CDATA[Thanks!  I must have something else wrong, because it always shows the group/Image.<br /><br /><div><div class="codetitle"><b>Code:</b> </div><div class="codecontent"><code>&#91;Variables&#93;<br />@Include1=#@#VariablesM2.inc<br />@Include2=#@#FloatingImage.inc<br />IN=1<br />;Holiday<br /><br />&#91;mIName&#93;<br />Measure=String<br />String=#IN#<br />DynamicVariables=1<br />RegExpSubstitute=1<br />Substitute=&quot;^1$&quot;:&quot;#1IName#&quot;,&quot;^2$&quot;:&quot;#2IName#&quot;,&quot;^3$&quot;:&quot;#3IName#&quot;,&quot;^4$&quot;:&quot;#4IName#&quot;,&quot;^5$&quot;:&quot;#5IName#&quot;,&quot;^6$&quot;:&quot;#6IName#&quot;,&quot;^7$&quot;:&quot;#7IName#&quot;,&quot;^8$&quot;:&quot;#8IName#&quot;,&quot;^9$&quot;:&quot;#9IName#&quot;,&quot;^10$&quot;:&quot;#10IName#&quot;<br /><br />&#91;mSizex&#93;<br />Measure=String<br />String=#IN#<br />DynamicVariables=1<br />RegExpSubstitute=1<br />Substitute=&quot;^1$&quot;:&quot;#1Sizex#&quot;,&quot;^2$&quot;:&quot;#2Sizex#&quot;,&quot;^3$&quot;:&quot;#3Sizex#&quot;,&quot;^4$&quot;:&quot;#4Sizex#&quot;,&quot;^5$&quot;:&quot;#5Sizex#&quot;,&quot;^6$&quot;:&quot;#6Sizex#&quot;,&quot;^7$&quot;:&quot;#7Sizex#&quot;,&quot;^8$&quot;:&quot;#8Sizex#&quot;,&quot;^9$&quot;:&quot;#9Sizex#&quot;,&quot;^10$&quot;:&quot;#10Sizex#&quot;<br /><br />&#91;mSizey&#93;<br />Measure=String<br />String=#IN#<br />DynamicVariables=1<br />RegExpSubstitute=1<br />Substitute=&quot;^1$&quot;:&quot;#1Sizey#&quot;,&quot;^2$&quot;:&quot;#2Sizey#&quot;,&quot;^3$&quot;:&quot;#3Sizey#&quot;,&quot;^4$&quot;:&quot;#4Sizey#&quot;,&quot;^5$&quot;:&quot;#5Sizey#&quot;,&quot;^6$&quot;:&quot;#6Sizey#&quot;,&quot;^7$&quot;:&quot;#7Sizey#&quot;,&quot;^8$&quot;:&quot;#8Sizey#&quot;,&quot;^9$&quot;:&quot;#9Sizey#&quot;,&quot;^10$&quot;:&quot;#10Sizey#&quot;<br /><br />&#91;mXMovemt&#93;<br />Measure=String<br />String=#IN#<br />DynamicVariables=1<br />RegExpSubstitute=1<br />Substitute=&quot;^1$&quot;:&quot;#1XMovemt#&quot;,&quot;^2$&quot;:&quot;#2XMovemt#&quot;,&quot;^3$&quot;:&quot;#3XMovemt#&quot;,&quot;^4$&quot;:&quot;#4XMovemt#&quot;,&quot;^5$&quot;:&quot;#5XMovemt#&quot;,&quot;^6$&quot;:&quot;#6XMovemt#&quot;,&quot;^7$&quot;:&quot;#7XMovemt#&quot;,&quot;^8$&quot;:&quot;#8XMovemt#&quot;,&quot;^9$&quot;:&quot;#9XMovemt#&quot;,&quot;^10$&quot;:&quot;#10XMovemt#&quot;<br /><br />&#91;mYMovemt&#93;<br />Measure=String<br />String=#IN#<br />DynamicVariables=1<br />RegExpSubstitute=1<br />Substitute=&quot;^1$&quot;:&quot;#1YMovemt#&quot;,&quot;^2$&quot;:&quot;#2YMovemt#&quot;,&quot;^3$&quot;:&quot;#3YMovemt#&quot;,&quot;^4$&quot;:&quot;#4YMovemt#&quot;,&quot;^5$&quot;:&quot;#5YMovemt#&quot;,&quot;^6$&quot;:&quot;#6YMovemt#&quot;,&quot;^7$&quot;:&quot;#7YMovemt#&quot;,&quot;^8$&quot;:&quot;#8YMovemt#&quot;,&quot;^9$&quot;:&quot;#9YMovemt#&quot;,&quot;^10$&quot;:&quot;#10YMovemt#&quot;<br /><br />&#91;mUpDDiv&#93;<br />Measure=String<br />String=#IN#<br />DynamicVariables=1<br />RegExpSubstitute=1<br />Substitute=&quot;^1$&quot;:&quot;#1UpDDiv#&quot;,&quot;^2$&quot;:&quot;#2UpDDiv#&quot;,&quot;^3$&quot;:&quot;#3UpDDiv#&quot;,&quot;^4$&quot;:&quot;#4UpDDiv#&quot;,&quot;^5$&quot;:&quot;#5UpDDiv#&quot;,&quot;^6$&quot;:&quot;#6UpDDiv#&quot;,&quot;^7$&quot;:&quot;#7UpDDiv#&quot;,&quot;^8$&quot;:&quot;#8UpDDiv#&quot;,&quot;^9$&quot;:&quot;#9UpDDiv#&quot;,&quot;^10$&quot;:&quot;#10UpDDiv#&quot;<br /><br />&#91;MeasureDate&#93;<br />Measure=Time<br />Format=%#m.%d<br />IfCondition=(MeasureDate &gt;= 12.02) &amp;&amp; (MeasureDate &lt;= 12.25)<br />IfTrueAction=&#91;!ShowGroup One&#93;<br />IfFalseAction=&#91;!HideGroup One&#93;<br /><br /><br />&#91;RX&#93;<br />Measure=Calc<br />Formula=Random<br />UpdateRandom=1<br />LowBound=(#Xc#-(&#91;mSizex&#93;+&#91;mXMovemt&#93;))<br />HighBound=(#Xc#+&#91;mXMovemt&#93;)<br />DynamicVariables=1<br />UpdateDivider=&#91;mUpDDiv&#93;<br /><br /><br />&#91;RY&#93;<br />Measure=Calc<br />Formula=Random<br />UpdateRandom=1<br />LowBound=(#Yc#-(&#91;mSizey&#93;+&#91;mYMovemt&#93;))<br />HighBound=(#Yc#+&#91;mYMovemt&#93;)<br />DynamicVariables=1<br />UpdateDivider=&#91;mUpDDiv&#93;<br /><br />&#91;Boo&#93;<br />Meter=Image<br />ImageName=#@#icons\&#91;mIName&#93;<br />x=&#91;RX&#93;<br />Y=&#91;RY&#93;<br />DynamicVariables=1<br />Group=One<br /><br /><br />&#91;SHData&#93;<br />Meter=String<br />x=900<br />y=50<br />FontSize=15<br />FontColor=0,0,0,255<br />Text=Xc=#Xc##CRLF#Yc=#Yc##CRLF#RX=&#91;RX&#93;#CRLF#RY=&#91;RY&#93;#CRLF#Xmovemt=&#91;mXmovemt&#93;#CRLF#YMovemt=&#91;mYMovemt&#93;#CRLF#UpDDivider=&#91;mUpDDiv&#93;#CRLF#&#91;MeasureDate&#93;</code></div></div><p>Statistics: Posted by <a href="http://rainmeter.net/forum/memberlist.php?mode=viewprofile&amp;u=10741">bill98</a> — Today, 7:36 am</p><hr />]]></content>
94
+  </entry>
95
+  <entry>
96
+    <author>
97
+      <name><![CDATA[balala]]></name>
98
+    </author>
99
+    <updated>2015-10-11T05:42:06+00:00</updated>
100
+    <published>2015-10-11T05:42:06+00:00</published>
101
+    <id>http://rainmeter.net/forum/viewtopic.php?t=21980&amp;p=116379#p116379</id>
102
+    <link href="http://rainmeter.net/forum/viewtopic.php?t=21980&amp;p=116379#p116379" />
103
+    <title type="html"><![CDATA[Help: Rainmeter Skins • Re: Lano Visualizer - computer can't auto-sleep]]></title>
104
+    <category term="Help: Rainmeter Skins" scheme="http://rainmeter.net/forum/viewforum.php?f=5" label="Help: Rainmeter Skins" />
105
+    <content type="html" xml:base="http://rainmeter.net/forum/viewtopic.php?t=21980&amp;p=116379#p116379"><![CDATA[I had the same issue a while ago. I also looked for a fix/solution, but found no one. Finaly I stoped using any visualizer skin. But I also would be interested finding a fix, if it's possible. There is one?<p>Statistics: Posted by <a href="http://rainmeter.net/forum/memberlist.php?mode=viewprofile&amp;u=7491">balala</a> — Today, 5:42 am</p><hr />]]></content>
106
+  </entry>
107
+  <entry>
108
+    <author>
109
+      <name><![CDATA[balala]]></name>
110
+    </author>
111
+    <updated>2015-10-11T05:37:02+00:00</updated>
112
+    <published>2015-10-11T05:37:02+00:00</published>
113
+    <id>http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116378#p116378</id>
114
+    <link href="http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116378#p116378" />
115
+    <title type="html"><![CDATA[Help: Rainmeter Skins • Re: Test if Today is Between 2 Dates]]></title>
116
+    <category term="Help: Rainmeter Skins" scheme="http://rainmeter.net/forum/viewforum.php?f=5" label="Help: Rainmeter Skins" />
117
+    <content type="html" xml:base="http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116378#p116378"><![CDATA[Don't use the IfMatch/IfMatchAction/IfNotMatchAction options, instead try with IfConditions. To do that, you have to properly format the date. Instead of the <span style="background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #869AA8; color: #2E8B57; display: inline; font-family: Monaco,'Andale Mono','Courier New',Courier,monospace; font-size: 1em; font-style: normal; line-height: 1.3em; padding: 0 3px;">Format=%m%d</span>, try this format option: <span style="background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #869AA8; color: #2E8B57; display: inline; font-family: Monaco,'Andale Mono','Courier New',Courier,monospace; font-size: 1em; font-style: normal; line-height: 1.3em; padding: 0 3px;">Format=%m.%d</span>. Now you'll have a date formated as a decimal number (eg for today I have right now 10.11). This way you can use the IfConditions:<br /><div><div class="codetitle"><b>Code:</b> </div><div class="codecontent"><code>&#91;MeasureDate&#93;<br />Measure=Time<br />Format=%#m.%d<br />IfCondition=((MeasureDate&gt;=10.01)&amp;&amp;(MeasureDate&lt;=10.09))<br />IfTrueAction=&#91;!ShowGroup One&#93;<br />IfFalseAction=&#91;!HideGroup One&#93;</code></div></div><br />Two other comments about your code:<br />1. I don't think you'd need the <span style="background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #869AA8; color: #2E8B57; display: inline; font-family: Monaco,'Andale Mono','Courier New',Courier,monospace; font-size: 1em; font-style: normal; line-height: 1.3em; padding: 0 3px;">IfConditionMode=1</span>/<span style="background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #869AA8; color: #2E8B57; display: inline; font-family: Monaco,'Andale Mono','Courier New',Courier,monospace; font-size: 1em; font-style: normal; line-height: 1.3em; padding: 0 3px;">IfMatchMode=1</span> option. Without it, the condition will be checked when the date is changing, with it, on every update cycle. It's useless.<br />2. Even if you'd try to use the IfMatch option, in your code that was wrong: you can't use operators (=, &lt; or &gt;), because we're talking about strings.<p>Statistics: Posted by <a href="http://rainmeter.net/forum/memberlist.php?mode=viewprofile&amp;u=7491">balala</a> — Today, 5:37 am</p><hr />]]></content>
118
+  </entry>
119
+  <entry>
120
+    <author>
121
+      <name><![CDATA[bill98]]></name>
122
+    </author>
123
+    <updated>2015-10-11T03:38:51+00:00</updated>
124
+    <published>2015-10-11T03:38:51+00:00</published>
125
+    <id>http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116377#p116377</id>
126
+    <link href="http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116377#p116377" />
127
+    <title type="html"><![CDATA[Help: Rainmeter Skins • Test if Today is Between 2 Dates]]></title>
128
+    <category term="Help: Rainmeter Skins" scheme="http://rainmeter.net/forum/viewforum.php?f=5" label="Help: Rainmeter Skins" />
129
+    <content type="html" xml:base="http://rainmeter.net/forum/viewtopic.php?t=21982&amp;p=116377#p116377"><![CDATA[Can I do something like this to test if the date is between two dates<br /><br /><br />[MeasureDate]<br />Measure=Time<br />Format=%m%d<br />IfMatch&gt;=1001 &amp;&amp; &lt;=1009<br />IfMatchAction=[!ShowGroup One]<br />IfNotMatchAction=[!HideGroup One]<br />IfMatchMode=1<p>Statistics: Posted by <a href="http://rainmeter.net/forum/memberlist.php?mode=viewprofile&amp;u=10741">bill98</a> — Today, 3:38 am</p><hr />]]></content>
130
+  </entry>
131
+</feed>

+ 36 - 1
spec/models/agents/website_agent_spec.rb

@@ -233,7 +233,7 @@ describe Agents::WebsiteAgent do
233 233
           to_return(body: 'hello',
234 234
                     status: 200)
235 235
         stub_request(:any, /deflate/).with(headers: { 'Accept-Encoding' => /deflate/ }).
236
-          to_return(body: '\xcb\x48\xcd\xc9\xc9\x07\x00\x06\x2c'.force_encoding(Encoding::ASCII_8BIT),
236
+          to_return(body: "\xcb\x48\xcd\xc9\xc9\x07\x00\x06\x2c".b,
237 237
                     headers: { 'Content-Encoding' => 'deflate' },
238 238
                     status: 200)
239 239
 
@@ -529,6 +529,41 @@ describe Agents::WebsiteAgent do
529 529
         end
530 530
       end
531 531
 
532
+      describe "XML with cdata" do
533
+        before do
534
+          stub_request(:any, /cdata_rss/).to_return(
535
+            body: File.read(Rails.root.join("spec/data_fixtures/cdata_rss.atom")),
536
+            status: 200
537
+          )
538
+
539
+          @checker = Agents::WebsiteAgent.new(name: 'cdata', options: {
540
+            'name' => 'CDATA',
541
+            'expected_update_period_in_days' => '2',
542
+            'type' => 'xml',
543
+            'url' => 'http://example.com/cdata_rss.atom',
544
+            'mode' => 'on_change',
545
+            'extract' => {
546
+              'author' => { 'xpath' => '/feed/entry/author/name', 'value' => './/text()'},
547
+              'title' => { 'xpath' => '/feed/entry/title', 'value' => './/text()' },
548
+              'content' => { 'xpath' => '/feed/entry/content', 'value' => './/text()' },
549
+            }
550
+          }, keep_events_for: 2.days)
551
+          @checker.user = users(:bob)
552
+          @checker.save!
553
+        end
554
+
555
+        it "works with XPath" do
556
+          expect {
557
+            @checker.check
558
+          }.to change { Event.count }.by(10)
559
+          event = Event.last
560
+          expect(event.payload['author']).to eq('bill98')
561
+          expect(event.payload['title']).to eq('Help: Rainmeter Skins • Test if Today is Between 2 Dates')
562
+          expect(event.payload['content']).to start_with('Can I ')
563
+        end
564
+
565
+      end
566
+
532 567
       describe "JSON" do
533 568
         it "works with paths" do
534 569
           json = {