Class: Jury::CommandLineInterface
- Inherits:
-
Object
- Object
- Jury::CommandLineInterface
- Includes:
- Tchk
- Defined in:
- lib/jury/command_line_interface.rb
Instance Method Summary collapse
-
#create_filesystem ⇒ Object
CB(2), BB(4).
-
#main(argv) ⇒ Object
US(3).
-
#show_help_message ⇒ Object
BB(3,1), BB(3,3).
Methods included from Tchk
#is_array_of_T, #is_string, #type_error
Instance Method Details
#create_filesystem ⇒ Object
CB(2), BB(4)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jury/command_line_interface.rb', line 13 def create_filesystem # CB(2), BB(4) # PRECONDITION -- current_directory not inside/under template_directory current_directory = Dir.pwd template_directory = File.(File.join(File.dirname(__FILE__), '..', '..', 'template')) set_of_files = Dir.glob(File.join(template_directory, "*")) FileUtils.cp_r set_of_files, current_directory # The above copy will not create empty directories, it seems. Either that, # or gem metadata refuses to accept that an empty template/spec directory # holds value to me. To work around this problem, we will need to create # this directory manually if it doesn't already exist. spec_directory = File.join(current_directory, "spec") FileUtils.mkdir(spec_directory) if !File.directory?(spec_directory) end |
#main(argv) ⇒ Object
US(3)
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/jury/command_line_interface.rb', line 38 def main(argv) # US(3) type_error if !is_array_of_T(argv, String, 1) @argv = argv if !argv[1].nil? then command = argv[1].downcase else command = 'help' end case command when 'init' create_filesystem # BB(3,2) else # BB(3,1) /\ BB(3,3) end end |
#show_help_message ⇒ Object
BB(3,1), BB(3,3)
28 29 30 31 32 33 34 35 36 |
# File 'lib/jury/command_line_interface.rb', line 28 def # BB(3,1), BB(3,3) puts <<EOM USAGE: #{@argv[0]} <command> <...> Commands supported includes: init - initialize a new Jury instance. help - show this message. EOM end |