Sha256: 7481bf580d6371865d849a659d8e321737008754311a3cda77380387c4fbc50b

Contents?: true

Size: 851 Bytes

Versions: 3

Compression:

Stored size: 851 Bytes

Contents

require "thor/group"  

module NewKata

  class App < Thor::Group
    include Thor::Actions

    argument :name
    
    def self.source_root
      File.dirname(__FILE__)
    end

    def check_name
      begin
        instance_eval("class #{name};end")
      rescue SyntaxError
        puts "The name argument must be usable as a Ruby class name."
        raise ArgumentError
      end
    end
    
    def create_class_file
      template('../templates/lib/skel.rb.tt', "#{name.downcase}/lib/#{name.downcase}.rb")
    end

    def create_spec_file
      template('../templates/spec/skel_spec.rb.tt', "#{name.downcase}/spec/#{name.downcase}_spec.rb")
    end
    
    def copy_config_files
      copy_file "../templates/Gemfile", "#{name.downcase}/Gemfile"
      copy_file "../templates/Guardfile", "#{name.downcase}/Guardfile"
    end

  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newkata-0.8.6 lib/newkata.rb
newkata-0.8.5 lib/newkata.rb
newkata-0.8.3 lib/newkata.rb