rucola 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +628 -0
- data/History.txt +4 -0
- data/License.txt +20 -0
- data/Manifest.txt +106 -0
- data/README.txt +126 -0
- data/Rakefile +32 -0
- data/TODO +28 -0
- data/app_generators/rucola/USAGE +6 -0
- data/app_generators/rucola/rucola_generator.rb +112 -0
- data/app_generators/rucola/templates/Rakefile.erb +12 -0
- data/app_generators/rucola/templates/Rakefile.erb.old +156 -0
- data/app_generators/rucola/templates/app/controllers/application_controller.rb +22 -0
- data/app_generators/rucola/templates/config/Info.plist.erb +28 -0
- data/app_generators/rucola/templates/config/boot.rb +2 -0
- data/app_generators/rucola/templates/config/environment.rb +11 -0
- data/app_generators/rucola/templates/config/environments/debug.rb +3 -0
- data/app_generators/rucola/templates/config/environments/release.rb +3 -0
- data/app_generators/rucola/templates/config/environments/test.rb +3 -0
- data/app_generators/rucola/templates/config/ib_external_class_defs.yml +13 -0
- data/app_generators/rucola/templates/misc/English.lproj/InfoPlist.strings.erb +3 -0
- data/app_generators/rucola/templates/misc/English.lproj/MainMenu.nib/classes.nib +40 -0
- data/app_generators/rucola/templates/misc/English.lproj/MainMenu.nib/info.nib +18 -0
- data/app_generators/rucola/templates/misc/English.lproj/MainMenu.nib/keyedobjects.nib +0 -0
- data/app_generators/rucola/templates/misc/main.m.erb +15 -0
- data/app_generators/rucola/templates/misc/rb_main.rb.erb +13 -0
- data/app_generators/rucola/templates/project.pbxproj.erb +299 -0
- data/app_generators/rucola/templates/script/plugin +84 -0
- data/app_generators/rucola/templates/test/controllers/test_application_controller.rb +10 -0
- data/app_generators/rucola/templates/test/test_helper.rb +10 -0
- data/bin/rucola +12 -0
- data/config/hoe.rb +71 -0
- data/config/requirements.rb +17 -0
- data/lib/rucola.rb +3 -0
- data/lib/rucola/info_plist.rb +37 -0
- data/lib/rucola/initializer.rb +313 -0
- data/lib/rucola/nib.rb +99 -0
- data/lib/rucola/rucola_support.rb +9 -0
- data/lib/rucola/rucola_support/controllers.rb +2 -0
- data/lib/rucola/rucola_support/controllers/rc_controller.rb +7 -0
- data/lib/rucola/rucola_support/controllers/rc_window_controller.rb +12 -0
- data/lib/rucola/rucola_support/core_ext.rb +2 -0
- data/lib/rucola/rucola_support/core_ext/objc.rb +4 -0
- data/lib/rucola/rucola_support/core_ext/objc/nsobject.rb +22 -0
- data/lib/rucola/rucola_support/core_ext/ruby.rb +4 -0
- data/lib/rucola/rucola_support/core_ext/ruby/string.rb +21 -0
- data/lib/rucola/rucola_support/initialize_hooks.rb +21 -0
- data/lib/rucola/rucola_support/models.rb +1 -0
- data/lib/rucola/rucola_support/models/rc_document.rb +10 -0
- data/lib/rucola/rucola_support/notifications.rb +1 -0
- data/lib/rucola/rucola_support/notifications/notifications.rb +146 -0
- data/lib/rucola/rucola_support/rc_app.rb +101 -0
- data/lib/rucola/tasks/freeze.rake +44 -0
- data/lib/rucola/tasks/interface_builder.rake +80 -0
- data/lib/rucola/tasks/main.rake +29 -0
- data/lib/rucola/tasks/xcode.rake +43 -0
- data/lib/rucola/test_helper.rb +57 -0
- data/lib/rucola/version.rb +9 -0
- data/lib/rucola/xcode.rb +148 -0
- data/log/debug.log +0 -0
- data/rucola_generators/controller/USAGE +5 -0
- data/rucola_generators/controller/controller_generator.rb +84 -0
- data/rucola_generators/controller/templates/controller_template.rb.erb +5 -0
- data/rucola_generators/controller/templates/test_controller_template.rb.erb +10 -0
- data/rucola_generators/document_model/USAGE +5 -0
- data/rucola_generators/document_model/document_model_generator.rb +67 -0
- data/rucola_generators/document_model/templates/document_model_template.rb.erb +27 -0
- data/rucola_generators/document_model/templates/test_document_model_template.rb.erb +10 -0
- data/rucola_generators/window_controller/USAGE +6 -0
- data/rucola_generators/window_controller/templates/Window.nib/classes.nib.erb +35 -0
- data/rucola_generators/window_controller/templates/Window.nib/info.nib +16 -0
- data/rucola_generators/window_controller/templates/Window.nib/keyedobjects.nib +0 -0
- data/rucola_generators/window_controller/templates/test_window_controller_template.rb.erb +10 -0
- data/rucola_generators/window_controller/templates/window_controller_template.rb.erb +19 -0
- data/rucola_generators/window_controller/window_controller_generator.rb +74 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +27 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/fixtures/Info.plist +28 -0
- data/test/fixtures/MainMenu.nib/classes.nib +32 -0
- data/test/fixtures/MainMenu.nib/info.nib +18 -0
- data/test/fixtures/MainMenu.nib/keyedobjects.nib +0 -0
- data/test/test_controller_generator.rb +75 -0
- data/test/test_core_ext.rb +15 -0
- data/test/test_document_model_generator.rb +64 -0
- data/test/test_generator_helper.rb +20 -0
- data/test/test_helper.rb +13 -0
- data/test/test_info_plist.rb +31 -0
- data/test/test_nib.rb +73 -0
- data/test/test_notifications.rb +75 -0
- data/test/test_objc_core_ext.rb +37 -0
- data/test/test_rc_app.rb +63 -0
- data/test/test_rc_document.rb +18 -0
- data/test/test_rc_window_controller.rb +13 -0
- data/test/test_rucola.rb +11 -0
- data/test/test_rucola_generator.rb +87 -0
- data/test/test_window_controller_generator.rb +50 -0
- data/test/test_xcode.rb +128 -0
- data/website/index.html +199 -0
- data/website/index.txt +126 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.rhtml +48 -0
- metadata +189 -0
data/History.txt
ADDED
data/License.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2007 Eloy Duran and Justin Palmer
|
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/Manifest.txt
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
ChangeLog
|
2
|
+
History.txt
|
3
|
+
License.txt
|
4
|
+
Manifest.txt
|
5
|
+
README.txt
|
6
|
+
Rakefile
|
7
|
+
TODO
|
8
|
+
app_generators/rucola/USAGE
|
9
|
+
app_generators/rucola/rucola_generator.rb
|
10
|
+
app_generators/rucola/templates/Rakefile.erb
|
11
|
+
app_generators/rucola/templates/Rakefile.erb.old
|
12
|
+
app_generators/rucola/templates/app/controllers/application_controller.rb
|
13
|
+
app_generators/rucola/templates/config/Info.plist.erb
|
14
|
+
app_generators/rucola/templates/config/boot.rb
|
15
|
+
app_generators/rucola/templates/config/environment.rb
|
16
|
+
app_generators/rucola/templates/config/environments/debug.rb
|
17
|
+
app_generators/rucola/templates/config/environments/release.rb
|
18
|
+
app_generators/rucola/templates/config/environments/test.rb
|
19
|
+
app_generators/rucola/templates/config/ib_external_class_defs.yml
|
20
|
+
app_generators/rucola/templates/misc/English.lproj/InfoPlist.strings.erb
|
21
|
+
app_generators/rucola/templates/misc/English.lproj/MainMenu.nib/classes.nib
|
22
|
+
app_generators/rucola/templates/misc/English.lproj/MainMenu.nib/info.nib
|
23
|
+
app_generators/rucola/templates/misc/English.lproj/MainMenu.nib/keyedobjects.nib
|
24
|
+
app_generators/rucola/templates/misc/main.m.erb
|
25
|
+
app_generators/rucola/templates/misc/rb_main.rb.erb
|
26
|
+
app_generators/rucola/templates/project.pbxproj.erb
|
27
|
+
app_generators/rucola/templates/script/plugin
|
28
|
+
app_generators/rucola/templates/test/controllers/test_application_controller.rb
|
29
|
+
app_generators/rucola/templates/test/test_helper.rb
|
30
|
+
bin/rucola
|
31
|
+
config/hoe.rb
|
32
|
+
config/requirements.rb
|
33
|
+
lib/rucola.rb
|
34
|
+
lib/rucola/info_plist.rb
|
35
|
+
lib/rucola/initializer.rb
|
36
|
+
lib/rucola/nib.rb
|
37
|
+
lib/rucola/rucola_support.rb
|
38
|
+
lib/rucola/rucola_support/controllers.rb
|
39
|
+
lib/rucola/rucola_support/controllers/rc_controller.rb
|
40
|
+
lib/rucola/rucola_support/controllers/rc_window_controller.rb
|
41
|
+
lib/rucola/rucola_support/core_ext.rb
|
42
|
+
lib/rucola/rucola_support/core_ext/objc.rb
|
43
|
+
lib/rucola/rucola_support/core_ext/objc/nsobject.rb
|
44
|
+
lib/rucola/rucola_support/core_ext/ruby.rb
|
45
|
+
lib/rucola/rucola_support/core_ext/ruby/string.rb
|
46
|
+
lib/rucola/rucola_support/initialize_hooks.rb
|
47
|
+
lib/rucola/rucola_support/models.rb
|
48
|
+
lib/rucola/rucola_support/models/rc_document.rb
|
49
|
+
lib/rucola/rucola_support/notifications.rb
|
50
|
+
lib/rucola/rucola_support/notifications/notifications.rb
|
51
|
+
lib/rucola/rucola_support/rc_app.rb
|
52
|
+
lib/rucola/tasks/freeze.rake
|
53
|
+
lib/rucola/tasks/interface_builder.rake
|
54
|
+
lib/rucola/tasks/main.rake
|
55
|
+
lib/rucola/tasks/xcode.rake
|
56
|
+
lib/rucola/test_helper.rb
|
57
|
+
lib/rucola/version.rb
|
58
|
+
lib/rucola/xcode.rb
|
59
|
+
log/debug.log
|
60
|
+
rucola_generators/controller/USAGE
|
61
|
+
rucola_generators/controller/controller_generator.rb
|
62
|
+
rucola_generators/controller/templates/controller_template.rb.erb
|
63
|
+
rucola_generators/controller/templates/test_controller_template.rb.erb
|
64
|
+
rucola_generators/document_model/USAGE
|
65
|
+
rucola_generators/document_model/document_model_generator.rb
|
66
|
+
rucola_generators/document_model/templates/document_model_template.rb.erb
|
67
|
+
rucola_generators/document_model/templates/test_document_model_template.rb.erb
|
68
|
+
rucola_generators/window_controller/USAGE
|
69
|
+
rucola_generators/window_controller/templates/Window.nib/classes.nib.erb
|
70
|
+
rucola_generators/window_controller/templates/Window.nib/info.nib
|
71
|
+
rucola_generators/window_controller/templates/Window.nib/keyedobjects.nib
|
72
|
+
rucola_generators/window_controller/templates/test_window_controller_template.rb.erb
|
73
|
+
rucola_generators/window_controller/templates/window_controller_template.rb.erb
|
74
|
+
rucola_generators/window_controller/window_controller_generator.rb
|
75
|
+
script/destroy
|
76
|
+
script/generate
|
77
|
+
script/txt2html
|
78
|
+
setup.rb
|
79
|
+
tasks/deployment.rake
|
80
|
+
tasks/environment.rake
|
81
|
+
tasks/website.rake
|
82
|
+
test/fixtures/Info.plist
|
83
|
+
test/fixtures/MainMenu.nib/classes.nib
|
84
|
+
test/fixtures/MainMenu.nib/info.nib
|
85
|
+
test/fixtures/MainMenu.nib/keyedobjects.nib
|
86
|
+
test/test_controller_generator.rb
|
87
|
+
test/test_core_ext.rb
|
88
|
+
test/test_document_model_generator.rb
|
89
|
+
test/test_generator_helper.rb
|
90
|
+
test/test_helper.rb
|
91
|
+
test/test_info_plist.rb
|
92
|
+
test/test_nib.rb
|
93
|
+
test/test_notifications.rb
|
94
|
+
test/test_objc_core_ext.rb
|
95
|
+
test/test_rc_app.rb
|
96
|
+
test/test_rc_document.rb
|
97
|
+
test/test_rc_window_controller.rb
|
98
|
+
test/test_rucola.rb
|
99
|
+
test/test_rucola_generator.rb
|
100
|
+
test/test_window_controller_generator.rb
|
101
|
+
test/test_xcode.rb
|
102
|
+
website/index.html
|
103
|
+
website/index.txt
|
104
|
+
website/javascripts/rounded_corners_lite.inc.js
|
105
|
+
website/stylesheets/screen.css
|
106
|
+
website/template.rhtml
|
data/README.txt
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
## Rucola: Framework for writing Cocoa applications in Ruby
|
2
|
+
|
3
|
+
SUPER DUPER PRE ALPHA VERSION (expect things to break kinda alpha...)
|
4
|
+
|
5
|
+
Rucola is a light weight framework that helps you write RubyCocoa apps.
|
6
|
+
It allows you to build, test, and deploy applications using rake commands,
|
7
|
+
eliminating the need to use XCode, however you can use XCode if you wish.
|
8
|
+
|
9
|
+
Rucola provides a set of generators to help you generate controllers, window controllers,
|
10
|
+
and document-based applications. It also provides APIs for simplifying some of Objective-C's
|
11
|
+
ways of doing things.
|
12
|
+
|
13
|
+
### Generating an application skeleton
|
14
|
+
|
15
|
+
rucola MyApp -a "Your Name"
|
16
|
+
|
17
|
+
Running this command will give you a complete, working application with a single window already
|
18
|
+
bound to your application controller.
|
19
|
+
|
20
|
+
|
21
|
+
### Using Notifications
|
22
|
+
|
23
|
+
//Rucola
|
24
|
+
class Foo < Rucola::RCController
|
25
|
+
notify :some_method, :when => :something_happens
|
26
|
+
|
27
|
+
def some_method(notification)
|
28
|
+
puts "w00t!"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
//Objective C (Excluding header file)
|
33
|
+
@implementation Foo
|
34
|
+
-(id)init {
|
35
|
+
if(self = [super init]) {
|
36
|
+
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
37
|
+
[center addObserver:self selector:(some_method:) name:@"SomethingHappensNotification" object:nil];
|
38
|
+
}
|
39
|
+
return self;
|
40
|
+
}
|
41
|
+
|
42
|
+
-(void)some_method:(NSNotification *) notification {
|
43
|
+
NSLog("w00t!");
|
44
|
+
}
|
45
|
+
@end
|
46
|
+
|
47
|
+
### Alternative Way Of Using Notifications
|
48
|
+
|
49
|
+
//Rucola
|
50
|
+
class Foo < Rucola::RCController
|
51
|
+
notify_on :something_happens do |notification|
|
52
|
+
puts "w0t0!"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
### Working with Interface Builder
|
57
|
+
|
58
|
+
A Cocoa application contains `outlets`. Outlets allow you to bind variable names to objects.
|
59
|
+
An object can be a user interface element or an instance of a class.
|
60
|
+
|
61
|
+
class ApplicationController < Rucola::RCController
|
62
|
+
ib_outlet :main_window
|
63
|
+
|
64
|
+
def awakeFromNib
|
65
|
+
# All the application delegate methods will be called on this object.
|
66
|
+
OSX::NSApp.delegate = self
|
67
|
+
|
68
|
+
puts "ApplicationController awoke."
|
69
|
+
puts "Edit: app/controllers/application_controller.rb"
|
70
|
+
puts "\nIt's window is: #{@main_window.inspect}"
|
71
|
+
end
|
72
|
+
|
73
|
+
# NSApplication delegate methods
|
74
|
+
def applicationDidFinishLaunching(notification)
|
75
|
+
puts "\nApplication finished launching."
|
76
|
+
end
|
77
|
+
|
78
|
+
def applicationWillTerminate(notification)
|
79
|
+
puts "\nApplication will terminate."
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
The `@main_window` variable now points to the user interface window. You can invoke any methods of NSWindow.
|
84
|
+
|
85
|
+
There is also a `rake ib:update` that will update your nib files with the outlets you specify in your code.
|
86
|
+
For example, if we wanted to add a button to the application controller above, we could add `ib_outlet :my_button`.
|
87
|
+
After you've added this, you can run `rake ib:update` and your outlet will be available in interface builder that
|
88
|
+
you can now hook up to your UI button.
|
89
|
+
|
90
|
+
### Configuring your application
|
91
|
+
If you plan on using additional objective-c frameworks (WebKit, etc.) or ruby gems, you'll need to add these
|
92
|
+
in your environment.rb file.
|
93
|
+
|
94
|
+
config.objc_frameworks = %w(WebKit IOKit)
|
95
|
+
config.use_active_record = true
|
96
|
+
|
97
|
+
### Building your application
|
98
|
+
|
99
|
+
To build your application, Rucola provides a simple rake command. (You can also build your application in XCode)
|
100
|
+
|
101
|
+
rake xcode:build
|
102
|
+
|
103
|
+
This will compile and run your application. At the moment we don't bundle Ruby or the gems that you are using
|
104
|
+
in your application, we have plans to support this in order to make it really easy to distribute your application.
|
105
|
+
|
106
|
+
### Extras
|
107
|
+
|
108
|
+
Browse the svn repo online at: http://rucola.rubyforge.org/svn/
|
109
|
+
|
110
|
+
The latest version can be checked out with:
|
111
|
+
|
112
|
+
$ svn co svn://rubyforge.org/var/svn/rucola/trunk rucola
|
113
|
+
|
114
|
+
A simpe sample app called Gembo can be found at:
|
115
|
+
|
116
|
+
$ svn co svn://rubyforge.org/var/svn/rucola/extras/examples/Gembo
|
117
|
+
|
118
|
+
There's a basic TextMate bundle which contains only 4 commands which are the equivalent of the "go to file" commands in the rails bundle. With these going from a controller to it's test/model/view file is only a shortcut away. To get it:
|
119
|
+
|
120
|
+
$ cd ~/Library/Application\ Support/TextMate/Bundles/
|
121
|
+
$ svn co svn://rubyforge.org/var/svn/rucola/extras/Rucola.tmbundle
|
122
|
+
|
123
|
+
There's a crash reporter plugin available, which you can install with script/plugin:
|
124
|
+
|
125
|
+
$ cd MyApp
|
126
|
+
$ script/plugin install SACrashReporter
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'config/requirements'
|
2
|
+
require 'config/hoe' # setup Hoe + all gem configuration
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
Rake::TaskManager.class_eval do
|
6
|
+
def remove_task(task_name)
|
7
|
+
@tasks.delete(task_name.to_s)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def remove_task(task_name)
|
12
|
+
Rake.application.remove_task(task_name)
|
13
|
+
end
|
14
|
+
|
15
|
+
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
16
|
+
|
17
|
+
remove_task :test
|
18
|
+
|
19
|
+
Rake::TestTask.new do |t|
|
20
|
+
t.test_files = FileList['test/test_*.rb']
|
21
|
+
t.options = '-rr'
|
22
|
+
end
|
23
|
+
|
24
|
+
# desc 'First uninstalls the currently installed Rucola gem and then installs the new one.'
|
25
|
+
# task :install_gem_test do
|
26
|
+
# if `rake check_manifest`.split("\n").length == 1
|
27
|
+
# sh 'gem uninstall rucola'
|
28
|
+
# Rake::Task['install_gem_no_doc'].invoke
|
29
|
+
# else
|
30
|
+
# puts "You first might need to update the manifest!"
|
31
|
+
# end
|
32
|
+
# end
|
data/TODO
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
* Did some restructuring of the dir layout with regards to controllers and initialize_hooks (rev 42).
|
2
|
+
Should probably look if the require structure is still ok... Justin knows about this.
|
3
|
+
|
4
|
+
* Create tests for initializer.rb.
|
5
|
+
|
6
|
+
* Make sure autotest works with the application generated directory structure.
|
7
|
+
|
8
|
+
* Create templates for testing in either TestUnit, TestSpec or rSpec.
|
9
|
+
I don't use rSpec anymore atm, so I (Eloy) will first focus on TestUnit & TestSpec.
|
10
|
+
Actually I will just move it to test/spec.
|
11
|
+
|
12
|
+
* Create README & simple website and release first version!
|
13
|
+
|
14
|
+
* No need to continuously rebuild your application when just changing a few lines of Ruby.
|
15
|
+
Still does xcodebuild for the build task, so add a check if the xcode project was updated,
|
16
|
+
if not then simply run the existing build.
|
17
|
+
|
18
|
+
* Allow transparent packaging. Developers need only worry about creating their application
|
19
|
+
and basic configuration not the innards of packaging and releasing.
|
20
|
+
|
21
|
+
config.objc_frameworks << ['Webkit', 'Quartz']
|
22
|
+
config.active_record = true
|
23
|
+
config.include_dirs << %w(models controllers lib)
|
24
|
+
|
25
|
+
* When in debug mode and using ActiveRecord, allow database to reside in your working
|
26
|
+
directory for easy access instead of buried in your users Application Support path.
|
27
|
+
|
28
|
+
* Load database config from config/database.yml
|
@@ -0,0 +1,112 @@
|
|
1
|
+
class RubiGen::Commands::Create
|
2
|
+
def symlink(relative_source, relative_destination)
|
3
|
+
return logger.identical(relative_destination) if File.exists?(destination_path(relative_destination))
|
4
|
+
# We don't want the symlink to point to a full path,
|
5
|
+
# so change to the destination_root and create the symlink.
|
6
|
+
Dir.chdir(destination_root) { File.symlink relative_source, relative_destination }
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class RucolaGenerator < RubiGen::Base
|
11
|
+
|
12
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
13
|
+
Config::CONFIG['ruby_install_name'])
|
14
|
+
|
15
|
+
default_options :author => 'YOUR NAME'
|
16
|
+
|
17
|
+
attr_reader :name, :project, :author
|
18
|
+
|
19
|
+
def initialize(runtime_args, runtime_options = {})
|
20
|
+
super
|
21
|
+
usage if args.empty?
|
22
|
+
@destination_root = File.expand_path(args.shift)
|
23
|
+
@name = base_name
|
24
|
+
@project = name
|
25
|
+
extract_options
|
26
|
+
end
|
27
|
+
|
28
|
+
def manifest
|
29
|
+
record do |m|
|
30
|
+
# Ensure appropriate folder(s) exists
|
31
|
+
m.directory ''
|
32
|
+
BASEDIRS.each { |path| m.directory path }
|
33
|
+
|
34
|
+
m.directory 'misc/English.lproj/MainMenu.nib' # TODO - allow alternate default languages
|
35
|
+
|
36
|
+
# Create stubs
|
37
|
+
m.template "Rakefile.erb", "Rakefile"
|
38
|
+
|
39
|
+
m.file "app/controllers/application_controller.rb", "app/controllers/application_controller.rb"
|
40
|
+
m.file_copy_each %w[boot.rb environment.rb ib_external_class_defs.yml], "config"
|
41
|
+
m.template "config/Info.plist.erb", "config/Info.plist"
|
42
|
+
m.symlink "config/Info.plist", "Info.plist"
|
43
|
+
|
44
|
+
m.file_copy_each %w[debug.rb release.rb test.rb], "config/environments"
|
45
|
+
|
46
|
+
#m.template_copy_each %w[main.m.erb rb_main.rb.erb], "misc"
|
47
|
+
m.template "misc/main.m.erb", "misc/main.m"
|
48
|
+
m.template "misc/rb_main.rb.erb", "misc/rb_main.rb"
|
49
|
+
|
50
|
+
# TODO - allow alternate default languages
|
51
|
+
m.template "misc/English.lproj/InfoPlist.strings.erb", "misc/English.lproj/InfoPlist.strings"
|
52
|
+
m.file_copy_each %w[classes.nib info.nib keyedobjects.nib], "misc/English.lproj/MainMenu.nib"
|
53
|
+
|
54
|
+
# xocde project
|
55
|
+
m.directory "#{@project}.xcodeproj"
|
56
|
+
m.template "project.pbxproj.erb", "#{@project}.xcodeproj/project.pbxproj"
|
57
|
+
|
58
|
+
# test
|
59
|
+
m.file "test/test_helper.rb", "test/test_helper.rb"
|
60
|
+
m.file "test/controllers/test_application_controller.rb", "test/controllers/test_application_controller.rb"
|
61
|
+
|
62
|
+
plugin = 'script/plugin'
|
63
|
+
logger.create plugin
|
64
|
+
FileUtils.mkdir_p File.dirname(destination_path(plugin))
|
65
|
+
FileUtils.copy(source_path(plugin), destination_path(plugin))
|
66
|
+
File.chmod(0755, destination_path(plugin))
|
67
|
+
|
68
|
+
m.dependency "install_rubigen_scripts", [destination_root, "rucola"],
|
69
|
+
:shebang => options[:shebang], :collision => :force
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
protected
|
74
|
+
def banner
|
75
|
+
<<-EOS
|
76
|
+
Creates a ...
|
77
|
+
|
78
|
+
USAGE: #{spec.name} name"
|
79
|
+
EOS
|
80
|
+
end
|
81
|
+
|
82
|
+
def add_options!(opts)
|
83
|
+
opts.separator ''
|
84
|
+
opts.separator 'Options:'
|
85
|
+
# For each option below, place the default
|
86
|
+
# at the top of the file next to "default_options"
|
87
|
+
opts.on("-a", "--author=\"Your Name\"", String,
|
88
|
+
"Places your name within some copyright headers.",
|
89
|
+
"Default: YOUR NAME") { |options[:author]| }
|
90
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
91
|
+
end
|
92
|
+
|
93
|
+
def extract_options
|
94
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
95
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
96
|
+
# raw instance variable value.
|
97
|
+
@author = options[:author]
|
98
|
+
end
|
99
|
+
|
100
|
+
# Installation skeleton. Intermediate directories are automatically
|
101
|
+
# created so don't sweat their absence here.
|
102
|
+
BASEDIRS = %w(
|
103
|
+
app/controllers
|
104
|
+
app/models
|
105
|
+
app/views
|
106
|
+
config/environments
|
107
|
+
script
|
108
|
+
test/controllers
|
109
|
+
test/models
|
110
|
+
vendor
|
111
|
+
)
|
112
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Application configuration
|
2
|
+
APPNAME = "<%= name %>"
|
3
|
+
TARGET = "#{APPNAME}.app"
|
4
|
+
#APPVERSION = "rev#{`svn info`[/Revision: (\d+)/, 1]}"
|
5
|
+
APPVERSION = Time.now.strftime("%Y-%m-%d")
|
6
|
+
PUBLISH = 'yourname@yourhost:path'
|
7
|
+
|
8
|
+
# Load Rucola tasks
|
9
|
+
SOURCE_ROOT = File.dirname(__FILE__)
|
10
|
+
require 'rubygems'
|
11
|
+
require 'rucola/rucola_support'
|
12
|
+
load 'rucola/tasks/main.rake'
|