fwtoolkit 0.5.0 → 0.5.1
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.
@@ -46,12 +46,20 @@ module FWToolkit
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def fwt_seed_app(model_names=[])
|
49
|
+
puts "Deprecated: fwt_seed_app(). Please use fwt_seed_app_with_pickle_models(). Will be changed in 0.6.0 to accept objects."
|
50
|
+
fwt_seed_app_with_pickle_models(model_names)
|
51
|
+
end
|
52
|
+
|
53
|
+
def fwt_seed_app_with_pickle_models(model_names=[])
|
49
54
|
objects = model_names.collect{|n| model!(n)}
|
50
|
-
|
55
|
+
fwt_seed_app_with_objects(objects)
|
56
|
+
end
|
57
|
+
|
58
|
+
def fwt_seed_app_with_objects(objects = [])
|
59
|
+
fwt_app_exec("seedCoreData:", objects.to_json)
|
51
60
|
end
|
52
61
|
|
53
62
|
def fwt_set_user_defaults(bundle_identifier, user_defaults)
|
54
|
-
|
55
63
|
app_dir = Dir.entries(fwt_simulator_applications_dir)
|
56
64
|
app_dir.delete "."
|
57
65
|
app_dir.delete ".."
|
@@ -62,9 +70,7 @@ module FWToolkit
|
|
62
70
|
data.merge! user_defaults
|
63
71
|
plist.value = CFPropertyList.guess(data)
|
64
72
|
plist.save(plist_file, CFPropertyList::List::FORMAT_BINARY)
|
65
|
-
|
66
73
|
end
|
67
|
-
|
68
74
|
end
|
69
75
|
end
|
70
76
|
end
|
data/lib/fwtoolkit/version.rb
CHANGED
data/lib/fwtoolkit.rb
CHANGED
@@ -6,3 +6,15 @@ require 'fwtoolkit/version'
|
|
6
6
|
require 'fwtoolkit/test/frank_model'
|
7
7
|
|
8
8
|
Dir["tasks/**/*.rake"].each { |ext| load ext } if defined?(Rake)
|
9
|
+
|
10
|
+
# add as_json to Array
|
11
|
+
class Array
|
12
|
+
def to_json(*)
|
13
|
+
contents = ""
|
14
|
+
self.each_index do |i|
|
15
|
+
contents << self[i].to_json
|
16
|
+
contents << ',' unless i == self.length - 1
|
17
|
+
end
|
18
|
+
"[#{contents}]"
|
19
|
+
end
|
20
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
//
|
2
2
|
// AppDelegate+Frank.m
|
3
|
-
//
|
3
|
+
// FWToolkit
|
4
4
|
//
|
5
5
|
// Created by Matt Brooke-Smith on 18/07/2012.
|
6
6
|
// Copyright (c) 2012 Future Workshops. All rights reserved.
|
@@ -10,7 +10,6 @@
|
|
10
10
|
#import <CoreData/CoreData.h>
|
11
11
|
#import <JSONKit/JSONKit.h>
|
12
12
|
#import <RestKit/RestKit.h>
|
13
|
-
#import "RKObjectManager+QVWOfflineTests.h"
|
14
13
|
|
15
14
|
@implementation AppDelegate (Frank)
|
16
15
|
|
@@ -34,7 +33,7 @@
|
|
34
33
|
|
35
34
|
NSError *error = nil;
|
36
35
|
if (![managedObjectContext save:&error]) {
|
37
|
-
|
36
|
+
NSLog(@"Error saving: %@", [error localizedDescription]);
|
38
37
|
}
|
39
38
|
}
|
40
39
|
|
@@ -17,12 +17,12 @@ Given /^I launch the app in the (iphone|ipad) simulator$/ do |device|
|
|
17
17
|
end
|
18
18
|
|
19
19
|
Given /^I reset and launch the app in the (iphone|ipad) simulator$/ do |device|
|
20
|
-
fwt_simulator_reset_data
|
20
|
+
fwt_simulator_reset_data ios_sdk
|
21
21
|
launch_app app_path, ios_sdk, device
|
22
22
|
end
|
23
23
|
|
24
24
|
Given /^I reset and launch the app in the (iphone|ipad) simulator, seeded with #{capture_model}$/ do |device, capture_model|
|
25
|
-
fwt_simulator_reset_data
|
25
|
+
fwt_simulator_reset_data ios_sdk
|
26
26
|
launch_app app_path, ios_sdk, device
|
27
27
|
fwt_seed_app [capture_model]
|
28
28
|
launch_app app_path, ios_sdk, device
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'jbuilder'
|
2
|
-
|
3
1
|
# Generated code
|
4
2
|
class <%= @class_name %> < FWToolkit::Test::FrankModel
|
5
3
|
# attributes
|
@@ -7,10 +5,6 @@ class <%= @class_name %> < FWToolkit::Test::FrankModel
|
|
7
5
|
# relationships
|
8
6
|
attr_reader <%= @model.relationships.select{|r| r.inverse != nil}.map{|r| ":#{r.name.ruby_format}"}.join(', ') %>
|
9
7
|
|
10
|
-
def initialize
|
11
|
-
@core_data_entity = '<%= @model.name %>'
|
12
|
-
end
|
13
|
-
|
14
8
|
# inverse relationship setters
|
15
9
|
<% @model.relationships.select{|r| not r.to_many? and r.inverse}.each do |r| %><% name = r.name.ruby_format %>
|
16
10
|
def <%= name %>=(_<%= name %>)
|
@@ -30,17 +24,7 @@ class <%= @class_name %> < FWToolkit::Test::FrankModel
|
|
30
24
|
<% end %>
|
31
25
|
|
32
26
|
def as_json(options={})
|
33
|
-
|
34
|
-
|
35
|
-
<% @model.attributes.each do |a| %>
|
36
|
-
json.<%= a.name %> self.<%= a.name.ruby_format %>
|
37
|
-
<% end %>
|
38
|
-
<% @model.relationships.select{|r| r.to_many? and r.inverse}.each do |r| %>
|
39
|
-
json.<%= r.name %> self.<%= r.name.ruby_format %> do |obj|
|
40
|
-
# fill out object properties
|
41
|
-
end
|
42
|
-
<% end %>
|
43
|
-
end
|
44
|
-
end
|
27
|
+
<% attributes_and_properties = @model.attributes + @model.relationships.select{|r| r.to_many? and r.inverse} %>
|
28
|
+
{'<%= @model.name %>' => {<%= attributes_and_properties.map {|p| ":#{p.name} => self.#{p.name.ruby_format}"}.join(', ') %>}}
|
45
29
|
end
|
46
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fwtoolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|