rubymotion / rubymotion-templates

RubyMotion templates. Some provided by the community. Some provided by RubyMotion.
BSD 2-Clause "Simplified" License
14 stars 24 forks source link

`No such file or directory` when running `rake -T` #56

Closed digitalmoksha closed 3 years ago

digitalmoksha commented 3 years ago

With the recent addition of project.rb, I'm now getting

/usr/bin/ruby: No such file or directory -- /Users/me/.rubymotion/rubymotion-templates/motion/../../bin/motion (LoadError)

It's occurring in https://github.com/amirrajan/rubymotion-templates/blob/3cda52b61c4c8c1aff95895b6428a1887a331873/motion/project.rb#L47

This happens when doing anything with rake, including rake -T

/cc @andrewhavens

andrewhavens commented 3 years ago

@digitalmoksha Thanks for reporting this. I'm not sure what we should do about this. Not sure if we should hard code it to /usr/local/bin/motion or /Library/RubyMotion/bin/motion or if there is a way to look up the relative path of the current version of RubyMotion. @amirrajan What do you think? Do you know how we should handle this?

digitalmoksha commented 3 years ago

Hmm, i'm wondering if you need to specify the location of the binary. It should already be setup in the path, right?

2.7.2 :004 > command = 'motion --version'
 => "motion --version"
2.7.2 :005 > system(command)
7.14
 => true
2.7.2 :007 > Bundler.respond_to?(:with_unbundled_env)
 => true
2.7.2 :008 > Bundler.with_unbundled_env { system(command) }
7.14
 => true
2.7.2 :009 > Bundler.with_clean_env { system(command) }
[DEPRECATED] `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` (called at (irb):9)
7.14
 => true

But maybe it would be a problem with running in CI.

If the binary is always located in a specific spot, then I think it's ok to hardcode it. Or maybe a variable gets set in the configuration, from within the scope of the original project.rb

amirrajan commented 3 years ago

@digitalmoksha Thanks for reporting this. I'm not sure what we should do about this. Not sure if we should hard code it to /usr/local/bin/motion or /Library/RubyMotion/bin/motion or if there is a way to look up the relative path of the current version of RubyMotion. @amirrajan What do you think? Do you know how we should handle this?

I'd just set it to motion and let the OS resolve it.

andrewhavens commented 3 years ago

Looks like Amir already committed a fix for this.