iphoneruby 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 +5 -0
- data/License.txt +20 -0
- data/Manifest.txt +34 -0
- data/PostInstall.txt +21 -0
- data/README.rdoc +83 -0
- data/Rakefile +4 -0
- data/app_generators/iphoneruby/USAGE +5 -0
- data/app_generators/iphoneruby/iphoneruby_generator.rb +68 -0
- data/app_generators/iphoneruby/templates/Rakefile +49 -0
- data/app_generators/iphoneruby/templates/dot_autotest +18 -0
- data/app_generators/iphoneruby/templates/test/test_helper.rb +8 -0
- data/bin/iphoneruby +17 -0
- data/config/hoe.rb +70 -0
- data/config/requirements.rb +15 -0
- data/iphoneruby_generators/model/USAGE +5 -0
- data/iphoneruby_generators/model/model_generator.rb +54 -0
- data/iphoneruby_generators/model/templates/model.h +15 -0
- data/iphoneruby_generators/model/templates/model.m +22 -0
- data/iphoneruby_generators/model/templates/test.rb +10 -0
- data/lib/iphoneruby/version.rb +9 -0
- data/lib/iphoneruby.rb +6 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/test_generator_helper.rb +29 -0
- data/test/test_helper.rb +2 -0
- data/test/test_iphoneruby.rb +11 -0
- data/test/test_iphoneruby_generator.rb +47 -0
- data/test/test_model_generator.rb +48 -0
- metadata +116 -0
data/History.txt
ADDED
data/License.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Dr Nic Williams
|
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,34 @@
|
|
1
|
+
History.txt
|
2
|
+
License.txt
|
3
|
+
Manifest.txt
|
4
|
+
PostInstall.txt
|
5
|
+
README.rdoc
|
6
|
+
Rakefile
|
7
|
+
app_generators/iphoneruby/USAGE
|
8
|
+
app_generators/iphoneruby/iphoneruby_generator.rb
|
9
|
+
app_generators/iphoneruby/templates/Rakefile
|
10
|
+
app_generators/iphoneruby/templates/dot_autotest
|
11
|
+
app_generators/iphoneruby/templates/test/test_helper.rb
|
12
|
+
bin/iphoneruby
|
13
|
+
config/hoe.rb
|
14
|
+
config/requirements.rb
|
15
|
+
iphoneruby_generators/model/USAGE
|
16
|
+
iphoneruby_generators/model/model_generator.rb
|
17
|
+
iphoneruby_generators/model/templates/model.h
|
18
|
+
iphoneruby_generators/model/templates/model.m
|
19
|
+
iphoneruby_generators/model/templates/test.rb
|
20
|
+
lib/iphoneruby.rb
|
21
|
+
lib/iphoneruby/version.rb
|
22
|
+
script/console
|
23
|
+
script/destroy
|
24
|
+
script/generate
|
25
|
+
script/txt2html
|
26
|
+
setup.rb
|
27
|
+
tasks/deployment.rake
|
28
|
+
tasks/environment.rake
|
29
|
+
tasks/website.rake
|
30
|
+
test/test_generator_helper.rb
|
31
|
+
test/test_helper.rb
|
32
|
+
test/test_iphoneruby.rb
|
33
|
+
test/test_iphoneruby_generator.rb
|
34
|
+
test/test_model_generator.rb
|
data/PostInstall.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
You can add Ruby-based unit tests to any iPhone/Xcode project by changing to the
|
3
|
+
project's folder in the terminal/console and running:
|
4
|
+
|
5
|
+
iphoneruby .
|
6
|
+
|
7
|
+
This adds the test framework, a Rakefile, and an `autotest` config file.
|
8
|
+
|
9
|
+
You can now create testable Objective-C models/classes using the generator:
|
10
|
+
|
11
|
+
$ script/generate model WidgetMaker
|
12
|
+
create Classes/WidgetMaker.h
|
13
|
+
create Classes/WidgetMaker.m
|
14
|
+
create test/test_widget_maker.rb
|
15
|
+
|
16
|
+
To run tests you have several options:
|
17
|
+
|
18
|
+
1. `rake` or `rake test`
|
19
|
+
1. `autotest` (after installing the ZenTest gem)
|
20
|
+
|
21
|
+
Enjoy iPhone development with Ruby!
|
data/README.rdoc
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
= iphoneruby
|
2
|
+
|
3
|
+
* http://iphoneruby.rubyforge.org
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Want to write iPhone apps with unit tests? Want to write them in Ruby?
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* Installs a Ruby-based unit testing framework into an iPhone/Objective-C/Xcode project
|
12
|
+
* Provides generators to create Objective-C classes with associated Ruby tests
|
13
|
+
|
14
|
+
Known issues:
|
15
|
+
|
16
|
+
* Currently only test/unit tests created; rspec etc coming soon
|
17
|
+
* Currently only supports Foundation framework, since its common between OS X and iPhone
|
18
|
+
* The plan is to mock out all the UIKit.framework classes so they can exist in RubyCocoa land.
|
19
|
+
|
20
|
+
== SYNOPSIS:
|
21
|
+
|
22
|
+
* Create a new iPhone project using Xcode templates
|
23
|
+
* Open the terminal
|
24
|
+
* Change to project folder
|
25
|
+
* `iphoneruby .`
|
26
|
+
|
27
|
+
This adds the test framework, a Rakefile, and an `autotest` config file.
|
28
|
+
|
29
|
+
You can now create testable Objective-C models/classes using the generator:
|
30
|
+
|
31
|
+
$ script/generate model WidgetMaker
|
32
|
+
create Classes/WidgetMaker.h
|
33
|
+
create Classes/WidgetMaker.m
|
34
|
+
create test/test_widget_maker.rb
|
35
|
+
|
36
|
+
To run tests you have several options:
|
37
|
+
|
38
|
+
1. `rake` or `rake test`
|
39
|
+
1. `autotest` (after installing the ZenTest gem)
|
40
|
+
|
41
|
+
All options will re-build the Objective-C code (if necessary) before running the tests.
|
42
|
+
|
43
|
+
If using autotest, your tests will be re-run if the test files or the Objective-C files are modified.
|
44
|
+
|
45
|
+
== REQUIREMENTS:
|
46
|
+
|
47
|
+
* RubyCocoa (installed on OS X Leopard; latest version at http://rubycocoa.com)
|
48
|
+
* XCode 3.1 (containing the iPhone SDK)
|
49
|
+
|
50
|
+
== INSTALL:
|
51
|
+
|
52
|
+
sudo gem install iphoneruby (COMING SOON)
|
53
|
+
|
54
|
+
From source:
|
55
|
+
|
56
|
+
git clone git://github.com/drnic/iphoneruby.git
|
57
|
+
cd iphoneruby
|
58
|
+
rake install_gem
|
59
|
+
|
60
|
+
== LICENSE:
|
61
|
+
|
62
|
+
(The MIT License)
|
63
|
+
|
64
|
+
Copyright (c) 2008 Dr Nic Williams
|
65
|
+
|
66
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
67
|
+
a copy of this software and associated documentation files (the
|
68
|
+
'Software'), to deal in the Software without restriction, including
|
69
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
70
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
71
|
+
permit persons to whom the Software is furnished to do so, subject to
|
72
|
+
the following conditions:
|
73
|
+
|
74
|
+
The above copyright notice and this permission notice shall be
|
75
|
+
included in all copies or substantial portions of the Software.
|
76
|
+
|
77
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
78
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
79
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
80
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
81
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
82
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
83
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
class IphonerubyGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
4
|
+
Config::CONFIG['ruby_install_name'])
|
5
|
+
|
6
|
+
default_options :author => nil
|
7
|
+
|
8
|
+
attr_reader :name
|
9
|
+
|
10
|
+
def initialize(runtime_args, runtime_options = {})
|
11
|
+
super
|
12
|
+
usage if args.empty?
|
13
|
+
@destination_root = File.expand_path(args.shift)
|
14
|
+
@name = base_name
|
15
|
+
extract_options
|
16
|
+
end
|
17
|
+
|
18
|
+
def manifest
|
19
|
+
record do |m|
|
20
|
+
# Ensure appropriate folder(s) exists
|
21
|
+
m.directory ''
|
22
|
+
BASEDIRS.each { |path| m.directory path }
|
23
|
+
|
24
|
+
# Create stubs
|
25
|
+
m.file_copy_each ["Rakefile"]
|
26
|
+
m.file "dot_autotest", ".autotest"
|
27
|
+
m.file_copy_each ["test/test_helper.rb"]
|
28
|
+
|
29
|
+
m.dependency "install_rubigen_scripts", [destination_root, 'iphoneruby'],
|
30
|
+
:shebang => options[:shebang], :collision => :force
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
def banner
|
36
|
+
<<-EOS
|
37
|
+
Want to write iPhone unit tests? Want to write them in Ruby?
|
38
|
+
Run this generator in the root folder of your Xcode project for your iPhone app.
|
39
|
+
|
40
|
+
USAGE: #{spec.name} name
|
41
|
+
EOS
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_options!(opts)
|
45
|
+
opts.separator ''
|
46
|
+
opts.separator 'Options:'
|
47
|
+
# For each option below, place the default
|
48
|
+
# at the top of the file next to "default_options"
|
49
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
50
|
+
# "Some comment about this option",
|
51
|
+
# "Default: none") { |options[:author]| }
|
52
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
53
|
+
end
|
54
|
+
|
55
|
+
def extract_options
|
56
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
57
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
58
|
+
# raw instance variable value.
|
59
|
+
# @author = options[:author]
|
60
|
+
end
|
61
|
+
|
62
|
+
# Installation skeleton. Intermediate directories are automatically
|
63
|
+
# created so don't sweat their absence here.
|
64
|
+
BASEDIRS = %w(
|
65
|
+
Classes
|
66
|
+
test
|
67
|
+
)
|
68
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "rake"
|
3
|
+
require "rake/testtask"
|
4
|
+
|
5
|
+
task :default => :test
|
6
|
+
|
7
|
+
Rake::TestTask.new do |t|
|
8
|
+
t.libs << "test" << "test/bundles"
|
9
|
+
t.test_files = FileList['test/test*.rb']
|
10
|
+
t.verbose = true
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace :objc do
|
14
|
+
desc "Compiles all Objective-C bundles for testing"
|
15
|
+
task :compile
|
16
|
+
end
|
17
|
+
|
18
|
+
task :compile => "objc:compile"
|
19
|
+
|
20
|
+
task :test => :compile
|
21
|
+
|
22
|
+
namespace :objc do
|
23
|
+
# look for Classes/*.m files containing a line "void Init_ClassName"
|
24
|
+
# These are the primary classes for bundles; make a bundle for each
|
25
|
+
model_file_paths = `find Classes/*.m -exec grep -l "^void Init_" {} \\;`.split("\n")
|
26
|
+
model_file_paths.each do |path|
|
27
|
+
path =~ /Classes\/(.*)\.m/
|
28
|
+
model_name = $1
|
29
|
+
|
30
|
+
task :compile => model_name do
|
31
|
+
if Dir.glob("**/#{model_name}.bundle").length == 0
|
32
|
+
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
33
|
+
STDERR.puts "Bundle actually failed to build."
|
34
|
+
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
35
|
+
exit(1)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
task model_name.to_sym => "build/bundles/#{model_name}.bundle"
|
40
|
+
|
41
|
+
file "build/bundles/#{model_name}.bundle" => "Classes/#{model_name}.m" do |t|
|
42
|
+
FileUtils.mkdir_p "build/bundles"
|
43
|
+
FileUtils.rm Dir["build/bundles/#{model_name}.bundle"]
|
44
|
+
sh "gcc -o build/bundles/#{model_name}.bundle -bundle -framework Foundation Classes/#{model_name}.m"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class String
|
2
|
+
def underscore
|
3
|
+
gsub(/::/, '/').
|
4
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
5
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
6
|
+
downcase
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
Autotest.add_hook :initialize do |at|
|
11
|
+
at.add_mapping(/Classes\/(.*)\.[mh]/) do |_, m|
|
12
|
+
["test/test_#{m[1].underscore}.rb"]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Autotest.add_hook :run_command do |at|
|
17
|
+
system "rake compile"
|
18
|
+
end
|
data/bin/iphoneruby
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rubigen'
|
5
|
+
|
6
|
+
if %w(-v --version).include? ARGV.first
|
7
|
+
require 'iphoneruby/version'
|
8
|
+
puts "#{File.basename($0)} #{Iphoneruby::VERSION::STRING}"
|
9
|
+
exit(0)
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rubigen/scripts/generate'
|
13
|
+
source = RubiGen::PathSource.new(:application,
|
14
|
+
File.join(File.dirname(__FILE__), "../app_generators"))
|
15
|
+
RubiGen::Base.reset_sources
|
16
|
+
RubiGen::Base.append_sources source
|
17
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'iphoneruby')
|
data/config/hoe.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'iphoneruby/version'
|
2
|
+
|
3
|
+
AUTHOR = 'Dr Nic Williams'
|
4
|
+
EMAIL = "drnicwilliams@gmail.com"
|
5
|
+
DESCRIPTION = "Want to write iPhone unit tests? Want to write them in Ruby?"
|
6
|
+
GEM_NAME = 'iphoneruby' # what ppl will type to install your gem
|
7
|
+
RUBYFORGE_PROJECT = 'iphoneruby' # The unix name for your project
|
8
|
+
HOMEPATH = "http://github.com/drnic/iphoneruby"
|
9
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
+
EXTRA_DEPENDENCIES = [
|
11
|
+
['rubigen', '>= 1.3.2']
|
12
|
+
] # An array of rubygem dependencies [name, version]
|
13
|
+
|
14
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
15
|
+
@config = nil
|
16
|
+
RUBYFORGE_USERNAME = "unknown"
|
17
|
+
def rubyforge_username
|
18
|
+
unless @config
|
19
|
+
begin
|
20
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
21
|
+
rescue
|
22
|
+
puts <<-EOS
|
23
|
+
ERROR: No rubyforge config file found: #{@config_file}
|
24
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
25
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
26
|
+
EOS
|
27
|
+
exit
|
28
|
+
end
|
29
|
+
end
|
30
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
VERS = IPhoneRuby::VERSION::STRING
|
35
|
+
RDOC_OPTS = ['--quiet', '--title', 'iphoneruby documentation',
|
36
|
+
"--opname", "index.html",
|
37
|
+
"--line-numbers",
|
38
|
+
"--main", "README",
|
39
|
+
"--inline-source"]
|
40
|
+
|
41
|
+
class Hoe
|
42
|
+
def extra_deps
|
43
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
44
|
+
@extra_deps
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Generate all the Rake tasks
|
49
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
50
|
+
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
51
|
+
p.developer(AUTHOR, EMAIL)
|
52
|
+
p.description = DESCRIPTION
|
53
|
+
p.summary = DESCRIPTION
|
54
|
+
p.url = HOMEPATH
|
55
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
56
|
+
p.test_globs = ["test/**/test_*.rb"]
|
57
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
58
|
+
|
59
|
+
# == Optional
|
60
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
61
|
+
#p.extra_deps = EXTRA_DEPENDENCIES
|
62
|
+
|
63
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
64
|
+
end
|
65
|
+
|
66
|
+
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
67
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
68
|
+
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
69
|
+
$hoe.rsync_args = '-av --delete --ignore-errors'
|
70
|
+
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
include FileUtils
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
+
begin
|
7
|
+
require req_gem
|
8
|
+
rescue LoadError
|
9
|
+
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
+
puts "Installation: gem install #{req_gem} -y"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class ModelGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
default_options :author => nil
|
4
|
+
|
5
|
+
attr_reader :name, :class_name
|
6
|
+
|
7
|
+
def initialize(runtime_args, runtime_options = {})
|
8
|
+
super
|
9
|
+
usage if args.empty?
|
10
|
+
@name = args.shift.underscore
|
11
|
+
@class_name = @name.camelcase
|
12
|
+
extract_options
|
13
|
+
end
|
14
|
+
|
15
|
+
def manifest
|
16
|
+
record do |m|
|
17
|
+
# Ensure appropriate folder(s) exists
|
18
|
+
m.directory 'Classes'
|
19
|
+
m.directory 'test'
|
20
|
+
|
21
|
+
# Create stubs
|
22
|
+
m.template "model.h", "Classes/#{class_name}.h"
|
23
|
+
m.template "model.m", "Classes/#{class_name}.m"
|
24
|
+
m.template "test.rb", "test/test_#{name}.rb"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
def banner
|
30
|
+
<<-EOS
|
31
|
+
Creates a ...
|
32
|
+
|
33
|
+
USAGE: #{$0} #{spec.name} name
|
34
|
+
EOS
|
35
|
+
end
|
36
|
+
|
37
|
+
def add_options!(opts)
|
38
|
+
# opts.separator ''
|
39
|
+
# opts.separator 'Options:'
|
40
|
+
# For each option below, place the default
|
41
|
+
# at the top of the file next to "default_options"
|
42
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
43
|
+
# "Some comment about this option",
|
44
|
+
# "Default: none") { |options[:author]| }
|
45
|
+
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
46
|
+
end
|
47
|
+
|
48
|
+
def extract_options
|
49
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
50
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
51
|
+
# raw instance variable value.
|
52
|
+
# @author = options[:author]
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
//
|
2
|
+
// <%= class_name %>.h
|
3
|
+
// <%= class_name %>
|
4
|
+
//
|
5
|
+
// Created by FIXME on <%= Date.today %>.
|
6
|
+
// Copyright <%= Date.today.year %> FIXME. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
@interface <%= class_name %> : NSObject {
|
12
|
+
|
13
|
+
}
|
14
|
+
|
15
|
+
@end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
//
|
2
|
+
// <%= class_name %>.h
|
3
|
+
// <%= class_name %>
|
4
|
+
//
|
5
|
+
// Created by FIXME on <%= Date.today %>.
|
6
|
+
// Copyright <%= Date.today.year %> FIXME. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "<%= class_name %>.h"
|
10
|
+
|
11
|
+
|
12
|
+
@implementation <%= class_name %>
|
13
|
+
|
14
|
+
@end
|
15
|
+
|
16
|
+
// This initialization function gets called when we import the Ruby module.
|
17
|
+
// It doesn't need to do anything because the RubyCocoa bridge will do
|
18
|
+
// all the initialization work.
|
19
|
+
// The iphoneruby test framework automatically generates bundles for
|
20
|
+
// each objective-c class containing the following line. These
|
21
|
+
// can be used by your tests.
|
22
|
+
void Init_<%= class_name %>() { }
|
data/lib/iphoneruby.rb
ADDED
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/iphoneruby.rb'}"
|
9
|
+
puts "Loading iphoneruby gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|