Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
generate
readme.md

readme.md

Usage

$ cd path/to/nsrails_repo
$ autogen/generate [options] path/to/rails_project

Files will be created in the autogen/ directory with the extension .gen, whose contained files can then be added to your Xcode project.

Options

Use the -h (--help) flag for a list of these options.

Option Description
--ruby
Generate .rb classes for RubyMotion or MacRuby. (Objective-C by default)
--created-at
--updated-at
Include created_at and/or updated_at properties. (Excluded by default)
--mutable-sets
Use NSMutableSet for properties that are has-many. (Useful when using NSRails with CoreData - NSMutableArray by default)
--nesting-retrievable-only
Make all nested properties retrievable-only. (Use this if you don't want to support accepting nested attributes)
--author, -a
--company, -c
--project, -p

(Each expects a string following it)

Metadata for headers. (Only relevant for Objective-C generation)
--prefix, -x

(Expects a string following it)

Class and filename prefix.

Example

$ autogen/generate -a "Nikola Tesla" -c "Tesla ELM" -p "The Coil" -x "NSR" --created-at --mutable-arrays APP_PATH

Could generate files like these:

//
//  NSRPost.h
//  The Coil
//
//  Created by Nikola Tesla on 1/29/12.
//  Copyright (c) 2012 Tesla ELM. All rights reserved.
//

#import "NSRails.h"

@class NSRResponse;

@interface NSRPost : NSRRemoteObject

@property (nonatomic, strong) NSRAuthor *author;
@property (nonatomic, strong) NSString *content;
@property (nonatomic, strong) NSDate *createdAt;
@property (nonatomic, strong) NSMutableArray *responses;

@end
//
//  NSRPost.m
//  The Coil
//
//  Created by Nikola Tesla on 1/29/12.
//  Copyright (c) 2012 Tesla ELM. All rights reserved.
//

#import "NSRPost.h"
#import "NSRResponse.h"

@implementation NSRPost
@synthesize content, author, createdAt, responses;
NSRMap(*, author -b, createdAt -r, responses:NSRResponse);

@end