Class: TTK::Strategies::Package

Inherits:
Collection show all
Includes:
Concrete, Ordered
Defined in:
lib/ttk/strategies/Package.rb

Instance Attribute Summary

Attributes inherited from Strategy

#status, #symtbl

Instance Method Summary collapse

Methods inherited from Collection

#attributes=, #contents=, #create, #initialize, #method_missing, #strategyclass, #strategyclass=

Methods inherited from Composite

#<<, #create, #initialize, #initialize_test, #new_symtbl

Methods inherited from Strategy

#abort, #assign, #clean_instance_variables, #display_unexpected_exc, #display_unexpected_synflow_exc, #fail, #initialize, #initialize_flow_factory, #pass, #raise_error, #reject, #run, #running?, #skip, #skip_if_cached, #strategy, #strategy=, #symbols=, #testify, #timeout=, #to_s, #wclass=

Constructor Details

This class inherits a constructor from TTK::Strategies::Collection

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TTK::Strategies::Collection

Instance Method Details

#prologueObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/ttk/strategies/Package.rb', line 15

def prologue 
  extract_dir = '<<extract_dir>>'
  self.attributes = {
    :dir => extract_dir,
  }

	super

  create(Checkout) do |checkout|
    checkout.name = 'Checkout'
    checkout.url = @url
    checkout.fatal = true
    checkout.weight = 0
  end

  unless skip_step? 'configure'
    create(Bootstrap) do |bootstrap|
      bootstrap.name = 'Bootstrapping'
      bootstrap.weight = 0
    end
  end

  unless skip_step? 'bootstrap'
    create(Configure) do |configure|
      configure.name = 'Configuring'
      configure.prefix = @prefix
      configure.flags = @configure_flags
      configure.weight = 0
    end
  end

  unless skip_step? 'build'
    create(Make) do |build|
      build.name = 'Building'
      build.continue_mode = true
      # build.jobs = 2
      build.fatal = true
    end
  end

  make = {}

  [ Make::Check, Make::DistCheck, Make::Install ].each do |step|
    step_name = step.target
    next if skip_step? step_name
    create(Make) do |build|
      build.name = "Building #{step_name}"
      build.target = step
      build.fatal = true
      make[step_name.to_sym] = build
    end
  end

  if @install_prefix and make.has_key? :install
    make[:install].options << "prefix=#@install_prefix"
  end

  if make.has_key? :distcheck
    make[:distcheck].options <<
      "DISTCHECK_CONFIGURE_FLAGS='<<configure_flags>>'"
  end

  unless skip_step? 'tarball'
    create(Block) do |test|
      test.name = 'Exporting the tarball'
      test.test = proc do
        balls = Pathname.glob("#{extract_dir}/*.tar.*")
        unless balls.empty?
          @log.new_node :contents, :seq do
            balls.each do |ball|
              ball.copy(dir)
              ball.to_ttk_log(@log)
            end
          end
        end
        true
      end
    end
  end

  unless @test.nil? or skip_step? 'test'
    create(@test)
  end

  unless skip_step? 'clean'
    create(Clean) do |clean|
      clean.name = 'Cleaning'
      clean.fatal = true
      clean.weight = 0
    end
  end

end

#skip_step?(step) ⇒ Boolean

Returns:

  • (Boolean)


109
110
111
112
# File 'lib/ttk/strategies/Package.rb', line 109

def skip_step? ( step )
  step = /#{step}/i unless step.is_a? Regexp
  @skip_steps.any? { |x| step =~ x }
end