Class: Camping::Commands

Inherits:
Object show all
Defined in:
lib/camping/commands.rb

Class Method Summary collapse

Class Method Details

.new_cmd(app_name = :Camp) ⇒ Object



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/camping/commands.rb', line 443

def new_cmd(app_name=:Camp)

  # Normalize the app_name
  Camping::CommandsHelpers.app_name_from_input(app_name) => {app_name:, snake_name:, camel_name:}

  # make a directory then move there.
  # _original_dir = Dir.pwd
  Dir.mkdir("#{snake_name}") unless Dir.exist?("#{snake_name}")
  Dir.chdir("#{snake_name}")

  # generate a new camping app in a directory named after it:
  Generators::make_camp_file(camel_name)
  Generators::make_gitignore()
  Generators::make_rakefile()
  Generators::make_ruby_version()
  Generators::make_configkdl()
  Generators::make_gemfile()
  Generators::make_readme()
  Generators::make_public_folder()
  Generators::make_test_folder()
  Generators::make_test_helper()

  # optionally add omnibus support
    # add src/ folder
    # add lib/ folder
    # add views/ folder

  # optionally add a local database too, through guidebook
    # add db/ folder
    # add db/migrate folder
    # add db/config.kdl
    # append migrations stuff to Rakefile.
    `ls`
end

.routes(theApp = Camping, silent = false) ⇒ Object

A helper method to spit out Routes for an application



437
438
439
440
441
# File 'lib/camping/commands.rb', line 437

def routes(theApp = Camping, silent = false)
  routes = Camping::CommandsHelpers::RoutesParser.parse theApp
  routes.display unless silent == true
  return routes
end