dtf 0.2.6 → 0.2.7
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.
- data/bin/dtf +1 -1
- data/doc/AnalysisCase.html +1 -1
- data/doc/CaseTest.html +1 -1
- data/doc/Dtf.html +5 -3
- data/doc/Dtf/{DtfCommands.html → Command.html} +327 -103
- data/doc/Dtf/HelpSystem.html +128 -0
- data/doc/User.html +1 -1
- data/doc/VerificationSuite.html +1 -1
- data/doc/_index.html +17 -2
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +16 -8
- data/doc/top-level-namespace.html +11 -23
- data/lib/dtf.rb +65 -11
- data/lib/dtf/error_system.rb +4 -4
- data/lib/dtf/help_system.rb +48 -44
- data/lib/dtf/version.rb +1 -1
- metadata +4 -3
data/lib/dtf/error_system.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# Reusable error response method
|
3
|
-
def raise_error
|
3
|
+
def raise_error(cmd)
|
4
4
|
raise ArgumentError
|
5
5
|
rescue
|
6
|
-
$stderr.puts "ERROR! #{
|
7
|
-
$stderr.puts "See 'dtf #{
|
6
|
+
$stderr.puts "ERROR! #{cmd} did not receive all required options."
|
7
|
+
$stderr.puts "See 'dtf #{cmd} -h' for help with this sub-command"
|
8
8
|
|
9
9
|
# Set non-zero exit value on error, for scripting use.
|
10
10
|
abort()
|
11
11
|
end
|
12
12
|
|
13
|
-
def display_errors()
|
13
|
+
def display_errors(cmd)
|
14
14
|
# TODO: Refactor error display to take sub-command as an arg
|
15
15
|
# and display obj.errors.messages.each properly for each arg type.
|
16
16
|
end
|
data/lib/dtf/help_system.rb
CHANGED
@@ -2,54 +2,58 @@
|
|
2
2
|
# DTF Help System
|
3
3
|
require 'trollop' # Used to implement help system
|
4
4
|
|
5
|
+
module Dtf::HelpSystem
|
6
|
+
|
7
|
+
# List of all sub-commands known within the Help System
|
5
8
|
SUB_COMMANDS = %w(create_user delete_user create_vs delete_vs)
|
6
9
|
|
7
|
-
# Global options default to '--version|-v' and '--help|-h'
|
8
|
-
global_opts = Trollop::options do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
# Global options default to '--version|-v' and '--help|-h'
|
11
|
+
global_opts = Trollop::options do
|
12
|
+
version "DTF v#{Dtf::VERSION}"
|
13
|
+
banner <<-EOS
|
14
|
+
#{version}
|
15
|
+
(c) Copyright 2012 David Deryl Downey / Deryl R. Doucette. All Rights Reserved.
|
16
|
+
This is free software; see the LICENSE file for copying conditions.
|
17
|
+
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
15
18
|
|
16
|
-
|
17
|
-
|
19
|
+
Usage:
|
20
|
+
dtf -v|--version -h|--help [[sub_cmds <options>] -h|--help]
|
18
21
|
|
19
|
-
|
20
|
-
|
22
|
+
Valid [sub_cmds] are: create_(user|vs), delete_(user|vs)
|
23
|
+
See 'dtf [sub_cmd] -h' for each sub_cmd's details and options
|
21
24
|
|
22
|
-
EOS
|
23
|
-
|
24
|
-
end
|
25
|
+
EOS
|
26
|
+
stop_on SUB_COMMANDS
|
27
|
+
end
|
25
28
|
|
26
|
-
|
27
|
-
@
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
29
|
+
@cmd = ARGV.shift
|
30
|
+
@cmd_opts = case @cmd
|
31
|
+
when "create_user"
|
32
|
+
Trollop::options do
|
33
|
+
opt(:user_name, desc="Username for new TF user - REQUIRED", opts={:type => :string, :short => '-u'})
|
34
|
+
opt(:full_name, desc="Real name for new TF user - REQUIRED", opts={:type => :string, :short => '-n'})
|
35
|
+
opt(:email_address, desc="Email address for new TF user - REQUIRED", opts={:type => :string, :short => '-e'})
|
36
|
+
end
|
37
|
+
when "create_vs"
|
38
|
+
Trollop::options do
|
39
|
+
opt(:user_name, desc="TF user to associate this VS with - REQUIRED", opts={:type => :string, :short => '-u'})
|
40
|
+
opt(:name, desc="Name for new VS - REQUIRED", opts={:type => :string, :short => '-n'})
|
41
|
+
opt(:description, desc="Description of VS's intended use - OPTIONAL", opts={:type => :string, :short => '-d', :default => ''})
|
42
|
+
end
|
43
|
+
when "delete_user"
|
44
|
+
Trollop::options do
|
45
|
+
opt(:user_name, desc="Username of TF user to delete - REQUIRED", opts={:type => :string, :short => '-u'})
|
46
|
+
opt(:delete_all, desc="Delete _all_ VSs this user owns", :type => :flag, :default => true)
|
47
|
+
end
|
48
|
+
when "delete_vs"
|
49
|
+
Trollop::options do
|
50
|
+
opt(:user_name, desc="Username of VS owner - REQUIRED", opts={:type => :string, :short => '-u'})
|
51
|
+
opt(:id, desc="ID of VS to be deleted - REQUIRED", opts={:type => :int, :short => '-i'})
|
52
|
+
end
|
53
|
+
when nil
|
54
|
+
Trollop::die "No command specified! Please specify an applicable command"
|
55
|
+
else
|
56
|
+
Trollop::die "Unknown DTF sub-command: #{@cmd.inspect}"
|
45
57
|
end
|
46
|
-
|
47
|
-
|
48
|
-
opt(:user_name, desc="Username of VS owner - REQUIRED", opts={:type => :string, :short => '-u'})
|
49
|
-
opt(:id, desc="ID of VS to be deleted - REQUIRED", opts={:type => :int, :short => '-i'})
|
50
|
-
end
|
51
|
-
when nil
|
52
|
-
Trollop::die "No command specified! Please specify an applicable command"
|
53
|
-
else
|
54
|
-
Trollop::die "Unknown DTF sub-command: #{@cmd.inspect}"
|
55
|
-
end
|
58
|
+
|
59
|
+
end
|
data/lib/dtf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dtf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -302,7 +302,8 @@ files:
|
|
302
302
|
- doc/AnalysisCase.html
|
303
303
|
- doc/CaseTest.html
|
304
304
|
- doc/Dtf.html
|
305
|
-
- doc/Dtf/
|
305
|
+
- doc/Dtf/Command.html
|
306
|
+
- doc/Dtf/HelpSystem.html
|
306
307
|
- doc/User.html
|
307
308
|
- doc/VerificationSuite.html
|
308
309
|
- doc/_index.html
|