clayallsopp / motion-require

Dependency management for RubyMotion, using a pseudo `require`
MIT License
34 stars 5 forks source link

OS X support! #15

Closed colinta closed 10 years ago

colinta commented 10 years ago

And it's about damn time. This is for gems that are using MotionRequire

Motion::Require.all(...)  # include files regardless of platform
Motion::Require.all(..., platform: :ios)  # only include if the platform is iOS
Motion::Require.all(..., platform: :osx)  # only include if the platform is OS X
Motion::Require.all(..., platform: [:ios, :osx])  # why yes, this IS redundant!  I added it by accident, figured it was good for "completeness"

AND there are SPECS for this bad boy!

colinta commented 10 years ago

So the use case here is in gems like Teacup / BubbleWrap, that would like to add some files depending on the platform.

clayallsopp commented 10 years ago

I think this makes sense, thanks!

Can you change the style to this so the diff is a bit cleaner?:

Motion::Project::App.setup do |app|
  # ...
  current_platform = app.respond_to?(:template) ? app.template : :ios
  return unless Motion::Require.check_platform(current_platform, check_platform
  # ...
end
colinta commented 10 years ago

Pushed! Thanks, Clay.

colinta commented 10 years ago

Got it resolved; turns out the App class includes a template method as well, so I could move the code outside the block. Tested, ready to merge.

clayallsopp commented 10 years ago

Sweet, will release as 0.2.0