Skip to content

Do not use `configs' which is used by RubyMotion internal #143

Merged
merged 1 commit into from Sep 21, 2012

8 participants

@Watson1978

`configs' will be removed with next update (v1.24).

@supermarin
Rubymotion Community member

It seems like it crashes the specs:

[master ✔] ➜ rake spec output=test_unit                                                                                
rake aborted!
undefined method `setup_blocks' for #<Motion::Project::Config:0x007fd78b628f58>

(See full trace by running task with --trace)
@Watson1978

Oh, sorry. `setup_blocks' method will be added by v1.24.
RubyMotion v1.24 is not release yet. but it will be release soon.

@supermarin
Rubymotion Community member

Okay sure,. Is there a way we can add a check if the RM version is >= 1.24 and based on that use the appropriate accessor?

@Watson1978

Which one do you like?

  1. To detect version number, you could parse the Motion::Version
  2. If setup_blocks will raise exception, you would call configs's method
diff --git a/lib/bubble-wrap/ext/motion_project_app.rb b/lib/bubble-wrap/ext/motion_project_app.rb
index 28e8f24..1d303f9 100644
--- a/lib/bubble-wrap/ext/motion_project_app.rb
+++ b/lib/bubble-wrap/ext/motion_project_app.rb
@@ -11,8 +11,12 @@ module BubbleWrap
               app.frameworks = ::BubbleWrap::Requirement.frameworks(app.frameworks)
               block.call(app) unless block.nil?
             end
-            configs.each_value &bw_config
-            config.validate
+            begin
+              config.setup_blocks << bw_config
+            rescue
+              configs.each_value &bw_config
+              config.validate
+            end
           end
           alias :setup_without_bubblewrap :setup
           alias :setup :setup_with_bubblewrap
  1. New BubbleWrap version would support only RubyMotion >= 1.24

I think that No.3 is best select :)

@supermarin
Rubymotion Community member

I would say option 2 + a warning to the user.
Some newer RM versions had introduced some bugs, and most likely some production apps are sticked to a specific RM version (an older one).

Let's see what the others think, but for now, my suggestion would be something like:

begin
  config.setup_blocks << bw_config
rescue
  NSLog "BW: It seems like you're running an older RubyMotion version than 1.24.
  Please run `sudo motion update` to remove this warning."
  configs.each_value &bw_config
  config.validate
end
@Watson1978

OK. Whenever you think that anyone will not have to downgrade, you could modify it :)
I will close this request at once.

Thanks :)

@Watson1978 Watson1978 closed this Sep 20, 2012
@supermarin supermarin reopened this Sep 20, 2012
@supermarin
Rubymotion Community member

I'll reopen this one until we get it fixed :)

Currently, the specs are failing with the iOS6 SDK, so I can't get it tested/merged.
Will close it when we get the proper specs.

@supermarin supermarin closed this Sep 20, 2012
@supermarin supermarin reopened this Sep 20, 2012
@michael-erasmus

Is this related to the error I'm getting?

I just update to the latest RubyMotion and BubbleWrap. This happens when I run rake:

undefined local variable or method `configs' for Motion::Project::App:Class
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/gems/bubble-wrap-1.1.3/lib/bubble-wrap/ext/motion_project_app.rb:14:in `setup_with_bubblewrap'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/gems/sugarcube-0.8.2/lib/sugarcube.rb:6:in `<top (required)>'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `require'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `each'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `block in require'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `each'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `require'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/gems/bundler-1.1.5/lib/bundler.rb:119:in `require'
/Users/developer/Source/22Seven/ios/Rakefile:5:in `<top (required)>'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in `load'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in `<main>'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/bin/ruby_noexec_wrapper:14:in `eval'
/Users/developer/.rvm/gems/ruby-1.9.3-p194@ios/bin/ruby_noexec_wrapper:14:in `<main>'
@clayallsopp
Rubymotion Community member
@michael-erasmus

It works fine when change

configs.each_value &bw_config

To

config.setup_blocks << bw_config

In

bubble-wrap-1.1.3/lib/bubble-wrap/ext/motion_project_app.rb

So that is a quickfix for anyone getting this and who still needs to work today :)

@aceofspades

@michael-erasmus Thanks for the patch

@dmarkow
Rubymotion Community member
dmarkow commented Sep 20, 2012

@mneorr Unfortunately, once you update to RubyMotion 1.24, the specs won't run because of this config vs configs issue (I realize that once that's fixed, there are still other issues preventing the specs from running).

I think we should push this change using the recommendation of Option 2 + a warning.

@mikesax
mikesax commented Sep 20, 2012

RubyMotion 1.24 fails to build projects that include BubbleWrap for me.

michael-erasmus's patch fixes it. (thanks!)

@dmarkow
Rubymotion Community member
dmarkow commented Sep 20, 2012

Now that I think about it, I think Option 3 is actually better (just don't support < 1.24). If someone has their app locked to an older version in production, they should also have it locked to an older version of BW too. Ideally, RubyMotion would have properly deprecated the configs removal, giving users a period of time to transition and use either one.

Since RubyMotion is still very young and new, and changing all the time, supporting older versions doesn't seem to make a lot of sense. I'd hate to see BW get littered with dozens of conditional statements and/or rescue blocks (for example, @Watson1978's other pull request to add _spec to the end of the test suite name would need a conditional based on the version of RubyMotion being used).

Thoughts? I'd like to get this fixed ASAP so we can push an updated gem; in the mean time, no one can use the current BW gem on RubyMotion 1.24

@aceofspades

@dmarkow Agreed on #3. Users should lock to a version/commit.

As more apps go into production, it'll be important too keep branches that work with a particular version of RubyMine/SDK around. Master should really only be for development work I think and should keep moving.

@siuying
Rubymotion Community member
siuying commented Sep 21, 2012

I'll merge this first for that 1.24 is released.

@siuying siuying merged commit 4e75e84 into rubymotion:master Sep 21, 2012
@supermarin
Rubymotion Community member

@dmarkow I've posted another one on #144, the failure reason was different than this one :)

It seems like the iOS5 - 6 transition had some problems with RM compiler.
After updating RM it seems like it's working fine.

@andyw8 andyw8 referenced this pull request in clayallsopp/formotion Sep 25, 2012
Closed

Broken for RubyMotion 1.24 #37

@siuying
Rubymotion Community member
siuying commented Sep 26, 2012

bubble-wrap 1.1.4 with this fix is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.