Sha256: 81b217e8e58a1cfc07f06ab5305ecca3f8d1370964b1694905c9895de5c66e7f

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

# motion-require

Miss `require`? Well, this is a step in that direction:

```ruby
# in a RubyMotion file
motion_require "base_view_controller"
motion_require "../util/controller_helper"

class MyController < BaseViewController
  include ControllerHelper
end
```

```ruby
# in your Rakefile
require 'motion/project'

require 'motion-require'
Motion::Require.all(Dir.glob("app/**/*.rb")

Motion::Project::App.setup do |app|
  # ...
end
```

![Whoa.](http://i.imgur.com/JLpjqkk.jpg)

It's used in:
- [Formotion](https://github.com/clayallsopp/formotion)

## Installation

`gem install motion-require`

Can also add to your `Gemfile` etc

## How?

motion-require uses static analysis (via [`ripper`](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/ripper/rdoc/Ripper.html)) to find the files using `motion_require` and automatically add the declared dependencies to `Motion::Project::Config#dependencies`. Then the `Kernel#motion_require` method is overriden at compile-time to be a noop.

The paths attached to `motion_require` are treated like those with `require_relative`.

## Contact

Clay Allsopp ([http://clayallsopp.com](http://clayallsopp.com))

- [http://twitter.com/clayallsopp](http://twitter.com/clayallsopp)
- [clay@usepropeller.com](clay@usepropeller.com)

## License

motion-require is available under the MIT license. See the LICENSE file for more info.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-require-0.0.1 README.md