Class: Gjp::SpecGenerator

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/gjp/spec_generator.rb

Overview

creates and updates spec files

Instance Method Summary collapse

Methods included from Logging

#log

Constructor Details

#initialize(project) ⇒ SpecGenerator

Returns a new instance of SpecGenerator.



8
9
10
# File 'lib/gjp/spec_generator.rb', line 8

def initialize(project)
  @project = project
end

Instance Method Details

#generate_kit_specObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gjp/spec_generator.rb', line 12

def generate_kit_spec
  @project.from_directory do
    spec_name = "#{@project.name}-kit.spec"
    spec_path = File.join("kit", spec_name)
    output_dir = File.join("output", "#{@project.name}-kit")
    FileUtils.mkdir_p(output_dir)

    adapter = Gjp::KitSpecAdapter.new(@project)
    conflict_count = generate_merging("kit.spec", adapter.public_binding, spec_path, :generate_kit_spec)

    symlink_to_output(spec_path, output_dir)

    [spec_path, conflict_count]
  end
end

#generate_package_spec(name, pom_path, filter) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gjp/spec_generator.rb', line 28

def generate_package_spec(name, pom_path, filter)
  pom = Gjp::Pom.new(pom_path)
  @project.from_directory do
    spec_name = "#{name}.spec"
    spec_path = File.join("src", name, spec_name)
    output_dir = File.join("output", name)
    FileUtils.mkdir_p(output_dir)

    adapter = Gjp::PackageSpecAdapter.new(@project, name, pom, filter)
    conflict_count = generate_merging("package.spec", adapter.public_binding, spec_path, "generate_#{name}_spec")

    symlink_to_output(spec_path, output_dir)

    [spec_path, conflict_count]
  end
end