lock-o-motion 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ .bundle
3
+ .rvmrc
4
+ Gemfile.lock
5
+ doc
6
+ pkg
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,5 @@
1
+ = LockOMotion CHANGELOG
2
+
3
+ == Version 0.1.0 (February 12, 2013)
4
+
5
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :gem_default do
6
+ gem "lock-o-motion", :path => "."
7
+ end
8
+
9
+ group :gem_development do
10
+ gem "pry"
11
+ end
12
+
13
+ group :gem_test do
14
+ gem "minitest"
15
+ gem "mocha", :require => "mocha/setup"
16
+ gem "pry"
17
+ gem "rake"
18
+ end
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Paul Engel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,362 @@
1
+ # LockOMotion
2
+
3
+ Require and mock Ruby gems (including their dependencies) within RubyMotion applications
4
+
5
+ ## Introduction
6
+
7
+ [RubyMotion](http://www.rubymotion.com) is one of the latest phenomenons in the world of Ruby. It allows you to develop and test native iOS applications (for iPhone and iPad) using the Ruby language.
8
+
9
+ One of the limitations is that you are not able to use any random Ruby gem you want. It either has to be RubyMotion aware (like [BubbleWrap](https://github.com/rubymotion/BubbleWrap)) or RubyMotion compatible (mostly when having as minimal gem dependencies as possible and without doing things like class and instance evaluation). You are not able to require files at runtime, but that is where `LockOMotion` hooks in as it handles requirements for you.
10
+
11
+ Please note that although it is a valuable asset, using LockOMotion will still not let you include any random Ruby gem. But it does bring us a few steps closer towards that point.
12
+
13
+ A possible strategy is to "mock" common Ruby gems (e.g. `yaml` or [HTTParty](https://github.com/jnunemaker/httparty)) using (semi) drop-in replacements which are hooked in using LockOMotion. Cause why do we have to eliminate Ruby gems because they use one or a few methods of a "blocking" Ruby dependency gem like `YAML.load`? Anyway, I very very well know that this is no more worth than a half solutation but it's more than nothing.
14
+
15
+ ## Installation
16
+
17
+ ### Add `LockOMotion` to your Gemfile
18
+
19
+ gem "lock-o-motion"
20
+
21
+ ### Install the gem dependencies
22
+
23
+ $ bundle
24
+
25
+ ## Usage
26
+
27
+ ### Set up your `Gemfile` and `Rakefile`
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:
30
+
31
+ source "http://rubygems.org"
32
+
33
+ # RubyMotion aware gems
34
+ gem "lock-o-motion"
35
+ gem "easy-button"
36
+
37
+ # RubyMotion unaware gems
38
+ group :lotion do
39
+ gem "betty_resource"
40
+ end
41
+
42
+ Add `Lotion.setup` at the end of your `Rakefile`:
43
+
44
+ # -*- coding: utf-8 -*-
45
+
46
+ # Use `rake config' to see complete project settings.
47
+ $:.unshift "/Library/RubyMotion/lib"
48
+
49
+ require "motion/project"
50
+ require "bundler"
51
+ Bundler.require
52
+
53
+ Motion::Project::App.setup do |app|
54
+ app.name = "Just Awesome"
55
+ app.frameworks << "AVFoundation"
56
+ end
57
+
58
+ Lotion.setup
59
+
60
+ Run `bundle install` if you haven't already and then `rake` to run the application in your iOS-simulator. Voila! You're done ^^
61
+
62
+ ### Auto-generated `.lotion.rb`
63
+
64
+ LockOMotion generates a hidden Ruby file called `.lotion.rb` in which the following constants are defined:
65
+
66
+ * `FILES` - All Ruby sources registered with `Motion::Project::App.files`
67
+ * `DEPENDENCIES` - All file dependencies registered with `Motion::Project::App.files_dependencies`
68
+ * `IGNORED_REQUIRES` - Ignored file requires (declared in `Lotion.setup`)
69
+ * `LOAD_PATHS` - Available load paths after running `rake`
70
+ * `GEM_PATHS` - Available gem paths (resembles `Gem.latest_load_paths`)
71
+ * `REQUIRED` - All required files after running `rake`
72
+
73
+ At runtime, LockOMotion uses `.lotion.rb` for resolving Ruby sources. This makes it possible the print warnings as specific as possible which makes debugging a little easier.
74
+
75
+ #### Example
76
+
77
+ Let us say your `Gemfile` looks like the following:
78
+
79
+ source "http://rubygems.org"
80
+
81
+ # RubyMotion awared gems
82
+ gem "lock-o-motion"
83
+
84
+ # RubyMotion unawared gems
85
+ group :lotion do
86
+ gem "slot_machine"
87
+ end
88
+
89
+ A fragment of the generated `.lotion.rb` looks like this:
90
+
91
+ module Lotion
92
+ 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/Sources/just_awesome/.lotion.rb",
96
+ "/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",
102
+ "./app/app_delegate.rb",
103
+ "./app/controllers/awesome_controller.rb"
104
+ ]
105
+ 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",
109
+ "/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"
114
+ ],
115
+ "/Users/paulengel/Sources/lock-o-motion/lib/motion/core_ext.rb" => [
116
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/colorize-0.5.8/lib/colorize.rb"
117
+ ],
118
+ "/Users/paulengel/Sources/lock-o-motion/lib/motion/lotion.rb" => [
119
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/colorize-0.5.8/lib/colorize.rb"
120
+ ],
121
+ "/Users/paulengel/Sources/just_awesome/.lotion.rb" => [
122
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/colorize-0.5.8/lib/colorize.rb"
123
+ ]
124
+ }
125
+ IGNORED_REQUIRES = []
126
+ 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",
129
+ "/Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/colorize-0.5.8/lib",
130
+ "/Library/RubyMotion/lib",
131
+
132
+ ### Warnings at runtime
133
+
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.
135
+
136
+ #### Restricted method calls
137
+
138
+ Using the same `Gemfile` as in the previous example. The console output would look something like this:
139
+
140
+ 1.9.3 paulengel:just_awesome $ rake
141
+ Build ./build/iPhoneSimulator-6.1-Development
142
+ Compile /Users/paulengel/Sources/just_awesome/.lotion.rb
143
+ Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
144
+ Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
145
+ 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) >
151
+
152
+ You will need to solve this yourself e.g. by overriding the method for instance or by refactoring.
153
+
154
+ #### Runtime requirements
155
+
156
+ It is possible that a Ruby source file gets required later on at runtime. Such file requirements are not allowed. This is the case when using [MultiJSON](https://github.com/intridea/multi_json). Using the following `Gemfile`:
157
+
158
+ source "http://rubygems.org"
159
+
160
+ # RubyMotion awared gems
161
+ gem "lock-o-motion"
162
+
163
+ # RubyMotion unawared gems
164
+ group :lotion do
165
+ gem "multi_json"
166
+ end
167
+
168
+ You will get the following console output:
169
+
170
+ 1.9.3 paulengel:just_awesome $ rake
171
+ Build ./build/iPhoneSimulator-6.1-Development
172
+ Compile /Users/paulengel/Sources/lock-o-motion/lib/motion/lotion.rb
173
+ Compile /Users/paulengel/Sources/just_awesome/.lotion.rb
174
+ Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
175
+ Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
176
+ 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
188
+ 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
191
+ 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'
195
+
196
+ When applicable, you will get a warning about it. Here is the fragment of the warning:
197
+
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
200
+ 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
203
+ Add within Lotion.setup block: app.require "multi_json/adapters/yajl"
204
+
205
+ The following section contains further information about how to correct this.
206
+
207
+ ### Extending `Lotion.setup`
208
+
209
+ You can require additional Ruby sources using `Lotion.setup`. To correct the earlier require warnings, declare the setup as follows:
210
+
211
+ Lotion.setup do |app|
212
+ app.require "yajl"
213
+ app.require "multi_json/adapters/yajl"
214
+ end
215
+
216
+ ### Requirement of `.bundle` files
217
+
218
+ As far as I know, you are not able to require `.bundle` files within a RubyMotion application. After adding the require statement within `Lotion.setup`, you will get the following warning:
219
+
220
+ 1.9.3 paulengel:just_awesome $ rake
221
+ Warning /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/yajl-ruby-1.1.0/lib/yajl.rb
222
+ requires /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/yajl-ruby-1.1.0/lib/yajl/yajl.bundle
223
+ Build ./build/iPhoneSimulator-6.1-Development
224
+ Compile /Users/paulengel/Sources/just_awesome/.lotion.rb
225
+ Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
226
+ Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Info.plist
227
+ Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/PkgInfo
228
+ Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
229
+ 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)
231
+
232
+ You can to try [mocking Ruby gems](https://github.com/archan937/lock-o-motion#mocking-ruby-gems) with drop-in replacements.
233
+
234
+ ### Adding `lotion.rb`
235
+
236
+ LockOMotion provides a possibility to run Ruby code at startup. You can think of it as a Rails initializer. Just add a file called `lotion.rb` within the root directory of your RubyMotion application.
237
+
238
+ 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
+
240
+ And when containing the following Ruby code:
241
+
242
+ puts "Hello, I am `lotion.rb`"
243
+ puts SlotMachine.class
244
+
245
+ The output will be as follows:
246
+
247
+ 1.9.3 paulengel:just_awesome $ rake
248
+ Build ./build/iPhoneSimulator-6.1-Development
249
+ 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
+ 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
+ Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
256
+ 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
+ Hello, I am `lotion.rb`
262
+ Module
263
+ (main)>
264
+
265
+ ### Mocking Ruby gems
266
+
267
+ 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
+
269
+ As opposed to not having the `HTTParty` to our availability:
270
+
271
+ ##### Gemfile
272
+
273
+ source "http://rubygems.org"
274
+
275
+ # RubyMotion aware gems
276
+ gem "lock-o-motion", :path => "/Users/paulengel/Sources/lock-o-motion"
277
+
278
+ # RubyMotion unaware gems
279
+ group :lotion do
280
+ gem "httparty"
281
+ end
282
+
283
+ ##### Console output
284
+
285
+ 1.9.3 paulengel:just_awesome $ rake
286
+ Warning Could not resolve dependency "socket.so"
287
+ Warning /Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb
288
+ requires /Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/x86_64-darwin12.2.1/zlib.bundle
289
+ Warning /Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb
290
+ requires /Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/x86_64-darwin12.2.1/stringio.bundle
291
+ Warning Skipped 'openssl' requirement
292
+ Warning /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/httparty-0.10.1/lib/httparty.rb
293
+ 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
295
+ 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
297
+ requires /Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/x86_64-darwin12.2.1/stringio.bundle
298
+ Warning /Users/paulengel/.rvm/gems/ruby-1.9.3-p374/gems/httparty-0.10.1/lib/httparty/net_digest_auth.rb
299
+ requires /Users/paulengel/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/x86_64-darwin12.2.1/digest/md5.bundle
300
+ Build ./build/iPhoneSimulator-6.1-Development
301
+ Compile /Users/paulengel/Sources/just_awesome/.lotion.rb
302
+ Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
303
+ Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
304
+ 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:'
307
+
308
+ We are able to leave the `Gemfile` as is and get a console output like this:
309
+
310
+ 1.9.3 paulengel:just_awesome $ rake
311
+ Build ./build/iPhoneSimulator-6.1-Development
312
+ Compile /Users/paulengel/Sources/just_awesome/.lotion.rb
313
+ Compile ./app/controllers/awesome_controller.rb
314
+ Link ./build/iPhoneSimulator-6.1-Development/Just Awesome.app/Just Awesome
315
+ Create ./build/iPhoneSimulator-6.1-Development/Just Awesome.dSYM
316
+ Simulate ./build/iPhoneSimulator-6.1-Development/Just Awesome.app
317
+ (main)>
318
+
319
+
320
+ <!DOCTYPE html>
321
+ <html>
322
+ <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
323
+ <meta charset='utf-8'>
324
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
325
+ <title>archan937/lock-o-motion · GitHub</title>
326
+ <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
327
+ <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
328
+
329
+ 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
+
331
+ Let's say the root directory of your RubyMotion application is `/Users/paulengel/Sources/just_awesome`. If you want to mock `require "httparty"`, create a file at `/Users/paulengel/Sources/just_awesome/mocks/httparty.rb` containing the mock code. If you want to mock `require "net/http"`, create a file at `/Users/paulengel/Sources/just_awesome/mocks/net/http.rb`. Cool, huh?
332
+
333
+ As already mentioned within the introduction, I am very well aware of this not being a waterproof solution, but it helps us getting on track.
334
+
335
+ ### Skipped requirements
336
+
337
+ There are a few Ruby file sources that LockOMotion will refuse to require:
338
+
339
+ * `pry`
340
+ * `openssl`
341
+
342
+ At the moment, you will have to find a replacement yourself.
343
+
344
+ ## Closing words
345
+
346
+ With LockOMotion, I have tried to lower the threshold for using more Ruby gems within RubyMotion applications. Contributions are very much welcome. Please spread the word about `LockOMotion` when you like it! ^^
347
+
348
+ ## Contact me
349
+
350
+ For support, remarks and requests, please mail me at [paul.engel@holder.nl](mailto:paul.engel@holder.nl).
351
+
352
+ ## License
353
+
354
+ Copyright (c) 2013 Paul Engel, released under the MIT license
355
+
356
+ [http://holder.nl](http://holder.nl) - [http://codehero.es](http://codehero.es) - [http://gettopup.com](http://gettopup.com) - [http://github.com/archan937](http://github.com/archan937) - [http://twitter.com/archan937](http://twitter.com/archan937) - [paul.engel@holder.nl](mailto:paul.engel@holder.nl)
357
+
358
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
359
+
360
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
361
+
362
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rake/testtask"
4
+
5
+ task :default => :test
6
+
7
+ Rake::TestTask.new do |test|
8
+ test.pattern = "test/**/test_*.rb"
9
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,65 @@
1
+ require "colorize"
2
+ require "motion/gem_ext"
3
+
4
+ require "lock-o-motion/app"
5
+ require "lock-o-motion/version"
6
+
7
+ module LockOMotion
8
+ extend self
9
+
10
+ USER_MOCKS = File.expand_path("./mocks")
11
+ GEM_MOCKS = File.expand_path("../lock-o-motion/mocks", __FILE__)
12
+
13
+ class GemPath
14
+ attr_reader :name, :version, :path, :version_numbers
15
+ include Comparable
16
+
17
+ def initialize(path)
18
+ @name, @version = File.basename(path).scan(/^(.+?)-([^-]+)$/).flatten
19
+ @path = path
20
+ @version_numbers = @version.split(/[^0-9]+/).collect(&:to_i)
21
+ end
22
+
23
+ def <=>(other)
24
+ raise "Not comparable gem paths ('#{name}' is not '#{other.name}')" unless name == other.name
25
+ @version_numbers <=> other.version_numbers
26
+ end
27
+ end
28
+
29
+ def setup(&block)
30
+ Motion::Project::App.setup do |app|
31
+ LockOMotion::App.setup app, &block
32
+ end
33
+ end
34
+
35
+ def gem_paths
36
+ @gem_paths ||= Dir["{#{::Gem.paths.path.join(",")}}" + "/gems/*"].inject({}) do |gem_paths, path|
37
+ gem_path = GemPath.new path
38
+ gem_paths[gem_path.name] ||= gem_path
39
+ gem_paths[gem_path.name] = gem_path if gem_paths[gem_path.name] < gem_path
40
+ gem_paths
41
+ end.values.collect do |gem_path|
42
+ gem_path.path + "/lib"
43
+ end.sort
44
+ end
45
+
46
+ def skip?(path)
47
+ !!%w(openssl pry).detect{|x| path.match %r{\b#{x}\b}}.tap do |file|
48
+ puts " Warning Skipped '#{file}' requirement".yellow if file
49
+ end
50
+ end
51
+
52
+ def mock_path(path)
53
+ path = path.gsub(/\.rb$/, "")
54
+ if File.exists?("#{USER_MOCKS}/#{path}.rb")
55
+ File.expand_path "./mocks/#{path}.rb"
56
+ elsif File.exists?("#{GEM_MOCKS}/#{path}.rb")
57
+ "lock-o-motion/mocks/#{path}"
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ unless defined?(Lotion)
64
+ Lotion = LockOMotion
65
+ end
@@ -0,0 +1,170 @@
1
+ module LockOMotion
2
+ class App
3
+
4
+ GEM_LOTION = ".lotion.rb"
5
+ USER_LOTION = "lotion.rb"
6
+
7
+ def self.setup(app, &block)
8
+ new(app).send :setup, &block
9
+ end
10
+
11
+ def initialize(app)
12
+ @app = app
13
+ end
14
+
15
+ def require(path, internal = false)
16
+ Kernel.require path, internal
17
+ end
18
+
19
+ def ignore_require(path)
20
+ @ignored_requires << path
21
+ end
22
+
23
+ def dependency(call, path, internal = false)
24
+ call = "BUNDLER" if call.match(/\bbundler\b/)
25
+ if call == __FILE__
26
+ call = internal ? "GEM_LOTION" : "USER_LOTION"
27
+ end
28
+
29
+ ($: + LockOMotion.gem_paths).each do |load_path|
30
+ if File.exists?(absolute_path = "#{load_path}/#{path}.bundle") ||
31
+ File.exists?(absolute_path = "#{load_path}/#{path}.rb")
32
+ if absolute_path.match(/\.rb$/)
33
+ register_dependency call, absolute_path
34
+ $:.unshift load_path unless $:.include?(load_path)
35
+ else
36
+ puts " Warning #{call}\n requires #{absolute_path}".red
37
+ end
38
+ return
39
+ end
40
+ end
41
+
42
+ if path.match(/^\//) && File.exists?(path)
43
+ register_dependency call, path
44
+ else
45
+ puts " Warning Could not resolve dependency \"#{path}\"".red
46
+ end
47
+ end
48
+
49
+ private
50
+
51
+ def register_dependency(call, absolute_path)
52
+ ((@dependencies[call] ||= []) << absolute_path).uniq!
53
+ end
54
+
55
+ def setup(&block)
56
+ @files = []
57
+ @dependencies = {}
58
+ @ignored_requires = []
59
+
60
+ Thread.current[:lotion_app] = self
61
+ Kernel.instance_eval &hook
62
+ Object.class_eval &hook
63
+
64
+ Bundler.require :lotion
65
+ require "colorize", true
66
+ yield self if block_given?
67
+
68
+ Kernel.instance_eval &unhook
69
+ Object.class_eval &unhook
70
+ Thread.current[:lotion_app] = nil
71
+
72
+ bundler = @dependencies.delete("BUNDLER") || []
73
+ gem_lotion = @dependencies.delete("GEM_LOTION") || []
74
+ user_lotion = @dependencies.delete("USER_LOTION") || []
75
+
76
+ gem_lotion.each do |file|
77
+ default_files.each do |default_file|
78
+ (@dependencies[default_file] ||= []) << file
79
+ end
80
+ end
81
+ (bundler + user_lotion).each do |file|
82
+ @dependencies[file] ||= []
83
+ @dependencies[file] = default_files + @dependencies[file]
84
+ end
85
+
86
+ @files = (default_files + gem_lotion.sort + bundler.sort + (@dependencies.keys + @dependencies.values).flatten.sort + user_lotion.sort + @app.files).uniq
87
+ @files << File.expand_path(USER_LOTION) if File.exists?(USER_LOTION)
88
+
89
+ @app.files = @files
90
+ @app.files_dependencies @dependencies
91
+ write_lotion
92
+ end
93
+
94
+ def hook
95
+ @hook ||= proc do
96
+ def require_with_catch(path, internal = false)
97
+ return if LockOMotion.skip?(path)
98
+ if mock_path = LockOMotion.mock_path(path)
99
+ path = mock_path
100
+ internal = false
101
+ end
102
+ if caller[0].match(/^(.*\.rb)\b/)
103
+ Thread.current[:lotion_app].dependency $1, path, internal
104
+ end
105
+ begin
106
+ require_without_catch path
107
+ rescue LoadError
108
+ if gem_path = LockOMotion.gem_paths.detect{|x| File.exists? "#{x}/#{path}"}
109
+ $:.unshift gem_path
110
+ require_without_catch path
111
+ end
112
+ end
113
+ end
114
+ alias :require_without_catch :require
115
+ alias :require :require_with_catch
116
+ end
117
+ end
118
+
119
+ def unhook
120
+ @unhook ||= proc do
121
+ alias :require :require_without_catch
122
+ undef :require_with_catch
123
+ undef :require_without_catch
124
+ end
125
+ end
126
+
127
+ def default_files
128
+ @default_files ||= [
129
+ File.expand_path("../../motion/core_ext.rb", __FILE__),
130
+ File.expand_path("../../motion/lotion.rb", __FILE__),
131
+ File.expand_path(GEM_LOTION)
132
+ ]
133
+ end
134
+
135
+ def write_lotion
136
+ FileUtils.rm GEM_LOTION if File.exists?(GEM_LOTION)
137
+ File.open(GEM_LOTION, "w") do |file|
138
+ file << <<-RUBY_CODE.gsub(" ", "")
139
+ module Lotion
140
+ FILES = #{pretty_inspect @files, 2}
141
+ DEPENDENCIES = #{pretty_inspect @dependencies, 2}
142
+ IGNORED_REQUIRES = #{pretty_inspect @ignored_requires, 2}
143
+ USER_MOCKS = #{pretty_inspect USER_MOCKS, 2}
144
+ GEM_MOCKS = #{pretty_inspect GEM_MOCKS, 2}
145
+ LOAD_PATHS = #{pretty_inspect $:, 2}
146
+ GEM_PATHS = #{pretty_inspect LockOMotion.gem_paths, 2}
147
+ REQUIRED = #{pretty_inspect $", 2}
148
+ end
149
+ RUBY_CODE
150
+ end
151
+ end
152
+
153
+ def pretty_inspect(object, indent = 0)
154
+ if object.is_a?(Array)
155
+ entries = object.collect{|x| " #{pretty_inspect x, indent + 2}"}
156
+ return "[]" if entries.empty?
157
+ entries.each_with_index{|x, i| entries[i] = "#{x}," if i < entries.size - 1}
158
+ ["[", entries, "]"].flatten.join "\n" + (" " * indent)
159
+ elsif object.is_a?(Hash)
160
+ entries = object.collect{|k, v| " #{k.inspect} => #{pretty_inspect v, indent + 2}"}
161
+ return "{}" if entries.empty?
162
+ entries.each_with_index{|x, i| entries[i] = "#{x}," if i < entries.size - 1}
163
+ ["{", entries, "}"].flatten.join "\n" + (" " * indent)
164
+ else
165
+ object.inspect
166
+ end
167
+ end
168
+
169
+ end
170
+ end
@@ -0,0 +1,125 @@
1
+ module HTTParty
2
+ extend self
3
+
4
+ def included(base)
5
+ base.extend self
6
+ end
7
+
8
+ def format(f)
9
+ @format = f
10
+ end
11
+
12
+ def base_uri(u)
13
+ @base_uri = u.sub(/\/$/, "")
14
+ end
15
+
16
+ def basic_auth(user, password)
17
+ @basic_auth = [user, password]
18
+ end
19
+
20
+ def get(path, options = {}, &block)
21
+ send_request path, :get
22
+ end
23
+
24
+ def post(path, options = {}, &block)
25
+ send_request path, :post
26
+ end
27
+
28
+ def put(path, options = {}, &block)
29
+ send_request path, :put
30
+ end
31
+
32
+ def delete(path, options = {}, &block)
33
+ send_request path, :delete
34
+ end
35
+
36
+ private
37
+
38
+ def send_request(path, method, options = {})
39
+ path = "#{@base_uri}/#{path}" if @base_uri && !path.match(/^\w+:\/\//)
40
+ path = path.stringByAddingPercentEscapesUsingEncoding NSUTF8StringEncoding
41
+ method = method.to_s.upcase
42
+
43
+ if options[:body]
44
+ payload = payload_to_query_string(options[:body]).dataUsingEncoding(NSUTF8StringEncoding) if POST / PUT && payload
45
+ end
46
+
47
+ if payload && method == "GET"
48
+ path << "#{path.include?("?") ? "&" : "?"}#{payload}"
49
+ end
50
+
51
+ url = NSURL.URLWithString path.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)
52
+ request = NSMutableURLRequest.requestWithURL url
53
+
54
+ if @basic_auth
55
+ auth_header = "Basic " + [@basic_auth.join(":")].pack("m0").dataUsingEncoding(NSUTF8StringEncoding)
56
+ request.addValue auth_header, forHTTPHeaderField: "Authorization"
57
+ request.HTTPMethod = method
58
+ end
59
+
60
+ if payload
61
+ request.HTTPBody = payload
62
+ end
63
+
64
+ response = Pointer.new :object
65
+ error = Pointer.new :object
66
+ data = NSURLConnection.sendSynchronousRequest request, returningResponse: response, error: error
67
+
68
+ HTTParty::Response.new response, data, {:format => @format, :error => error}
69
+ end
70
+
71
+ def payload_to_query_string(payload_hash)
72
+ payload_hash_to_array(payload_hash).collect{|key, value| "#{escape key}=#{escape value}"}.join "&"
73
+ end
74
+
75
+ def payload_hash_to_array(hash, prefix = nil)
76
+ array = []
77
+ hash.each do |key, value|
78
+ if value.is_a?(Hash)
79
+ array += payload_hash_to_array(value, prefix ? "#{prefix}[#{key.to_s}]" : key.to_s)
80
+ elsif value.is_a?(Array)
81
+ value.each do |val|
82
+ array << [prefix ? "#{prefix}[#{key.to_s}][]" : "#{key.to_s}[]", val]
83
+ end
84
+ else
85
+ array << [prefix ? "#{prefix}[#{key.to_s}]" : key.to_s, value]
86
+ end
87
+ end
88
+ array
89
+ end
90
+
91
+ def escape(string)
92
+ CFURLCreateStringByAddingPercentEscapes(nil, string, "[]", ";=&,", KCFStringEncodingUTF8) if string
93
+ end
94
+
95
+ end
96
+
97
+ module HTTParty
98
+ class Response
99
+
100
+ def initialize(response, data, options = {})
101
+ @cached_response = NSCachedURLResponse.alloc.initWithResponse response.value, data: data
102
+ @options = options
103
+ end
104
+
105
+ def parsed_response
106
+ @parsed_response ||= begin
107
+ case @options[:format]
108
+ when :json
109
+ NSJSONSerialization.JSONObjectWithData @cached_response.data, options: NSJSONReadingMutableContainers, error: nil
110
+ else
111
+ NSString.alloc.initWithData @cached_response.data, encoding: NSUTF8StringEncoding
112
+ end
113
+ end
114
+ end
115
+
116
+ def code
117
+ @cached_response.response.statusCode
118
+ end
119
+
120
+ def ok?
121
+ code.to_s.match /^20\d$/
122
+ end
123
+
124
+ end
125
+ end
@@ -0,0 +1,7 @@
1
+ module LockOMotion #:nodoc:
2
+ MAJOR = 0
3
+ MINOR = 1
4
+ TINY = 0
5
+
6
+ VERSION = [MAJOR, MINOR, TINY].join(".")
7
+ end
@@ -0,0 +1,49 @@
1
+ module Kernel
2
+ def require(*args, &block)
3
+ Lotion.require args.first, caller
4
+ end
5
+ end
6
+
7
+ class Module
8
+ alias :original_class_eval :class_eval
9
+ def class_eval(*args, &block)
10
+ if block_given?
11
+ original_class_eval &block
12
+ else
13
+ Lotion.warn name, :class_eval, caller
14
+ end
15
+ end
16
+ alias :original_module_eval :module_eval
17
+ def module_eval(*args, &block)
18
+ if block_given?
19
+ original_module_eval &block
20
+ else
21
+ Lotion.warn name, :module_eval, caller
22
+ end
23
+ end
24
+ end
25
+
26
+ class Class
27
+ def delegate(*args, &block)
28
+ to = args.pop
29
+ args.each do |method|
30
+ send :define_method, method do |*args, &block|
31
+ send(to).send(method, *args, &block)
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ class Object
38
+ def require(*args, &block)
39
+ Lotion.require args.first, caller
40
+ end
41
+ alias :original_instance_eval :instance_eval
42
+ def instance_eval(*args, &block)
43
+ if block_given?
44
+ instance_eval &block
45
+ else
46
+ Lotion.warn self.class.name, :instance_eval, caller
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,21 @@
1
+ module Motion
2
+ module Project
3
+ class Config
4
+
5
+ def files_dependencies(deps_hash)
6
+ res_path = lambda do |x|
7
+ path = /^\.?\//.match(x) ? x : File.join(".", x)
8
+ unless @files.flatten.include?(path)
9
+ App.fail "Can't resolve dependency `#{x}'"
10
+ end
11
+ path
12
+ end
13
+ deps_hash.each do |path, deps|
14
+ deps = [deps] unless deps.is_a?(Array)
15
+ @dependencies[res_path.call(path)] = deps.map(&res_path)
16
+ end
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,60 @@
1
+ module Lotion
2
+ extend self
3
+
4
+ def require(path, caller)
5
+ return if required.include? path
6
+ required << path
7
+
8
+ if absolute_path = resolve(path)
9
+ unless (IGNORED_REQUIRES + REQUIRED).include?(absolute_path)
10
+ warn [
11
+ "Called `require \"#{path}\"` from",
12
+ derive_caller(caller),
13
+ "Add within Lotion.setup block: ".yellow + "app.require \"#{path}\"".green
14
+ ].join("\n")
15
+ end
16
+ else
17
+ raise LoadError, "cannot load such file -- #{path}"
18
+ end
19
+ end
20
+
21
+ def warn(*args)
22
+ message = begin
23
+ if args.size == 1
24
+ args.first
25
+ else
26
+ object, method, caller = *args
27
+ "Called `#{object}.#{method}` from\n#{derive_caller(caller)}"
28
+ end
29
+ end
30
+ puts " Warning #{message.gsub("\n", "\n ")}".yellow
31
+ end
32
+
33
+ private
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}"
39
+ end
40
+
41
+ def required
42
+ @required ||= []
43
+ end
44
+
45
+ def resolve(path)
46
+ if path.match /^\//
47
+ path
48
+ else
49
+ ([USER_MOCKS, GEM_MOCKS] + LOAD_PATHS + GEM_PATHS).each do |load_path|
50
+ if File.exists?(absolute_path = "#{load_path}/#{path}.bundle") ||
51
+ File.exists?(absolute_path = "#{load_path}/#{path}.rb") ||
52
+ File.exists?(absolute_path = "#{load_path}/#{path}")
53
+ return (absolute_path if absolute_path.match(/\.rb$/))
54
+ end
55
+ end
56
+ nil
57
+ end
58
+ end
59
+
60
+ end
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Paul Engel"]
5
+ gem.email = ["paul.engel@holder.nl"]
6
+ gem.summary = %q{Require and mock Ruby gems (including their dependencies) within RubyMotion applications}
7
+ gem.description = %q{Require and mock Ruby gems (including their dependencies) within RubyMotion applications}
8
+ gem.homepage = "https://github.com/archan937/lock-o-motion"
9
+
10
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
11
+ gem.files = `git ls-files`.split("\n")
12
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
+ gem.name = "lock-o-motion"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = "0.1.0"
16
+
17
+ gem.add_dependency "colorize"
18
+ end
data/script/console ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+ require "bundler"
4
+
5
+ Bundler.require :gem_default, :gem_development
6
+
7
+ puts "Loading LockOMotion development environment (#{LockOMotion::VERSION})"
8
+ Pry.start
@@ -0,0 +1,19 @@
1
+ require "rubygems"
2
+ require "bundler"
3
+
4
+ require "minitest/unit"
5
+ require "minitest/autorun"
6
+
7
+ Bundler.require :gem_default, :gem_test
8
+
9
+ def silence(&block)
10
+ Kernel.module_eval do
11
+ alias :original_puts :puts
12
+ def puts(message); end
13
+ end
14
+ block.call
15
+ Kernel.module_eval do
16
+ alias :puts :original_puts
17
+ undef :original_puts
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ require File.expand_path("../../../test_helper", __FILE__)
2
+
3
+ module Unit
4
+ module Mocks
5
+ class TestHTTParty < MiniTest::Unit::TestCase
6
+
7
+ describe "HTTParty" do
8
+ it "should do something" do
9
+ # assert something
10
+ end
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ require File.expand_path("../../test_helper", __FILE__)
2
+
3
+ module Unit
4
+ class TestLockOMotion < MiniTest::Unit::TestCase
5
+
6
+ describe LockOMotion do
7
+ it "should skip certain files for requirement" do
8
+ silence do
9
+ assert_equal true , LockOMotion.skip?("pry")
10
+ assert_equal true , LockOMotion.skip?("openssl")
11
+ assert_equal false, LockOMotion.skip?("slot_machine")
12
+ end
13
+ end
14
+
15
+ it "should mock paths when possible" do
16
+ assert_equal "lock-o-motion/mocks/httparty", LockOMotion.mock_path("httparty")
17
+ assert_equal nil, LockOMotion.mock_path("slot_machine")
18
+ end
19
+ end
20
+
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lock-o-motion
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Paul Engel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: colorize
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Require and mock Ruby gems (including their dependencies) within RubyMotion
31
+ applications
32
+ email:
33
+ - paul.engel@holder.nl
34
+ executables: []
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - .gitignore
39
+ - CHANGELOG.rdoc
40
+ - Gemfile
41
+ - MIT-LICENSE
42
+ - README.md
43
+ - Rakefile
44
+ - VERSION
45
+ - lib/lock-o-motion.rb
46
+ - lib/lock-o-motion/app.rb
47
+ - lib/lock-o-motion/mocks/httparty.rb
48
+ - lib/lock-o-motion/version.rb
49
+ - lib/motion/core_ext.rb
50
+ - lib/motion/gem_ext.rb
51
+ - lib/motion/lotion.rb
52
+ - lock-o-motion.gemspec
53
+ - script/console
54
+ - test/test_helper.rb
55
+ - test/unit/mocks/test_httparty.rb
56
+ - test/unit/test_lock-o-motion.rb
57
+ homepage: https://github.com/archan937/lock-o-motion
58
+ licenses: []
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ segments:
70
+ - 0
71
+ hash: 3290312885139253223
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ segments:
79
+ - 0
80
+ hash: 3290312885139253223
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 1.8.25
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Require and mock Ruby gems (including their dependencies) within RubyMotion
87
+ applications
88
+ test_files:
89
+ - test/test_helper.rb
90
+ - test/unit/mocks/test_httparty.rb
91
+ - test/unit/test_lock-o-motion.rb