trollop 1.8.1 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,11 @@
1
- == 1.8.1 / 2008-06-24
1
+ == 1.8.2 / 2008-06-25
2
+ * Bugfix for #conflicts and #depends error messages
2
3
 
4
+ == 1.8.1 / 2008-06-24
3
5
  * Bugfix for short option autocreation
4
6
  * More aggressive documentation
5
7
 
6
8
  == 1.8 / 2008-06-16
7
-
8
9
  * Sub-command support via Parser#stop_on
9
10
 
10
11
  == 1.7.2 / 2008-01-16
data/Rakefile CHANGED
@@ -23,7 +23,7 @@ end
23
23
 
24
24
  WWW_FILES = FileList["www/*"] + %w(README.txt FAQ.txt)
25
25
  task :upload_webpage => WWW_FILES do |t|
26
- sh "scp -C #{t.prerequisites * ' '} wmorgan@rubyforge.org:/var/www/gforge-projects/trollop/"
26
+ sh "rsync -Paz -essh #{t.prerequisites * ' '} wmorgan@rubyforge.org:/var/www/gforge-projects/trollop/"
27
27
  end
28
28
 
29
29
  task :upload_docs => [:docs] do |t|
@@ -5,7 +5,7 @@
5
5
 
6
6
  module Trollop
7
7
 
8
- VERSION = "1.8.1"
8
+ VERSION = "1.8.2"
9
9
 
10
10
  ## Thrown by Parser in the event of a commandline error. Not needed if
11
11
  ## you're using the Trollop::options entry.
@@ -289,9 +289,9 @@ class Parser
289
289
 
290
290
  case type
291
291
  when :depends
292
- syms.each { |sym| raise CommandlineError, "--#{@long[constraint_sym]} requires --#{@long[sym]}" unless found[sym] }
292
+ syms.each { |sym| raise CommandlineError, "--#{@specs[constraint_sym][:long]} requires --#{@specs[sym][:long]}" unless found[sym] }
293
293
  when :conflicts
294
- syms.each { |sym| raise CommandlineError, "--#{@long[constraint_sym]} conflicts with --#{@long[sym]}" if found[sym] && sym != constraint_sym }
294
+ syms.each { |sym| raise CommandlineError, "--#{@specs[constraint_sym][:long]} conflicts with --#{@specs[sym][:long]}" if found[sym] && sym != constraint_sym }
295
295
  end
296
296
  end
297
297
 
@@ -438,6 +438,20 @@ EOM
438
438
  assert_raises(CommandlineError) { opts = @p.parse %w(--one --mellow --two --jello) }
439
439
  end
440
440
 
441
+ def test_conflict_error_messages
442
+ @p.opt :one
443
+ @p.opt "two"
444
+ @p.conflicts :one, "two"
445
+
446
+ begin
447
+ @p.parse %w(--one --two)
448
+ flunk "no error thrown"
449
+ rescue CommandlineError => e
450
+ assert_match(/--one/, e.message)
451
+ assert_match(/--two/, e.message)
452
+ end
453
+ end
454
+
441
455
  def test_depends
442
456
  @p.opt :one
443
457
  assert_raises(ArgumentError) { @p.depends :one, :two }
@@ -465,6 +479,30 @@ EOM
465
479
  assert_raises(CommandlineError) { opts = @p.parse %w(--mellow --two --jello --one) }
466
480
  end
467
481
 
482
+ def test_depend_error_messages
483
+ @p.opt :one
484
+ @p.opt "two"
485
+ @p.depends :one, "two"
486
+
487
+ assert_nothing_raised { @p.parse %w(--one --two) }
488
+
489
+ begin
490
+ @p.parse %w(--one)
491
+ flunk "no error thrown"
492
+ rescue CommandlineError => e
493
+ assert_match(/--one/, e.message)
494
+ assert_match(/--two/, e.message)
495
+ end
496
+
497
+ begin
498
+ @p.parse %w(--two)
499
+ flunk "no error thrown"
500
+ rescue CommandlineError => e
501
+ assert_match(/--one/, e.message)
502
+ assert_match(/--two/, e.message)
503
+ end
504
+ end
505
+
468
506
  ## courtesy neill zero
469
507
  def test_two_required_one_missing_accuses_correctly
470
508
  @p.opt "arg1", "desc1", :required => true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trollop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Morgan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-24 00:00:00 -07:00
12
+ date: 2008-06-25 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15