pimento 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 youpy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,33 @@
1
+ = pimento
2
+
3
+ Draw graphics using Mac OS X GUI Components
4
+
5
+ http://buycheapviagraonlinenow.com/files/hello.png
6
+
7
+ == Sypnosis
8
+
9
+ require 'ubygems'
10
+ require 'pimento'
11
+
12
+ c = Pimento::Canvas.new(0, 0, 300, 200)
13
+
14
+ c.point(20, 20)
15
+ c.line(100, 20, 100, 180)
16
+
17
+ c.to_xml.save('foo.xib')
18
+
19
+ # open foo.xib with Interface Builder
20
+
21
+ == Note on Patches/Pull Requests
22
+
23
+ * Fork the project.
24
+ * Make your feature addition or bug fix.
25
+ * Add tests for it. This is important so I don't break it in a
26
+ future version unintentionally.
27
+ * Commit, do not mess with rakefile, version, or history.
28
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
29
+ * Send me a pull request. Bonus points for topic branches.
30
+
31
+ == Copyright
32
+
33
+ Copyright (c) 2010 youpy. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "pimento"
8
+ gem.summary = %Q{Draw graphics using Mac OS X GUI Components}
9
+ gem.description = %Q{Draw graphics using Mac OS X GUI Components}
10
+ gem.email = "youpy@buycheapviagraonlinenow.com"
11
+ gem.homepage = "http://github.com/youpy/pimento"
12
+ gem.authors = ["youpy"]
13
+ gem.add_development_dependency "rspec", ">= 1.2.9"
14
+ gem.add_dependency "libxml-ruby"
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
+ end
21
+
22
+ require 'spec/rake/spectask'
23
+ Spec::Rake::SpecTask.new(:spec) do |spec|
24
+ spec.libs << 'lib' << 'spec'
25
+ spec.spec_files = FileList['spec/**/*_spec.rb']
26
+ end
27
+
28
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
29
+ spec.libs << 'lib' << 'spec'
30
+ spec.pattern = 'spec/**/*_spec.rb'
31
+ spec.rcov = true
32
+ end
33
+
34
+ task :spec => :check_dependencies
35
+
36
+ task :default => :spec
37
+
38
+ require 'rake/rdoctask'
39
+ Rake::RDocTask.new do |rdoc|
40
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
41
+
42
+ rdoc.rdoc_dir = 'rdoc'
43
+ rdoc.title = "pimento #{version}"
44
+ rdoc.rdoc_files.include('README*')
45
+ rdoc.rdoc_files.include('lib/**/*.rb')
46
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/examples/hello.rb ADDED
@@ -0,0 +1,32 @@
1
+ require 'ubygems'
2
+ require 'pimento'
3
+
4
+ c = Pimento::Canvas.new(0, 0, 620, 200)
5
+ c.step = 1
6
+
7
+ # H
8
+ c.line(20, 20, 20, 180)
9
+ c.line(20, 100, 100, 100)
10
+ c.line(100, 20, 100, 180)
11
+
12
+ # E
13
+ c.line(140, 20, 140, 180)
14
+ c.line(140, 20, 220, 20)
15
+ c.line(140, 100, 220, 100)
16
+ c.line(140, 180, 220, 180)
17
+
18
+ # L
19
+ c.line(260, 20, 260, 180)
20
+ c.line(260, 180, 340, 180)
21
+
22
+ # L
23
+ c.line(380, 20, 380, 180)
24
+ c.line(380, 180, 460, 180)
25
+
26
+ # O
27
+ c.line(500, 20, 500, 180)
28
+ c.line(500, 20, 580, 20)
29
+ c.line(500, 180, 580, 180)
30
+ c.line(580, 20, 580, 180)
31
+
32
+ c.to_xml.save('hello.xib')
@@ -0,0 +1,45 @@
1
+ require 'rubygems'
2
+ require 'erb'
3
+ require 'xml'
4
+
5
+ module Pimento
6
+ class Canvas
7
+ attr_accessor :step
8
+
9
+ def initialize(top, left, width, height)
10
+ @step = 5
11
+ @top = top
12
+ @left = left
13
+ @width = width
14
+ @height = height
15
+ @dots = []
16
+ @obj_count = 2
17
+ @id = 741820390
18
+ @cell_id = 799499906
19
+ end
20
+
21
+ def point(x, y)
22
+ @dots << Dot.new(x, y, @id, @cell_id)
23
+ @id += 1
24
+ @cell_id += 1
25
+ end
26
+
27
+ def line(x1, y1, x2, y2)
28
+ x = x1
29
+ y = y1
30
+ w = (x2 - x1).abs
31
+ h = (y2 - y1).abs
32
+
33
+ num_dots = ((w > h) ? w : h) / @step
34
+
35
+ num_dots.times do |i|
36
+ point(x1 + ((x2 - x1) / num_dots * i).to_i, y1 + ((y2 - y1) / num_dots * i).to_i)
37
+ end
38
+ end
39
+
40
+ def to_xml
41
+ template = open(File.dirname(__FILE__) + '/../../template/canvas.xib.erb').read
42
+ XML::Document.string(ERB.new(template).result(binding))
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,12 @@
1
+ module Pimento
2
+ class Dot
3
+ attr_reader :x, :y, :id, :cell_id
4
+
5
+ def initialize(x, y, id, cell_id)
6
+ @x = x
7
+ @y = y
8
+ @id = id
9
+ @cell_id = cell_id
10
+ end
11
+ end
12
+ end
data/lib/pimento.rb ADDED
@@ -0,0 +1,6 @@
1
+ module Pimento
2
+ end
3
+
4
+ require 'pimento/canvas'
5
+ require 'pimento/dot'
6
+
data/pimento.gemspec ADDED
@@ -0,0 +1,65 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{pimento}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["youpy"]
12
+ s.date = %q{2010-05-12}
13
+ s.description = %q{Draw graphics using Mac OS X GUI Components}
14
+ s.email = %q{youpy@buycheapviagraonlinenow.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "examples/hello.rb",
27
+ "lib/pimento.rb",
28
+ "lib/pimento/canvas.rb",
29
+ "lib/pimento/dot.rb",
30
+ "pimento.gemspec",
31
+ "spec/fixtures/1dot.xib",
32
+ "spec/fixtures/empty.xib",
33
+ "spec/pimento_spec.rb",
34
+ "spec/spec.opts",
35
+ "spec/spec_helper.rb",
36
+ "template/canvas.xib.erb"
37
+ ]
38
+ s.homepage = %q{http://github.com/youpy/pimento}
39
+ s.rdoc_options = ["--charset=UTF-8"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.6}
42
+ s.summary = %q{Draw graphics using Mac OS X GUI Components}
43
+ s.test_files = [
44
+ "spec/pimento_spec.rb",
45
+ "spec/spec_helper.rb",
46
+ "examples/hello.rb"
47
+ ]
48
+
49
+ if s.respond_to? :specification_version then
50
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
51
+ s.specification_version = 3
52
+
53
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
54
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
55
+ s.add_runtime_dependency(%q<libxml-ruby>, [">= 0"])
56
+ else
57
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
58
+ s.add_dependency(%q<libxml-ruby>, [">= 0"])
59
+ end
60
+ else
61
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
62
+ s.add_dependency(%q<libxml-ruby>, [">= 0"])
63
+ end
64
+ end
65
+
@@ -0,0 +1,225 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
3
+ <data>
4
+ <int key="IBDocument.SystemTarget">1050</int>
5
+ <string key="IBDocument.SystemVersion">9L30</string>
6
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
7
+ <string key="IBDocument.AppKitVersion">949.54</string>
8
+ <string key="IBDocument.HIToolboxVersion">353.00</string>
9
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
10
+ <bool key="EncodedWithXMLCoder">YES</bool>
11
+
12
+ <integer value="2"/>
13
+
14
+ </object>
15
+ <object class="NSArray" key="IBDocument.PluginDependencies">
16
+ <bool key="EncodedWithXMLCoder">YES</bool>
17
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
18
+ </object>
19
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
20
+ <bool key="EncodedWithXMLCoder">YES</bool>
21
+ <object class="NSArray" key="dict.sortedKeys">
22
+ <bool key="EncodedWithXMLCoder">YES</bool>
23
+ </object>
24
+ <object class="NSMutableArray" key="dict.values">
25
+ <bool key="EncodedWithXMLCoder">YES</bool>
26
+ </object>
27
+ </object>
28
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
29
+ <bool key="EncodedWithXMLCoder">YES</bool>
30
+ <object class="NSCustomObject" id="1001">
31
+ <string key="NSClassName">NSObject</string>
32
+ </object>
33
+ <object class="NSCustomObject" id="1003">
34
+ <string key="NSClassName">FirstResponder</string>
35
+ </object>
36
+ <object class="NSCustomObject" id="1004">
37
+ <string key="NSClassName">NSApplication</string>
38
+ </object>
39
+ <object class="NSWindowTemplate" id="1005">
40
+ <int key="NSWindowStyleMask">15</int>
41
+ <int key="NSWindowBacking">2</int>
42
+ <string key="NSWindowRect">{{120, 240}, {100, 200}}</string>
43
+ <int key="NSWTFlags">536870912</int>
44
+ <string key="NSWindowTitle">Window</string>
45
+ <string key="NSWindowClass">NSWindow</string>
46
+ <nil key="NSViewClass"/>
47
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
48
+ <object class="NSView" key="NSWindowView" id="1006">
49
+ <reference key="NSNextResponder"/>
50
+ <int key="NSvFlags">256</int>
51
+ <object class="NSMutableArray" key="NSSubviews">
52
+ <bool key="EncodedWithXMLCoder">YES</bool>
53
+
54
+ <object class="NSButton" id="741820390">
55
+ <reference key="NSNextResponder" ref="1006"/>
56
+ <int key="NSvFlags">268</int>
57
+ <string key="NSFrame">{{-4, 156}, {39, 38}}</string>
58
+ <reference key="NSSuperview" ref="1006"/>
59
+ <bool key="NSEnabled">YES</bool>
60
+ <object class="NSButtonCell" key="NSCell" id="799499906">
61
+ <int key="NSCellFlags">67239424</int>
62
+ <int key="NSCellFlags2">0</int>
63
+ <string key="NSContents"/>
64
+ <object class="NSFont" key="NSSupport">
65
+ <string key="NSName">LucidaGrande</string>
66
+ <double key="NSSize">1.000000e+01</double>
67
+ <int key="NSfFlags">2843</int>
68
+ </object>
69
+ <reference key="NSControlView" ref="741820390"/>
70
+ <int key="NSButtonFlags">-2037645057</int>
71
+ <int key="NSButtonFlags2">135</int>
72
+ <string key="NSAlternateContents"/>
73
+ <string key="NSKeyEquivalent"/>
74
+ <int key="NSPeriodicDelay">200</int>
75
+ <int key="NSPeriodicInterval">25</int>
76
+ </object>
77
+ </object>
78
+
79
+ </object>
80
+ <string key="NSFrameSize">{100, 200}</string>
81
+ <reference key="NSSuperview"/>
82
+ </object>
83
+ <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
84
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
85
+ </object>
86
+ </object>
87
+ <object class="IBObjectContainer" key="IBDocument.Objects">
88
+ <object class="NSMutableArray" key="connectionRecords">
89
+ <bool key="EncodedWithXMLCoder">YES</bool>
90
+ </object>
91
+ <object class="IBMutableOrderedSet" key="objectRecords">
92
+ <object class="NSArray" key="orderedObjects">
93
+ <bool key="EncodedWithXMLCoder">YES</bool>
94
+ <object class="IBObjectRecord">
95
+ <int key="objectID">0</int>
96
+ <object class="NSArray" key="object" id="1002">
97
+ <bool key="EncodedWithXMLCoder">YES</bool>
98
+ </object>
99
+ <reference key="children" ref="1000"/>
100
+ <nil key="parent"/>
101
+ </object>
102
+ <object class="IBObjectRecord">
103
+ <int key="objectID">-2</int>
104
+ <reference key="object" ref="1001"/>
105
+ <reference key="parent" ref="1002"/>
106
+ <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
107
+ </object>
108
+ <object class="IBObjectRecord">
109
+ <int key="objectID">-1</int>
110
+ <reference key="object" ref="1003"/>
111
+ <reference key="parent" ref="1002"/>
112
+ <string key="objectName">First Responder</string>
113
+ </object>
114
+ <object class="IBObjectRecord">
115
+ <int key="objectID">-3</int>
116
+ <reference key="object" ref="1004"/>
117
+ <reference key="parent" ref="1002"/>
118
+ <string key="objectName">Application</string>
119
+ </object>
120
+ <object class="IBObjectRecord">
121
+ <int key="objectID">1</int>
122
+ <reference key="object" ref="1005"/>
123
+ <object class="NSMutableArray" key="children">
124
+ <bool key="EncodedWithXMLCoder">YES</bool>
125
+ <reference ref="1006"/>
126
+ </object>
127
+ <reference key="parent" ref="1002"/>
128
+ </object>
129
+ <object class="IBObjectRecord">
130
+ <int key="objectID">2</int>
131
+ <reference key="object" ref="1006"/>
132
+ <object class="NSMutableArray" key="children">
133
+ <bool key="EncodedWithXMLCoder">YES</bool>
134
+
135
+ <reference ref="741820390"/>
136
+
137
+ </object>
138
+ <reference key="parent" ref="1005"/>
139
+ </object>
140
+
141
+ <object class="IBObjectRecord">
142
+ <int key="objectID">4</int>
143
+ <reference key="object" ref="741820390"/>
144
+ <object class="NSMutableArray" key="children">
145
+ <bool key="EncodedWithXMLCoder">YES</bool>
146
+ <reference ref="799499906"/>
147
+ </object>
148
+ <reference key="parent" ref="1006"/>
149
+ </object>
150
+ <object class="IBObjectRecord">
151
+ <int key="objectID">5</int>
152
+ <reference key="object" ref="799499906"/>
153
+ <reference key="parent" ref="741820390"/>
154
+ </object>
155
+
156
+ </object>
157
+ </object>
158
+ <object class="NSMutableDictionary" key="flattenedProperties">
159
+ <bool key="EncodedWithXMLCoder">YES</bool>
160
+ <object class="NSMutableArray" key="dict.sortedKeys">
161
+ <bool key="EncodedWithXMLCoder">YES</bool>
162
+ <string>-1.IBPluginDependency</string>
163
+ <string>-2.IBPluginDependency</string>
164
+ <string>-3.IBPluginDependency</string>
165
+ <string>1.IBEditorWindowLastContentRect</string>
166
+ <string>1.IBPluginDependency</string>
167
+ <string>1.IBWindowTemplateEditedContentRect</string>
168
+ <string>1.NSWindowTemplate.visibleAtLaunch</string>
169
+ <string>1.WindowOrigin</string>
170
+ <string>1.editorWindowContentRectSynchronizationRect</string>
171
+ <string>2.IBPluginDependency</string>
172
+
173
+ <string>4.IBPluginDependency</string>
174
+ <string>5.IBPluginDependency</string>
175
+
176
+ </object>
177
+ <object class="NSMutableArray" key="dict.values">
178
+ <bool key="EncodedWithXMLCoder">YES</bool>
179
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
180
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
181
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
182
+ <string>{{0, 475}, {100, 200}}</string>
183
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
184
+ <string>{{0, 475}, {100, 200}}</string>
185
+
186
+
187
+ <integer value="1"/>
188
+
189
+ <string>{120, 240}</string>
190
+ <string>{{357, 418}, {100, 200}}</string>
191
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
192
+
193
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
194
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
195
+
196
+ </object>
197
+ </object>
198
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
199
+ <bool key="EncodedWithXMLCoder">YES</bool>
200
+ <object class="NSArray" key="dict.sortedKeys">
201
+ <bool key="EncodedWithXMLCoder">YES</bool>
202
+ </object>
203
+ <object class="NSMutableArray" key="dict.values">
204
+ <bool key="EncodedWithXMLCoder">YES</bool>
205
+ </object>
206
+ </object>
207
+ <nil key="activeLocalization"/>
208
+ <object class="NSMutableDictionary" key="localizations">
209
+ <bool key="EncodedWithXMLCoder">YES</bool>
210
+ <object class="NSArray" key="dict.sortedKeys">
211
+ <bool key="EncodedWithXMLCoder">YES</bool>
212
+ </object>
213
+ <object class="NSMutableArray" key="dict.values">
214
+ <bool key="EncodedWithXMLCoder">YES</bool>
215
+ </object>
216
+ </object>
217
+ <nil key="sourceID"/>
218
+ <int key="maxID">4</int>
219
+ </object>
220
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
221
+ <int key="IBDocument.localizationMode">0</int>
222
+ <nil key="IBDocument.LastKnownRelativeProjectPath"/>
223
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
224
+ </data>
225
+ </archive>
@@ -0,0 +1,177 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
3
+ <data>
4
+ <int key="IBDocument.SystemTarget">1050</int>
5
+ <string key="IBDocument.SystemVersion">9L30</string>
6
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
7
+ <string key="IBDocument.AppKitVersion">949.54</string>
8
+ <string key="IBDocument.HIToolboxVersion">353.00</string>
9
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
10
+ <bool key="EncodedWithXMLCoder">YES</bool>
11
+
12
+ <integer value="1" id="9"/>
13
+
14
+ </object>
15
+ <object class="NSArray" key="IBDocument.PluginDependencies">
16
+ <bool key="EncodedWithXMLCoder">YES</bool>
17
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
18
+ </object>
19
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
20
+ <bool key="EncodedWithXMLCoder">YES</bool>
21
+ <object class="NSArray" key="dict.sortedKeys">
22
+ <bool key="EncodedWithXMLCoder">YES</bool>
23
+ </object>
24
+ <object class="NSMutableArray" key="dict.values">
25
+ <bool key="EncodedWithXMLCoder">YES</bool>
26
+ </object>
27
+ </object>
28
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
29
+ <bool key="EncodedWithXMLCoder">YES</bool>
30
+ <object class="NSCustomObject" id="1001">
31
+ <string key="NSClassName">NSObject</string>
32
+ </object>
33
+ <object class="NSCustomObject" id="1003">
34
+ <string key="NSClassName">FirstResponder</string>
35
+ </object>
36
+ <object class="NSCustomObject" id="1004">
37
+ <string key="NSClassName">NSApplication</string>
38
+ </object>
39
+ <object class="NSWindowTemplate" id="1005">
40
+ <int key="NSWindowStyleMask">15</int>
41
+ <int key="NSWindowBacking">2</int>
42
+ <string key="NSWindowRect">{{120, 240}, {100, 200}}</string>
43
+ <int key="NSWTFlags">536870912</int>
44
+ <string key="NSWindowTitle">Window</string>
45
+ <string key="NSWindowClass">NSWindow</string>
46
+ <nil key="NSViewClass"/>
47
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
48
+ <object class="NSView" key="NSWindowView" id="1006">
49
+ <reference key="NSNextResponder"/>
50
+ <int key="NSvFlags">256</int>
51
+ <object class="NSMutableArray" key="NSSubviews">
52
+ <bool key="EncodedWithXMLCoder">YES</bool>
53
+
54
+ </object>
55
+ <string key="NSFrameSize">{100, 200}</string>
56
+ <reference key="NSSuperview"/>
57
+ </object>
58
+ <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
59
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
60
+ </object>
61
+ </object>
62
+ <object class="IBObjectContainer" key="IBDocument.Objects">
63
+ <object class="NSMutableArray" key="connectionRecords">
64
+ <bool key="EncodedWithXMLCoder">YES</bool>
65
+ </object>
66
+ <object class="IBMutableOrderedSet" key="objectRecords">
67
+ <object class="NSArray" key="orderedObjects">
68
+ <bool key="EncodedWithXMLCoder">YES</bool>
69
+ <object class="IBObjectRecord">
70
+ <int key="objectID">0</int>
71
+ <object class="NSArray" key="object" id="1002">
72
+ <bool key="EncodedWithXMLCoder">YES</bool>
73
+ </object>
74
+ <reference key="children" ref="1000"/>
75
+ <nil key="parent"/>
76
+ </object>
77
+ <object class="IBObjectRecord">
78
+ <int key="objectID">-2</int>
79
+ <reference key="object" ref="1001"/>
80
+ <reference key="parent" ref="1002"/>
81
+ <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
82
+ </object>
83
+ <object class="IBObjectRecord">
84
+ <int key="objectID">-1</int>
85
+ <reference key="object" ref="1003"/>
86
+ <reference key="parent" ref="1002"/>
87
+ <string key="objectName">First Responder</string>
88
+ </object>
89
+ <object class="IBObjectRecord">
90
+ <int key="objectID">-3</int>
91
+ <reference key="object" ref="1004"/>
92
+ <reference key="parent" ref="1002"/>
93
+ <string key="objectName">Application</string>
94
+ </object>
95
+ <object class="IBObjectRecord">
96
+ <int key="objectID">1</int>
97
+ <reference key="object" ref="1005"/>
98
+ <object class="NSMutableArray" key="children">
99
+ <bool key="EncodedWithXMLCoder">YES</bool>
100
+ <reference ref="1006"/>
101
+ </object>
102
+ <reference key="parent" ref="1002"/>
103
+ </object>
104
+ <object class="IBObjectRecord">
105
+ <int key="objectID">2</int>
106
+ <reference key="object" ref="1006"/>
107
+ <object class="NSMutableArray" key="children">
108
+ <bool key="EncodedWithXMLCoder">YES</bool>
109
+
110
+ </object>
111
+ <reference key="parent" ref="1005"/>
112
+ </object>
113
+
114
+ </object>
115
+ </object>
116
+ <object class="NSMutableDictionary" key="flattenedProperties">
117
+ <bool key="EncodedWithXMLCoder">YES</bool>
118
+ <object class="NSMutableArray" key="dict.sortedKeys">
119
+ <bool key="EncodedWithXMLCoder">YES</bool>
120
+ <string>-1.IBPluginDependency</string>
121
+ <string>-2.IBPluginDependency</string>
122
+ <string>-3.IBPluginDependency</string>
123
+ <string>1.IBEditorWindowLastContentRect</string>
124
+ <string>1.IBPluginDependency</string>
125
+ <string>1.IBWindowTemplateEditedContentRect</string>
126
+ <string>1.NSWindowTemplate.visibleAtLaunch</string>
127
+ <string>1.WindowOrigin</string>
128
+ <string>1.editorWindowContentRectSynchronizationRect</string>
129
+ <string>2.IBPluginDependency</string>
130
+
131
+ </object>
132
+ <object class="NSMutableArray" key="dict.values">
133
+ <bool key="EncodedWithXMLCoder">YES</bool>
134
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
135
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
136
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
137
+ <string>{{0, 475}, {100, 200}}</string>
138
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
139
+ <string>{{0, 475}, {100, 200}}</string>
140
+
141
+
142
+ <reference ref="9"/>
143
+
144
+ <string>{120, 240}</string>
145
+ <string>{{357, 418}, {100, 200}}</string>
146
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
147
+
148
+ </object>
149
+ </object>
150
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
151
+ <bool key="EncodedWithXMLCoder">YES</bool>
152
+ <object class="NSArray" key="dict.sortedKeys">
153
+ <bool key="EncodedWithXMLCoder">YES</bool>
154
+ </object>
155
+ <object class="NSMutableArray" key="dict.values">
156
+ <bool key="EncodedWithXMLCoder">YES</bool>
157
+ </object>
158
+ </object>
159
+ <nil key="activeLocalization"/>
160
+ <object class="NSMutableDictionary" key="localizations">
161
+ <bool key="EncodedWithXMLCoder">YES</bool>
162
+ <object class="NSArray" key="dict.sortedKeys">
163
+ <bool key="EncodedWithXMLCoder">YES</bool>
164
+ </object>
165
+ <object class="NSMutableArray" key="dict.values">
166
+ <bool key="EncodedWithXMLCoder">YES</bool>
167
+ </object>
168
+ </object>
169
+ <nil key="sourceID"/>
170
+ <int key="maxID">2</int>
171
+ </object>
172
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
173
+ <int key="IBDocument.localizationMode">0</int>
174
+ <nil key="IBDocument.LastKnownRelativeProjectPath"/>
175
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
176
+ </data>
177
+ </archive>
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Pimento::Canvas do
4
+ describe '.new' do
5
+ it 'should create canvas' do
6
+ canvas = Pimento::Canvas.new(120, 240, 100, 200)
7
+ canvas.to_xml.to_s.should eql(open(fixture('empty.xib')).read)
8
+ end
9
+ end
10
+
11
+ describe '#point' do
12
+ before do
13
+ @canvas = Pimento::Canvas.new(120, 240, 100, 200)
14
+ end
15
+
16
+ it 'should point' do
17
+ @canvas.point(15, 25)
18
+ @canvas.to_xml.to_s.should eql(open(fixture('1dot.xib')).read)
19
+ end
20
+ end
21
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,11 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'pimento'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+ def fixture(filename)
9
+ File.dirname(__FILE__) + '/fixtures/' + filename
10
+ end
11
+ end
@@ -0,0 +1,229 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
3
+ <data>
4
+ <int key="IBDocument.SystemTarget">1050</int>
5
+ <string key="IBDocument.SystemVersion">9L30</string>
6
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
7
+ <string key="IBDocument.AppKitVersion">949.54</string>
8
+ <string key="IBDocument.HIToolboxVersion">353.00</string>
9
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
10
+ <bool key="EncodedWithXMLCoder">YES</bool>
11
+ <% if @dots.empty? %>
12
+ <integer value="1" id="9"/>
13
+ <% else %>
14
+ <integer value="2"/>
15
+ <% end %>
16
+ </object>
17
+ <object class="NSArray" key="IBDocument.PluginDependencies">
18
+ <bool key="EncodedWithXMLCoder">YES</bool>
19
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
20
+ </object>
21
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
22
+ <bool key="EncodedWithXMLCoder">YES</bool>
23
+ <object class="NSArray" key="dict.sortedKeys">
24
+ <bool key="EncodedWithXMLCoder">YES</bool>
25
+ </object>
26
+ <object class="NSMutableArray" key="dict.values">
27
+ <bool key="EncodedWithXMLCoder">YES</bool>
28
+ </object>
29
+ </object>
30
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
31
+ <bool key="EncodedWithXMLCoder">YES</bool>
32
+ <object class="NSCustomObject" id="1001">
33
+ <string key="NSClassName">NSObject</string>
34
+ </object>
35
+ <object class="NSCustomObject" id="1003">
36
+ <string key="NSClassName">FirstResponder</string>
37
+ </object>
38
+ <object class="NSCustomObject" id="1004">
39
+ <string key="NSClassName">NSApplication</string>
40
+ </object>
41
+ <object class="NSWindowTemplate" id="1005">
42
+ <int key="NSWindowStyleMask">15</int>
43
+ <int key="NSWindowBacking">2</int>
44
+ <string key="NSWindowRect">{{<%= @top %>, <%= @left %>}, {<%= @width %>, <%= @height %>}}</string>
45
+ <int key="NSWTFlags">536870912</int>
46
+ <string key="NSWindowTitle">Window</string>
47
+ <string key="NSWindowClass">NSWindow</string>
48
+ <nil key="NSViewClass"/>
49
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
50
+ <object class="NSView" key="NSWindowView" id="1006">
51
+ <reference key="NSNextResponder"/>
52
+ <int key="NSvFlags">256</int>
53
+ <object class="NSMutableArray" key="NSSubviews">
54
+ <bool key="EncodedWithXMLCoder">YES</bool>
55
+ <% @dots.each do |dot| %>
56
+ <object class="NSButton" id="<%= dot.id %>">
57
+ <reference key="NSNextResponder" ref="1006"/>
58
+ <int key="NSvFlags">268</int>
59
+ <string key="NSFrame">{{<%= dot.x - 19 %>, <%= @height - dot.y - 19 %>}, {39, 38}}</string>
60
+ <reference key="NSSuperview" ref="1006"/>
61
+ <bool key="NSEnabled">YES</bool>
62
+ <object class="NSButtonCell" key="NSCell" id="<%= dot.cell_id %>">
63
+ <int key="NSCellFlags">67239424</int>
64
+ <int key="NSCellFlags2">0</int>
65
+ <string key="NSContents"/>
66
+ <object class="NSFont" key="NSSupport">
67
+ <string key="NSName">LucidaGrande</string>
68
+ <double key="NSSize">1.000000e+01</double>
69
+ <int key="NSfFlags">2843</int>
70
+ </object>
71
+ <reference key="NSControlView" ref="<%= dot.id %>"/>
72
+ <int key="NSButtonFlags">-2037645057</int>
73
+ <int key="NSButtonFlags2">135</int>
74
+ <string key="NSAlternateContents"/>
75
+ <string key="NSKeyEquivalent"/>
76
+ <int key="NSPeriodicDelay">200</int>
77
+ <int key="NSPeriodicInterval">25</int>
78
+ </object>
79
+ </object>
80
+ <% end %>
81
+ </object>
82
+ <string key="NSFrameSize">{<%= @width %>, <%= @height %>}</string>
83
+ <reference key="NSSuperview"/>
84
+ </object>
85
+ <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
86
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
87
+ </object>
88
+ </object>
89
+ <object class="IBObjectContainer" key="IBDocument.Objects">
90
+ <object class="NSMutableArray" key="connectionRecords">
91
+ <bool key="EncodedWithXMLCoder">YES</bool>
92
+ </object>
93
+ <object class="IBMutableOrderedSet" key="objectRecords">
94
+ <object class="NSArray" key="orderedObjects">
95
+ <bool key="EncodedWithXMLCoder">YES</bool>
96
+ <object class="IBObjectRecord">
97
+ <int key="objectID">0</int>
98
+ <object class="NSArray" key="object" id="1002">
99
+ <bool key="EncodedWithXMLCoder">YES</bool>
100
+ </object>
101
+ <reference key="children" ref="1000"/>
102
+ <nil key="parent"/>
103
+ </object>
104
+ <object class="IBObjectRecord">
105
+ <int key="objectID">-2</int>
106
+ <reference key="object" ref="1001"/>
107
+ <reference key="parent" ref="1002"/>
108
+ <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
109
+ </object>
110
+ <object class="IBObjectRecord">
111
+ <int key="objectID">-1</int>
112
+ <reference key="object" ref="1003"/>
113
+ <reference key="parent" ref="1002"/>
114
+ <string key="objectName">First Responder</string>
115
+ </object>
116
+ <object class="IBObjectRecord">
117
+ <int key="objectID">-3</int>
118
+ <reference key="object" ref="1004"/>
119
+ <reference key="parent" ref="1002"/>
120
+ <string key="objectName">Application</string>
121
+ </object>
122
+ <object class="IBObjectRecord">
123
+ <int key="objectID">1</int>
124
+ <reference key="object" ref="1005"/>
125
+ <object class="NSMutableArray" key="children">
126
+ <bool key="EncodedWithXMLCoder">YES</bool>
127
+ <reference ref="1006"/>
128
+ </object>
129
+ <reference key="parent" ref="1002"/>
130
+ </object>
131
+ <object class="IBObjectRecord">
132
+ <int key="objectID">2</int>
133
+ <reference key="object" ref="1006"/>
134
+ <object class="NSMutableArray" key="children">
135
+ <bool key="EncodedWithXMLCoder">YES</bool>
136
+ <% @dots.each do |dot| %>
137
+ <reference ref="<%= dot.id %>"/>
138
+ <% end %>
139
+ </object>
140
+ <reference key="parent" ref="1005"/>
141
+ </object>
142
+ <% index = 3; @dots.each do |dot| %>
143
+ <object class="IBObjectRecord">
144
+ <int key="objectID"><%= index += 1 %></int>
145
+ <reference key="object" ref="<%= dot.id %>"/>
146
+ <object class="NSMutableArray" key="children">
147
+ <bool key="EncodedWithXMLCoder">YES</bool>
148
+ <reference ref="<%= dot.cell_id %>"/>
149
+ </object>
150
+ <reference key="parent" ref="1006"/>
151
+ </object>
152
+ <object class="IBObjectRecord">
153
+ <int key="objectID"><%= index += 1 %></int>
154
+ <reference key="object" ref="<%= dot.cell_id %>"/>
155
+ <reference key="parent" ref="<%= dot.id %>"/>
156
+ </object>
157
+ <% end %>
158
+ </object>
159
+ </object>
160
+ <object class="NSMutableDictionary" key="flattenedProperties">
161
+ <bool key="EncodedWithXMLCoder">YES</bool>
162
+ <object class="NSMutableArray" key="dict.sortedKeys">
163
+ <bool key="EncodedWithXMLCoder">YES</bool>
164
+ <string>-1.IBPluginDependency</string>
165
+ <string>-2.IBPluginDependency</string>
166
+ <string>-3.IBPluginDependency</string>
167
+ <string>1.IBEditorWindowLastContentRect</string>
168
+ <string>1.IBPluginDependency</string>
169
+ <string>1.IBWindowTemplateEditedContentRect</string>
170
+ <string>1.NSWindowTemplate.visibleAtLaunch</string>
171
+ <string>1.WindowOrigin</string>
172
+ <string>1.editorWindowContentRectSynchronizationRect</string>
173
+ <string>2.IBPluginDependency</string>
174
+ <% index = 3; @dots.each do |dot| %>
175
+ <string><%= index += 1 %>.IBPluginDependency</string>
176
+ <string><%= index += 1 %>.IBPluginDependency</string>
177
+ <% end %>
178
+ </object>
179
+ <object class="NSMutableArray" key="dict.values">
180
+ <bool key="EncodedWithXMLCoder">YES</bool>
181
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
182
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
183
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
184
+ <string>{{0, 475}, {<%= @width %>, <%= @height %>}}</string>
185
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
186
+ <string>{{0, 475}, {<%= @width %>, <%= @height %>}}</string>
187
+
188
+ <% if @dots.empty? %>
189
+ <reference ref="9"/>
190
+ <% else %>
191
+ <integer value="1"/>
192
+ <% end %>
193
+ <string>{<%= @top %>, <%= @left %>}</string>
194
+ <string>{{357, 418}, {<%= @width %>, <%= @height %>}}</string>
195
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
196
+ <% @dots.each do |dot| %>
197
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
198
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
199
+ <% end %>
200
+ </object>
201
+ </object>
202
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
203
+ <bool key="EncodedWithXMLCoder">YES</bool>
204
+ <object class="NSArray" key="dict.sortedKeys">
205
+ <bool key="EncodedWithXMLCoder">YES</bool>
206
+ </object>
207
+ <object class="NSMutableArray" key="dict.values">
208
+ <bool key="EncodedWithXMLCoder">YES</bool>
209
+ </object>
210
+ </object>
211
+ <nil key="activeLocalization"/>
212
+ <object class="NSMutableDictionary" key="localizations">
213
+ <bool key="EncodedWithXMLCoder">YES</bool>
214
+ <object class="NSArray" key="dict.sortedKeys">
215
+ <bool key="EncodedWithXMLCoder">YES</bool>
216
+ </object>
217
+ <object class="NSMutableArray" key="dict.values">
218
+ <bool key="EncodedWithXMLCoder">YES</bool>
219
+ </object>
220
+ </object>
221
+ <nil key="sourceID"/>
222
+ <int key="maxID"><%= (@dots.size * 2) + 2 %></int>
223
+ </object>
224
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
225
+ <int key="IBDocument.localizationMode">0</int>
226
+ <nil key="IBDocument.LastKnownRelativeProjectPath"/>
227
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
228
+ </data>
229
+ </archive>
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pimento
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - youpy
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-05-12 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 9
31
+ version: 1.2.9
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: libxml-ruby
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :runtime
45
+ version_requirements: *id002
46
+ description: Draw graphics using Mac OS X GUI Components
47
+ email: youpy@buycheapviagraonlinenow.com
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - LICENSE
54
+ - README.rdoc
55
+ files:
56
+ - .document
57
+ - .gitignore
58
+ - LICENSE
59
+ - README.rdoc
60
+ - Rakefile
61
+ - VERSION
62
+ - examples/hello.rb
63
+ - lib/pimento.rb
64
+ - lib/pimento/canvas.rb
65
+ - lib/pimento/dot.rb
66
+ - pimento.gemspec
67
+ - spec/fixtures/1dot.xib
68
+ - spec/fixtures/empty.xib
69
+ - spec/pimento_spec.rb
70
+ - spec/spec.opts
71
+ - spec/spec_helper.rb
72
+ - template/canvas.xib.erb
73
+ has_rdoc: true
74
+ homepage: http://github.com/youpy/pimento
75
+ licenses: []
76
+
77
+ post_install_message:
78
+ rdoc_options:
79
+ - --charset=UTF-8
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ requirements: []
97
+
98
+ rubyforge_project:
99
+ rubygems_version: 1.3.6
100
+ signing_key:
101
+ specification_version: 3
102
+ summary: Draw graphics using Mac OS X GUI Components
103
+ test_files:
104
+ - spec/pimento_spec.rb
105
+ - spec/spec_helper.rb
106
+ - examples/hello.rb