Sha256: e71a5f380f2881b866d1f33c085ad048c83ac98abe2f4c2105b1db5065013b1c

Contents?: true

Size: 1.6 KB

Versions: 6

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true

require "colorize"

module RailsInteractive
  # 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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails-interactive-0.1.9 lib/rails_interactive/message.rb
rails-interactive-0.1.8 lib/rails_interactive/message.rb
rails-interactive-0.1.7 lib/rails_interactive/message.rb
rails-interactive-0.1.6 lib/rails_interactive/message.rb
rails-interactive-0.1.5 lib/rails_interactive/message.rb
rails-interactive-0.1.4 lib/rails_interactive/message.rb