Permalink
Browse files

Removed tools folder

  • Loading branch information...
1 parent 536d0fc commit d3b5cb05568b48282addadc3f7f70ff5f248d984 @danielmarbach danielmarbach committed Jan 24, 2014
Showing with 48 additions and 48 deletions.
  1. +47 −47 {Tools/Rake → }/quicktemplate.rb
  2. +1 −1 rakefile.rb
@@ -1,48 +1,48 @@
-require 'rake'
-require 'erb'
-
-class QuickTemplate
- attr_reader :args, :file
-
- def initialize(file)
- raise "The template file to process must be given" if file.nil?
-
- @file = file
- end
-
- def exec(args = {})
- template = prepare_template File.read(@file)
- result = exec_erb template, args
-
- resultFile = @file.ext('')
- File.open(resultFile, 'w') do
- |f| f.write(result)
- end
-
- puts "Created file #{resultFile}"
- end
-
- def prepare_template(template)
- tag_regex = /(@\w[\w\.]+\w@)/
-
- hits = template.scan(tag_regex)
- tags = hits.map do |item|
- item[0].chomp('@').reverse.chomp('@').reverse.strip
- end
-
- tags.map! do |a|
- a.to_sym
- end
- tags.uniq!
-
- tags.inject(template) do |text, tag|
- text.gsub /@#{tag.to_s}@/, "<%= #{tag.to_s} %>"
- end
- end
-
- def exec_erb(template, args)
- b = binding
- erb = ERB.new(template, 0, "%")
- erb.result(b)
- end
+require 'rake'
+require 'erb'
+
+class QuickTemplate
+ attr_reader :args, :file
+
+ def initialize(file)
+ raise "The template file to process must be given" if file.nil?
+
+ @file = file
+ end
+
+ def exec(args = {})
+ template = prepare_template File.read(@file)
+ result = exec_erb template, args
+
+ resultFile = @file.ext('')
+ File.open(resultFile, 'w') do
+ |f| f.write(result)
+ end
+
+ puts "Created file #{resultFile}"
+ end
+
+ def prepare_template(template)
+ tag_regex = /(@\w[\w\.]+\w@)/
+
+ hits = template.scan(tag_regex)
+ tags = hits.map do |item|
+ item[0].chomp('@').reverse.chomp('@').reverse.strip
+ end
+
+ tags.map! do |a|
+ a.to_sym
+ end
+ tags.uniq!
+
+ tags.inject(template) do |text, tag|
+ text.gsub /@#{tag.to_s}@/, "<%= #{tag.to_s} %>"
+ end
+ end
+
+ def exec_erb(template, args)
+ b = binding
+ erb = ERB.new(template, 0, "%")
+ erb.result(b)
+ end
end
View
@@ -3,7 +3,7 @@
require 'albacore'
require 'configatron'
require 'fileutils'
- require File.dirname(__FILE__) + "/Tools/Rake/quicktemplate.rb"
+ require './quicktemplate.rb'
require './rakefile.include.rb'
rescue LoadError

0 comments on commit d3b5cb0

Please sign in to comment.