semantic_puppet 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cc51e7ab0b07b0b4c1979c14793404659c9720a
4
- data.tar.gz: 3227968773bf344fc65892aad90f6f0fd05647ae
3
+ metadata.gz: f3b8c9749c1289e2571d5252ea6bd1a464545d9f
4
+ data.tar.gz: c73441801b17011eb978062596b86216bcb224f1
5
5
  SHA512:
6
- metadata.gz: 08852e7be254e66d9ca6c3b577535d127326132f63b13c9c1989092057398e5e9a4471264f85219b884b0b16eceef7e6873bbaee4ea6bdf6b0d6bb2f4c79a3c9
7
- data.tar.gz: 2be83a97af2b3533fdf0b77c9bbf85d6216e66a3ef88c721d60843411541dc1c36493e6ea75acca75cd72ddac0a7929106a44f3118c28e0c60f4163898e6c406
6
+ metadata.gz: 5bf4ca513a1edde4040868602fb1ff4b92d849681547cfb11a8e7f274c1b169ff61eec066fcfd1c5ba9b9178fd6c3cfa91b508bf126706163ea73ccd6836bc95
7
+ data.tar.gz: 72d5a7cf4727fc5d84adff17884d433de4ee0d985bcccd4cab1170a33346d3bea81ed69df5f7c9b8f75161acc5ed812bf259db1ef915e82626b2649b6f4a97f8
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## 1.0.1 - 2017-07-01
6
+ - Fix bug causing pre-release identifiers being considered invalid when they contained letters but started with a zero
7
+
5
8
  ## 1.0.0 - 2017-04-05
6
9
  - Complete rewrite of the VersionRange to make it compatible with Node Semver
7
10
  - General speedup of Version (hash, <=>, and to_s in particular)
@@ -1,3 +1,3 @@
1
1
  module SemanticPuppet
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -30,7 +30,7 @@ module SemanticPuppet
30
30
  false
31
31
  else
32
32
  prerelease = match[4]
33
- prerelease.nil? || prerelease.split('.').all? { |x| !(x =~ /^0\d+/) }
33
+ prerelease.nil? || prerelease.split('.').all? { |x| !(x =~ /^0\d+$/) }
34
34
  end
35
35
  end
36
36
 
@@ -351,22 +351,199 @@ describe SemanticPuppet::Version do
351
351
  end
352
352
 
353
353
  describe '.valid?' do
354
- # All the specific variations are tested in the .parse tests, so these are just basic
355
- # smoke tests.
356
-
357
354
  def subject(str)
358
355
  SemanticPuppet::Version.valid?(str)
359
356
  end
360
357
 
361
- it 'recognizes valid versions' do
362
- expect(subject('1.0.1')).to be true
363
- expect(subject('1.0.3-p324')).to be true
358
+ context 'Spec v2.0.0' do
359
+ context 'Section 2' do
360
+ # A normal version number MUST take the form X.Y.Z where X, Y, and Z are
361
+ # non-negative integers, and MUST NOT contain leading zeroes. X is the
362
+ # major version, Y is the minor version, and Z is the patch version.
363
+
364
+ it 'rejects versions that contain too few parts' do
365
+ expect(subject('1.2')).to be false
366
+ end
367
+
368
+ it 'rejects versions that contain too many parts' do
369
+ expect(subject('1.2.3.4')).to be false
370
+ end
371
+
372
+ it 'rejects versions that contain non-integers' do
373
+ expect(subject('x.2.3')).to be false
374
+ expect(subject('1.y.3')).to be false
375
+ expect(subject('1.2.z')).to be false
376
+ end
377
+
378
+ it 'rejects versions that contain negative integers' do
379
+ expect(subject('-1.2.3')).to be false
380
+ expect(subject('1.-2.3')).to be false
381
+ expect(subject('1.2.-3')).to be false
382
+ end
383
+
384
+ it 'rejects version numbers containing leading zeroes' do
385
+ expect(subject('01.2.3')).to be false
386
+ expect(subject('1.02.3')).to be false
387
+ expect(subject('1.2.03')).to be false
388
+ end
389
+
390
+ it 'permits zeroes in version number parts' do
391
+ expect(subject('0.2.3')).to be true
392
+ expect(subject('1.0.3')).to be true
393
+ expect(subject('1.2.0')).to be true
394
+ end
395
+ end
396
+
397
+ context 'Section 9' do
398
+ # A pre-release version MAY be denoted by appending a hyphen and a
399
+ # series of dot separated identifiers immediately following the patch
400
+ # version. Identifiers MUST comprise only ASCII alphanumerics and
401
+ # hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric
402
+ # identifiers MUST NOT include leading zeroes. Pre-release versions
403
+ # have a lower precedence than the associated normal version. A
404
+ # pre-release version indicates that the version is unstable and
405
+ # might not satisfy the intended compatibility requirements as denoted
406
+ # by its associated normal version.
407
+ # Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.
408
+
409
+ it 'rejects prerelease identifiers with non-alphanumerics' do
410
+ expect(subject('1.2.3-$100')).to be false
411
+ expect(subject('1.2.3-rc.1@me')).to be false
412
+ end
413
+
414
+ it 'rejects empty prerelease versions' do
415
+ expect(subject('1.2.3-')).to be false
416
+ end
417
+
418
+ it 'rejects empty prerelease version identifiers' do
419
+ expect(subject('1.2.3-.rc1')).to be false
420
+ expect(subject('1.2.3-rc1.')).to be false
421
+ expect(subject('1.2.3-rc..1')).to be false
422
+ end
423
+
424
+ it 'rejects numeric prerelease identifiers with leading zeroes' do
425
+ expect(subject('1.2.3-01')).to be false
426
+ expect(subject('1.2.3-rc.01')).to be false
427
+ end
428
+
429
+ it 'permits numeric prerelease identifiers of zero' do
430
+ expect(subject('1.2.3-0')).to be true
431
+ expect(subject('1.2.3-rc.0')).to be true
432
+ end
433
+
434
+ it 'permits non-numeric prerelease identifiers' do
435
+ expect(subject('1.2.3-DEADBEEF')).to be true
436
+ expect(subject('1.2.3-DE.AD.BE.EF')).to be true
437
+ expect(subject('2.1.0-12-BE-EF')).to be true
438
+ end
439
+
440
+ it 'permits non-numeric prerelease identifiers with leading zeroes' do
441
+ expect(subject('1.2.3-0xDEADBEEF')).to be true
442
+ expect(subject('1.2.3-rc.0x10c')).to be true
443
+ expect(subject('2.1.0-0016-13fae4a9')).to be true
444
+ end
445
+ end
446
+
447
+ context 'Section 10' do
448
+ # Build metadata MAY be denoted by appending a plus sign and a series
449
+ # of dot separated identifiers immediately following the patch or
450
+ # pre-release version. Identifiers MUST comprise only ASCII
451
+ # alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty.
452
+ # Build metadata SHOULD be ignored when determining version precedence.
453
+ # Thus two versions that differ only in the build metadata, have the
454
+ # same precedence.
455
+ # Examples: 1.0.0-alpha+001, 1.0.0+20130313144700,
456
+ # 1.0.0-beta+exp.sha.5114f85.
457
+
458
+ it 'rejects build identifiers with non-alphanumerics' do
459
+ expect(subject('1.2.3+$100')).to be false
460
+ expect(subject('1.2.3+rc.1@me')).to be false
461
+ end
462
+
463
+ it 'rejects empty build metadata' do
464
+ expect(subject('1.2.3+')).to be false
465
+ end
466
+
467
+ it 'rejects empty build identifiers' do
468
+ expect(subject('1.2.3+.rc1')).to be false
469
+ expect(subject('1.2.3+rc1.')).to be false
470
+ expect(subject('1.2.3+rc..1')).to be false
471
+ end
472
+
473
+ it 'permits numeric build identifiers with leading zeroes' do
474
+ expect(subject('1.2.3+01')).to be true
475
+ expect(subject('1.2.3+rc.01')).to be true
476
+ end
477
+
478
+ it 'permits numeric build identifiers of zero' do
479
+ expect(subject('1.2.3+0')).to be true
480
+ expect(subject('1.2.3+rc.0')).to be true
481
+ end
482
+
483
+ it 'permits non-numeric build identifiers with leading zeroes' do
484
+ expect(subject('1.2.3+0xDEADBEEF')).to be true
485
+ expect(subject('1.2.3+rc.0x10c')).to be true
486
+ end
487
+ end
364
488
  end
