Compile ember data


#1

Hello everyone!

I’m completely new to emberjs. When I started reading about models in guides I realized that I need to compile ember-data by myself. Okay, went to http://stackoverflow.com/questions/14160898/compiling-ember-data, tried:

git clone git://github.com/emberjs/data.git - OK

cd data - OK

bundle install - there I got an error:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb 

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire’ from extconf.rb:1:in `’

Gem files will remain installed in /var/lib/gems/1.9.1/gems/posix-spawn-0.3.6 for inspection. Results logged to /var/lib/gems/1.9.1/gems/posix-spawn-0.3.6/ext/gem_make.out

An error occurred while installing posix-spawn (0.3.6), and Bundler cannot continue. Make sure that gem install posix-spawn -v '0.3.6' succeeds before bundling.

Then I tried: `gem install posix-spawn -v ‘0.3.6’ and got this:

Building native extensions. This could take a while… ERROR: Error installing posix-spawn: ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire’ from extconf.rb:1:in `’

Gem files will remain installed in /var/lib/gems/1.9.1/gems/posix-spawn-0.3.6 for inspection. Results logged to /var/lib/gems/1.9.1/gems/posix-spawn-0.3.6/ext/gem_make.out

I’ve never worked with ruby. Seems a little bit complicated, what should I do to get the last ember-data.js?

Thanks in advance


#2

You have to have Ruby 1.9.2+ as per the readme https://github.com/emberjs/data/blob/master/README.md#setup


#3

Hmm, ruby -v shows:

ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]


#4

But the above shows that it is finding and using 1.9.1… Probably your env needs to be updated to point to 1.9.3


#5

It looks like you’re not using rvm. Unless you have some particular reason for avoiding it, I would recommend switching to rvm: it will likely save you the headache of trying to figure out why your environment seems to be pointing to the wrong ruby.


#6

I ran into a similar problem (in my case, I didn’t have bundle), but I would like to ask a slightly higher-level question:

Why do we all need to compile ember-data in the first place?

It would make it way easier for me, as a new (potential?) Ember user, to be able to just download ember-data.js from somewhere. I totally understand ember-data is under development, and to that end, I would be more than happy to git clone a repo, and either copy or create a symlink to a file within it, but making me install ruby, bundle, various gems, etc… just to link to a javascript file seems a little heavy weight.

If something like http://cloud.github.com/downloads/emberjs/data/ember-data-latest.js was kept up to date (and I’m not asking for a per-commit update here. Maybe just when the revision number changes?), that would be awesome. In the meantime, until someone can tell me why it’s a terrible idea, I’m using the copy from https://raw.github.com/toranb/ember-django-rest/master/ember/static/script/vendor/ember-data.js.

Thanks!


#7

Okay, I’ll try to compile it at my work once again paying special attention to ruby version. But now I tried to use bwinton’s link, and it seems it’s not going to be easy :slight_smile: This is my head section:

<script src="jquery-1.9.1.min.js"></script>
<script src="handlebars.js"></script>
<script src="ember-1.0.0-rc.1.js"></script>
<script src="ember-data.js"></script>
<!--<script src="application.js"></script>-->

I commented application.js so as I’m sure I don’t have any mistakes in my app. And I get: Uncaught TypeError: Object [object Object] has no method ‘readOnly’, line 3535


#8

@Vict0r the issue is because you are using older version ember.js. Try using ember rc2.