lib/subtrac/project.rb in ktec-subtrac-0.1.47 vs lib/subtrac/project.rb in ktec-subtrac-0.1.48
- old
+ new
@@ -17,19 +17,29 @@
# replace the tokens in the project
glob_path, exp_search, exp_replace = "#{@template}/**","", @display_name
puts "Lets see what the filter has returned: #{Dir.glob(glob_path)}"
Dir.glob(glob_path).each do |file|
unless File.directory?(file) # only mess with files
- buffer = File.new(file,'r').read.gsub(/\$\{project.display_name\}/,exp_replace)
+ buffer = tokenize(File.new(file,'r').read)
puts buffer
File.open(file,'w') {|fw| fw.write(buffer)}
end
end
# TODO: We'll need to run through and do some renaming if necessary
end
end
+
def clear_temp
# delete the temporary directory
#FileUtils.rm_r(@temp_dir, :force => true)
end
+
+ private
+
+ # Replaces some tokens
+ def tokenize( string )
+ string.gsub( /\$\{project.display_name\}/, @display_name ).
+ gsub( /\$\{client.display_name\}/, @client.display_name )
+ end
+
end
end
\ No newline at end of file