Class: Hanami::Cli

Inherits:
Thor
  • Object
show all
Extended by:
CliBase
Defined in:
lib/hanami/cli.rb

Overview

Since:

  • 0.1.0

Instance Method Summary collapse

Methods included from CliBase

define_commands

Instance Method Details

#consoleObject

Since:

  • 0.1.0



80
81
82
83
84
85
86
# File 'lib/hanami/cli.rb', line 80

def console
  if options[:help]
    invoke :help, ['console']
  else
    Hanami::Commands::Console.new(options).start
  end
end

#new(application_name = nil) ⇒ Object

Since:

  • 0.1.0



107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/hanami/cli.rb', line 107

def new(application_name=nil)
  if options[:help]
    invoke :help, ['new']
  elsif application_name.nil?
    warn %(`hanami new` was called with no arguments\nUsage: `hanami new PROJECT_NAME`)
    exit(1)
  elsif options[:architecture] == 'app'
    Hanami::Commands::New::App.new(options, application_name).start
  else
    Hanami::Commands::New::Container.new(options, application_name).start
  end
end

#rackserverObject

Since:

  • 0.1.0



61
62
63
64
65
66
67
68
# File 'lib/hanami/cli.rb', line 61

def rackserver
  if options[:help]
    invoke :help, ['rackserver']
  else
    require 'hanami/server'
    Hanami::Server.new(options).start
  end
end

#routesObject

Since:

  • 0.1.0



126
127
128
129
130
131
132
133
# File 'lib/hanami/cli.rb', line 126

def routes
  if options[:help]
    invoke :help, ['routes']
  else
    require 'hanami/commands/routes'
    Hanami::Commands::Routes.new(options).start
  end
end

#serverObject

Since:

  • 0.1.0



41
42
43
44
45
46
47
48
# File 'lib/hanami/cli.rb', line 41

def server
  if options[:help]
    invoke :help, ['server']
  else
    require 'hanami/commands/server'
    Hanami::Commands::Server.new(options).start
  end
end

#versionObject

Since:

  • 0.1.0



16
17
18
19
# File 'lib/hanami/cli.rb', line 16

def version
  require 'hanami/version'
  puts "v#{ Hanami::VERSION }"
end