class Fudge::Generator
Generator
for default Fudgefile
Attributes
pwd[R]
Public Class Methods
new(pwd)
click to toggle source
# File lib/fudge/generator.rb, line 6 def initialize(pwd) @pwd = pwd end
Public Instance Methods
write_fudgefile()
click to toggle source
Writes the fudgefile to initialized directory unless on present
# File lib/fudge/generator.rb, line 11 def write_fudgefile if exists? "Fudgefile already exists." else writer { |file| file << build_templated } "Fudgefile created." end end
Private Instance Methods
build_templated()
click to toggle source
# File lib/fudge/generator.rb, line 34 def build_templated contents = "" contents << "build :default do\n" contents << " task :rspec\n" contents << "end" end
exists?()
click to toggle source
# File lib/fudge/generator.rb, line 30 def exists? File.exists?(path) end
path()
click to toggle source
# File lib/fudge/generator.rb, line 26 def path @path ||= File.expand_path('Fudgefile', pwd) end
writer() { |f| ... }
click to toggle source
# File lib/fudge/generator.rb, line 22 def writer File.open(path, 'w') { |f| yield f } end