hotcocoa 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -14,7 +14,7 @@ From rubygems:
14
14
 
15
15
  Or to get the bleeding edge, you can clone the repository on Github and install from there:
16
16
 
17
- $ git clone git://github.com/ferrous26/hotcocoa
17
+ $ git clone git://github.com/HotCocoa/hotcocoa
18
18
  $ cd hotcocoa
19
19
  $ sudo macrake install
20
20
 
@@ -29,13 +29,13 @@ in order to run HotCocoa. Read about it on the
29
29
 
30
30
  ### Documentation
31
31
 
32
- The documentation can be found on [rdoc.info](http://rdoc.info/github/ferrous26/hotcocoa/master/frames).
32
+ The documentation can be found on [rdoc.info](http://rdoc.info/github/HotCocoa/hotcocoa/master/frames).
33
33
 
34
34
  The most important pages are:
35
35
 
36
- * [the overview](http://rubydoc.info/github/ferrous26/hotcocoa/master/file/docs/Overview.markdown)
37
- * [a guide to the mappings](http://rubydoc.info/github/ferrous26/hotcocoa/master/file/docs/Mappings.markdown)
38
- * [troubleshooting](http://rubydoc.info/github/ferrous26/hotcocoa/master/file/docs/Troubleshooting.markdown)
36
+ * [the overview](http://rubydoc.info/github/HotCocoa/hotcocoa/master/file/docs/Overview.markdown)
37
+ * [a guide to the mappings](http://rubydoc.info/github/HotCocoa/hotcocoa/master/file/docs/Mappings.markdown)
38
+ * [troubleshooting](http://rubydoc.info/github/HotCocoa/hotcocoa/master/file/docs/Troubleshooting.markdown)
39
39
 
40
40
  The documentation currently does not cover the shipped mappings right now due to the
41
41
  way that mappings are implemented; a YARD plug-in or new YARD features
@@ -43,7 +43,7 @@ will be needed (stay tuned).
43
43
 
44
44
  ### Examples
45
45
 
46
- Have a look in the [examples folder](https://github.com/ferrous26/hotcocoa/tree/master/examples) to see some sample apps which use HotCocoa.
46
+ Have a look in the [examples folder](https://github.com/HotCocoa/hotcocoa/tree/master/examples) to see some sample apps which use HotCocoa.
47
47
 
48
48
  ## Contributing
49
49
 
@@ -73,7 +73,7 @@ send in the patch :)).
73
73
  (The MIT License)
74
74
 
75
75
  Copyright (c) 2009-2010 Richard Kilmer
76
- Copyright (c) 2011 Mark Rada
76
+ Copyright (c) 2011-2012 Mark Rada
77
77
 
78
78
  Permission is hereby granted, free of charge, to any person obtaining
79
79
  a copy of this software and associated documentation files (the
@@ -0,0 +1,17 @@
1
+ require 'mkmf'
2
+
3
+ system('test -d /System/Library/BridgeSupport/include')
4
+ bridge_support_required = $?.to_i
5
+
6
+ if bridge_support_required
7
+ $stderr.puts ""
8
+ $stderr.puts "###################################################################"
9
+ $stderr.puts "# #"
10
+ $stderr.puts "# BridgeSupport installation required. #"
11
+ $stderr.puts "# Get the latest version at: http://www.MacRuby.org/files #"
12
+ $stderr.puts "# #"
13
+ $stderr.puts "###################################################################"
14
+ $stderr.puts ""
15
+ end
16
+
17
+ create_makefile('hotcocoa/hotcocoa')
@@ -0,0 +1 @@
1
+ #include </System/Library/BridgeSupport/include/_BS_bool.h>
@@ -16,7 +16,7 @@ class NSString
16
16
  ##
17
17
  # Borrowed from Active Support.
18
18
  def camel_case
19
- to_s.gsub /(?:^|_)(.)/ do $1.upcase end
19
+ gsub /(?:^|_)(.)/ do $1.upcase end
20
20
  end
21
21
 
22
22
  ##
@@ -1,3 +1,3 @@
1
1
  module HotCocoa
2
- VERSION = '0.6.1'
2
+ VERSION = '0.6.2'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hotcocoa
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.1
5
+ version: 0.6.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Richard Kilmer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-12-04 00:00:00 -05:00
13
+ date: 2012-01-03 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,14 +21,14 @@ dependencies:
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: "2.8"
24
+ version: "2.10"
25
25
  type: :development
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  none: false
28
28
  requirements:
29
29
  - - ~>
30
30
  - !ruby/object:Gem::Version
31
- version: "2.8"
31
+ version: "2.10"
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: yard
34
34
  prerelease: false
@@ -68,12 +68,12 @@ email:
68
68
  - mrada@marketcircle.com
69
69
  executables:
70
70
  - hotcocoa
71
- extensions: []
71
+ extensions:
72
+ - ext/hotcocoa/extconf.rb
72
73
  extra_rdoc_files:
73
74
  - README.markdown
74
75
  - History.markdown
75
76
  - docs/Contributors.markdown
76
- - docs/HeatingUpWithHotCocoa-part1.markdown
77
77
  - docs/Mappings.markdown
78
78
  - docs/MappingsExplained.markdown
79
79
  - docs/Overview.markdown
@@ -182,6 +182,8 @@ files:
182
182
  - template/lib/menu.rb
183
183
  - template/Rakefile
184
184
  - template/resources/HotCocoa.icns
185
+ - ext/hotcocoa/noop_bridge_support_check.c
186
+ - ext/hotcocoa/extconf.rb
185
187
  - test/application/helper.rb
186
188
  - test/application/test_builder.rb
187
189
  - test/application/test_document_type_specification.rb
@@ -212,7 +214,6 @@ files:
212
214
  - README.markdown
213
215
  - History.markdown
214
216
  - docs/Contributors.markdown
215
- - docs/HeatingUpWithHotCocoa-part1.markdown
216
217
  - docs/Mappings.markdown
217
218
  - docs/MappingsExplained.markdown
218
219
  - docs/Overview.markdown
@@ -220,7 +221,7 @@ files:
220
221
  - docs/Troubleshooting.markdown
221
222
  - docs/Tutorial.markdown
222
223
  has_rdoc: true
223
- homepage: http://github.com/ferrous26/hotcocoa
224
+ homepage: http://github.com/HotCocoa/hotcocoa
224
225
  licenses:
225
226
  - MIT
226
227
  post_install_message:
@@ -1,189 +0,0 @@
1
- Originally written by Dan Sinclair, this tutorial has been updated for
2
- newer HotCocoa features.
3
-
4
- I've had my eye on giving HotCocoa a test run for a while now. Other
5
- things have conspired to come up over the last few months so I haven't
6
- had a chance to give it a spin. That is, until now. I started poking
7
- at it the other day, a few things still confuse me, but I'm getting
8
- there.
9
-
10
- I figured I'd write stuff down as I plow my way through the code and
11
- create a simple little application. The application is nothing fancy,
12
- I'm going to query [PostRank](http://www.postrank.com) and pull back
13
- engagement information on a feed entered into a text box. This will be
14
- a multi-part tutorial.
15
-
16
- In the usual fashion, let's start at the start. What is HotCocoa?
17
- Well, HotCocoa is a layer of Ruby code that sits on top of the Mac OS
18
- X frameworks including
19
- [Cocoa](http://developer.apple.com/cocoa/). HotCocoa is part of the
20
- [MacRuby](http://www.macruby.org) distribution which will ship with
21
- figure versions of OS X. MacRuby is a port of Ruby 1.9 to run on top
22
- of Objective-C.
23
-
24
- I'm going to assume you have MacRuby installed for this tutorial.
25
-
26
- The HotCocoa developers make life easy to get started developing your
27
- application. There is a `hotcocoa` command that is installed when you
28
- install MacRuby. This will create the basic application structure and
29
- Rakefile to get you up and running.
30
-
31
- titania:Development dj2$ hotcocoa Postie
32
-
33
- We can then execute our application by changing into the `Postie`
34
- directory and executing `macrake`. *Note*, this uses `mac`rake and not
35
- regular rake. MacRuby installs alongside the normal Ruby runtime on OS
36
- X. You'll need to make sure you use `macrake`, `macirb`, `macgem` and
37
- `macruby` to work with the MacRuby versions. You should see a `Hello
38
- from HotCooca` window if everything worked correctly.
39
-
40
- ![Hello from HotCocoa](images/hello_from_hotcocoa.png)
41
-
42
- You'll notice that you now have a Postie.app in your root
43
- directory. This application can be executed by double clicking like
44
- any other Mac application, although, you'll need MacRuby installed for
45
- it to execute. You can also execute `macruby lib/application.rb` to
46
- execute the application. This allows passing flags to `macruby` for
47
- things like enabling debug mode.
48
-
49
- Let's take a quick look at the files generated by the `hotcocoa`
50
- command.
51
-
52
- ```sh
53
- ./Rakefile
54
- ./config/build.yml
55
- ./resources/HotCocoa.icns
56
- ./lib/application.rb
57
- ./lib/menu.rb
58
- ```
59
-
60
- The `build.yml` file contains information used by `hotcocoa` to build
61
- your application. This includes things like the name, version, icon
62
- and source files. The icon, by default, is `HotCocoa.icns`. The main
63
- files we're interested in are `application.rb` and `menu.rb`.
64
-
65
- ```ruby
66
- module HotCocoa
67
- def application_menu
68
- menu do |main|
69
- main.submenu :apple do |apple|
70
- apple.item :about, :title => "About #{NSApp.name}"
71
- apple.separator
72
- apple.item :preferences, :key => ","
73
- apple.separator
74
- apple.submenu :services
75
- apple.separator
76
- apple.item :hide, :title => "Hide #{NSApp.name}", :key => "h"
77
- apple.item :hide_others, :title => "Hide Others", :key => "h", :modifiers => [:command, :alt]
78
- apple.item :show_all, :title => "Show All"
79
- apple.separator
80
- apple.item :quit, :title => "Quit #{NSApp.name}", :key => "q"
81
- end
82
- main.submenu :file do |file|
83
- file.item :new, :key => "n"
84
- file.item :open, :key => "o"
85
- end
86
- main.submenu :window do |win|
87
- win.item :minimize, :key => "m"
88
- win.item :zoom
89
- win.separator
90
- win.item :bring_all_to_front, :title => "Bring All to Front", :key => "o"
91
- end
92
- main.submenu :help do |help|
93
- help.item :help, :title => "#{NSApp.name} Help"
94
- end
95
- end
96
- end
97
- end
98
- ```
99
-
100
- The `menu.rb` file contains information about the menu for our
101
- applcation. This includes the menu names, hot keys, modifiers and
102
- general layout.
103
-
104
- The `:apple` submenu is special and will appear with a menu title
105
- based on your application name, as is typical for OS X
106
- applications. For the other submenus, by default, the menu title will
107
- be the capitalized version of the symbol name converted to a
108
- string. You can also provide a `:title => 'foo'` option to specify a
109
- different name. `menu.submenu :postrank, :title => 'PostRank'`.
110
-
111
- The symbol provided to each submenu `item`, e.g. `file.item :new` will
112
- be used to form the name of the method invoked in your application
113
- delegate. The methods are named `on_<key>`. For our `:new` item the
114
- `on_new` menu item will be invoked. If there is no `on_<key>` method
115
- the menu item will be disabled. As you can see above you can also
116
- specify `:modifiers` and `:key` equivalents for your items.
117
-
118
- As with the menu titles, the items names will be formed from
119
- capitalizing the symbol provided unless a `:title` is provided.
120
-
121
- In the case of `Postie` I've erased everything but the `:apple`
122
- submenu for now. I don't need any extra menu items at the moment. This
123
- also means all of the `on_*` methods can be removed from
124
- `application.rb`.
125
-
126
- The default `application.rb` provided by the `hotcocoa` command is
127
- pretty short.
128
-
129
- ```ruby
130
- require 'hotcocoa'
131
-
132
- class Application
133
- include HotCocoa
134
-
135
- def start
136
- application(:name => "Postie") do |app|
137
- app.delegate = self
138
- window(:frame => [100, 100, 500, 500], :title => "Postie") do |win|
139
- win << label(:text => "Hello from HotCocoa", :layout => {:start => false})
140
- win.will_close { exit }
141
- end
142
- end
143
- end
144
- end
145
-
146
- Application.new.start
147
- ```
148
-
149
- Let's take a quick look and see if we can figure out what's going
150
- on. We need to `require hotcocoa'` to get access to the needed
151
- HotCocoa classes. We then `include HotCocoa` into our `Application`
152
- class to make everything shorter. Feel free to rename `Application`
153
- just do it in the class definition and at the bottom of the file.
154
-
155
- Jumping to the bottom, you can see we're calling
156
- `Application.new.start` so the `Application#start` method will be
157
- invoked. It's worth noting, the application will not return from
158
- `Application#start`.
159
-
160
- Going back to `Application#start` we call `application` to create our
161
- application, setting the title as desired. We then set ourselves as
162
- the application delegate. This means that our class will receive all
163
- of the callbacks that are called on the Cocoa application. This
164
- includes the menu `on_*`callbacks we talked about earlier.
165
-
166
- We then proceed to create a `window`. We're setting a `:frame` on the
167
- window to position it at X 100, Y 100 (from the bottom left) with a
168
- width of 500 and height of 500. We `:title` the window as `Postie`.
169
- If you don't want to specify the entire frame of the window you can
170
- specify just the `:size => [500, 500]` of the window. You can also
171
- specify `:center => true` to center the window on the desktop. If you
172
- look at the Objective-C documentation for NSWindow the options
173
- available in Obj-C are available in the HotCocoa layer.
174
-
175
- Once the window is created we add a `label` to the window and set the
176
- `will_close` handler to `exit` when executed.
177
-
178
- The `will_close` callback is the HotCocoa name for the Cocoa
179
- `windowWillClose:`. Many of the Cocoa callbacks have been remapped to
180
- make the names more Ruby like. You can view all the HotCocoa mappings
181
- for windows at the bottom of the
182
- [NSWindow mapping file](https://github.com/ferrous26/hotcocoa/blob/master/lib/hotcocoa/mappings/appkit/window.rb).
183
-
184
- That's it for part I. We've now setup with our basic application
185
- structure and have an idea of what we're working with. In the next
186
- installment, we'll work on getting our application views setup as we
187
- want.
188
-
189
- [Read the next article: “Application Layout”](https://github.com/ferrous26/hotcocoa/wiki/Application-Layout)