ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

gem version for postgres

Added by Dies Koper at 2012-02-10 06:54 am

Hi,

While installing CP 3.0.0 with postgres on CentOS 5.6, I noticed the bundle install wanted pg version 0.9.0 and not a more recent version (like 0.13.0).
Is there any particular reason (like documented bugs or incompatibilities) for not configuring the bundle to default to a recent version?

Thanks,
Dies


Replies (19)

RE: gem version for postgres - Added by Felix Schäfer at 2012-02-11 07:33 pm

I wouldn't know of any other than we need a version compatible with Rails 2.3. If that is the case for the most current version of the pg gem, feel free to send us a pull request with the change, even better if you have tested it beforehand :-)

RE: gem version for postgres - Added by Dies Koper at 2012-02-13 02:11 am

Thanks for the quick reply.

Are there any particular operations you'd recommend I test?
I've tested:
  • installation
  • creation of new project
  • creation of new issue
  • update of wiki
  • addition of news
  • creation and assigning of groups and users

I didn't notice any issues.

RE: gem version for postgres - Added by Felix Schäfer at 2012-02-13 04:27 am

Dies Koper wrote:

Are there any particular operations you'd recommend I test?

Run the tests? :-) Other than that, maybe add a git repo and see if it shows everything expected, but I honestly can't remember anything wrong with the pg gem other than we needed a version to pin it on, so I don't expect problems.

RE: gem version for postgres - Added by Dies Koper at 2012-02-13 08:07 am

I have two questions:

  • How do I run the tests?
    I've cloned the repository and got as far as running rake test but it gives me a long error saying it failed to run git:
D:/programs/Ruby187/bin/ruby.exe -I"lib;test" -I"D:/programs/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib" "D:/programs/Ruby187/lib/
ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/functional/**/*_test.rb" 
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from D:/programs/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
D:/sources/OSS/IT/chiliproject/lib/redmine/scm/adapters/abstract_adapter.rb:214:in `shellout': No such file or directory - "git" --git-
dir='D:/sources/OSS/IT/chiliproject/.git' rev-parse --short=9 HEAD (Redmine::Scm::Adapters::CommandFailed)
        from D:/sources/OSS/IT/chiliproject/lib/chili_project/version.rb:46:in `send'

I can run git from my command prompt so it's in my PATH. Also, I can run the command that it tried to run (git --git-dir=D:/sources/OSS/IT/chiliproject/.git rev-parse --short=9 HEAD) as long as I delete the single quotes around the path of the .git path.

  • How would you prefer the version be updated?

pg 0.13.1 was released today. So I could make it "~> 0.13.1" if the tests pass. Or is there a way to specify that it downloads 0.13.x if the user doesn't have the pg gem yet or use whatever they have (as long as it's between 0.8.0 and 0.13.x) if they already have a (working) version.
I had a discussion with a (rails) colleague and he had a different philosophy from mine. He preferred staying at an old version unless he had a problem with it (which reminded me of Redmine and its dependencies) while I prefer to use the latest (stable) version as that's the only one you'd get any community support for. (At least in the Java OSS world where I live that's usually how it works).

RE: gem version for postgres - Added by Felix Schäfer at 2012-02-14 07:50 am

Dies Koper wrote:

  • How do I run the tests?

That should work indeed, I don't have any experience with windows other than having used it enough 8-10 years ago to know I didn't want to stick with it though, so I can't really help you with that, sorry. The code part that seems to fail is used to determine the ChiliProject version and git commit if pulled from git, does the "Administration > Info" page work for you? (it's shown there, so if it shows the code works…)

  • How would you prefer the version be updated?

