Sha256: 9af43602c00ef6ef5d14150fc6e6d54a166108391a39bffc6f189f49f2422094

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

require_relative '../command'

module Sumcli
  module Commands
    class New < Sumcli::Command
      def initialize(name, options)
        @name = name
        @options = options
      end

      def execute(input: $stdin, output: $stdout)
        output.puts "OK"

        unless @name.nil? or File.directory?(@name)
          directory = File.expand_path('../../templates/new/app', __FILE__)
          generator.copy_directory(directory, @name)
          return File.chmod(0744, "#{@name}/bin/console")
        end

        output.puts "Directory #{@name} already exists."
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sumcli-0.6.0 lib/sumcli/commands/new.rb
sumcli-0.4.0 lib/sumcli/commands/new.rb