rubymotion-community / sugarcube

Some sugar for your cocoa. RubyMotion helpers.
Other
422 stars 66 forks source link

sugarcube_cleanup #104

Closed yestoall closed 10 years ago

yestoall commented 11 years ago

i have this compiling error with the new version:

undefined method `sugarcube_cleanup' for UIControl:Class (NoMethodError)

adtaylor commented 11 years ago

I'm having this same issue.

yestoall commented 11 years ago

i've shared in rubymotion's googlegroup the solution that works for me:


it's really weird... "rake clean" doesn´t help me

but i've just solved using gem "sugarcube", :require => "sugarcube-all"

in place of gem "sugarcube", :require => "sugarcube-all", :git => "git://github.com/rubymotion/sugarcube.git"

i don't understand why, but now it's working again

adtaylor commented 11 years ago

Thanks for your help, @yestoall

What version of the gem is in your Gemfile.lock?

The only what I can fix this is to version down to 1.3.2 and I only ran into this problem after a bundle update.

yestoall commented 11 years ago

sugarcube (1.3.3)

maybe the problem is not sugarcube. i'm experimenting weird problems with afmotion too, and i solved like magic cloning again my github repository and compiling again... sounds like a ruby motion cache compilation problem

i can't understand it but now is working

anyway i love rubymotion & sugarcube & afmotion

On Mon, Oct 14, 2013 at 3:46 PM, Ad Taylor notifications@github.com wrote:

Thanks for your help, @yestoall https://github.com/yestoall

What version of the gem is in your Gemfile.lock?

The only what I can fix this is to version down to 1.3.2 and I only ran into this problem after a bundle update.

— Reply to this email directly or view it on GitHubhttps://github.com/rubymotion/sugarcube/issues/104#issuecomment-26255929 .

nacho

jsheets commented 11 years ago

I was able to work around this error by patching this code at the bottom of sugarcube_cleanup.rb. I'm not sure why UIControl isn't seeing the identical method in UIResponder in the same file. Does kind of seem like a cache compilation problem, but "rake clean" does not solve it.

class UIControl class << self def sugarcube_cleanup(&block) @sugarcube_cleanup ||= [] return @sugarcube_cleanup unless block @sugarcube_cleanup << block return nil end end end

rjsamson commented 11 years ago

Anything new on this? I'm seeing the same issue in 1.3.3, and the issue is still present when using 1.3.4 from github.

colinta commented 11 years ago

I wonder if it's a dependency issue - do you have detect_dependencies disabled?

Here's the tiny project I made; https://gist.github.com/colinta/7018857

rjsamson commented 11 years ago

No - I do not have detect_dependencies disabled. A quick note, I am also requiring sugarcube-all. Like @adtaylor when I drop back to 1.3.2 the issue goes away.

colinta commented 11 years ago

Updated https://gist.github.com/colinta/7018857 to use sugarcube-all and added more sugarcube_cleanup code...

If you open the gem source (bundle show sugarcube), the file _sugarcubecleanup.rb should be in lib/sugarcube/. Toss in an NSLog() in there, make sure the file is compiled and the log message appears. If the file is compiled, but no log message, that means that file hasn't been loaded yet.

In which case, it would need to be added to app.files_dependencies.

yestoall commented 11 years ago

for me is working since 1.3.3 if i put this on my Gemfile gem "sugarcube", :require => "sugarcube-all"

with the github version is not working gem "sugarcube", :git => "git://github.com/rubymotion/sugarcube.git"

On Thu, Oct 17, 2013 at 5:45 AM, Colin T.A. Gray notifications@github.comwrote:

Updated https://gist.github.com/colinta/7018857 to use sugarcube-all and added more sugarcube_cleanup code...

If you open the gem source (bundle show sugarcube), the file sugarcube_cleanup.rb\ should be in lib/sugarcube/. Toss in an NSLog() in there, make sure the file is compiled and the log message appears. If the file is compiled, but no log message, that means that file hasn't been loaded yet.

In which case, it would need to be added to app.files_dependencies.

— Reply to this email directly or view it on GitHubhttps://github.com/rubymotion/sugarcube/issues/104#issuecomment-26477398 .

nacho

rjsamson commented 11 years ago

So I've found what at least seems to be the difference between what's happening in 1.3.2 and 1.3.3. In both 1.3.3 and 1.3.2 I added a app.files.each { |file| puts file } to sugarcube-core.rb in each. In 1.3.2 the end of the build looks like this:

RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-568/uiimage.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-animations/animation_chain.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-animations/caanimation.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-animations/calayer.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-animations/uiview.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-anonymous/anonymous.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-anonymous/anonymous_array.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-attributedstring/nsattributedstring.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-awesome/awesome_exts.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-color/fixnum.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-color/nsarray.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-color/nsstring.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-color/symbol.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-color/uicolor.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-color/uiimage.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube-constants/symbol.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube/adjust.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube/look_in.rb
RUBYDIR/gems/sugarcube-1.3.2/lib/sugarcube/version.rb
./app/app_delegate.rb
./app/models/list.rb
./app/models/todo.rb
./app/screens/add_todo_screen.rb
./app/screens/help_screen.rb
./app/screens/home_screen.rb
./app/screens/todo_screen.rb
./app/styles/home_styles.rb
./app/views/todo_cell.rb
     Build ./build/iPhoneSimulator-7.0-Development

But then in 1.3.3 I'm seeing 27 files get inserted after ./app

RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-568/uiimage.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-animations/animation_chain.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-animations/caanimation.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-animations/calayer.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-animations/uiview.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-anonymous/anonymous.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-anonymous/anonymous_array.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-attributedstring/nsattributedstring.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-awesome/awesome_exts.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-color/fixnum.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-color/nsarray.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-color/nsstring.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-color/symbol.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-color/uicolor.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-color/uiimage.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-constants/symbol.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube/adjust.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube/look_in.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube/sugarcube_cleanup.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube/version.rb
./app/app_delegate.rb
./app/models/list.rb
./app/models/todo.rb
./app/screens/add_todo_screen.rb
./app/screens/help_screen.rb
./app/screens/home_screen.rb
./app/screens/todo_screen.rb
./app/styles/home_styles.rb
./app/views/todo_cell.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-coregraphics.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-corelocation.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-events.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-factories.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-files.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-foundation.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-gestures.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-image.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-indexpath.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-localized.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-modal.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-notifications.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-nscoder.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-nsdata.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-nsdate.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-nsuserdefaults.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-numbers.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-pipes.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-pointer.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-repl.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-resources.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-timer.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-to_s.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-uifont.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-uikit.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube-unholy.rb
RUBYDIR/gems/sugarcube-1.3.3/lib/sugarcube.rb
     Build ./build/iPhoneSimulator-7.0-Development

Might this have something to do with what I'm seeing?

colinta commented 11 years ago

hmm, the interesting thing THERE is that those files after 'app/' shouldn't even be there! those are the files that are loaded from the Rakefile... I'll see if that's happening locally, too.

holgersindbaek commented 10 years ago

I'm still getting this error. Is there any solution to this?

colinta commented 10 years ago

@holgersindbaek which error, there are a few on this page now.

colinta commented 10 years ago

@rjsamson can you send me your Rakefile and Gemfile? I can't reproduce the bug where those extra 27 files are being included.

rjsamson commented 10 years ago

Sure - here's a gist: https://gist.github.com/rjsamson/7217381

The issue goes away when I don't use 'sugarcube-all' and just include what I need individually.

rjsamson commented 10 years ago

@colinta any insight after taking a look at the gemfile / rakefile?

colinta commented 10 years ago

None, I created an app using your Gemfile and Rakefile, but it only included the expected sugarcube files.

rjsamson commented 10 years ago

Interestingly enough on sugarcube 1.3.5 with RubyMotion 2.12 the issue seems to have vanished - no other changes - wondering if others who had the issue also have it cleared up? Very strange, but I'll take it!