Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.md clarification #472

Open
kjayma opened this issue Mar 13, 2014 · 6 comments
Open

README.md clarification #472

kjayma opened this issue Mar 13, 2014 · 6 comments

Comments

@kjayma
Copy link

kjayma commented Mar 13, 2014

I was following the section for "Contribute/test" and was initially unsuccessful in running "bundle update".

I was able to succeed after setting a RAILS_VERSION environment variable. In my case, I set it as follows:

$ export RAILS_VERSION=3.2

If my understanding is correct, and that this is a necessary step in setting up a fresh Surveyor fork, it would be helpful to note in README.md.

@rsutphin
Copy link
Contributor

Exporting RAILS_VERSION should not be necessary for general running of Surveyor's tests. Those bits are in Gemfile.rails_version to allow our CI build to force testing against specific versions. When you just run bundle update you should get the latest version of Rails that surveyor supports. (Currently 3.2.x.)

What error did you get when you ran bundle update without RAILS_VERSION set?

@kjayma
Copy link
Author

kjayma commented Mar 13, 2014

I'm on ruby-1.9.3-p545. I ran $rvm gemset empty. Bundler is version 1.5.3. I clone the repository, run bundle update, and get the following:

Bundler could not find compatible versions for gem "tilt":
  In Gemfile:
    surveyor (>= 0) ruby depends on
      tilt (!= 1.3.0, ~> 1.1) ruby

    surveyor (>= 0) ruby depends on
      tilt (2.0.0)

Bundler could not find compatible versions for gem "mime-types":
  In Gemfile:
    surveyor (>= 0) ruby depends on
      mime-types (~> 1.16) ruby

    capybara (~> 1.1.1) ruby depends on
      mime-types (2.1)

Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    surveyor (>= 0) ruby depends on
      bundler (~> 1.0.0) ruby

  Current Bundler version:
    bundler (1.5.3)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

@rsutphin
Copy link
Contributor

This part is suspicious:

This Gemfile requires a different version of Bundler.

Surveyor doesn't list bundler (~> 1.0.0) as a dep. Seems like bundler is getting confused (as is known to happen, particularly on projects with a large number of possible dependencies). If doing export RAILS_VERSION=3.2 helps you get past it, that seems like a reasonable workaround.

@kjayma
Copy link
Author

kjayma commented Mar 14, 2014

If I'm reading the code correctly, not specifying a RAILS_VERSION means that Gemfile.rails_version will evaluate to null. Therefore, the "eval" statement in Gemfile will also evaluate to null, and not insert a gem command for Rails. That means that the rails dependency specified in surveyor.gemspec will be used. Surveyor.gemspec has this line:

s.add_dependency('rails', '~> 3.0')

Rails version 3.0 has a dependency on `bundler '~> 1.0.0'``. You can check that out on the link here: https://rubygems.org/gems/rails/versions/3.0.0.

Seems like bundler got it right on that one, though I haven't noodled out the others.

@rsutphin
Copy link
Contributor

A version specification of '~> 3.0' for a gem (note the tilde) is equivalent to '>= 3.0', '< 4.0'. Given the version incompatibility for the bundler dep, bundler should have rejected Rails 3.0.0 and moved on to another version.

I have never investigated the cause, but it does seem that, when presented with a large number of possible dependency combinations, recent versions of bundler will give up after a while and give an inaccurate error message[1]. The fact that you can get past your problem by specifying a more constrained rails dependency — which, given the number of dependencies rails has, greatly reduces the search space — suggests that this is the problem you are seeing.

Unfortunately, I don't know of a good solution that doesn't unnecessarily constrain the real-life dependencies of surveyor.

[1]: This is preferable to previous versions, in which bundler would just keep looking forever and gradually use up all the memory in the machine.

@kjayma
Copy link
Author

kjayma commented Mar 14, 2014

OK, that makes sense.

yoon pushed a commit that referenced this issue Mar 23, 2014
yoon pushed a commit that referenced this issue Mar 24, 2014
* rails4: (37 commits)
  support whitelisted attributes in Rails 3.2
  moving redcap feature to redcap spec
  removing surveyor_parser.feature (integrated into parser_spec)
  moving parser cucumber feature to parser spec. moving fixture surveys to fixture directory
  respect :clean_with_truncation
  whitelisted attributes for Rails 3.2
  making changes backwards compatible with Rails 3.2. removing benchmark spec
  attempting to get travis to work
  dropping cucumber
  quote rails in Gemfile.rails_version
  allow full version specifications in ENV, e.g. RAILS_VERSION=3.2.0
  test ruby 2.0 on travis
  travis ci matrix. default rails version. #472
  adding .travis.yml
  more strong parameters
  dealing with strong parameters
  Hash#diff is deprecated
  new stub and activerecord query syntax
  use surveyor common operators instead of aliasing them through a class method in ValidationCondition
  refactoring classes with ActiveSupport::Concern
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants