HipByte / Flow

Cross-platform libraries for RubyMotion
BSD 2-Clause "Simplified" License
141 stars 29 forks source link

Add support for osx #3

Closed bmichotte closed 8 years ago

bmichotte commented 8 years ago

Nothing fancy, just add support for OSX

Atm, everything in flow is completely similar to iOS, so we can use ios dirs. If something appears to be incompatible with iOS and need a specific API, a check on osx dir instead of ios could be added

lrz commented 8 years ago

Very nice! May I suggest we rename the ios directory into cocoa then? It would make more sense as we use Foundation-level APIs that exist in all platforms. And we can support watchOS and tvOS similarly.

If we even need to call iOS-specific APIs in a library we could then adopt a subfolder strategy (ex. cocoa/ios).

bmichotte commented 8 years ago

I like this idea ! Do you want I rename the directories into my PR ?

bmichotte commented 8 years ago

Also, with this change, we can get rid of osx.rb and ios.rb to cocoa.rb and simply use Motion::Project::App.template to load the right directories

lrz commented 8 years ago

Agreed. @jjaffeux do you also agree?

jjaffeux commented 8 years ago

@lrz @bmichotte I don't know much about osx, however, I have one concern, how can people write gems on top of Flow, I'm wondering if this './app/xx' logic is not a bad idea and if we shouldn't go back to one of our ideas /xx/platform/xx or some_class.platform.rb

Sorry this is a little bit out of context, but this is one of my concern atm, and still related to this.

bmichotte commented 8 years ago

I think I did not forget anything, please let me know (the current code is tested on an osx app)

jjaffeux commented 8 years ago

@bmichotte

lrz commented 8 years ago

Indeed, the android config file and the template should be fixed.

bmichotte commented 8 years ago

mhh, have a problem with lib/cocoa.rb how can I get the current template here when using the flow samples (from invoke_rake in motion-flow.rb) ?

I can't do

$:.unshift("/Library/RubyMotion/lib")
template = Motion::Project::App.template
require "motion/project/template/#{template}"

because Motion::Project::App is not defined at this time

bmichotte commented 8 years ago

Mhhh, maybe with ENV

lrz commented 8 years ago

@bmichotte I think the best is to set a global variable in lib/motion-flow.rb with the template symbol and read it in lib/cocoa.rb.

bmichotte commented 8 years ago

@lrz I added an ENV var to the rake invocation and it works fine.

I'm currently writing a sample for OS X, but it's more difficult when you can't use Motion gems ;)

jjaffeux commented 8 years ago

@bmichotte dont lose time with the sample :) I just want to be sure we can start an osx app, we can figure out the sample later

lrz commented 8 years ago

I agree with Joffrey we can do the sample later :)

bmichotte commented 8 years ago

Ok, so, you can try a rake osx:run. You should get a window and a dump in your term

jjaffeux commented 8 years ago

@bmichotte I can't run the spec atm :

cd test
rake ios:spec

No Rakefile found (looking for: config/cocoa.rb)

Once this is fixed, I think we can merge, if you could merge all your commit in one, that would be perfect.

lrz commented 8 years ago

I think the config file should remain platform-specific (ex. config/ios.rb, config/osx.rb, config/android.rb) as there the significant differences between an ios and osx project, config-wise.

jjaffeux commented 8 years ago

I agree

bmichotte commented 8 years ago

This should be ok (also provide osx tests)

I can not get net tests passing because of thin which don't want to install, could you try everything is ok on your side @jjaffeux ?

jjaffeux commented 8 years ago

@bmichotte ok thanks tests are passing for me, I will try to merge it tomorrow, if @lrz has nothing to add

lrz commented 8 years ago

I have nothing to add. Great work @bmichotte!!!1!1!111!!

jjaffeux commented 8 years ago

@bmichotte merged :) thx, it's official we now have OSX in Flow... what have we done ?

Todo