Sha256: 65420525b097bd262f69aceb32d08ada7f472701236c80b742a35b02209a3fce

Contents?: true

Size: 573 Bytes

Versions: 10

Compression:

Stored size: 573 Bytes

Contents

require "fileutils"

module Ruboty
  module Commands
    class Generate < Base
      def call
        valid? ? copy : die
      end

      private

      def copy
        FileUtils.cp_r(templates_directory_path, destination_path)
      end

      def die
        Ruboty.die("#{destination_path} already exists.")
      end

      def templates_directory_path
        File.expand_path("../../../../templates", __FILE__)
      end

      def destination_path
        "./ruboty/"
      end

      def valid?
        !File.exists?(destination_path)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruboty-1.1.4 lib/ruboty/commands/generate.rb
ruboty-1.1.3 lib/ruboty/commands/generate.rb
ruboty-1.1.2 lib/ruboty/commands/generate.rb
ruboty-1.1.1 lib/ruboty/commands/generate.rb
ruboty-1.1.0 lib/ruboty/commands/generate.rb
ruboty-1.0.4 lib/ruboty/commands/generate.rb
ruboty-1.0.3 lib/ruboty/commands/generate.rb
ruboty-1.0.2 lib/ruboty/commands/generate.rb
ruboty-1.0.1 lib/ruboty/commands/generate.rb
ruboty-1.0.0 lib/ruboty/commands/generate.rb