cocoa 0.1.2 → 0.1.3
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/README.md +12 -8
- data/VERSION +1 -1
- data/cocoa.gemspec +5 -2
- data/examples/hello_world.rb +10 -0
- data/lib/cocoa/bindings/Cocoa.rb +6693 -0
- data/lib/cocoa/extensions.rb +58 -8
- data/lib/cocoa/helpers.rb +23 -429
- data/lib/cocoa/objc.rb +262 -0
- data/lib/cocoa/structs/NSPoint.rb +6 -0
- data/lib/cocoa/structs/NSRange.rb +23 -0
- data/lib/cocoa/structs/NSRect.rb +6 -0
- data/lib/cocoa/structs/NSSize.rb +4 -0
- data/lib/cocoa.rb +2 -6694
- data/spec/cocoa/cocoa_spec.rb +1 -1
- data/tasks/generate.rake +2 -28
- metadata +5 -2
data/spec/cocoa/cocoa_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe 'Cocoa' do
|
|
21
21
|
array = Cocoa::NSMutableArray.array
|
22
22
|
array.addObject "head"
|
23
23
|
array.addObject "tail"
|
24
|
-
|
24
|
+
ObjC.NSString_to_String(array.description.object).should == "(\n head,\n tail\n)"
|
25
25
|
end
|
26
26
|
it 'should return stringifyable strings' do
|
27
27
|
array = Cocoa::NSMutableArray.array
|
data/tasks/generate.rake
CHANGED
@@ -115,33 +115,8 @@ task :generate do
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
mod = File.open("lib/cocoa.rb",'w')
|
119
|
-
mod.puts
|
120
|
-
require 'active_support'
|
121
|
-
|
122
|
-
require 'cocoa/helpers'
|
123
|
-
require "cocoa/bindings/NSString"
|
124
|
-
|
125
|
-
module Cocoa
|
126
|
-
extend FFI::Library
|
127
|
-
|
128
|
-
# Load the Cocoa framework's binary code
|
129
|
-
ffi_lib '/System/Library/Frameworks/Cocoa.framework/Cocoa'
|
130
|
-
|
131
|
-
# Needed to properly set up the Objective-C environment.
|
132
|
-
attach_function :NSApplicationLoad, [], :bool
|
133
|
-
NSApplicationLoad()
|
134
|
-
|
135
|
-
def const_missing name
|
136
|
-
if File.exists?(File.dirname(__FILE__) + "/cocoa/bindings/\#{name}.rb")
|
137
|
-
require "cocoa/bindings/\#{name}"
|
138
|
-
"Cocoa::\#{name}".constantize
|
139
|
-
else
|
140
|
-
super
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
}
|
118
|
+
mod = File.open("lib/cocoa/bindings/Cocoa.rb",'w')
|
119
|
+
mod.puts 'module Cocoa'
|
145
120
|
enums.each do |name,value|
|
146
121
|
mod.puts " #{name} = #{value}"
|
147
122
|
end
|
@@ -179,6 +154,5 @@ module Cocoa
|
|
179
154
|
end
|
180
155
|
end
|
181
156
|
mod.puts "end"
|
182
|
-
mod.puts 'require "cocoa/extensions"'
|
183
157
|
mod.close
|
184
158
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- Rakefile
|
138
138
|
- VERSION
|
139
139
|
- cocoa.gemspec
|
140
|
+
- examples/hello_world.rb
|
140
141
|
- examples/window.rb
|
141
142
|
- lib/cocoa.rb
|
142
143
|
- lib/cocoa/bindings/CAAnimation.rb
|
@@ -166,6 +167,7 @@ files:
|
|
166
167
|
- lib/cocoa/bindings/CIColor.rb
|
167
168
|
- lib/cocoa/bindings/CIFilter.rb
|
168
169
|
- lib/cocoa/bindings/CIImage.rb
|
170
|
+
- lib/cocoa/bindings/Cocoa.rb
|
169
171
|
- lib/cocoa/bindings/NSATSTypesetter.rb
|
170
172
|
- lib/cocoa/bindings/NSActionCell.rb
|
171
173
|
- lib/cocoa/bindings/NSAffineTransform.rb
|
@@ -529,6 +531,7 @@ files:
|
|
529
531
|
- lib/cocoa/helpers.rb
|
530
532
|
- lib/cocoa/objc.rb
|
531
533
|
- lib/cocoa/structs/NSPoint.rb
|
534
|
+
- lib/cocoa/structs/NSRange.rb
|
532
535
|
- lib/cocoa/structs/NSRect.rb
|
533
536
|
- lib/cocoa/structs/NSSize.rb
|
534
537
|
- spec/cocoa/cocoa_spec.rb
|