gecoder-with-gecode 0.9.0-x86-mswin32-60 → 0.9.1-x86-mswin32-60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +6 -0
- data/README +1 -1
- data/THANKS +18 -0
- data/example/equation_system.rb +3 -1
- data/example/magic_sequence.rb +3 -1
- data/example/queens.rb +3 -1
- data/example/send_more_money.rb +24 -30
- data/example/send_most_money.rb +15 -26
- data/example/square_tiling.rb +3 -1
- data/example/sudoku-set.rb +3 -1
- data/lib/gecode.dll +0 -0
- data/lib/gecoder/bindings.rb +7 -5
- data/lib/gecoder/bindings/bindings.rb +8 -8
- data/lib/gecoder/interface.rb +4 -2
- data/lib/gecoder/interface/binding_changes.rb +1 -1
- data/lib/gecoder/interface/branch.rb +1 -1
- data/lib/gecoder/interface/constraints/bool_enum_constraints.rb +4 -4
- data/lib/gecoder/interface/constraints/bool_var_constraints.rb +2 -2
- data/lib/gecoder/interface/constraints/extensional_regexp.rb +1 -1
- data/lib/gecoder/interface/constraints/fixnum_enum_constraints.rb +2 -2
- data/lib/gecoder/interface/constraints/int_enum/extensional.rb +5 -5
- data/lib/gecoder/interface/constraints/int_enum_constraints.rb +4 -4
- data/lib/gecoder/interface/constraints/int_var_constraints.rb +2 -2
- data/lib/gecoder/interface/constraints/selected_set/select.rb +8 -8
- data/lib/gecoder/interface/constraints/set_enum/{select.rb → element.rb} +10 -10
- data/lib/gecoder/interface/constraints/set_enum_constraints.rb +5 -5
- data/lib/gecoder/interface/constraints/set_var_constraints.rb +2 -2
- data/lib/gecoder/interface/{model_sugar.rb → convenience.rb} +19 -4
- data/lib/gecoder/interface/enum_wrapper.rb +1 -1
- data/lib/gecoder/interface/{model.rb → mixin.rb} +93 -60
- data/lib/gecoder/interface/search.rb +23 -22
- data/lib/gecoder/version.rb +1 -1
- data/specs/branch.rb +5 -3
- data/specs/constraints/bool/boolean.rb +3 -1
- data/specs/constraints/bool/linear.rb +3 -1
- data/specs/constraints/bool_enum/bool_enum_relation.rb +3 -1
- data/specs/constraints/bool_enum/channel.rb +3 -1
- data/specs/constraints/fixnum_enum/element.rb +3 -1
- data/specs/constraints/int/arithmetic.rb +3 -1
- data/specs/constraints/int/channel.rb +3 -1
- data/specs/constraints/int/linear.rb +3 -1
- data/specs/constraints/int/linear_properties.rb +3 -1
- data/specs/constraints/int_enum/arithmetic.rb +3 -1
- data/specs/constraints/int_enum/channel.rb +3 -1
- data/specs/constraints/int_enum/count.rb +3 -1
- data/specs/constraints/int_enum/distinct.rb +3 -1
- data/specs/constraints/int_enum/element.rb +3 -1
- data/specs/constraints/int_enum/sort.rb +3 -1
- data/specs/constraints/property_helper.rb +10 -10
- data/specs/constraints/reification_sugar.rb +3 -1
- data/specs/constraints/selected_set/select.rb +6 -5
- data/specs/constraints/selected_set/select_properties.rb +12 -10
- data/specs/constraints/set/channel.rb +3 -1
- data/specs/constraints/set/domain.rb +4 -4
- data/specs/constraints/set/relation.rb +4 -4
- data/specs/constraints/set_enum/channel.rb +3 -1
- data/specs/constraints/set_enum/distinct.rb +3 -1
- data/specs/constraints/set_enum/{select.rb → element.rb} +13 -9
- data/specs/enum_wrapper.rb +1 -1
- data/specs/mixin.rb +78 -0
- data/specs/model.rb +5 -5
- data/specs/search.rb +20 -14
- data/specs/selected_set.rb +3 -3
- data/specs/set_elements.rb +2 -2
- data/tasks/distribution.rake +25 -4
- data/vendor/gecode/win32/lib/{libgecodeint.dll → libWindowsgecodeintWindows.dll} +0 -0
- data/vendor/gecode/win32/lib/{libgecodekernel.dll → libWindowsgecodekernelWindows.dll} +0 -0
- data/vendor/gecode/win32/lib/{libgecodeminimodel.dll → libWindowsgecodeminimodelWindows.dll} +0 -0
- data/vendor/gecode/win32/lib/{libgecodesearch.dll → libWindowsgecodesearchWindows.dll} +0 -0
- data/vendor/gecode/win32/lib/{libgecodeset.dll → libWindowsgecodesetWindows.dll} +0 -0
- data/vendor/gecode/win32/lib/{libgecodesupport.dll → libWindowsgecodesupportWindows.dll} +0 -0
- metadata +20 -17
- data/example/money.rb +0 -36
@@ -79,8 +79,8 @@ Gecode::Util::SET_RELATION_TYPES.each_pair do |relation, type|
|
|
79
79
|
(@set.value.to_a - @non_range).should be_empty
|
80
80
|
when :complement
|
81
81
|
val = @set.value
|
82
|
-
val.min.should == Gecode::
|
83
|
-
val.max.should == Gecode::
|
82
|
+
val.min.should == Gecode::Mixin::SET_MIN_INT
|
83
|
+
val.max.should == Gecode::Mixin::SET_MAX_INT
|
84
84
|
@non_range.each do |element|
|
85
85
|
@set.not_in_upper_bound?(element).should be_true
|
86
86
|
end
|
@@ -100,8 +100,8 @@ Gecode::Util::SET_RELATION_TYPES.each_pair do |relation, type|
|
|
100
100
|
(@set.value.to_a - @non_range).should_not be_empty
|
101
101
|
when :complement
|
102
102
|
val = @set.value
|
103
|
-
((val.min != Gecode::
|
104
|
-
(val.max != Gecode::
|
103
|
+
((val.min != Gecode::Mixin::SET_MIN_INT) ||
|
104
|
+
(val.max != Gecode::Mixin::SET_MAX_INT) ||
|
105
105
|
@non_range.any?{ |element| @set.in_lower_bound?(element) }
|
106
106
|
).should be_true
|
107
107
|
when :disjoint
|
@@ -41,8 +41,8 @@ Gecode::Util::SET_RELATION_TYPES.each_pair do |relation, type|
|
|
41
41
|
(@set.value.to_a - @set2.value.to_a).should be_empty
|
42
42
|
when :complement
|
43
43
|
val = @set.value
|
44
|
-
val.min.should == Gecode::
|
45
|
-
val.max.should == Gecode::
|
44
|
+
val.min.should == Gecode::Mixin::SET_MIN_INT
|
45
|
+
val.max.should == Gecode::Mixin::SET_MAX_INT
|
46
46
|
@set2.value.each do |element|
|
47
47
|
@set.not_in_upper_bound?(element).should be_true
|
48
48
|
end
|
@@ -63,8 +63,8 @@ Gecode::Util::SET_RELATION_TYPES.each_pair do |relation, type|
|
|
63
63
|
(@set.value.to_a - @set2.value.to_a).should_not be_empty
|
64
64
|
when :complement
|
65
65
|
val = @set.value
|
66
|
-
((val.min != Gecode::
|
67
|
-
(val.max != Gecode::
|
66
|
+
((val.min != Gecode::Mixin::SET_MIN_INT) ||
|
67
|
+
(val.max != Gecode::Mixin::SET_MAX_INT) ||
|
68
68
|
@set.value.to_a.any?{ |element| @set.in_lower_bound?(element) }
|
69
69
|
).should be_true
|
70
70
|
when :disjoint
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../property_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class SetElementSampleProblem < Gecode::Model
|
4
4
|
attr :sets
|
5
5
|
attr :set
|
6
6
|
attr :target
|
@@ -18,17 +18,17 @@ end
|
|
18
18
|
|
19
19
|
# Requires everything that composite behaviour spec requires in addition to
|
20
20
|
# @stub and @expect_constrain_equal .
|
21
|
-
describe '
|
21
|
+
describe 'element constraint', :shared => true do
|
22
22
|
it 'should not disturb normal array access' do
|
23
23
|
@sets[0].should be_kind_of(Gecode::SetVar)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
describe Gecode::SetEnum::
|
27
|
+
describe Gecode::SetEnum::Element, ' (int operand)' do
|
28
28
|
include GecodeR::Specs::SetHelper
|
29
29
|
|
30
30
|
before do
|
31
|
-
@model =
|
31
|
+
@model = SetElementSampleProblem.new
|
32
32
|
@sets = @model.sets
|
33
33
|
@target = @set = @model.target
|
34
34
|
@index = @model.index
|
@@ -43,26 +43,30 @@ describe Gecode::SetEnum::Select, ' (int operand)' do
|
|
43
43
|
@constraint_class = Gecode::BlockConstraint
|
44
44
|
end
|
45
45
|
|
46
|
+
it 'should not disturb normal array access' do
|
47
|
+
@sets[0].respond_to?(:to_set_var).should be_true
|
48
|
+
end
|
49
|
+
|
46
50
|
it 'should constrain the specified element of an enum of sets' do
|
47
51
|
@sets[@index].must_be.superset_of([5,7,9])
|
48
52
|
@model.solve!
|
49
53
|
@sets[@index.value].value.should include(5,7,9)
|
50
54
|
end
|
51
55
|
|
52
|
-
it 'should translate into a
|
53
|
-
Gecode::Raw.should_receive(:
|
56
|
+
it 'should translate into a element constraint' do
|
57
|
+
Gecode::Raw.should_receive(:element)
|
54
58
|
@sets[@index].must_be.superset_of([5,7,9])
|
55
59
|
@model.solve!
|
56
60
|
end
|
57
61
|
|
58
|
-
it_should_behave_like '
|
62
|
+
it_should_behave_like 'element constraint'
|
59
63
|
it_should_behave_like(
|
60
64
|
'property that produces set operand by short circuiting equality')
|
61
65
|
end
|
62
66
|
|
63
|
-
describe Gecode::SetEnum::
|
67
|
+
describe Gecode::SetEnum::Element, ' (set operand)' do
|
64
68
|
before do
|
65
|
-
@model =
|
69
|
+
@model = SetElementSampleProblem.new
|
66
70
|
@sets = @model.sets
|
67
71
|
@set = @model.set
|
68
72
|
end
|
data/specs/enum_wrapper.rb
CHANGED
data/specs/mixin.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
class MixinSampleProblem
|
4
|
+
include Gecode::Mixin
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
x, y, z = vars_is_an int_var_array(3, 0..9)
|
8
|
+
|
9
|
+
(x + y).must == z
|
10
|
+
x.must == y - 3
|
11
|
+
vars.must_be.distinct
|
12
|
+
|
13
|
+
branch_on vars
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class ClassWithMethodMissingLast
|
18
|
+
include Gecode::Mixin
|
19
|
+
|
20
|
+
def method_missing(*args)
|
21
|
+
return :foo
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class ClassWithMethodMissingFirst
|
26
|
+
def method_missing(*args)
|
27
|
+
return :foo
|
28
|
+
end
|
29
|
+
|
30
|
+
include Gecode::Mixin
|
31
|
+
end
|
32
|
+
|
33
|
+
describe Gecode::Mixin, ' (mixed into a class)' do
|
34
|
+
before do
|
35
|
+
@mix = Object.new
|
36
|
+
class <<@mix
|
37
|
+
include Gecode::Mixin
|
38
|
+
end
|
39
|
+
|
40
|
+
@model = Gecode::Model.new
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should respond to everything that Gecode::Model does' do
|
44
|
+
@model.public_methods.sort.each do |method|
|
45
|
+
@mix.respond_to?(method).should be_true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should solve a sample problem' do
|
50
|
+
lambda do
|
51
|
+
MixinSampleProblem.new.solve!.vars.values
|
52
|
+
end.should_not raise_error
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should not mess with classes defining method missing' do
|
56
|
+
model = ClassWithMethodMissingFirst.new
|
57
|
+
|
58
|
+
# Should not completely overwrite #method_missing.
|
59
|
+
model.does_not_exist.should == :foo
|
60
|
+
|
61
|
+
# Should still allow *_is_a sugar .
|
62
|
+
bool_var = model.bool_var
|
63
|
+
bool_var.should_not == :foo
|
64
|
+
model.foo_is_a(bool_var).should == bool_var
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should not mess with classes defining method missing (2)' do
|
68
|
+
model = ClassWithMethodMissingLast.new
|
69
|
+
|
70
|
+
# Should not completely overwrite #method_missing.
|
71
|
+
model.does_not_exist.should == :foo
|
72
|
+
|
73
|
+
# Should still allow *_is_a sugar .
|
74
|
+
bool_var = model.bool_var
|
75
|
+
bool_var.should_not == :foo
|
76
|
+
model.foo_is_a(bool_var).should == bool_var
|
77
|
+
end
|
78
|
+
end
|
data/specs/model.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
|
-
describe Gecode::
|
3
|
+
describe Gecode::Mixin, ' (integer creation)' do
|
4
4
|
before do
|
5
5
|
@model = Gecode::Model.new
|
6
6
|
end
|
@@ -101,7 +101,7 @@ describe Gecode::Model, ' (integer creation)' do
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
-
describe Gecode::
|
104
|
+
describe Gecode::Mixin, ' (bool creation)' do
|
105
105
|
before do
|
106
106
|
@model = Gecode::Model.new
|
107
107
|
end
|
@@ -128,7 +128,7 @@ describe Gecode::Model, ' (bool creation)' do
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
describe Gecode::
|
131
|
+
describe Gecode::Mixin, ' (set creation)' do
|
132
132
|
before do
|
133
133
|
@model = Gecode::Model.new
|
134
134
|
@glb_range = 0..3
|
@@ -249,7 +249,7 @@ describe Gecode::Model, ' (set creation)' do
|
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
|
-
describe Gecode::
|
252
|
+
describe Gecode::Mixin, ' (space access restriction)' do
|
253
253
|
before do
|
254
254
|
@model = Gecode::Model.new
|
255
255
|
end
|
@@ -267,7 +267,7 @@ describe Gecode::Model, ' (space access restriction)' do
|
|
267
267
|
end
|
268
268
|
end
|
269
269
|
|
270
|
-
describe Gecode::
|
270
|
+
describe Gecode::Mixin, ' (accessible variable creation)' do
|
271
271
|
before do
|
272
272
|
@model = Class.new(Gecode::Model).new
|
273
273
|
end
|
data/specs/search.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
require 'set'
|
3
3
|
|
4
|
-
class SampleProblem
|
4
|
+
class SampleProblem
|
5
|
+
include Gecode::Mixin
|
6
|
+
|
5
7
|
attr :var
|
6
8
|
attr :array
|
7
9
|
attr :hash
|
@@ -19,7 +21,9 @@ class SampleProblem < Gecode::Model
|
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
|
-
class SampleOptimizationProblem
|
24
|
+
class SampleOptimizationProblem
|
25
|
+
include Gecode::Mixin
|
26
|
+
|
23
27
|
attr :x
|
24
28
|
attr :y
|
25
29
|
attr :z
|
@@ -33,7 +37,9 @@ class SampleOptimizationProblem < Gecode::Model
|
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
36
|
-
class SampleOptimizationProblem2
|
40
|
+
class SampleOptimizationProblem2
|
41
|
+
include Gecode::Mixin
|
42
|
+
|
37
43
|
attr :money
|
38
44
|
|
39
45
|
def initialize
|
@@ -53,7 +59,7 @@ class Array
|
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
56
|
-
describe Gecode::
|
62
|
+
describe Gecode::Mixin, ' (with multiple solutions)' do
|
57
63
|
before do
|
58
64
|
@domain = 0..3
|
59
65
|
@solved_domain = [2]
|
@@ -103,7 +109,7 @@ describe Gecode::Model, ' (with multiple solutions)' do
|
|
103
109
|
end
|
104
110
|
end
|
105
111
|
|
106
|
-
describe Gecode::
|
112
|
+
describe Gecode::Mixin, ' (after #solve!)' do
|
107
113
|
before do
|
108
114
|
@domain = 0..3
|
109
115
|
@solved_domain = [2]
|
@@ -159,7 +165,7 @@ describe 'reset model', :shared => true do
|
|
159
165
|
end
|
160
166
|
end
|
161
167
|
|
162
|
-
describe Gecode::
|
168
|
+
describe Gecode::Mixin, ' (after #reset!)' do
|
163
169
|
before do
|
164
170
|
@domain = 0..3
|
165
171
|
@reset_domain = 2..3
|
@@ -171,7 +177,7 @@ describe Gecode::Model, ' (after #reset!)' do
|
|
171
177
|
it_should_behave_like 'reset model'
|
172
178
|
end
|
173
179
|
|
174
|
-
describe Gecode::
|
180
|
+
describe Gecode::Mixin, ' (after #solution)' do
|
175
181
|
before do
|
176
182
|
@domain = 0..3
|
177
183
|
@reset_domain = 2..3
|
@@ -182,7 +188,7 @@ describe Gecode::Model, ' (after #solution)' do
|
|
182
188
|
it_should_behave_like 'reset model'
|
183
189
|
end
|
184
190
|
|
185
|
-
describe Gecode::
|
191
|
+
describe Gecode::Mixin, ' (after #each_solution)' do
|
186
192
|
before do
|
187
193
|
@domain = 0..3
|
188
194
|
@reset_domain = 2..3
|
@@ -193,7 +199,7 @@ describe Gecode::Model, ' (after #each_solution)' do
|
|
193
199
|
it_should_behave_like 'reset model'
|
194
200
|
end
|
195
201
|
|
196
|
-
describe Gecode::
|
202
|
+
describe Gecode::Mixin, ' (without solution)' do
|
197
203
|
before do
|
198
204
|
@domain = 0..3
|
199
205
|
@model = SampleProblem.new(@domain)
|
@@ -233,7 +239,7 @@ describe Gecode::Model, ' (without solution)' do
|
|
233
239
|
end
|
234
240
|
end
|
235
241
|
|
236
|
-
describe Gecode::
|
242
|
+
describe Gecode::Mixin, ' (without constraints)' do
|
237
243
|
before do
|
238
244
|
@model = Gecode::Model.new
|
239
245
|
@x = @model.int_var(0..1)
|
@@ -244,7 +250,7 @@ describe Gecode::Model, ' (without constraints)' do
|
|
244
250
|
end
|
245
251
|
end
|
246
252
|
|
247
|
-
describe Gecode::
|
253
|
+
describe Gecode::Mixin, '(optimization search)' do
|
248
254
|
it 'should optimize the solution' do
|
249
255
|
solution = SampleOptimizationProblem.new.optimize! do |model, best_so_far|
|
250
256
|
model.z.must > best_so_far.z.value
|
@@ -266,7 +272,7 @@ describe Gecode::Model, '(optimization search)' do
|
|
266
272
|
|
267
273
|
it 'should raise error if no constrain proc has been defined' do
|
268
274
|
lambda do
|
269
|
-
Gecode::
|
275
|
+
Gecode::Mixin.constrain(nil, nil)
|
270
276
|
end.should raise_error(NotImplementedError)
|
271
277
|
end
|
272
278
|
|
@@ -344,7 +350,7 @@ describe 'single variable optimization', :shared => true do
|
|
344
350
|
end
|
345
351
|
end
|
346
352
|
|
347
|
-
describe Gecode::
|
353
|
+
describe Gecode::Mixin, '(single variable minimization)' do
|
348
354
|
before do
|
349
355
|
@method_name = 'minimize!'
|
350
356
|
@variable_name = 'x'
|
@@ -363,7 +369,7 @@ describe Gecode::Model, '(single variable minimization)' do
|
|
363
369
|
it_should_behave_like 'single variable optimization'
|
364
370
|
end
|
365
371
|
|
366
|
-
describe Gecode::
|
372
|
+
describe Gecode::Mixin, '(single variable maximization)' do
|
367
373
|
before do
|
368
374
|
@method_name = 'maximize!'
|
369
375
|
@variable_name = 'z'
|
data/specs/selected_set.rb
CHANGED
@@ -10,7 +10,7 @@ describe Gecode::SelectedSet::SelectedSetOperand do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should implement #model' do
|
13
|
-
@operand.model.should be_kind_of(Gecode::
|
13
|
+
@operand.model.should be_kind_of(Gecode::Mixin)
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should implement #to_selected_set' do
|
@@ -20,12 +20,12 @@ describe Gecode::SelectedSet::SelectedSetOperand do
|
|
20
20
|
@model.solve!
|
21
21
|
set_var = set.to_set_var
|
22
22
|
((set_var.lower_bound == []) &&
|
23
|
-
(set_var.upper_bound == Gecode::
|
23
|
+
(set_var.upper_bound == Gecode::Mixin::LARGEST_SET_BOUND)).should_not(
|
24
24
|
be_true)
|
25
25
|
enum.each do |element|
|
26
26
|
set_var = element.to_set_var
|
27
27
|
((set_var.lower_bound == []) &&
|
28
|
-
(set_var.upper_bound == Gecode::
|
28
|
+
(set_var.upper_bound == Gecode::Mixin::LARGEST_SET_BOUND)).should_not(
|
29
29
|
be_true)
|
30
30
|
end
|
31
31
|
end
|
data/specs/set_elements.rb
CHANGED
@@ -8,7 +8,7 @@ describe Gecode::SelectedSet::SelectedSetOperand do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should implement #model' do
|
11
|
-
@operand.model.should be_kind_of(Gecode::
|
11
|
+
@operand.model.should be_kind_of(Gecode::Mixin)
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should implement #to_set_elements' do
|
@@ -17,7 +17,7 @@ describe Gecode::SelectedSet::SelectedSetOperand do
|
|
17
17
|
@model.solve!
|
18
18
|
set_var = set.to_set_var
|
19
19
|
((set_var.lower_bound == []) &&
|
20
|
-
(set_var.upper_bound == Gecode::
|
20
|
+
(set_var.upper_bound == Gecode::Mixin::LARGEST_SET_BOUND)).should_not(
|
21
21
|
be_true)
|
22
22
|
end
|
23
23
|
|
data/tasks/distribution.rake
CHANGED
@@ -8,6 +8,10 @@ PKG_FILE_NAME_WITH_GECODE = "#{PKG_NAME_WITH_GECODE}-#{PKG_VERSION}"
|
|
8
8
|
# The location where the precompiled DLL should be placed.
|
9
9
|
DLL_LOCATION = 'lib/gecode.dll'
|
10
10
|
EXT_DIR = 'ext'
|
11
|
+
GECODE_DIR = 'vendor/gecode'
|
12
|
+
GECODE_NAME = 'gecode-2.2.0'
|
13
|
+
GECODE_ARCHIVE_NAME = "#{GECODE_NAME}.tar.gz"
|
14
|
+
|
11
15
|
|
12
16
|
desc 'Generate RDoc'
|
13
17
|
rd = Rake::RDocTask.new do |rdoc|
|
@@ -16,7 +20,7 @@ rd = Rake::RDocTask.new do |rdoc|
|
|
16
20
|
rdoc.template = 'doc/rdoc/jamis.rb'
|
17
21
|
rdoc.options << '--line-numbers' << '--inline-source' <<
|
18
22
|
'--accessor' << 'delegate' << '--main' << 'README'
|
19
|
-
rdoc.rdoc_files.include('README', 'CHANGES', 'LGPL-LICENSE', 'lib/**/*.rb')
|
23
|
+
rdoc.rdoc_files.include('README', 'CHANGES', 'THANKS', 'LGPL-LICENSE', 'lib/**/*.rb')
|
20
24
|
end
|
21
25
|
|
22
26
|
TMP_DIR = 'doc/tmp/rdoc_dev'
|
@@ -43,6 +47,18 @@ task :prepare_rdoc_dev do
|
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
50
|
+
desc 'Extracts the source of Gecode before it is packaged into a gem'
|
51
|
+
task :extract_gecode do
|
52
|
+
next if File.exist? "#{EXT_DIR}/#{GECODE_NAME}"
|
53
|
+
cd(EXT_DIR) do
|
54
|
+
cp "../#{GECODE_DIR}/#{GECODE_ARCHIVE_NAME}", GECODE_ARCHIVE_NAME
|
55
|
+
system("tar -xvf #{GECODE_ARCHIVE_NAME}")
|
56
|
+
rm GECODE_ARCHIVE_NAME
|
57
|
+
end
|
58
|
+
end
|
59
|
+
# To ensure that the Gecode files exist for the gem spec.
|
60
|
+
Rake::Task['extract_gecode'].invoke
|
61
|
+
|
46
62
|
spec = Gem::Specification.new do |s|
|
47
63
|
s.name = PKG_NAME
|
48
64
|
s.version = GecodeR::VERSION
|
@@ -67,7 +83,7 @@ spec = Gem::Specification.new do |s|
|
|
67
83
|
].to_a
|
68
84
|
s.require_path = 'lib'
|
69
85
|
s.extensions << 'ext/extconf.rb'
|
70
|
-
s.requirements << 'Gecode 2.
|
86
|
+
s.requirements << 'Gecode 2.2.0'
|
71
87
|
|
72
88
|
s.has_rdoc = true
|
73
89
|
s.rdoc_options = rd.options
|
@@ -109,7 +125,7 @@ spec_windows_binary_with_gecode.platform = 'x86-mswin32-60' #Gem::Platform::WIN3
|
|
109
125
|
spec_with_gecode = spec.dup
|
110
126
|
spec_with_gecode.name = PKG_NAME_WITH_GECODE
|
111
127
|
spec_with_gecode.extensions =
|
112
|
-
spec_with_gecode.extensions.dup.unshift 'ext/gecode-2.
|
128
|
+
spec_with_gecode.extensions.dup.unshift 'ext/gecode-2.2.0/configure'
|
113
129
|
spec_with_gecode.requirements = []
|
114
130
|
spec_with_gecode.files = spec.files.dup + FileList['ext/gecode-*/**/*'].to_a
|
115
131
|
|
@@ -141,6 +157,8 @@ end
|
|
141
157
|
desc 'Removes generated distribution files'
|
142
158
|
task :clobber do
|
143
159
|
rm DLL_LOCATION if File.exists? DLL_LOCATION
|
160
|
+
extracted_gecode = "#{EXT_DIR}/#{GECODE_NAME}"
|
161
|
+
rm_r extracted_gecode if File.exists? extracted_gecode
|
144
162
|
FileList[
|
145
163
|
"#{EXT_DIR}/*.o",
|
146
164
|
"#{EXT_DIR}/gecode.{cc,hh}",
|
@@ -177,8 +195,11 @@ gecode_release_files = [
|
|
177
195
|
"pkg/#{PKG_FILE_NAME_WITH_GECODE}.gem",
|
178
196
|
#"pkg/#{PKG_FILE_NAME_WITH_GECODE}.tgz",
|
179
197
|
#"pkg/#{PKG_FILE_NAME_WITH_GECODE}.zip",
|
180
|
-
"pkg/#{PKG_FILE_NAME_WITH_GECODE}-x86-mswin32.gem"
|
198
|
+
"pkg/#{PKG_FILE_NAME_WITH_GECODE}-x86-mswin32-60.gem"
|
181
199
|
]
|
200
|
+
gecode_release_files.each do |pkg|
|
201
|
+
file pkg => :extract_gecode
|
202
|
+
end
|
182
203
|
desc 'Publish Gecode/R with Gecode packages on RubyForge'
|
183
204
|
task :publish_gecoder_with_gecode_packages =>
|
184
205
|
[:verify_user] + gecode_release_files do
|