pg 0.13.1 was released today. So I could make it "~> 0.13.1" if the tests pass. Or is there a way to specify that it downloads 0.13.x if the user doesn't have the pg gem yet or use whatever they have (as long as it's between 0.8.0 and 0.13.x) if they already have a (working) version.
I had a discussion with a (rails) colleague and he had a different philosophy from mine. He preferred staying at an old version unless he had a problem with it (which reminded me of Redmine and its dependencies) while I prefer to use the latest (stable) version as that's the only one you'd get any community support for. (At least in the Java OSS world where I live that's usually how it works).

The general rule of thumb (at least for ChiliProject) is to keep the requirements as "inexact" as possible, thus also the use of the squiggly operator ~> for versions (~> 2.3.4 says "anything equivalent to 2.3 but at least 2.3.4" IIRC). Long story short, unless 0.13.1 offers some update to 0.13.0 that is absolutely needed, I'd say use ~> 0.13 as the version requirement.

A short note: I thought about this a little more yesterday, and the requirement to 0.9 might be due to some long-term Debian, Ubuntu, RHEL or whatever distro releases shipping with 0.9 still that wouldn't work (as easily) with an updated version. I've asked the fellow devs in IRC, I'll post here again should that be clarified.

RE: gem version for postgres - Added by Dies Koper at 2012-02-14 12:21 pm

The code part that seems to fail is used to determine the ChiliProject version and git commit if pulled from git, does the "Administration > Info" page work for you?

No, starting ChiliProject from the git clone (bundle exec ruby script/server -e production) gives the same error.
I tried removing the single quotes around the following line in version.rb; it results in a different error:

          git.send(:shellout, "#{git.sq_bin} --git-dir='#{git_dir}' rev-parse --short=9 HEAD") { |io| io.read }.to_s.chomp

D:/programs/Ruby187/bin/ruby.exe -I"lib;test" -I"D:/programs/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib" "D:/programs/Ruby187/lib/
ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/integration/**/*_test.rb" 
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from D:/programs/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
D:/programs/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require': no such file to load -- object_daddy
(MissingSourceFile)
        from D:/programs/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
        from D:/programs/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each'
        from D:/programs/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `require'
        from D:/programs/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each'
        from D:/programs/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require'
        from D:/programs/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler.rb:122:in `require'
        from D:/sources/OSS/IT/chiliproject/config/boot.rb:58:in `load_gems'
        from D:/programs/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:164:in `process'

If you can give me a hint on how to solve this one I won't mind ploughing on a bit further and see if we can identify the changes required to make the tests work on Windows.

0.13.1 fixes "a problem with people calling #disconnect more than once on a Connection" so I suppose that should be fine with rails.

RE: gem version for postgres - Added by Dies Koper at 2012-02-15 06:19 am

I tried on CentOS, using ~> 0.13 (installing 0.13.1), and saw one failure:

Functional:
  1) Failure:
test_post_new(TrackersControllerTest) [test/functional/trackers_controller_test.rb:48]:
<[1, 6]> expected but was
<[6, 1]>.

712 tests, 2198 assertions, 1 failures, 0 errors

Integration:

1181 tests, 2141 assertions, 0 failures, 0 errors

I've run them again with pg 0.9.0 to be sure, but with 0.9.0 all pass. pg issue?

RE: gem version for postgres - Added by Dies Koper at 2012-02-15 10:43 am

With 0.10.0 and 0.11.0 they also passed. I'll try more tomorrow.

RE: gem version for postgres - Added by Felix Schäfer at 2012-02-15 11:41 am

Dies Koper wrote:

I've run them again with pg 0.9.0 to be sure, but with 0.9.0 all pass. pg issue?

At first view this looks like an ordering issue, and ordering is not guaranteed on PG so I guess this is either a genuine error in the ChiliProject code or at least the test assumes order where there is none guaranteed. Can you open an issue with this and assign it to me? Thanks!

RE: gem version for postgres - Added by Felix Schäfer at 2012-02-15 11:54 am

Dies Koper wrote:

I tried on CentOS, using ~> 0.13 (installing 0.13.1)

As a side note, Holger pointed out to me that ~> 0.13 is not the same as ~> 0.13.0 (see the IRC log).

More generally, we had pinned pg to a 0.9.x version because it was the last version to support ruby 1.8.6 (see here), as ChiliProject doesn't officially support it anymore, we can drop the version requirement for pg altogether and let bundler handle dependencies.

RE: gem version for postgres - Added by Felix Schäfer at 2012-02-15 12:13 pm

Dies Koper wrote:

I tried removing the single quotes around the following line in version.rb; it results in a different error:

OK, so the single quotes thing is a bug on windows. I had a look at the GitAdapter and it doesn't put quotes around the path when shelling out, so they probably aren't needed. I guess I'll ask you for an extra ticket for that :-)

