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



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/camping/commands.rb', line 373

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()

  # 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



367
368
369
370
371
# File 'lib/camping/commands.rb', line 367

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