Sha256: 155f67be7c910b31e0a0d19f302dde2f8fedbd6106a0a01f1eaab5b74ded6907
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
# https://github.com/piotrmurach/tty-prompt require 'thor' require 'tty-prompt' require 'tty-file' require 'tty-spinner' module Dx class CLI < Thor include Thor::Actions def self.source_root File.dirname(__FILE__) + '/../' end desc "Login", "Login to application" def login # USER PROMPT prompt = TTY::Prompt.new(interrupt: :exit) email = prompt.ask('Email :', required: true) do |q| q.validate(:email, 'Invalid email address') end password = prompt.mask('Password :', required: true) do |q| q.validate(/^.{8,}$/, 'Password is too short') end # Verification if email && password Deemx::Auth.login(email,password) ? \ prompt.ok('You are now logged in!') : \ prompt.error('Invalid credentials') else prompt.say('Bye.') end end desc 'Start folder', 'Copy selected folder' def init(project_name) directory "templates/pug", project_name end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dx-0.1.0 | lib/dx/cli.rb |