Sha256: 660ca1d1816f2f5789995fa1bb71bbd9cc2762f8014a7f05dfe92133d35a4b00
Contents?: true
Size: 819 Bytes
Versions: 59
Compression:
Stored size: 819 Bytes
Contents
# frozen_string_literal: true require 'zaru' require 'fileutils' module Superbot module CLI class NewCommand < Clamp::Command parameter "PATH", "path name to create" do |path| unless path == Zaru.sanitize!(path) raise ArgumentError, "#{path} is not valid name for a directory" end if Dir.exist? path raise ArgumentError, "directory #{path} already exists" end if File.exist? path raise ArgumentError, "#{path} is an existing file" end path end def execute FileUtils.mkdir path File.write File.join(path, "main.rb"), "visit \"http://example.com\"\n" puts """🤖 created directory #{path} with main.rb Start testing with: superbot run #{path} """ end end end end
Version data entries
59 entries across 59 versions & 1 rubygems