Skip to content

Commit

Permalink
updated generators for to use the one-bundle-for-all-src instead of o…
Browse files Browse the repository at this point in the history
…ne bundle per class
  • Loading branch information
drnic committed Sep 10, 2008
1 parent 185fb94 commit 9b196aa
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 18 deletions.
7 changes: 4 additions & 3 deletions app_generators/rbiphonetest/rbiphonetest_generator.rb
Expand Up @@ -6,14 +6,15 @@ class RbiphonetestGenerator < RubiGen::Base
default_options :author => nil,
:test_framework => 'test_unit'

attr_reader :name
attr_reader :name, :module_name
attr_reader :test_framework

def initialize(runtime_args, runtime_options = {})
super
usage if args.empty?
@destination_root = File.expand_path(args.shift)
@name = base_name
@name = base_name.gsub("-", "_")
@module_name = name.camelize
extract_options
end

Expand Down Expand Up @@ -75,4 +76,4 @@ def extract_options
Classes
tasks
)
end
end
3 changes: 1 addition & 2 deletions app_generators/rbiphonetest/templates/Rakefile
@@ -1,6 +1,7 @@
require "rubygems"
require "rake"

bundle_name = '<%= module_name %>'
src_paths = %w[Classes] # any included projects, add folders here
src_files = FileList['Classes/**/*.m'] # any included projects, add files here
req_frameworks = %w[Foundation] # use only frameworks available to both Cocoa + iPhone SDKs
Expand Down Expand Up @@ -33,8 +34,6 @@ end
dot_o_files = src_files.map { |file| "build/" + File.basename(file).gsub(/\.m$/,'') + ".o" }

namespace :objc do
bundle_name = File.basename File.dirname(__FILE__)

task :compile => "build/bundles/#{bundle_name}.bundle" do
if Dir.glob("**/#{bundle_name}.bundle").length == 0
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Expand Down
@@ -1,3 +1,7 @@
require "osx/cocoa"

$:.unshift File.dirname(__FILE__) + "/../build/bundles"
$:.unshift File.dirname(__FILE__) + "/../build/bundles"

bundle_name = '<%= module_name %>'
require "#{bundle_name}.bundle"
OSX::ns_import bundle_name.to_sym
@@ -1,4 +1,8 @@
require "test/unit"
require "osx/cocoa"

$:.unshift File.dirname(__FILE__) + "/../build/bundles"
$:.unshift File.dirname(__FILE__) + "/../build/bundles"

bundle_name = '<%= module_name %>'
require "#{bundle_name}.bundle"
OSX::ns_import bundle_name.to_sym
3 changes: 2 additions & 1 deletion rbiphonetest_generators/model_rspec/model_rspec_generator.rb
Expand Up @@ -2,13 +2,14 @@ class ModelRspecGenerator < RubiGen::Base

default_options :author => nil

attr_reader :name, :class_name
attr_reader :name, :class_name, :module_name

def initialize(runtime_args, runtime_options = {})
super
usage if args.empty?
@name = args.shift.underscore
@class_name = @name.camelcase
@module_name = File.basename(destination_root).gsub("-", "_").camelize
extract_options
end

Expand Down
3 changes: 0 additions & 3 deletions rbiphonetest_generators/model_rspec/templates/spec.rb
@@ -1,8 +1,5 @@
require File.dirname(__FILE__) + '/spec_helper'

require "<%= class_name %>.bundle"
OSX::ns_import :<%= class_name %>

describe OSX::<%= class_name %> do
it "should exist" do
Expand Down
Expand Up @@ -2,13 +2,14 @@ class ModelTestUnitGenerator < RubiGen::Base

default_options :author => nil

attr_reader :name, :class_name
attr_reader :name, :class_name, :module_name

def initialize(runtime_args, runtime_options = {})
super
usage if args.empty?
@name = args.shift.underscore
@class_name = @name.camelcase
@name = args.shift.underscore
@class_name = @name.camelcase
@module_name = File.basename(destination_root).gsub("-", "_").camelize
extract_options
end

Expand Down Expand Up @@ -48,4 +49,4 @@ def extract_options
# raw instance variable value.
# @author = options[:author]
end
end
end
3 changes: 0 additions & 3 deletions rbiphonetest_generators/model_test_unit/templates/test.rb
@@ -1,8 +1,5 @@
require File.dirname(__FILE__) + '/test_helper'

require "<%= class_name %>.bundle"
OSX::ns_import :<%= class_name %>

class Test<%= class_name %> < Test::Unit::TestCase
def test_<%= name %>_class_exists
OSX::<%= class_name %>
Expand Down

0 comments on commit 9b196aa

Please sign in to comment.