Sha256: 90d2672f0e53ca82c0649cb6ce5e35f671a267c61190ce30f429926004558342

Contents?: true

Size: 572 Bytes

Versions: 12

Compression:

Stored size: 572 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.exist?(destination_path)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ruboty-1.3.1 lib/ruboty/commands/generate.rb
ruboty-1.3.0 lib/ruboty/commands/generate.rb
ruboty-1.2.4 lib/ruboty/commands/generate.rb
ruboty-1.2.3 lib/ruboty/commands/generate.rb
ruboty-1.2.2 lib/ruboty/commands/generate.rb
ruboty-1.2.1 lib/ruboty/commands/generate.rb
ruboty-1.2.0 lib/ruboty/commands/generate.rb
ruboty-1.1.9 lib/ruboty/commands/generate.rb
ruboty-1.1.8 lib/ruboty/commands/generate.rb
ruboty-1.1.7 lib/ruboty/commands/generate.rb
ruboty-1.1.6 lib/ruboty/commands/generate.rb
ruboty-1.1.5 lib/ruboty/commands/generate.rb