Module: Bgem::New

Defined in:
lib/bgem/lib.rb,
lib/bgem/new.rb,
lib/bgem/print_help.rb

Defined Under Namespace

Classes: Lib

Class Method Summary collapse

Class Method Details



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bgem/print_help.rb', line 3

def self.print_help
  puts <<~S
    A CLI to generate new Bgem projects.

    Usage:
      bgem-new TYPE NAME
      
      For example:
        bgem-new lib SomeConstant

      TYPE: the type of the project to be generated.
            Possible values:
              lib
              cli
      NAME: the name of the constant to be worked on in the project.
            Nested constants should be given using ':' as a delimiter.
            
            For example:
              Constant
              Constant:InSomeNested:Namespace
  S
end

.runObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bgem/new.rb', line 3

def self.run
  command, name = ARGV

  case command
  when nil
    require_relative 'print_help'
    print_help
  when 'lib'
    require_relative 'lib'
    Lib.new name
  when 'cli'
    p 'Not implemented yet.'
  else
    p "Unknown command #{command}."
  end
end