365
489
 
366
- it 'does not recognize invalid versions' do
367
- expect(subject('1.0')).to be false # too few segments
368
- expect(subject('1.0.3.6')).to be false # too many segments
369
- expect(subject('1.03.14')).to be false # leading zero in segment
490
+ context 'Spec v1.0.0' do
491
+ context 'Section 2' do
492
+ # A normal version number MUST take the form X.Y.Z where X, Y, and Z
493
+ # are integers. X is the major version, Y is the minor version, and Z
494
+ # is the patch version.
495
+
496
+ it 'rejects versions that contain too few parts' do
497
+ expect(subject('1.2')).to be false
498
+ end
499
+
500
+ it 'rejects versions that contain too many parts' do
501
+ expect(subject('1.2.3.4')).to be false
502
+ end
503
+
504
+ it 'rejects versions that contain non-integers' do
505
+ expect(subject('x.2.3')).to be false
506
+ expect(subject('1.y.3')).to be false
507
+ expect(subject('1.2.z')).to be false
508
+ end
509
+
510
+ it 'permits zeroes in version number parts' do
511
+ expect(subject('0.2.3')).to be true
512
+ expect(subject('1.0.3')).to be true
513
+ expect(subject('1.2.0')).to be true
514
+ end
515
+ end
516
+
517
+ context 'Section 4' do
518
+ # A pre-release version number MAY be denoted by appending an arbitrary
519
+ # string immediately following the patch version and a dash. The string
520
+ # MUST be comprised of only alphanumerics plus dash [0-9A-Za-z-].
521
+ # Pre-release versions satisfy but have a lower precedence than the
522
+ # associated normal version. Precedence SHOULD be determined by
523
+ # lexicographic ASCII sort order.
524
+ # For instance: 1.0.0-alpha1 < 1.0.0-beta1 < 1.0.0-beta2 < 1.0.0-rc1
525
+
526
+ it 'rejects prerelease identifiers with non-alphanumerics' do
527
+ expect(subject('1.2.3-$100')).to be false
528
+ expect(subject('1.2.3-rc.1@me')).to be false
529
+ end
530
+
531
+ it 'rejects empty prerelease versions' do
532
+ expect(subject('1.2.3-')).to be false
533
+ end
534
+
535
+ it 'rejects numeric prerelease identifiers with leading zeroes' do
536
+ expect(subject('1.2.3-01')).to be false
537
+ end
538
+
539
+ it 'permits numeric prerelease identifiers of zero' do
540
+ expect(subject('1.2.3-0')).to be true
541
+ end
542
+
543
+ it 'permits non-numeric prerelease identifiers with leading zeroes' do
544
+ expect(subject('1.2.3-0xDEADBEEF')).to be true
545
+ end
546
+ end
370
547
  end
371
548
  end
372
549
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-26 00:00:00.000000000 Z
11
+ date: 2017-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gettext-setup