If you can give me a hint on how to solve this one I won't mind ploughing on a bit further and see if we can identify the changes required to make the tests work on Windows.

It's missing object_daddy, it should come with the edavis10-object_daddy gem.

RE: gem version for postgres - Added by Dies Koper at 2012-02-15 02:01 pm

It's missing object_daddy, it should come with the edavis10-object_daddy gem.

gem list edavis gives:

edavis10-object_daddy (0.4.3)

Looking in its directories I found:

D:\programs\Ruby187\lib\ruby\gems\1.8\gems\edavis10-object_daddy-0.4.3\lib\object_daddy.rb

RE: gem version for postgres - Added by Felix Schäfer at 2012-02-15 04:30 pm

Does bundle show list the gem?

RE: gem version for postgres - Added by Dies Koper at 2012-02-16 07:11 am

It didn't. I may had something broken (ran bundle install rmagick which put everything in a rmagick directory :)).
I've fixed that, now bundle show lists the daddy gem.
With the single quotes removed from version.rb, I now see a lot of database related errors. Most tests failed, all with DELETE FROM errors:

1) Error:
test: GET #register with self registration off should redirect to /. (AccountControllerTest):
ActiveRecord::StatementInvalid: PGError: ERROR: relation "roles" does not exist
LINE 1: DELETE FROM "roles"
^
: DELETE FROM "roles"

I created the test database in a similar way to the production database, just with the different name used in database.yml:

CREATE ROLE chiliproject LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';
CREATE DATABASE chiliproject_test WITH ENCODING='UTF8' OWNER=chiliproject;

I thought the table creation was automated. Why would I see these errors?

RE: gem version for postgres - Added by Felix Schäfer at 2012-02-16 07:23 am

No, you have to export the current DB schema first and import it into the test DB, I think the rake db:test:prepare does all of that for you.

RE: gem version for postgres - Added by Dies Koper at 2012-02-17 02:05 am

Thanks. Eventually I did:

C:\ChiliProject\chiliproject-3.0.0>C:\Ruby\Ruby187\lib\ruby\gems\1.8\bin\rake.bat db:test:prepare RAILS_ENV=test
You have 200 pending migrations:
     1 Setup
     2 IssueMove
     3 IssueAddNote
...
Run "rake db:migrate" to update your database then try again.
C:\ChiliProject\chiliproject-3.0.0>C:\Ruby\Ruby187\lib\ruby\gems\1.8\bin\rake.bat db:migrate RAILS_ENV=test
==  Setup: migrating ==========================================================
...

The RAILS_ENV=test addition was required to prevent "FATAL: database "chiliproject_development" does not exist" errors.
With this all tests passed.

Is the way to run the tests documented somewhere or is it so common among all rails apps that it does not require explaining?

RE: gem version for postgres - Added by Felix Schäfer at 2012-02-17 12:50 pm

It's pretty common-ish, but having a tutorial/wiki page for it won't hue either. Wasn't there one on the Redmine wiki? If so, could you port it to the ChiliProject wiki?

RE: gem version for postgres - Added by Dies Koper at 2012-03-01 07:18 am

I couldn't find it, but I did find some notes somewhere (or was it on the CP web site?).
However, are you sure the commands I ran are the right ones? I was trying the other day and it took a while until I got it to work. I'm wondering whether it was mere chance that I got it going last time ;)
After all, the message from db:test:prepare I quoted above says I should run it again after "rake db:migrate", but I didn't...

RE: gem version for postgres - Added by Felix Schäfer at 2012-03-01 10:59 am

Well, the steps I use are:

  • rake db:migrate: make sure my current development database is up-to-date (RAILS_ENV defaults to development if it's not specified),
  • rake db:test:prepare: copy the schema from the current RAILS_ENV, i.e. in this case development, to the test RAILS_ENV (your rake db:test:prepare RAILS_ENV=test doesn't make much sense as you're basically saying "copy the schema from the test RAILS_ENV to the test RAILS_ENV"),
  • rake test, rake test:units, ruby test/unit/issue_test.rb and so on: run the tests or parts of the tests.

There's also some other useful rake tasks, for example rake db:create to create the database for the current RAILS_ENV, have a look at rake -T to see all available tasks.

(1-19/19)