Sha256: a24d62f8862f98030e73286f4071e0461b9333f4ca861b9559c84b20ea9c92ee

Contents?: true

Size: 936 Bytes

Versions: 3

Compression:

Stored size: 936 Bytes

Contents

module Skellington
  class Generator
    attr_reader :path, :filename, :camelname, :files, :gems
    attr_accessor :licensee

    def initialize path
      @full_path = path
      @path = File.dirname @full_path
      @filename = File.basename(@full_path)
      @camelname = Skellington.camelise(wormname)
      @gems = config['gems']
      @files = config['files']
    end

    def config
      @config ||= YAML.load File.read File.join File.dirname(__FILE__), '..', '..', 'config/config.yaml'
    end

    def run
      generate
      git_init
      post_run
    end

    def generate
      @files.each do |k, v|
        t = Template.new k, self
        t.write
      end
    end

    def wormname
      @filename.gsub('-', '_')
    end

    def renamed
      @filename != wormname
    end

    def git_init
      Git.init wormname
    end

    def post_run
      t = Template.new 'post-run', self
      puts t.to_s
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
skellington-0.4.13 lib/skellington/generator.rb
skellington-0.4.11 lib/skellington/generator.rb
skellington-0.4.10 lib/skellington/generator.rb