librelist archives

« back to archive

A tangled web (mess) of dependencies Encoding vs. SQLite3 vs. ActiveRecord

A tangled web (mess) of dependencies Encoding vs. SQLite3 vs. ActiveRecord

From:
Andrew S. Townley
Date:
2011-11-18 @ 16:53
Hi Folks,

I'm trying to write a small little application using Shoes and 
ActiveRecord with SQLite3.  This is all just fine--except activerecord 
3.1.1 depends on SQLite3 3.1.1 and that's newer than what comes with Shoes
from the download:

shoes policeman (0.r1739) [universal.x86_64-darwin11.1.0 Ruby1.9.1]

I tried to downgrade activerecord to 2.3.5, but then I get messages about 
Encoding::UTF-8 not being defined.

Unfortunately, I need this combination to work.  Is there any way - apart 
from building a new version of policeman with updated SQLite that might 
get me going with a minimum of fuss?

Also, whatever it is needs to be something that I can eventually roll up 
into a big ball and deliver to someone running Windows--again, with the 
minimum of fuss.

Is this possible, or should I just give up and write a Rails app?  BTW, 
I'm sincerely hoping the answer to this is a resounding "no"...

Once you run the application, you need to check the messages in the 
console window to see what I'm talking about.  Changing the require 
version to 2.3.5 gives you a different, yet equally exciting, error 
message in the console log.

Any ideas/suggestions would be most appreciated.

Thanks in advance,

ast

The application in question:

valkyrie$ cat /tmp/artest.rb
#! /usr/bin/env open -a Shoes.app

Shoes.setup do
# gem 'activerecord', '2.3.5'
  gem 'activerecord', '3.1.1'
end

require 'active_record'

Shoes.app do
  ActiveRecord::Base.establish_connection(
    :adapter => 'sqlite3',
    :dbfile => 'test.sqlite3')

  para "it works"
end
--
Andrew S. Townley <ast@atownley.org>
http://atownley.org

Re: [shoes] A tangled web (mess) of dependencies Encoding vs. SQLite3 vs. ActiveRecord

From:
J. Kaiden
Date:
2011-11-18 @ 17:45
> Unfortunately, I need this combination to work.  Is there any way - apart
> from building a new version of policeman with updated SQLite that might get
> me going with a minimum of fuss?
>
>
  hi Andrew,

  i don't know if there's another way - but building your own policeman
with the gems you want is not that big a deal...  this link -
https://github.com/lljk/shoes-stuff/wiki/Shoes-and-Gems-with-Native-Dependencies
-
deals specifically with gstreamer, but should be 'translatable' to other
gems...

  hopefully someone will be able to help you out with a simpler answer, but
if not - roll your own!

  Shoes On,

  - j

Re: [shoes] A tangled web (mess) of dependencies Encoding vs. SQLite3 vs. ActiveRecord

From:
Steve Klabnik
Date:
2011-11-18 @ 18:46
Hey Andrew!

> This is all just fine--except activerecord 3.1.1 depends on SQLite3 
3.1.1 and that's newer than what comes with Shoes from the download:

Ahh, That's a bummer.

> Unfortunately, I need this combination to work.  Is there any way - 
apart from building a new version of policeman with updated SQLite that 
might get me going with a minimum of fuss?

Not right now, though as Kaiden points out, it's not too hard to just
build your own Shoes with the gems you want.

> Also, whatever it is needs to be something that I can eventually roll up
into a big ball and deliver to someone running Windows--again, with the 
minimum of fuss.

This is part of the problem. C extension gems need to be compiled on a
per-architecture basis, so unless people have dev tools installed,
there's no way to do this simply.

> Is this possible, or should I just give up and write a Rails app?  BTW, 
I'm sincerely hoping the answer to this is a resounding "no"...

It's certainly possible, but at the current stage, requires compiling
a special pair of Shoes.

We've been talking about creating a buildbot webservice where you
could just request a pair of Shoes and get a copy with everything
installed. That's not happening soon, though.

Re: [shoes] A tangled web (mess) of dependencies Encoding vs. SQLite3 vs. ActiveRecord

From:
Andrew S. Townley
Date:
2011-11-18 @ 19:09
Hi Steve,

On 18 Nov 2011, at 6:46 PM, Steve Klabnik wrote:

> Hey Andrew!
> 
>>  This is all just fine--except activerecord 3.1.1 depends on SQLite3 
3.1.1 and that's newer than what comes with Shoes from the download:
> 
> Ahh, That's a bummer.

Actually, it seems to be worse than that.  For some reason, even when I 
took the version out of the installed gem call in the connection adapter, 
it still choked on the gem statement in the active_record dependency 
check.

gems/activerecord-3.1.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:

  1 require 'active_record/connection_adapters/sqlite_adapter'
  2 
  3 #gem 'sqlite3', '~> 1.3.0'
  4 require 'sqlite3'
  5 

I had to completely remove line 3 in order to get it loaded.  Who knows 
what else will break, but I don't think I'm pushing the adapter very hard 
with what I need to do. *fingers crossed*

>> Unfortunately, I need this combination to work.  Is there any way - 
apart from building a new version of policeman with updated SQLite that 
might get me going with a minimum of fuss?
> 
> Not right now, though as Kaiden points out, it's not too hard to just
> build your own Shoes with the gems you want.

...except for this: https://github.com/shoes/shoes/issues/159 ;)

I can't disturb my Ruby environment on this machine because I need it for 
other projects using 1.8.7p249, and I'm not ready to dive in to the 
macports vs. homebrew stuff since I've spent a large part of this week 
just trying to get something simple going this way.

>> Also, whatever it is needs to be something that I can eventually roll 
up into a big ball and deliver to someone running Windows--again, with the
minimum of fuss.
> 
> This is part of the problem. C extension gems need to be compiled on a
> per-architecture basis, so unless people have dev tools installed,
> there's no way to do this simply.

No, I understand that part.  I meant setting up an environment (Windows) 
and then bundling everything in there before distribution.  We have the 
ability to do this, but I was hoping not to have to hack and slash default
gems just to get going.

>> Is this possible, or should I just give up and write a Rails app?  BTW,
I'm sincerely hoping the answer to this is a resounding "no"...
> 
> It's certainly possible, but at the current stage, requires compiling
> a special pair of Shoes.
> 
> We've been talking about creating a buildbot webservice where you
> could just request a pair of Shoes and get a copy with everything
> installed. That's not happening soon, though.


That would be quite cool--kinda like the old build servers sourceforge 
used to provide.  Understand that it isn't a runner for the near term.

I've managed to get a bit further than I was by commenting out the gem 
call in the sqlite3 connector in the active record 3.1.1 source, but I'm 
going to end up with a very fragile environment before I know it...

Thanks for the input.  Will keep plugging away.  This is actually less 
scary than Rails after building a totally different web framework for the 
last 6 years...  Let's just say my mental models aren't quite in line with
the Rails way of doing things.  Was really hoping this was a quicker 
alternative for the piddly little thing I'm trying to do.  Less and less 
certain as the days go by... ;)

Cheers,

ast
--
Andrew S. Townley <ast@atownley.org>
http://atownley.org