lock-o-motion 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  = LockOMotion CHANGELOG
2
2
 
3
+ == Version 0.1.1 (February 13, 2013)
4
+
5
+ * Being able to resolve absolute file paths at runtime only based on a file name
6
+
3
7
  == Version 0.1.0 (February 12, 2013)
4
8
 
5
9
  * Initial release
data/README.md CHANGED
@@ -26,7 +26,7 @@ A possible strategy is to "mock" common Ruby gems (e.g. `yaml` or [HTTParty](htt
26
26
 
27
27
  ### Set up your `Gemfile` and `Rakefile`
28
28
 
29
- You need to setup your `Gemfile` by separating RubyMotion aware Ruby gems from the ones that are not. Put the RubyMotion *unaware* gems in the `:lotion` (short for LockOMotion of course) Bundler group like this:
29
+ You need to setup your `Gemfile` by separating RubyMotion aware Ruby gems from the ones that are not. Put the RubyMotion **unaware** gems in the `:lotion` (short for LockOMotion of course) Bundler group like this:
30
30
 
31
31
  source "http://rubygems.org"
32
32
 
@@ -66,6 +66,8 @@ LockOMotion generates a hidden Ruby file called `.lotion.rb` in which the follow
66
66
  * `FILES` - All Ruby sources registered with `Motion::Project::App.files`
67
67
  * `DEPENDENCIES` - All file dependencies registered with `Motion::Project::App.files_dependencies`
68
68
  * `IGNORED_REQUIRES` - Ignored file requires (declared in `Lotion.setup`)
69
+ * `USER_MOCKS` - The directory in which user defined mock gems are located
70
+ * `GEM_MOCKS` - The directory in which LockOMotion mock gems are located
69
71
  * `LOAD_PATHS` - Available load paths after running `rake`
70
72
  * `GEM_PATHS` - Available gem paths (resembles `Gem.latest_load_paths`)
71
73
  * `REQUIRED` - All required files after running `rake`
@@ -83,39 +85,51 @@ Let us say your `Gemfile` looks like the following:
83
85
 
84
86
  # RubyMotion unawared gems
85
87
  group :lotion do
86
- gem "slot_machine"
88
+ gem "mab"
87
89
  end
88
90
 
89
91
  A fragment of the generated `.lotion.rb` looks like this:
90
92
 
91
93
  module Lotion
92
94
  FILES = [
93
- "/Users/paulengel/Sources/lock-o-motion/lib/motion/core_ext.rb",
94
- "/Users/paulengel/Sources/lock-o-motion/lib/motion/lotion.rb",
95
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/lock-o-motion-0.1.1/lib/motion/core_ext.rb",
96
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/lock-o-motion-0.1.1/lib/motion/lotion.rb",
95
97
  "/Users/paulengel/Sources/just_awesome/.lotion.rb",
96
98
  "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/colorize-0.5.8/lib/colorize.rb",
97
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot_machine.rb",
98
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot.rb",
99
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot_machine/slot.rb",
100
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot_machine/version.rb",
101
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/time_slot.rb",
99
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab.rb",
100
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/builder.rb",
101
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/indentation.rb",
102
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/mixin.rb",
103
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/version.rb",
104
+ "/Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/cgi.rb",
105
+ "/Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/cgi/cookie.rb",
106
+ "/Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/cgi/core.rb",
107
+ "/Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/cgi/util.rb",
102
108
  "./app/app_delegate.rb",
103
109
  "./app/controllers/awesome_controller.rb"
104
110
  ]
105
111
  DEPENDENCIES = {
106
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot_machine.rb" => [
107
- "/Users/paulengel/Sources/lock-o-motion/lib/motion/core_ext.rb",
108
- "/Users/paulengel/Sources/lock-o-motion/lib/motion/lotion.rb",
112
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab.rb" => [
113
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/lock-o-motion-0.1.1/lib/motion/core_ext.rb",
114
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/lock-o-motion-0.1.1/lib/motion/lotion.rb",
109
115
  "/Users/paulengel/Sources/just_awesome/.lotion.rb",
110
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot_machine/slot.rb",
111
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot_machine/version.rb",
112
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot.rb",
113
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/time_slot.rb"
116
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/version.rb",
117
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/mixin.rb",
118
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/indentation.rb",
119
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/builder.rb"
120
+ ],
121
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/mixin.rb" => [
122
+ "/Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/cgi.rb"
123
+ ],
124
+ "/Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/cgi.rb" => [
125
+ "/Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/cgi/core.rb",
126
+ "/Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/cgi/cookie.rb",
127
+ "/Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/cgi/util.rb"
114
128
  ],
115
- "/Users/paulengel/Sources/lock-o-motion/lib/motion/core_ext.rb" => [
129
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/lock-o-motion-0.1.1/lib/motion/core_ext.rb" => [
116
130
  "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/colorize-0.5.8/lib/colorize.rb"
117
131
  ],
118
- "/Users/paulengel/Sources/lock-o-motion/lib/motion/lotion.rb" => [
132
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/lock-o-motion-0.1.1/lib/motion/lotion.rb" => [
119
133
  "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/colorize-0.5.8/lib/colorize.rb"
120
134
  ],
121
135
  "/Users/paulengel/Sources/just_awesome/.lotion.rb" => [
@@ -123,19 +137,21 @@ A fragment of the generated `.lotion.rb` looks like this:
123
137
  ]
124
138
  }
