graffle 0.1.0
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/History.txt +2 -0
- data/LICENSE.txt +34 -0
- data/Manifest.txt +53 -0
- data/README.txt +19 -0
- data/Rakefile +32 -0
- data/Rakefile.hoe +23 -0
- data/bin/bin-skeleton +23 -0
- data/graffle.tmproj +335 -0
- data/lib/graffle.rb +43 -0
- data/lib/graffle/.document +4 -0
- data/lib/graffle/lib-skeleton +3 -0
- data/lib/graffle/nodoc/hacks.rb +69 -0
- data/lib/graffle/point.rb +42 -0
- data/lib/graffle/stereotypes.rb +446 -0
- data/lib/graffle/styled-text-reader.rb +52 -0
- data/lib/graffle/third-party/s4t-utils.rb +21 -0
- data/lib/graffle/third-party/s4t-utils/capturing-globals.rb +78 -0
- data/lib/graffle/third-party/s4t-utils/claims.rb +14 -0
- data/lib/graffle/third-party/s4t-utils/command-line.rb +15 -0
- data/lib/graffle/third-party/s4t-utils/error-handling.rb +20 -0
- data/lib/graffle/third-party/s4t-utils/friendly-format.rb +27 -0
- data/lib/graffle/third-party/s4t-utils/hacks.rb +32 -0
- data/lib/graffle/third-party/s4t-utils/load-path-auto-adjuster.rb +120 -0
- data/lib/graffle/third-party/s4t-utils/more-assertions.rb +29 -0
- data/lib/graffle/third-party/s4t-utils/os.rb +28 -0
- data/lib/graffle/third-party/s4t-utils/rake-task-helpers.rb +75 -0
- data/lib/graffle/third-party/s4t-utils/rakefile-common.rb +106 -0
- data/lib/graffle/third-party/s4t-utils/svn-file-movement.rb +101 -0
- data/lib/graffle/third-party/s4t-utils/test-util.rb +19 -0
- data/lib/graffle/third-party/s4t-utils/version.rb +3 -0
- data/lib/graffle/version.rb +8 -0
- data/setup.rb +1585 -0
- data/test/abstract-graphic-tests.rb +56 -0
- data/test/array-and-hash-stereotyping-tests.rb +49 -0
- data/test/document-tests.rb +117 -0
- data/test/graffle-file-types/as-a-package.graffle/data.plist +953 -0
- data/test/graffle-file-types/as-a-package.graffle/image1.png +0 -0
- data/test/graffle-file-types/as-a-package.graffle/image2.png +0 -0
- data/test/graffle-file-types/as-a-package.graffle/image3.png +0 -0
- data/test/graffle-file-types/multiple-canvases.graffle +6821 -0
- data/test/graffle-file-types/opening-tests.rb +45 -0
- data/test/graffle-file-types/two-boxes-and-a-line.graffle +347 -0
- data/test/group-tests.rb +109 -0
- data/test/hacks-tests.rb +58 -0
- data/test/line-graphic-tests.rb +155 -0
- data/test/point-tests.rb +43 -0
- data/test/set-standalone-test-paths.rb +5 -0
- data/test/shaped-graphic-tests.rb +93 -0
- data/test/sheet-tests.rb +124 -0
- data/test/styled-text-reader-tests.rb +89 -0
- data/test/test-skeleton +19 -0
- data/test/text-tests.rb +55 -0
- data/test/util.rb +15 -0
- metadata +139 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Brian Marick on 2007-07-06.
|
4
|
+
# Copyright (c) 2007. All rights reserved.
|
5
|
+
|
6
|
+
require "set-standalone-test-paths.rb" unless $started_from_rakefile
|
7
|
+
require 'test/unit'
|
8
|
+
require 's4t-utils'
|
9
|
+
include S4tUtils
|
10
|
+
|
11
|
+
require 'graffle'
|
12
|
+
require 'extensions/string'
|
13
|
+
|
14
|
+
class TestStyledTextReaderConversions < Test::Unit::TestCase
|
15
|
+
include Graffle
|
16
|
+
|
17
|
+
ONE_LINE =
|
18
|
+
"| {\\rtf1\\mac\\ansicpg10000\\cocoartf824\\cocoasubrtf420
|
19
|
+
| {\\fonttbl\\f0\\fswiss\\fcharset77 Helvetica;}
|
20
|
+
| {\\colortbl;\\red255\\green255\\blue255;}
|
21
|
+
| \\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\qc\\pardirnatural
|
22
|
+
|
|
23
|
+
| \\f0\\fs24 \\cf0 WELCOME}".trim('|')
|
24
|
+
|
25
|
+
TWO_ONE_LINE_PARAGRAPHS =
|
26
|
+
"| {\\rtf1\\mac\\ansicpg10000\\cocoartf824\\cocoasubrtf420
|
27
|
+
| {\\fonttbl\\f0\\fswiss\\fcharset77 Helvetica;}
|
28
|
+
| {\\colortbl;\\red255\\green255\\blue255;}
|
29
|
+
| \\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\qc\\pardirnatural
|
30
|
+
|
|
31
|
+
| \\f0\\fs24 \\cf0 John signs up as \"john\", email \"john@example.com\", password \"sloop\"\\
|
32
|
+
| \\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\pardirnatural
|
33
|
+
| John sees a welcome page}".trim('|')
|
34
|
+
|
35
|
+
LINE_BREAKS_WITHOUT_PARAGRAPHS =
|
36
|
+
"| {\\rtf1\\mac\\ansicpg10000\\cocoartf824\\cocoasubrtf420
|
37
|
+
| {\\fonttbl\\f0\\fswiss\\fcharset77 Helvetica;}
|
38
|
+
| {\\colortbl;\\red255\\green255\\blue255;}
|
39
|
+
| \\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\ql\\qnatural\\pardirnatural
|
40
|
+
|
|
41
|
+
| \\f0\\fs24 \\cf0 type: button\\
|
42
|
+
| name: run\\
|
43
|
+
| active: no}".trim('|')
|
44
|
+
|
45
|
+
def test_is_rtf
|
46
|
+
assert_false(StyledTextReader.new("{\\rt").is_rtf?)
|
47
|
+
assert_true(StyledTextReader.new(ONE_LINE).is_rtf?)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_stripping_of_rtf_header
|
51
|
+
text = StyledTextReader.new(ONE_LINE)
|
52
|
+
assert_equal(['\\f0\\fs24 \\cf0 WELCOME}'], text.without_rtf_header)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_single_line_text_as_lines
|
56
|
+
text = StyledTextReader.new(ONE_LINE)
|
57
|
+
assert_equal(['WELCOME'], text.as_lines)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_two_paragraph_text_as_lines
|
61
|
+
text = StyledTextReader.new(TWO_ONE_LINE_PARAGRAPHS)
|
62
|
+
assert_equal(['John signs up as "john", email "john@example.com", password "sloop"',
|
63
|
+
'John sees a welcome page'], text.as_lines)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_lines_without_paragraphs
|
67
|
+
text = StyledTextReader.new(LINE_BREAKS_WITHOUT_PARAGRAPHS)
|
68
|
+
assert_equal(['type: button', 'name: run', 'active: no'], text.as_lines)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_single_line_text_as_message_tokens
|
72
|
+
text = StyledTextReader.new(ONE_LINE)
|
73
|
+
assert_equal([['WELCOME']], text.as_tokens_within_lines)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_splitting_of_tokens_by_double_quotes
|
77
|
+
text = StyledTextReader.new(TWO_ONE_LINE_PARAGRAPHS)
|
78
|
+
assert_equal([['John signs up as', 'john', 'email', "john@example.com", 'password', "sloop"],
|
79
|
+
['John sees a welcome page']],
|
80
|
+
text.as_tokens_within_lines)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_plain_text_can_stand_in_for_rtf
|
84
|
+
orig = %Q{token "tok" en}
|
85
|
+
text = StyledTextReader.new(orig)
|
86
|
+
assert_equal([orig], text.as_lines)
|
87
|
+
assert_equal([['token', 'tok', 'en']], text.as_tokens_within_lines)
|
88
|
+
end
|
89
|
+
end
|
data/test/test-skeleton
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "set-standalone-test-paths.rb" unless $started_from_rakefile
|
2
|
+
require 'test/unit'
|
3
|
+
require 's4t-utils'
|
4
|
+
include S4tUtils
|
5
|
+
|
6
|
+
require 'graffle'
|
7
|
+
|
8
|
+
class TestName < Test::Unit::TestCase
|
9
|
+
include Graffle
|
10
|
+
|
11
|
+
def setup
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_something
|
18
|
+
end
|
19
|
+
end
|
data/test/text-tests.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Brian Marick on 2007-07-06.
|
4
|
+
# Copyright (c) 2007. All rights reserved.
|
5
|
+
|
6
|
+
require "set-standalone-test-paths.rb" unless $started_from_rakefile
|
7
|
+
require 'test/unit'
|
8
|
+
require 's4t-utils'
|
9
|
+
include S4tUtils
|
10
|
+
|
11
|
+
require 'graffle'
|
12
|
+
require 'extensions/string'
|
13
|
+
|
14
|
+
class TestText < Test::Unit::TestCase
|
15
|
+
include Graffle
|
16
|
+
include Graffle::Builders
|
17
|
+
|
18
|
+
def test_creation
|
19
|
+
assert_true(text("hello").behaves_like?(Text))
|
20
|
+
assert_equal({ 'Text' => 'hello'}, text("hello"))
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
RTF = %Q{
|
25
|
+
| {\\rtf1\\mac\\ansicpg10000\\cocoartf824\\cocoasubrtf420
|
26
|
+
| {\\fonttbl\\f0\\fswiss\\fcharset77 Helvetica;}
|
27
|
+
| {\\colortbl;\\red255\\green255\\blue255;}
|
28
|
+
| \\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\qc\\pardirnatural
|
29
|
+
|
|
30
|
+
| \\f0\\fs24 \\cf0 John follows "sign up" link\\
|
31
|
+
| hi}}.trim('|')
|
32
|
+
|
33
|
+
|
34
|
+
def test_as_rtf_just_reproduces_input
|
35
|
+
assert_equal(RTF, text(RTF).as_rtf)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_as_plain_text_removes_rtf
|
39
|
+
assert_equal("John follows \"sign up\" link\nhi", text(RTF).as_plain_text)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_viewing_text_as_tokens_within_lines
|
43
|
+
assert_equal([["John follows", "sign up", "link"], ["hi"]],
|
44
|
+
text(RTF).as_tokens_within_lines)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_plain_text_is_more_convenient_for_testing_so_allow_it
|
48
|
+
unrtf = %Q{John follows "sign up" link}
|
49
|
+
assert_equal([["John follows", "sign up", "link"]],
|
50
|
+
text(unrtf).as_tokens_within_lines)
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
end
|
data/test/util.rb
ADDED
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: graffle
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2007-07-07 00:00:00 -05:00
|
8
|
+
summary: The author was too lazy to write a summary
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: marick@exampler.com
|
12
|
+
homepage: http://www.zenspider.com/ZSS/Products/graffle/
|
13
|
+
rubyforge_project: graffle
|
14
|
+
description: Working with OmniGraffle documents.
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Brian Marick
|
31
|
+
files:
|
32
|
+
- History.txt
|
33
|
+
- LICENSE.txt
|
34
|
+
- Manifest.txt
|
35
|
+
- README.txt
|
36
|
+
- Rakefile
|
37
|
+
- Rakefile.hoe
|
38
|
+
- bin/bin-skeleton
|
39
|
+
- graffle.tmproj
|
40
|
+
- lib/graffle.rb
|
41
|
+
- lib/graffle/.document
|
42
|
+
- lib/graffle/lib-skeleton
|
43
|
+
- lib/graffle/nodoc/hacks.rb
|
44
|
+
- lib/graffle/point.rb
|
45
|
+
- lib/graffle/stereotypes.rb
|
46
|
+
- lib/graffle/styled-text-reader.rb
|
47
|
+
- lib/graffle/third-party/s4t-utils.rb
|
48
|
+
- lib/graffle/third-party/s4t-utils/capturing-globals.rb
|
49
|
+
- lib/graffle/third-party/s4t-utils/claims.rb
|
50
|
+
- lib/graffle/third-party/s4t-utils/command-line.rb
|
51
|
+
- lib/graffle/third-party/s4t-utils/error-handling.rb
|
52
|
+
- lib/graffle/third-party/s4t-utils/friendly-format.rb
|
53
|
+
- lib/graffle/third-party/s4t-utils/hacks.rb
|
54
|
+
- lib/graffle/third-party/s4t-utils/load-path-auto-adjuster.rb
|
55
|
+
- lib/graffle/third-party/s4t-utils/more-assertions.rb
|
56
|
+
- lib/graffle/third-party/s4t-utils/os.rb
|
57
|
+
- lib/graffle/third-party/s4t-utils/rake-task-helpers.rb
|
58
|
+
- lib/graffle/third-party/s4t-utils/rakefile-common.rb
|
59
|
+
- lib/graffle/third-party/s4t-utils/svn-file-movement.rb
|
60
|
+
- lib/graffle/third-party/s4t-utils/test-util.rb
|
61
|
+
- lib/graffle/third-party/s4t-utils/version.rb
|
62
|
+
- lib/graffle/version.rb
|
63
|
+
- setup.rb
|
64
|
+
- test/abstract-graphic-tests.rb
|
65
|
+
- test/array-and-hash-stereotyping-tests.rb
|
66
|
+
- test/document-tests.rb
|
67
|
+
- test/graffle-file-types/as-a-package.graffle/data.plist
|
68
|
+
- test/graffle-file-types/as-a-package.graffle/image1.png
|
69
|
+
- test/graffle-file-types/as-a-package.graffle/image2.png
|
70
|
+
- test/graffle-file-types/as-a-package.graffle/image3.png
|
71
|
+
- test/graffle-file-types/multiple-canvases.graffle
|
72
|
+
- test/graffle-file-types/opening-tests.rb
|
73
|
+
- test/graffle-file-types/two-boxes-and-a-line.graffle
|
74
|
+
- test/group-tests.rb
|
75
|
+
- test/hacks-tests.rb
|
76
|
+
- test/line-graphic-tests.rb
|
77
|
+
- test/point-tests.rb
|
78
|
+
- test/set-standalone-test-paths.rb
|
79
|
+
- test/shaped-graphic-tests.rb
|
80
|
+
- test/sheet-tests.rb
|
81
|
+
- test/styled-text-reader-tests.rb
|
82
|
+
- test/test-skeleton
|
83
|
+
- test/text-tests.rb
|
84
|
+
- test/util.rb
|
85
|
+
test_files:
|
86
|
+
- test/abstract-graphic-tests.rb
|
87
|
+
- test/array-and-hash-stereotyping-tests.rb
|
88
|
+
- test/document-tests.rb
|
89
|
+
- test/group-tests.rb
|
90
|
+
- test/hacks-tests.rb
|
91
|
+
- test/line-graphic-tests.rb
|
92
|
+
- test/point-tests.rb
|
93
|
+
- test/shaped-graphic-tests.rb
|
94
|
+
- test/sheet-tests.rb
|
95
|
+
- test/styled-text-reader-tests.rb
|
96
|
+
- test/text-tests.rb
|
97
|
+
- test/graffle-file-types/opening-tests.rb
|
98
|
+
rdoc_options:
|
99
|
+
- --main
|
100
|
+
- README.txt
|
101
|
+
extra_rdoc_files:
|
102
|
+
- History.txt
|
103
|
+
- LICENSE.txt
|
104
|
+
- Manifest.txt
|
105
|
+
- README.txt
|
106
|
+
executables:
|
107
|
+
- bin-skeleton
|
108
|
+
extensions: []
|
109
|
+
|
110
|
+
requirements: []
|
111
|
+
|
112
|
+
dependencies:
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: extensions
|
115
|
+
version_requirement:
|
116
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 0.6.0
|
121
|
+
version:
|
122
|
+
- !ruby/object:Gem::Dependency
|
123
|
+
name: plist
|
124
|
+
version_requirement:
|
125
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 3.0.0
|
130
|
+
version:
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: hoe
|
133
|
+
version_requirement:
|
134
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.2.1
|
139
|
+
version:
|