Skip to content

Commit

Permalink
Fix: correct template pathing
Browse files Browse the repository at this point in the history
Once build and installed as a gem, the previous path was not correct.
Use __FILE__ to determine the location of the binary and then work our
way back out to the template files.

Version bump.
  • Loading branch information
Tim Harvey committed Feb 8, 2012
1 parent 1736ccf commit 7398a62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion bin/mini-cutter
Expand Up @@ -10,7 +10,7 @@ class MyVars
end
end

Dir.glob("./templates/*.erb") do |file|
Dir.glob("#{File.dirname(__FILE__)}/../templates/*.erb") do |file|
erb_template = ERB.new File.open(file, 'r').read
erb_result = erb_template.result(MyVars.new(class_name).send(:binding))

Expand All @@ -20,6 +20,8 @@ Dir.glob("./templates/*.erb") do |file|
# the 'class_name' from the file name
new_file_name = file_name.gsub(/.erb/, '').gsub(/class_name/, class_name)

puts "Creating: #{new_file_name}"

# Create a new file, writing the erb template result
new_file = File.new(new_file_name, 'w')
new_file.write erb_result
Expand Down
2 changes: 1 addition & 1 deletion mini-cutter.gemspec
Expand Up @@ -2,7 +2,7 @@ Gem::Specification.new do |s|
s.name = 'mini-cutter'
s.summary = 'Mini Cutter: create the boilerplate files needed for a mini-gem'
s.description = 'Quick tool for building out a quick set of files needed to make a micro-gem'
s.version = '0.1.0'
s.version = '0.1.1'
s.platform = Gem::Platform::RUBY

s.files = Dir['bin/*'] + Dir['templates/*']
Expand Down

0 comments on commit 7398a62

Please sign in to comment.