Module: Tetra::Speccable
Overview
adds methods to generate a spec file from a package object
Instance Method Summary collapse
-
#_to_spec(project, name, template_spec_name, destination_dir) ⇒ Object
saves a specfile for this object in correct directories returns the spec path and the conflict count with the previously generated version, if any destination_dir/name/name.spec.
Methods included from Generatable
Instance Method Details
#_to_spec(project, name, template_spec_name, destination_dir) ⇒ Object
saves a specfile for this object in correct directories returns the spec path and the conflict count with the previously generated version, if any destination_dir/name/name.spec
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tetra/packages/speccable.rb', line 12 def _to_spec(project, name, template_spec_name, destination_dir) project.from_directory do spec_name = "#{name}.spec" spec_dir = File.join(destination_dir, name) FileUtils.mkdir_p(spec_dir) spec_path = File.join(spec_dir, spec_name) new_content = generate(template_spec_name, binding) label = "Spec for #{name} generated" conflict_count = project.merge_new_content(new_content, spec_path, label, "#{name}-spec") [spec_path, conflict_count] end end |