motion-momentum 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7bb4234678f577982c6dffb954ddd4619bd0095
4
- data.tar.gz: 72617675728c088133de612a48f5d3e0bdf89f9e
3
+ metadata.gz: 3c7db6a16d865889e44c4ebe62ac260433684aff
4
+ data.tar.gz: 4e11790d5a9870fd8f971188bb13b67857219bc3
5
5
  SHA512:
6
- metadata.gz: 95ca815da7a9abd58e3f0ba594b5017bf3372696e4402f93d3906bbb5b98afd10c07aede3974cdd3e91245a9bb48d099c2a6049a839d303dd0b7ab2ba5ab7f46
7
- data.tar.gz: cb76b47b63ff7906f39e3691264a7b8b83b0886c146b713cd3d44c8eeef4e2ea47b7f64975dc83e9a8629fe03846ab18830652efa4defceb2df6865338af496f
6
+ metadata.gz: 178698f510384eac8311061e690bd7cd7cb231134c5204167b80c4cfbd17b0637decbe02ebe6fabfbec5c3eeddafba17c5ab3ba1135916f95b82350d1ab800ab
7
+ data.tar.gz: a45a5053fb512abfc0afd26503e37dcecae25403511c826e94e0f5ee07cd477ae005780a197b5d62d3ca3b5e3a5aa7bdc5d0e58698f04afbe14893589c67b37c
data/README.md CHANGED
@@ -8,6 +8,8 @@ I suggest you use this framework with [RMQ](https://github.com/infinitered/rmq)
8
8
 
9
9
  This framework is being developed along side the [RubyMotion for Rails Developers book](http://book.motioninmotion.tv/), but my vision for it is most certainly to help the long term happiness of the RubyMotion community. Please share your ideas by submitting an issue here on GitHub. Show support by purchasing the book or [subscribe to my screencasts](https://motioninmotion.tv/).
10
10
 
11
+ You can see sample application in the [MomentumSampleApps repo](https://github.com/FluffyJack/MomentumSampleApps).
12
+
11
13
  ## Installation
12
14
 
13
15
  Add this line to your application's Gemfile:
@@ -6,14 +6,25 @@ module Momentum
6
6
  end
7
7
 
8
8
  module ClassMethods
9
- %w(view delegate stylesheet).each do |class_helper_method|
10
- define_method class_helper_method.to_sym do |class_string|
11
- send :define_method, "#{class_helper_method}_class".to_sym do
12
- if Object.const_defined? class_string
13
- Object.const_get class_string
14
- else
15
- puts "[Momentum Warning] ::: The #{class_helper_method} class #{class_string} does not exist, you attempted to use it in #{self.class}"
16
- end
9
+ private
10
+ def view(class_string)
11
+ add_related_class_macro('view', class_string)
12
+ end
13
+
14
+ def delegate(class_string)
15
+ add_related_class_macro('delegate', class_string)
16
+ end
17
+
18
+ def stylesheet(class_string)
19
+ add_related_class_macro('stylesheet', class_string)
20
+ end
21
+
22
+ def add_related_class_macro(class_helper_method, class_string)
23
+ send :define_method, "#{class_helper_method}_class".to_sym do
24
+ if Object.const_defined? class_string
25
+ Object.const_get class_string
26
+ else
27
+ puts "[Momentum Warning] ::: The #{class_helper_method} class #{class_string} does not exist, you attempted to use it in #{self.class}"
17
28
  end
18
29
  end
19
30
  end
@@ -36,8 +47,8 @@ module Momentum
36
47
  end
37
48
 
38
49
  def loadView
39
- self.view = self.view_class.new
40
- self.delegate = self.delegate_class.new
50
+ self.view = (self.view_class || UIView).new
51
+ self.delegate = (self.delegate_class || Delegate).new
41
52
  self.view.delegate = self.delegate if self.view.class.instance_methods.include?(:delegate)
42
53
  self.view.dataSource = self.delegate if self.view.class.instance_methods.include?(:dataSource)
43
54
  end
@@ -1,3 +1,3 @@
1
1
  module Momentum
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -89,4 +89,20 @@ describe Momentum::ViewController do
89
89
  end
90
90
 
91
91
  end
92
+
93
+ context "no related classes" do
94
+
95
+ before { @vc = NoRelatedClassesMockController.new }
96
+
97
+ it "has a UIView as it's view" do
98
+ @vc.loadView
99
+ @vc.view.class.should == UIView
100
+ end
101
+
102
+ it "has a Momentum::Delegate as it's delegate" do
103
+ @vc.loadView
104
+ @vc.delegate.class.should == Momentum::Delegate
105
+ end
106
+
107
+ end
92
108
  end
@@ -0,0 +1,2 @@
1
+ class NoRelatedClassesMockController < Momentum::ViewController
2
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-momentum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Dean Watson-Hamblin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-10 00:00:00.000000000 Z
11
+ date: 2014-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,6 +84,7 @@ files:
84
84
  - spec/motion-momentum-ios/controller/view_controller_spec.rb
85
85
  - spec/motion-momentum-ios/mocks/controllers/custom_mock_controller.rb
86
86
  - spec/motion-momentum-ios/mocks/controllers/mock_controller.rb
87
+ - spec/motion-momentum-ios/mocks/controllers/no_related_classes_mock_controller.rb
87
88
  - spec/motion-momentum-ios/mocks/controllers/no_setup_mock_controller.rb
88
89
  - spec/motion-momentum-ios/mocks/delegates/custom_data_source.rb
89
90
  - spec/motion-momentum-ios/mocks/delegates/mock_delegate.rb
@@ -125,6 +126,7 @@ test_files:
125
126
  - spec/motion-momentum-ios/controller/view_controller_spec.rb
126
127
  - spec/motion-momentum-ios/mocks/controllers/custom_mock_controller.rb
127
128
  - spec/motion-momentum-ios/mocks/controllers/mock_controller.rb
129
+ - spec/motion-momentum-ios/mocks/controllers/no_related_classes_mock_controller.rb
128
130
  - spec/motion-momentum-ios/mocks/controllers/no_setup_mock_controller.rb
129
131
  - spec/motion-momentum-ios/mocks/delegates/custom_data_source.rb
130
132
  - spec/motion-momentum-ios/mocks/delegates/mock_delegate.rb