Sha256: e44c0328cc3d3187d51d84a4255e27f7bbb66794910314195f40b6cf1d198512

Contents?: true

Size: 1.75 KB

Versions: 5

Compression:

Stored size: 1.75 KB

Contents

# frozen_string_literal: true

require "colorize"

module RailsInteractive
  class CLI
    # Utils class for the interactive CLI module
    class Message
      def self.greet
        render_ascii
        puts "Welcome to Rails Interactive CLI".colorize(:yellow)
      end

      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

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

        EOF
        # rubocop:enable Naming/HeredocDelimiterNaming
      end

      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

      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails-interactive-2.1.3 lib/cli/message.rb
rails-interactive-2.1.2 lib/cli/message.rb
rails-interactive-2.1.1 lib/cli/message.rb
rails-interactive-2.1.0 lib/cli/message.rb
rails-interactive-2.0.0 lib/cli/message.rb