osheet 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -3
- data/lib/osheet/mixin.rb +9 -0
- data/lib/osheet/version.rb +1 -1
- data/lib/osheet/workbook.rb +1 -0
- data/test/mixin_test.rb +46 -2
- data/test/mixins.rb +17 -0
- data/test/rails/three/Gemfile.lock +1 -1
- data/test/rails/two/Gemfile.lock +1 -1
- metadata +6 -8
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
osheet (0.
|
4
|
+
osheet (0.7.0)
|
5
5
|
enumeration (~> 1.1.0)
|
6
6
|
xmlss (~> 0.2.0)
|
7
7
|
|
@@ -43,7 +43,6 @@ PLATFORMS
|
|
43
43
|
|
44
44
|
DEPENDENCIES
|
45
45
|
bundler (~> 1.0)
|
46
|
-
enumeration (~> 1.1.0)
|
47
46
|
open4
|
48
47
|
osheet!
|
49
48
|
rack-test (>= 0.5.3)
|
@@ -51,4 +50,3 @@ DEPENDENCIES
|
|
51
50
|
sinatra (>= 0.9.4)
|
52
51
|
test-belt (= 0.2.1)
|
53
52
|
webrat (>= 0.6.0)
|
54
|
-
xmlss (~> 0.2.0)
|
data/lib/osheet/mixin.rb
CHANGED
@@ -25,6 +25,15 @@ module Osheet::Mixin
|
|
25
25
|
def templates
|
26
26
|
instance_variable_get("@t") || []
|
27
27
|
end
|
28
|
+
|
29
|
+
def partial(name, &block)
|
30
|
+
instance_variable_set("@p",
|
31
|
+
(instance_variable_get("@p") || []) << ::Osheet::Partial.new(name, &block)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
def partials
|
35
|
+
instance_variable_get("@p") || []
|
36
|
+
end
|
28
37
|
end
|
29
38
|
|
30
39
|
end
|
data/lib/osheet/version.rb
CHANGED
data/lib/osheet/workbook.rb
CHANGED
data/test/mixin_test.rb
CHANGED
@@ -7,12 +7,13 @@ module Osheet
|
|
7
7
|
context "Osheet::Mixin thing" do
|
8
8
|
subject { DefaultMixin }
|
9
9
|
|
10
|
-
should_have_readers :styles, :templates
|
11
|
-
should_have_instance_methods :style, :template
|
10
|
+
should_have_readers :styles, :templates, :partials
|
11
|
+
should_have_instance_methods :style, :template, :partial
|
12
12
|
|
13
13
|
should "set it's defaults" do
|
14
14
|
assert_equal [], subject.styles
|
15
15
|
assert_equal [], subject.templates
|
16
|
+
assert_equal [], subject.partials
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -43,4 +44,47 @@ module Osheet
|
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
47
|
+
class MixinPartialTest < Test::Unit::TestCase
|
48
|
+
context "that defines partials" do
|
49
|
+
subject { PartialedMixin }
|
50
|
+
|
51
|
+
should "have it's partials defined" do
|
52
|
+
assert subject.partials
|
53
|
+
assert_equal 2, subject.partials.size
|
54
|
+
assert_kind_of Partial, subject.partials.first
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class MixinUseTest < Test::Unit::TestCase
|
60
|
+
context "A workbook that uses mixins" do
|
61
|
+
setup do
|
62
|
+
@workbook = Osheet::Workbook.new do
|
63
|
+
use PartialedMixin
|
64
|
+
use TemplatedMixin
|
65
|
+
use StyledMixin
|
66
|
+
end
|
67
|
+
end
|
68
|
+
subject { @workbook }
|
69
|
+
|
70
|
+
should "have mixin partials" do
|
71
|
+
workbook_partials = @workbook.partials.values
|
72
|
+
PartialedMixin.partials.each do |partial|
|
73
|
+
assert workbook_partials.include?(partial)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
should "have mixin templates" do
|
78
|
+
workbook_templates = @workbook.templates.values.collect{ |t| t.values.first }
|
79
|
+
TemplatedMixin.templates.each do |template|
|
80
|
+
assert workbook_templates.include?(template)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
should "have mixin styles" do
|
85
|
+
assert_equal StyledMixin.styles, @workbook.styles
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
46
90
|
end
|
data/test/mixins.rb
CHANGED
@@ -29,3 +29,20 @@ class TemplatedMixin
|
|
29
29
|
}
|
30
30
|
|
31
31
|
end
|
32
|
+
|
33
|
+
class PartialedMixin
|
34
|
+
include Osheet::Mixin
|
35
|
+
|
36
|
+
partial(:three_empty_rows) {
|
37
|
+
row { }
|
38
|
+
row { }
|
39
|
+
row { }
|
40
|
+
}
|
41
|
+
|
42
|
+
partial(:two_cells_in_a_row) {
|
43
|
+
row {
|
44
|
+
cell { data "one" }
|
45
|
+
cell { data "two" }
|
46
|
+
}
|
47
|
+
}
|
48
|
+
end
|
data/test/rails/two/Gemfile.lock
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 7
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.7.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kelly Redding
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-20 00:00:00
|
19
|
-
default_executable:
|
18
|
+
date: 2011-04-20 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: bundler
|
@@ -322,7 +321,6 @@ files:
|
|
322
321
|
- test/xmlss_writer/base_test.rb
|
323
322
|
- test/xmlss_writer/elements_test.rb
|
324
323
|
- test/xmlss_writer/styles_test.rb
|
325
|
-
has_rdoc: true
|
326
324
|
homepage: http://github.com/kelredd/osheet
|
327
325
|
licenses: []
|
328
326
|
|
@@ -352,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
352
350
|
requirements: []
|
353
351
|
|
354
352
|
rubyforge_project:
|
355
|
-
rubygems_version: 1.
|
353
|
+
rubygems_version: 1.7.2
|
356
354
|
signing_key:
|
357
355
|
specification_version: 3
|
358
356
|
summary: A DSL for specifying and generating spreadsheets using Ruby
|