125
139
  IGNORED_REQUIRES = []
140
+ USER_MOCKS = "/Users/paulengel/Sources/just_awesome/mocks"
141
+ GEM_MOCKS = "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/lock-o-motion-0.1.1/lib/lock-o-motion/mocks"
126
142
  LOAD_PATHS = [
127
- "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib",
128
- "/Users/paulengel/Sources/lock-o-motion/lib",
143
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib",
144
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/lock-o-motion-0.1.1/lib",
129
145
  "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/colorize-0.5.8/lib",
130
146
  "/Library/RubyMotion/lib",
131
147
 
132
148
  ### Warnings at runtime
133
149
 
134
- As said before, you are not able to require sources at runtime and you cannot use "dynamic code execution" like `class_eval` or `instance_eval`. LockOMotion warns you about these kind of statements.
150
+ As said before, you are not able to require sources at runtime and you cannot do "dynamic code execution" using `class_eval` or `instance_eval` with string interpolation (passing blocks is possible though). LockOMotion warns you about these kind of statements.
135
151
 
136
152
  #### Restricted method calls
137
153
 
138
- Using the same `Gemfile` as in the previous example. The console output would look something like this:
154
+ Using the previous `Gemfile`, as Mab uses `class_eval` with string interpolation. The console output would look something like this:
139
155
 
140
156
  1.9.3 paulengel:just_awesome $ rake
141
157
  Build ./build/iPhoneSimulator-6.1-Development
@@ -143,11 +159,19 @@ Using the same `Gemfile` as in the previous example. The console output would lo
143
159
  Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
144
160
  Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
145
161
  Simulate ./build/iPhoneSimulator-6.1-Development/Just Awesome.app
146
- Warning Called `Slot.class_eval` from
147
- /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot.rb:5
148
- Warning Called `TimeSlot.class_eval` from
149
- /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot.rb:5
150
- (main) >
162
+ Warning Called `Mab::Mixin::HTML5.class_eval` from
163
+ /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/mixin.rb:201
164
+ Warning Called `Mab::Mixin::HTML5.class_eval` from
165
+ /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/mixin.rb:201
166
+ Warning Called `Mab::Mixin::HTML5.class_eval` from
167
+ /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/mixin.rb:201
168
+ Warning Called `Mab::Mixin::HTML5.class_eval` from
169
+ /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/mixin.rb:201
170
+ Warning Called `Mab::Mixin::HTML5.class_eval` from
171
+ /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/mixin.rb:201
172
+ Warning Called `Mab::Mixin::HTML5.class_eval` from
173
+ /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/mab-0.0.2/lib/mab/mixin.rb:201
174
+ Warning Called `Mab::Mixin::HTML5.class_eval` from
151
175
 
152
176
  You will need to solve this yourself e.g. by overriding the method for instance or by refactoring.
153
177
 
@@ -169,37 +193,36 @@ You will get the following console output:
169
193
 
170
194
  1.9.3 paulengel:just_awesome $ rake
171
195
  Build ./build/iPhoneSimulator-6.1-Development
172
- Compile /Users/paulengel/Sources/lock-o-motion/lib/motion/lotion.rb
173
196
  Compile /Users/paulengel/Sources/just_awesome/.lotion.rb
174
197
  Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
175
198
  Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
176
199
  Simulate ./build/iPhoneSimulator-6.1-Development/Just Awesome.app
177
- (main)> 2013-02-10 18:27:40.813 Just Awesome[73896:c07] lotion.rb:17:in `require:': cannot load such file -- oj (LoadError)
178
- from core_ext.rb:29:in `require:'
179
- from multi_json.rb:33:in `block in default_adapter'
180
- from multi_json.rb:31:in `default_adapter'
181
- from multi_json.rb:49:in `adapter'
182
- from multi_json.rb:108:in `current_adapter:'
183
- from multi_json.rb:94:in `load:'
184
- from awesome_controller.rb:11:in `viewDidLoad'
185
- from app_delegate.rb:13:in `application:didFinishLaunchingWithOptions:'
186
- Warning Called `require "yajl"` from /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.5.0/lib/multi_json.rb:33
187
- /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.5.0/lib/multi_json.rb:33
200
+ 2013-02-13 01:10:53.584 Just Awesome[57808:c07] lotion.rb:17:in `require:': cannot load such file -- oj (LoadError)
201
+ from core_ext.rb:39:in `require:'
202
+ from multi_json.rb:38:in `block in default_adapter'
203
+ from multi_json.rb:36:in `default_adapter'
204
+ from multi_json.rb:85:in `load_adapter:'
205
+ from multi_json.rb:73:in `use:'
206
+ from multi_json.rb:55:in `adapter'
207
+ from multi_json.rb:114:in `current_adapter:'
208
+ from multi_json.rb:100:in `load:'
209
+ Warning Called `require "yajl"` from
210
+ /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.6.0/lib/multi_json.rb:38
188
211
  Add within Lotion.setup block: app.require "yajl"
189
- Warning Called `require "multi_json/adapters/yajl"` from /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.5.0/lib/multi_json.rb:74
190
- /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.5.0/lib/multi_json.rb:74
212
+ Warning Called `require "multi_json/adapters/yajl"` from
213
+ /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.6.0/lib/multi_json.rb:82
191
214
  Add within Lotion.setup block: app.require "multi_json/adapters/yajl"
192
- 2013-02-10 18:27:40.981 Just Awesome[73896:c07] multi_json.rb:75:in `load_adapter:': uninitialized constant MultiJson::Adapters (NameError)
193
- from multi_json.rb:65:in `use:'
194
- from multi_json.rb:49:in `adapter'
215
+ 2013-02-13 01:10:53.728 Just Awesome[57808:c07] multi_json.rb:83:in `load_adapter:': uninitialized constant MultiJson::Adapters (NameError)
216
+ from multi_json.rb:85:in `load_adapter:'
217
+ from multi_json.rb:73:in `use:'
195
218
 
196
219
  When applicable, you will get a warning about it. Here is the fragment of the warning:
197
220
 
198
- Warning Called `require "yajl"` from /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.5.0/lib/multi_json.rb:33
199
- /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.5.0/lib/multi_json.rb:33
221
+ Warning Called `require "yajl"` from
222
+ /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.6.0/lib/multi_json.rb:38
200
223
  Add within Lotion.setup block: app.require "yajl"
201
- Warning Called `require "multi_json/adapters/yajl"` from /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.5.0/lib/multi_json.rb:74
202
- /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.5.0/lib/multi_json.rb:74
224
+ Warning Called `require "multi_json/adapters/yajl"` from
225
+ /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.6.0/lib/multi_json.rb:82
203
226
  Add within Lotion.setup block: app.require "multi_json/adapters/yajl"
204
227
 
205
228
  The following section contains further information about how to correct this.
@@ -222,12 +245,14 @@ As far as I know, you are not able to require `.bundle` files within a RubyMotio
222
245
  requires /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/yajl-ruby-1.1.0/lib/yajl/yajl.bundle
223
246
  Build ./build/iPhoneSimulator-6.1-Development
224
247
  Compile /Users/paulengel/Sources/just_awesome/.lotion.rb
248
+ Compile /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_json-1.6.0/lib/multi_json/adapters/yajl.rb
249
+ Compile /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/yajl-ruby-1.1.0/lib/yajl.rb
225
250
  Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
226
251
  Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Info.plist
227
252
  Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/PkgInfo
228
253
  Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
229
254
  Simulate ./build/iPhoneSimulator-6.1-Development/Just Awesome.app
230
- (main)> 2013-02-10 18:40:02.534 Just Awesome[74192:c07] uninitialized constant Yajl (NameError)
255
+ (main)> 2013-02-13 01:13:03.630 Just Awesome[57933:c07] uninitialized constant Yajl (NameError)
231
256
 
232
257
  You can to try [mocking Ruby gems](https://github.com/archan937/lock-o-motion#mocking-ruby-gems) with drop-in replacements.
233
258
 
@@ -237,27 +262,31 @@ LockOMotion provides a possibility to run Ruby code at startup. You can think of
237
262
 
238
263
  Let's say the root directory of your RubyMotion application is `/Users/paulengel/Sources/just_awesome`. Create a file at `/Users/paulengel/Sources/just_awesome/lotion.rb`.
239
264
 
240
- And when containing the following Ruby code:
265
+ When containing the following Ruby code:
241
266
 
242
267
  puts "Hello, I am `lotion.rb`"
243
268
  puts SlotMachine.class
244
269
 
270
+ Using the following `Gemfile`:
271
+
272
+ source "http://rubygems.org"
273
+
274
+ # RubyMotion awared gems
275
+ gem "lock-o-motion"
276
+
277
+ # RubyMotion unawared gems
278
+ group :lotion do
279
+ gem "slot_machine"
280
+ end
281
+
245
282
  The output will be as follows:
246
283
 
247
284
  1.9.3 paulengel:just_awesome $ rake
248
285
  Build ./build/iPhoneSimulator-6.1-Development
249
286
  Compile /Users/paulengel/Sources/just_awesome/.lotion.rb
250
- Compile ./app/controllers/awesome_controller.rb
251
- Compile /Users/paulengel/Sources/just_awesome/lotion.rb
252
287
  Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
253
- Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Info.plist
254
- Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/PkgInfo
255
288
  Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
256
289
  Simulate ./build/iPhoneSimulator-6.1-Development/Just Awesome.app
257
- (main)> Warning Called `Slot.class_eval` from
258
- /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot.rb:5
259
- Warning Called `TimeSlot.class_eval` from
260
- /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/slot_machine-0.1.0/lib/slot.rb:5
261
290
  Hello, I am `lotion.rb`
262
291
  Module
263
292
  (main)>
@@ -266,21 +295,28 @@ The output will be as follows:
266
295
 
267
296
  LockOMotion is able to mock some of the `HTTParty` core methods (GET, POST, PUT, DELETE requests and HTTP Basic Authentication). With this achievement, we are able to use several Ruby gems which have `HTTParty` as gem dependency. The dependency will not be a blocking factor anymore when it comes to using the gem within a RubyMotion application.
268
297
 
269
- As opposed to not having the `HTTParty` to our availability:
298
+ As opposed to not having the `HTTParty` mock to our availability:
270
299
 
271
- ##### Gemfile
300
+ **Gemfile**
272
301
 
273
302
  source "http://rubygems.org"
274
303
 
275
304
  # RubyMotion aware gems
276
- gem "lock-o-motion", :path => "/Users/paulengel/Sources/lock-o-motion"
305
+ gem "lock-o-motion"
277
306
 
278
307
  # RubyMotion unaware gems
279
308
  group :lotion do
280
309
  gem "httparty"
281
310
  end
282
311
 
283
- ##### Console output
312
+ **Fragment of a defined UIViewController for instance**
313
+
314
+ def viewDidLoad
315
+ super
316
+ puts HTTParty.get("https://github.com/archan937/lock-o-motion").parsed_response
317
+ end
318
+
319
+ **Console output**
284
320
 
285
321
  1.9.3 paulengel:just_awesome $ rake
286
322
  Warning Could not resolve dependency "socket.so"
@@ -291,9 +327,9 @@ As opposed to not having the `HTTParty` to our availability:
291
327
  Warning Skipped 'openssl' requirement
292
328
  Warning /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/httparty-0.10.1/lib/httparty.rb
293
329
  requires /Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/x86_64-darwin12.2.1/zlib.bundle
294
- Warning /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_xml-0.5.2/lib/multi_xml.rb
330
+ Warning /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_xml-0.5.3/lib/multi_xml.rb
295
331
  requires /Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/x86_64-darwin12.2.1/bigdecimal.bundle
296
- Warning /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_xml-0.5.2/lib/multi_xml.rb
332
+ Warning /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/multi_xml-0.5.3/lib/multi_xml.rb
297
333
  requires /Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/x86_64-darwin12.2.1/stringio.bundle
298
334
  Warning /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/httparty-0.10.1/lib/httparty/net_digest_auth.rb
299
335
  requires /Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/x86_64-darwin12.2.1/digest/md5.bundle
@@ -302,14 +338,15 @@ As opposed to not having the `HTTParty` to our availability:
302
338
  Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
303
339
  Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
304
340
  Simulate ./build/iPhoneSimulator-6.1-Development/Just Awesome.app
305
- 2013-02-11 01:06:52.671 Just Awesome[95675:c07] lotion.rb:17:in `require:': cannot load such file -- pathname.so (LoadError)
306
- from core_ext.rb:29:in `require:'
341
+ (main)> 2013-02-13 01:21:39.888 Just Awesome[59028:c07] lotion.rb:17:in `require:': cannot load such file -- pathname.so (LoadError)
342
+ from core_ext.rb:39:in `require:'
307
343
 
308
- We are able to leave the `Gemfile` as is and get a console output like this:
344
+ When we do have the `HTTParty` mock to our availability, we can just leave the code as is and get a console output like this:
309
345
 
310
346
  1.9.3 paulengel:just_awesome $ rake
311
347
  Build ./build/iPhoneSimulator-6.1-Development
312
348
  Compile /Users/paulengel/Sources/just_awesome/.lotion.rb
349
+ Compile /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/lock-o-motion-0.1.1/lib/lock-o-motion/mocks/httparty.rb
313
350
  Compile ./app/controllers/awesome_controller.rb
314
351
  Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
315
352
  Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
@@ -325,6 +362,13 @@ We are able to leave the `Gemfile` as is and get a console output like this:
325
362
  <title>archan937/lock-o-motion · GitHub</title>
326
363
  <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
327
364
  <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
365
+ <link rel="apple-touch-icon-precomposed" sizes="57x57" href="apple-touch-icon-114.png" />
366
+ <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114.png" />
367
+ <link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-144.png" />
368
+ <link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144.png" />
369
+ <link rel="logo" type="image/svg" href="http://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
370
+ <meta name="msapplication-TileImage"
371
+ (main)>
328
372
 
329
373
  I am planning on writing more "mocks" for common Ruby gems. But aside from mocks being defined within the LockOMotion gem sources, you can also define your own mocks within your RubyMotion application. Just add a directory called `mocks` within the root directory of the application and put the "mock sources" in it. The relative path of the mock source within that directory ensures a certain Ruby gem being mocked at compile time.
330
374
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -24,7 +24,7 @@ module Lotion
24
24
  args.first
25
25
  else
26
26
  object, method, caller = *args
27
- "Called `#{object}.#{method}` from\n#{derive_caller(caller)}"
27
+ "Called `#{object}.#{method}` from\n#{derive_caller(caller, false)}"
28
28
  end
29
29
  end
30
30
  puts " Warning #{message.gsub("\n", "\n ")}".yellow
@@ -32,17 +32,32 @@ module Lotion
32
32
 
33
33
  private
34
34
 
35
- def derive_caller(caller)
36
- return "<unknown path>" if caller.empty?
37
- file, line = *caller[0].match(/^(.*\.rb):(\d+)/).captures
38
- "#{resolve file}:#{line}"
35
+ def derive_caller(caller, identical = true)
36
+ if caller.empty?
37
+ "<unknown path>"
38
+ else
39
+ file, line = *caller[0].match(/^(.*\.rb):(\d+)/).captures
40
+ resolved = resolve file, identical
41
+ case resolved
42
+ when String
43
+ "#{resolved}:#{line}"
44
+ when Array
45
+ if resolved.size == 1
46
+ "#{resolved[0]}:#{line}"
47
+ else
48
+ "either " + resolved.collect{|x| "#{x}:#{line}"}.join("\n or ")
49
+ end
50
+ else
51
+ "#{file || caller[0].match(/^(.*\.\w+):/).captures[0]}:#{line}"
52
+ end
53
+ end
39
54
  end
40
55
 
41
56
  def required
42
57
  @required ||= []
43
58
  end
44
59
 
45
- def resolve(path)
60
+ def resolve(path, identical = true)
46
61
  if path.match /^\//
47
62
  path
48
63
  else
@@ -53,7 +68,9 @@ private
53
68
  return (absolute_path if absolute_path.match(/\.rb$/))
54
69
  end
55
70
  end
56
- nil
71
+ if !identical && path.match(/\.rb$/) && !(matches = (FILES + REQUIRED).uniq.select{|file| file.match(/\/#{path}$/)}).empty?
72
+ matches
73
+ end
57
74
  end
58
75
  end
59
76
 
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
13
  gem.name = "lock-o-motion"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "0.1.0"
15
+ gem.version = "0.1.1"
16
16
 
17
17
  gem.add_dependency "colorize"
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lock-o-motion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.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: 2013-02-12 00:00:00.000000000 Z
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -68,7 +68,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
68
68
  version: '0'
69
69
  segments:
70
70
  - 0
71
- hash: 3290312885139253223
71
+ hash: -4339189044300898671
72
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  segments:
79
79
  - 0
80
- hash: 3290312885139253223
80
+ hash: -4339189044300898671
81
81
  requirements: []
82
82
  rubyforge_project:
83
83
  rubygems_version: 1.8.25