lib/gemstone.rb in gemstone-0.3 vs lib/gemstone.rb in gemstone-0.4

- old
+ new

@@ -1,11 +1,11 @@ require 'erb' require 'fileutils' module GemStone - VERSION = '0.3' + VERSION = '0.4' class MissingOption < Exception; end class CLI @@ -87,15 +87,20 @@ # 'My gem' => 'MyGem' def classify(gem_name) gem_name.strip.split.map{ |word| word.capitalize}.join.gsub(' ', '') end + def render_file(path, result_file_path = path) - source_path = File.join 'template', path + source_path = File.join template_path, path result_file_path = result_path(result_file_path) FileUtils.mkdir_p File.dirname(result_file_path) result = ERB.new(File.read(source_path)).result(binding) File.open(result_file_path, 'w') {|f| f.write(result) } + end + + def template_path + File.dirname(__FILE__) + '/../template' end def result_path(source_path) File.join @options[:gem_path], source_path end \ No newline at end of file