Sha256: da655883f0428d503e498e7db67162268fadc5358995d3c42547efcfc7e0df04

Contents?: true

Size: 647 Bytes

Versions: 3

Compression:

Stored size: 647 Bytes

Contents

require "thor/actions"
require "thor/group"

module Prez
  class New < Thor::Group
    include Thor::Actions
    argument :name, type: :string

    def check_file!
      if File.exists? filename
        raise Prez::Error.new("There is already a presentation file named '#{filename}'")
      end
    end

    def generate_prez
      template "new.prez.tt", "#{name}.prez"
    end

    private

    def filename
      if name =~ /\.prez$/
        name
      else
        "#{name}.prez"
      end
    end

    class << self
      def source_root
        File.absolute_path File.expand_path("../../../templates", __FILE__)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prez-0.1.2 lib/prez/new.rb
prez-0.1.1 lib/prez/new.rb
prez-0.1.0 lib/prez/new.rb