class SchemaEvolutionManager::InstallTemplate
Constants
- TEMPLATE
Public Class Methods
new(opts={})
click to toggle source
# File lib/schema-evolution-manager/install_template.rb, line 5 def initialize(opts={}) @lib_dir = Preconditions.check_not_blank(opts.delete(:lib_dir), "lib_dir is required") @bin_dir = Preconditions.check_not_blank(opts.delete(:bin_dir), "bin_dir is required") Preconditions.assert_empty_opts(opts) end
Public Instance Methods
generate()
click to toggle source
Generates the actual contents of the install file
# File lib/schema-evolution-manager/install_template.rb, line 12 def generate template = Template.new template.add('timestamp', Time.now.to_s) template.add('lib_dir', @lib_dir) template.add('bin_dir', @bin_dir) template.parse(TEMPLATE) end
write_to_file(path)
click to toggle source
# File lib/schema-evolution-manager/install_template.rb, line 20 def write_to_file(path) puts "Writing %s" % path File.open(path, "w") do |out| out << generate end Library.system_or_error("chmod +x %s" % path) end