Class: RailsInteractive::CLI::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/message.rb

Overview

Utils class for the interactive CLI module

Class Method Summary collapse

Class Method Details

.greetObject



9
10
11
12
# File 'lib/cli/message.rb', line 9

def self.greet
  render_ascii
  puts "Welcome to Rails Interactive CLI".colorize(:yellow)
end

.helpObject



14
15
16
17
18
# File 'lib/cli/message.rb', line 14

def self.help
  puts "bin/interactive new - Create a new Rails Project".colorize(:yellow)
  puts "bin/interactive help - List all commands".colorize(:yellow)
  exit
end

.prepareObject



34
35
36
37
38
39
# File 'lib/cli/message.rb', line 34

def self.prepare
  puts ""
  puts "Project created successfully ✅".colorize(:green)
  puts "Go to your project folder and ready to go 🎉".colorize(:green)
  rails_commands
end

.rails_commandsObject



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/cli/message.rb', line 41

def self.rails_commands
  puts "You can run several commands:".colorize(:green)

  puts "Starts the webpack development server".colorize(:cyan)
  puts "> bin/webpack-dev-server".colorize(:yellow)

  puts "Starts the rails server".colorize(:cyan)
  puts "> bin/rails s or bin/rails server".colorize(:yellow)

  puts "Starts the rails console".colorize(:cyan)
  puts "> bin/rails c or bin/rails console".colorize(:yellow)
end

.render_asciiObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cli/message.rb', line 20

def self.render_ascii
  # rubocop:disable Naming/HeredocDelimiterNaming
  puts <<-'EOF'
  _____       _ _     _____       _                      _   _
 |  __ \     (_) |   |_   _|     | |                    | | (_)
 | |__) |__ _ _| |___  | |  _ __ | |_ ___ _ __ __ _  ___| |_ ___   _____
 |  _  // _` | | / __| | | | '_ \| __/ _ \ '__/ _` |/ __| __| \ \ / / _ \
 | | \ \ (_| | | \__ \_| |_| | | | ||  __/ | | (_| | (__| |_| |\ V /  __/
 |_|  \_\__,_|_|_|___/_____|_| |_|\__\___|_|  \__,_|\___|\__|_| \_/ \___|

  EOF
  # rubocop:enable Naming/HeredocDelimiterNaming
end