thoughtbot / appraisal Goto Github PK
View Code? Open in Web Editor NEWA Ruby library for testing your library against different versions of dependencies.
Home Page: https://thoughtbot.com
License: MIT License
A Ruby library for testing your library against different versions of dependencies.
Home Page: https://thoughtbot.com
License: MIT License
Steps to reproduce:
$ git clone https://gist.github.com/6130471.git
$ cd 6130471/
$ bundle --path .bundle
$ bundle exec rake appraisal:install
>> bundle check --gemfile='/home/james/projects/tmp/6130471/gemfiles/v1.gemfile' || bundle install --gemfile='/home/james/projects/tmp/6130471/gemfiles/v1.gemfile'
/opt/rubies/1.9.3-p448/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [appraisal-0.5.2, rake-10.1.0] (Gem::LoadError)
from /opt/rubies/1.9.3-p448/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /opt/rubies/1.9.3-p448/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
from /opt/rubies/1.9.3-p448/bin/bundle:22:in `<main>'
I can only get Appraisal to work if I bundle my project's deps into the global gem installation space (either in ~/.gem
or in the Ruby installation in /opt/rubies
).
I'm getting the following conflict when trying to bundle.
Is there a chance to not fix the version of thor in this line?
Bundler could not find compatible versions for gem "thor":
In Gemfile:
rails (~> 4.0) ruby depends on
thor (< 2.0, >= 0.18.1) ruby
appraisal (~> 1.0) ruby depends on
thor (0.15.4)
An update was made to the Clearance gemfiles that strikes me as a problem:
I just bundled and the /mike directory gets changed to /croaky. I assume every developer will incidentally change this line.
Should gemfiles/*.lock be gitignored? If so, let's update the README.
Even though Appraisal supports gemspec in Gemfile, if you only want to include the gemspec for certain appraisals within the Appraisals file. Most of the time you want to run tests against the local gem, but sometimes you may have a set of tests that you want to run without the local gem, so you'd want something like this in Appraisals:
appraise "with gem" do
gemspec
# ...
end
appraise "without gem" do
# ...
end
But currently that would result in an error, e.g.:
undefined local variable or method `gemspec' for #<Appraisal::Appraisal:0x007fd0dca4eb10>
This is probably an edge case, but it seems like Appraisals should work like like a more flexible Gemfile, and for it to do that, it seems like it should be able to support loading the gemspec by specifying Appraisals instead of Gemfile if that is required.
I'm trying to add Appraisal
to my branch of rspec-core however I get the following error.
Update: I use the github/master version as depending on aruba 0.4.2
$ rake --trace
rake aborted!
undefined method `expand_path' for Appraisal::File:Class
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/gemfile.rb:22:in `block in run'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/gemfile.rb:21:in `each'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/gemfile.rb:21:in `run'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/gemfile.rb:18:in `instance_eval'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/gemfile.rb:18:in `run'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/gemfile.rb:14:in `load'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/file.rb:16:in `initialize'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/file.rb:10:in `new'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/file.rb:10:in `each'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/task.rb:30:in `block in initialize'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task_manager.rb:207:in `in_namespace'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/dsl_definition.rb:95:in `namespace'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal/task.rb:9:in `initialize'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal.rb:3:in `new'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bundler/gems/appraisal-f8029181543b/lib/appraisal.rb:3:in `<top (required)>'
/Users/seb/Work/GitHub/rspec-core/Rakefile:5:in `require'
/Users/seb/Work/GitHub/rspec-core/Rakefile:5:in `<top (required)>'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:78:in `block in load_rakefile'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:61:in `block in run'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/seb/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
The idea of Appraisal
is really awesome, thanks for this great work.
Guys the documentation on README use some commands that dont exist.
I try appraisal install
and got appraisal: command not found
.
I make this work with:
Add to Rakefile
# Rakefile
require 'appraisal'
And run the appraisal with the following rake tasks:
$ rake appraisal:install --trace
$ rake appraisal --trace
$ rake appraisal:4.0 --trace
One other thing is on README is recomended not check *.gemfile.lock
but shoulda-matchers commit Gemfile.lock and paperclip not.
I think this problem somehow exists because of my environment but I can't find it quickly.
Appraisals
file:appraise "rails-3" do
gem "rails", "3.2.21"
end
appraise "rails-4-0" do
gem "rails", "4.0.13"
end
appraise "rails-4-1" do
gem "rails", "4.1.9"
end
appraise "rails-4-2" do
gem "rails", "4.2.0"
end
appraisal install
I get following error:0:gon_tests:[master ✗]$ appraisal install
WARN: Unresolved specs during Gem::Specification.reset:
rake (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
>> bundle check --gemfile='/Users/alex/code/gon_tests/gemfiles/rails_3.gemfile' || bundle install --gemfile='/Users/alex/code/gon_tests/gemfiles/rails_3.gemfile'
/Users/alex/.rubies/ruby-2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'bundler' (>= 0) among 65 total gem(s) (Gem::LoadError)
from /Users/alex/.rubies/ruby-2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
from /Users/alex/.rubies/ruby-2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /Users/alex/.gem/ruby/2.1.5/bin/bundle:22:in `<main>'
/Users/alex/.rubies/ruby-2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'bundler' (>= 0) among 65 total gem(s) (Gem::LoadError)
from /Users/alex/.rubies/ruby-2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
from /Users/alex/.rubies/ruby-2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /Users/alex/.gem/ruby/2.1.5/bin/bundle:22:in `<main>'
0:gon_tests:[master ✗]$ bundle check --gemfile='/Users/alex/code/gon_tests/gemfiles/rails_3.gemfile' || bundle install --gemfile='/Users/alex/code/gon_tests/gemfiles/rails_3.gemfile'
The Gemfile's dependencies are satisfied
Do you have any idea how I can trace the problem?
When the Gemfile contains:
source :rubygems
rake appraisal:install
errors with:
/Users/matt/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.14/lib/bundler/source.rb:156:in normalize_uri': The source must be an absolute URI (ArgumentError) from /Users/matt/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.14/lib/bundler/source.rb:131:in
add_remote'
from /Users/matt/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.14/lib/bundler/dsl.rb:168:in rubygems_source' from /Users/matt/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.14/lib/bundler/dsl.rb:82:in
source'
workaround is to rewrite as:
source "http://rubygems.org"
I've described the general error at: http://stackoverflow.com/questions/6556709/gems-rake-tasks-to-use-current-location
However, the quick idea is that Appraisal
use relative gemfiles path that doesn't seem to play nice with aruba
I've tried to get it as absolute path, but don't know how to get the current Rakefile location used to run rake appraisal
from the Appraisal
rake tasks.
Bundler actually doesn't have groups
syntax. We made it by mistake.
We already attempting to deprecate it in #78. Let's remove it afterward then.
Hey guys,
I'm trying to get Appraisal installed for testing our newest library for Zuora, but It seems like bundler is not able to find the gems in any source, though the source :rubygems
is present in the Gemfile
The repository can be found here and here's the build log on Travis-CI, same result on 1.8 and 1.9.
Anyone knows what's going on ?
Thanks guys.
I saw in #29 / #31 that support was added for Bundler groups with multiple names, but I'm not understanding why the groups are being ignored in the first place. I'm using Jeweler for mongoid-locker, and those development/test groups are needed for the tests, but they aren't being included in the generated Gemfiles. Am I missing something?
I added Appraisal in it's own branch:
https://github.com/afeld/mongoid-locker/compare/appraisal
and get the following error:
$ bundle exec rake appraisal spec
>> BUNDLE_GEMFILE=/Users/aidan/dev/mongoid-locker/gemfiles/mongoid2.gemfile bundle exec /Users/aidan/.rvm/gems/ruby-1.9.3-p0/bin/rake spec
/Users/aidan/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.1.4/lib/bundler/rubygems_integration.rb:147:in `block in replace_gem': rake is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/aidan/.rvm/gems/ruby-1.9.3-p0/bin/rake:18:in `<main>'
I get the following error when running Appraisal with a Gemfile that specifies a platforms block like so:
platforms :ruby_20 do
gem "syck"
gem "iconv"
end
undefined method
platforms' for #Appraisal::Gemfile:0x007fe830e4ee20`
I did see this comment on issue:
#47 (comment) which suggests that support for this is being worked on.
Thanks
A recent change to add Ruby 1.8 support to Appraisal forced "activesupport" to be ">= 3.2.21"
. This now disallows developers to use Appraisal to test against any Rails (or activesupport) version prior to 3.2.21.
Previously, the Appraisal activesupport dependency was a development dependency. As such, the generated Appraisal Gemfiles within a project did not inject their own activesupport dependency.
The move to making activesupport a production dependency significantly reduces Appraisal's usefulness as now all appraisals have to have activesupport >= 3.2.21.
Given a Gemfile with activerecord 4.0 and an appraisal with activerecord 3.2 it generates activerecord 4.0 for activerecord32 gemfile
noticed it here: zendesk/kasket#11
I have a scenario where some of my tests run for a certain Gemfile, and others for another.
The code itself is also conditional in this sense, which means that test coverage libraries will get the percentage wrong, since they should take both runs into account, and they don't.
Have you had this issue and do you have a solution for it? Is this even something appraisal
can do anything about?
The code is here.
Thanks.
According to Travis documentation, the key should be gemfile
.
Thanks to @PikachuEXE for reporting.
Pretty sure I'm n00bin it up over here since this error would prevent anyone from using the gem... but here goes nothin.
$ be rake appraisal:install
>> bundle check --gemfile='<project>/gemfiles/rails2.gemfile' || bundle install --gemfile='<project>/gemfiles/rails2.gemfile'
Your Gemfile's dependencies could not be satisfied
Install missing gems with `bundle install`
Fetching gem metadata from http://rubygems.org/.....
Error Bundler::HTTPError during request to dependency API
Fetching full source index from http://rubygems.org/
Could not find gem 'rpsec-rails (= 1.3.4) ruby' in the gems available on this machine.
Hmm the dependency API does indeed seem to be up...
So I tried a different gem source:
$ be rake appraisal:install
>> bundle check --gemfile='<project>/gemfiles/rails2.gemfile' || bundle install --gemfile='<project>/gemfiles/rails2.gemfile'
Your Gemfile's dependencies could not be satisfied
Install missing gems with `bundle install`
Fetching gem metadata from http://gems.github.com/.
Fetching full source index from http://gems.github.com/
Could not find gem 'rpsec-rails (= 1.3.4) ruby' in the gems available on this machine.
But installing directly worked:
$ gem install rspec-rails -v 1.3.4 --source 'http://gems.github.com'
Fetching: rspec-1.3.2.gem (100%)
Fetching: rspec-rails-1.3.4.gem (100%)
Successfully installed rspec-1.3.2
Successfully installed rspec-rails-1.3.4
2 gems installed
And a bundle after the gem install:
$ bundle install --gemfile='<project>/gemfiles/rails2.gemfile'
Fetching gem metadata from http://gems.github.com/.
Fetching full source index from http://gems.github.com/
Could not find gem 'rpsec-rails (= 1.3.4) ruby' in the gems available on this machine.
I suspect RVM, but again, could be n00bin it.
OSX 10.7
rvm, tried ree, 1.9.3
Because we use a hash and not an array for tracking dependencies in a Gemfile, it produces different results on 1.8.7 and 1.9.2. We should use an array to make sure that order is preserved and consistent from Ruby to Ruby.
See: https://github.com/thoughtbot/appraisal/blob/master/lib/appraisal/gemfile.rb#L22
Adding a development dependency like this:
s.add_development_dependency "rails", ">= 3.0"
And then trying to override it in an appraisal causes this error: "You cannot specify the same gem twice with different version requirements."
We can solve this by parsing the gemspec instead of relying on bundler's gemspec directive, since bundler doesn't support merging.
Hi guys! Awesome gem, really helped me when I was trying to figure out how to test against multiple versions of Puppet 👍
So, my idea for a cool feature is an additional rake task that automatically writes to and/or creates a .travis.yml.
file in your repo, adding in the multiple gem versions to the gemfile:
parameter there.
Sound good?
It seems that appraisal is a useful utility and not a part of the application. That is, it seems to be something that you want to install with brew install appraisal
and not something that you want to install by modifying your Gemfile
.
To this end it would be helpful to rebrand appraisal as a tool (such as make
, ruby
, or ls
) and not as a library (such as httparty
, clearance
, or factory_girl
). This may even involve removing the gemspec!
We've had good success with this on gitsh (using autotools) and liftoff (using rake).
For some reason getting the error "undefined method `dirname' for Appraisal::File:Class" when trying to:
rake appraisal:install
Full trace:
$ rake appraisal:install --trace
rake aborted!
undefined method `dirname' for Appraisal::File:Class
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal/gemfile.rb:23:in `run'
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal/gemfile.rb:19:in `instance_eval'
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal/gemfile.rb:19:in `run'
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal/gemfile.rb:15:in `load'
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal/file.rb:16:in `initialize'
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal/file.rb:10:in `new'
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal/file.rb:10:in `each'
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal/task.rb:30:in `block in initialize'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task_manager.rb:207:in `in_namespace'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb:102:in `namespace'
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal/task.rb:9:in `initialize'
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal.rb:4:in `new'
/path/to/.rvm/gems/ruby-1.9.3-p194@my_project/gems/appraisal-0.4.1/lib/appraisal.rb:4:in `<top (required)>'
/path/to/project/Rakefile:5:in `require'
/path/to/project/Rakefile:5:in `<top (required)>'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in `load'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in `<main>'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/bin/ruby_noexec_wrapper:14:in `eval'
/path/to/.rvm/gems/ruby-1.9.3-p194@global/bin/ruby_noexec_wrapper:14:in `<main>'
Although Appraisal does support gemspec (#48) and other Bundler DSL methods, there are some discrepancies in where the gemspec method is allowed.
I'd like to use Appraisal to test a vagrant plugin against multiple releases of Vagrant. Vagrant and Vagrant plugins are just gems, but Vagrant plugin development follows less common Gemfile conventions that don't seem to work with Appraisal.
This is a brief explanation of how Vagrant and Vagrant plugin installs work, and why that's resulted in unusual Gemfile conventions. If you don't care why Vagrant plugins use special bundler groups than you can skip to the next section. Nothing in this section needs to be supported by Appraisal.
Vagrant is no longer distributed via RubyGems. Instead, it's distributed via native package installers that include an embedded Ruby, so Vagrant has more control over non-Ruby dependencies (e.g. Virtualbox) and is easy to install for non-Ruby users. This also means plugins are installed to the embedded ruby with vagrant plugin install
rather than gem install
or bundle install
.
The result is that Gemfiles for Vagrant development follow different conventions than many Ruby projects:
vagrant plugin install
.I would like to use these Appraisals:
appraise "latest-stable" do
group :development do
gem "vagrant", :git => 'git://github.com/mitchellh/vagrant.git', :branch => 'v1.4.2'
end
end
# Oldest (current release)
appraise "oldest-current" do
group :development do
gem "vagrant", :git => 'git://github.com/mitchellh/vagrant.git', :branch => 'v1.4.0'
end
end
# Latest patch (previous release)
appraise "previous-release" do
group :development do
gem "vagrant", :git => 'git://github.com/mitchellh/vagrant.git', :branch => 'v1.3.5'
end
end
appraise "windows-wip" do
group :development do
gem "vagrant", :git => 'git://github.com/maxlinc/vagrant.git', :branch => 'winrmssl'
end
end
That will test my plugin the last several releases of Vagrant, as well as a fork where new features are being added for Windows.
Appraisal actually overrides the vagrant dependencies properly. It has an issue with the gem under development.
This is what I have in my Gemfile:
source 'https://rubygems.org'
group :development do
gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
gem 'appraisal', '~> 1.0'
end
group :plugins do
gemspec
end
This doesn't work, because although Appraisal handles the gemspec method it doesn't seem to allow it within a group:
$ bundle exec appraisal install
/opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/gemfile.rb:39:in `block in run': undefined local variable or method `gemspec' for #<Appraisal::Group:0x007fb09c299c40> (NameError)
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/group.rb:12:in `instance_exec'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/group.rb:12:in `run'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/gemfile.rb:38:in `group'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/gemfile.rb:38:in `run'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/gemfile.rb:29:in `instance_eval'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/gemfile.rb:29:in `run'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/gemfile.rb:25:in `load'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/file.rb:17:in `initialize'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/file.rb:11:in `new'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/file.rb:11:in `each'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/task.rb:32:in `block in initialize'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task_manager.rb:209:in `in_namespace'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/dsl_definition.rb:146:in `namespace'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal/task.rb:9:in `initialize'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal.rb:4:in `new'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/lib/appraisal.rb:4:in `<top (required)>'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/bin/appraisal:4:in `require'
from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/appraisal-1.0.2/bin/appraisal:4:in `<top (required)>'
from /opt/boxen/rbenv/versions/2.1.0/bin/appraisal:23:in `load'
from /opt/boxen/rbenv/versions/2.1.0/bin/appraisal:23:in `<main>'
Alternately, the vagrant plugin development guide uses gem "my-plugin", path: "."
instead of gemspec
.
source 'https://rubygems.org'
group :development do
gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
gem 'appraisal', '~> 1.0'
end
group :plugins do
gem "vagrant-rackspace", path: "."
end
This doesn't work either, probably because support for rewriting path wasn't completed/merged (#19). The result:
$ bundle exec appraisal install
bundle check --gemfile='/Users/Thoughtworker/repos/rackspace/vagrant-rackspace/gemfiles/latest_stable.gemfile' || bundle install --gemfile='/Users/Thoughtworker/repos/rackspace/vagrant-rackspace/gemfiles/latest_stable.gemfile'
Resolving dependencies...
Bundler can't satisfy your Gemfile's dependencies.
Install missing gems with `bundle install`.
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Could not find gem 'vagrant-rackspace (>= 0) ruby' in source at ..
Source does not contain any versions of 'vagrant-rackspace (>= 0) ruby'
Related to #13, please allow support for vendorized gems. When using a Continuous Integration server (like Hudson or Jenkins), gems cannot be installed globally for a variety of reasons:
Note that #13 occurs when you install gems anywhere other than the default path. i.e. specifying --path
in the bundle
option completely breaks appraisal...
The issue happens because you're shelling out to the system another bundle command here.
my default rake task is
sh "bundle exec rake appraisal:install && bundle exec rake appraisal test"
so people can just go to the project run rake and everything works (wkithout having to debug/learn why tests blow up).
This runs install all the time, which is a bit slow and may change the lock file occasionally,
so it would be great to have something like apraisal:bundle which basically does a bundle check || bundle install
, which would be fast + less output + not modify locks.
@padi and I were trying this gem out and named our file Appraisal
. When we ran rake appraisal:install
, no gemfiles
directory was created, nor did any error appear. It took about 15 minutes for us to realize that it should be named Appraisals
.
Should the rake task complain that there's no Appraisals
file when it's missing?
For gems whose Gemfile has multiple source declarations, bundler (i.e., v1.10.4) emits the following security warning:
Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config disable_multisource true`.
However, source declarations with blocks are not supported by the appraisal gem when it generates appraisal gemfiles. Gems declared inside of a source block do not appear in generated appraisal gemfiles.
So, given that my project Gemfile has:
gem "rails", "~> 3.0.7"
and my Appraisals file has:
appraisal :rails_3_1 do
gem "rails", "~> 3.1.0.rc1"
end
I will get this error:
You cannot specify the same gem twice with different version requirements. You specified: rails (= 3.1.0.rc1) and rails (= 3.0.7)
The workaround is to remove Rails from your project's Gemfile/gemspec, but that might not be the right way to do it.
Given:
Gemfile with:
group :localdev do
gem 'appraisal'
end
and
myproj.gemspec
does not contain gem.add_development_dependency 'appraisal'
When:
Running any rake task including appraisal semantics
Then:
Task fails with:
cannot load such file -- appraisal
I suspect this is due to the generated .gemfile specifying:
gemspec :path=>"../"
And this is thereby not loading the Gemfile from the root directory.
Essentially, I would expect a contributor to clone, bundle
and have everything. Travis doesn't need to install/include the appraisal gem, as it's already generated the gemfiles, hence not including it into the gemspec.
I don't really have an idea how to solve it - probably for now would be to document that if using both a Gemfile and gemspec, put the dependency in in the gemspec.
See #76. Basically:
The vagrant plugin development guide uses
gem "my-plugin", path: "."
instead ofgemspec
.source 'https://rubygems.org' group :development do gem "vagrant", git: "https://github.com/mitchellh/vagrant.git" gem 'appraisal', '~> 1.0' end group :plugins do gem "vagrant-rackspace", path: "." endThis doesn't work either, probably because support for rewriting path wasn't completed/merged (#19). The result:
$ bundle exec appraisal install bundle check --gemfile='/Users/Thoughtworker/repos/rackspace/vagrant-rackspace/gemfiles/latest_stable.gemfile' || bundle install --gemfile='/Users/Thoughtworker/repos/rackspace/vagrant-rackspace/gemfiles/latest_stable.gemfile' Resolving dependencies... Bundler can't satisfy your Gemfile's dependencies. Install missing gems with `bundle install`. Fetching gem metadata from https://rubygems.org/.......... Resolving dependencies... Could not find gem 'vagrant-rackspace (>= 0) ruby' in source at .. Source does not contain any versions of 'vagrant-rackspace (>= 0) ruby'
The README has instructions for using Appraisal with TravisCI. However, Suspenders was just updated to use CircleCI and yet Appraisal contains no information about CircleCI integration.
After searching around a bit, it does not appear to be a straightforward configuration setting in the circle.yml
.
Are there any official Appraisal configuration settings for CircleCI? And if so, can they be added to the README?
It seems like the aliases were swapped unless the bundler DSL used to be different.
In the Bundler DSL:
#platforms
is aliased as #platform
#group
does not have an aliasIn the Appraisal DSL:
#group
is aliased as #groups
#platform
does not have an aliasRight now it looks like the group syntax like that:
group :development do
gem 'guard-rails'
end
does not work, and the workaround is to rewrite the Gemfile to this format:
gem 'guard-rails', :group => :development
Here's the trace from rake appraisal:install:
rake aborted!
undefined method `group' for source "http://rubygems.org"
gemspec :path=>"../":Appraisal::Gemfile
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal/gemfile.rb:22:in run' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal/gemfile.rb:18:in
instance_eval'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal/gemfile.rb:18:in run' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal/gemfile.rb:14:in
load'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal/file.rb:16:in initialize' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal/file.rb:10:in
new'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal/file.rb:10:in each' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal/task.rb:30:in
block in initialize'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/task_manager.rb:207:in in_namespace' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/dsl_definition.rb:95:in
namespace'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal/task.rb:9:in initialize' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal.rb:3:in
new'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/appraisal-0.3.6/lib/appraisal.rb:3:in <top (required)>' /Users/gk/.rvm/rubies/ruby-1.9.2-p180-patched/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in
require'
/Users/gk/.rvm/rubies/ruby-1.9.2-p180-patched/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in rescue in require' /Users/gk/.rvm/rubies/ruby-1.9.2-p180-patched/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in
require'
/Users/gk/Work/utils/polish/Rakefile:3:in <top (required)>' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in
load'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in load_rakefile' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/application.rb:495:in
raw_load_rakefile'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/application.rb:78:in block in load_rakefile' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/application.rb:129:in
standard_exception_handling'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/application.rb:77:in load_rakefile' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/application.rb:61:in
block in run'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/lib/rake/application.rb:59:in
run'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/gems/rake-0.9.2/bin/rake:32:in <top (required)>' /Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/bin/rake:19:in
load'
/Users/gk/.rvm/gems/ruby-1.9.2-p180-patched/bin/rake:19:in `
Reported by @phillbaker in #50
I get a
Bundler could not find compatible versions for gem "thor":
when trying torake appraisal:install
for an Appraisal fileappraise "rails3" do gem "rails", "~> 3.0.11" end
Probably because of
- https://rubygems.org/gems/appraisal/versions/1.0.0.beta1=>
thor ~> 0.18.1
- https://rubygems.org/gems/railties/versions/3.2.3 (and earlier) =>
thor ~> 0.14.6
- https://rubygems.org/gems/railties/versions/3.2.4 => ```thor < 2.0, >= 0.14.6
Is it possible to relax the thor requirements for appraisal? Otherwise it looks like rails 3.0.0 - 3.2.3 won't bundle (other gems with a dependency on thor would probably also be effected).
We should make appraisal requires older version of Thor, or relaxing the requirement.
The cucumber features will fail when running them in a fresh clone without manually installing shoulda with gem install shoulda -v 2.11.3
Let's say you have an appraisal like this:
appraisal 'rails4' do
gem 'rails', '~> 4.0.0.rc1'
end
You run rake appraisal:install
, generate your gemfiles/lockfiles, all is well.
Then you come back later and change that to:
appraisal 'rails4' do
gem 'rails', '~> 4.0.0'
end
Now you run rake appraisal:install
again and get:
$ rake appraisal:install
>> bundle check --gemfile='[whatever]/gemfiles/rails4.gemfile' || bundle install --gemfile='[whatever]/gemfiles/rails4.gemfile'
Resolving dependencies...
Bundler can't satisfy your Gemfile's dependencies.
Install missing gems with `bundle install`.
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
You have requested:
railties = 4.0.0
The bundle currently has railties locked at 4.0.0.rc1.
Try running `bundle update railties`
The only way to fix this right now is to say BUNDLE_GEMFILE=$PWD/gemfiles/rails4.gemfile bundle update railties
and then re-run rake appraisal:install
. However, obviously this is not ideal.
Is there even a way we could make this better?
That's what we are currently doing to get relative paths in our lockfiles (to not always change them when another user bundles)
Can this get into appraisal, so we do not have to copy-paste it around ?
task :default do
sh "bundle exec rake appraisal:install appraisal:relativize && bundle exec rake appraisal test"
end
namespace :appraisal do
task :relativize do
Dir["gemfiles/*.lock"].each do |file|
content = File.read(file)
content.gsub!(File.dirname(__FILE__), "../")
File.open(file, "w") { |f| f.write(content) }
end
end
end
Right now, we're doing the autodetection for parallel gem installing. However, there might be some case that you don't want that to happen.
I think the best solution is to introduce ENV['JOBS']
that you can set when running rake appraisal
.
Note that this will turned into --jobs=
command line argument if this going to be implemented on CLI.
[~] appraisal --help
~/.rvm/gems/ruby-2.2.2/gems/appraisal-2.0.1/lib/appraisal/gemfile.rb:13:in `read': No such file or directory @ rb_sysopen - Gemfile (Errno::ENOENT)
from ~/.rvm/gems/ruby-2.2.2/gems/appraisal-2.0.1/lib/appraisal/gemfile.rb:13:in `load'
from ~/.rvm/gems/ruby-2.2.2/gems/appraisal-2.0.1/lib/appraisal/file.rb:17:in `initialize'
from ~.rvm/gems/ruby-2.2.2/gems/appraisal-2.0.1/lib/appraisal/file.rb:11:in `new'
from~/.rvm/gems/ruby-2.2.2/gems/appraisal-2.0.1/lib/appraisal/file.rb:11:in `each'
from~/.rvm/gems/ruby-2.2.2/gems/appraisal-2.0.1/lib/appraisal/task.rb:32:in `block in initialize'
Just noticed that that the issue where multiple groups in the Gemfile are not supported in appraisal 0.4.1 that is in rubygems was fixed months ago, but has not been released. Travis tests are passing, so I'm guessing it is stable?
Given the following Gemfile:
source 'http://rubygems.org'
gemspec
gem 'jquery-rails'
group :test do
gem 'minitest'
gem 'turn', :require => false
end
platforms :jruby do
gem 'jruby-openssl'
gem 'activerecord-jdbcmysql-adapter'
gem 'activerecord-jdbcpostgresql-adapter'
gem 'activerecord-jdbcsqlite3-adapter'
end
And running rake appraisal:install
I get:
undefined method 'platforms' for #<Appraisal::Gemfile:0x007fdce309a2f0>
.
Does appraisals have support for the platforms option in a Gemfile?
I started writing the new cli spec using RSpec, and it looks much better than Cucumber counterpart. Let's move away from having to have Cucumber in our project.
I have a gem that I need to test against completely different sent of dependencies. There no such thing as "default" dependencies.
So, I've generated 4 Gemfiles with appraisal and would like to use one of them as a default, so when I run rake
it'll actually lanch something like appraisal:default_gemset test
. Actually, even appraisal
rake task would be ok for default.
Unfortunately this doesn't work.
In my Rakefile I have this:
task :default => %w(appraisal test)
when I run rake
i see this stacktrace:
jbuilder ➤ rake --trace git:appraisal*
** Invoke default (first_time)
** Invoke appraisal (first_time)
** Invoke appraisal:all (first_time)
** Execute appraisal:all
rake aborted!
can't convert nil into Array
/Users/rwz/.rbenv/versions/1.9.3-p392-perf/lib/ruby/gems/1.9.1/gems/appraisal-0.5.2/lib/appraisal/command.rb:7:in `+'
/Users/rwz/.rbenv/versions/1.9.3-p392-perf/lib/ruby/gems/1.9.1/gems/appraisal-0.5.2/lib/appraisal/command.rb:7:in `from_args'
/Users/rwz/.rbenv/versions/1.9.3-p392-perf/lib/ruby/gems/1.9.1/gems/appraisal-0.5.2/lib/appraisal/task.rb:39:in `block (3 levels) in initialize'
/Users/rwz/.rbenv/versions/1.9.3-p392-perf/lib/ruby/gems/1.9.1/gems/appraisal-0.5.2/lib/appraisal/file.rb:21:in `each'
/Users/rwz/.rbenv/versions/1.9.3-p392-perf/lib/ruby/gems/1.9.1/gems/appraisal-0.5.2/lib/appraisal/file.rb:21:in `each'
/Users/rwz/.rbenv/versions/1.9.3-p392-perf/lib/ruby/gems/1.9.1/gems/appraisal-0.5.2/lib/appraisal/file.rb:10:in `each'
/Users/rwz/.rbenv/versions/1.9.3-p392-perf/lib/ruby/gems/1.9.1/gems/appraisal-0.5.2/lib/appraisal/task.rb:38:in `block (2 levels) in initialize'
/Users/rwz/.rbenv/versions/1.9.3-p392-perf/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
...
I am getting error:
Could not find bundler (>= 0) amongst [aruba-0.4.5, bcat-0.6.1, builder-3.0.0, childprocess-0.2.0, cucumber-1.0.2, diff-lcs-1.1.2, ffi-1.0.9, gherkin-2.4.5, json-1.5.3, rack-1.3.2, rake-0.9.2, rdiscount-1.6.8, rspec-2.6.0, rspec-core-2.6.4, rspec-expectations-2.6.0, rspec-mocks-2.6.0, term-ansicolor-1.0.6] (Gem::LoadError)
I get the error in our app that uses appraisal and I'm getting the error in the appraisal cucumber features. for the appraisal app I run "bundle exec rake cucumber" and get the below failed scenarios with the error above. I am failing on step 'When I successfully run bundle exec rake appraisal:install --trace
'
Failing Scenarios:
cucumber features/appraisals.feature:45 # Scenario: run a specific task with one appraisal
cucumber features/gemspec.feature:47 # Scenario: run a gem in the gemspec
cucumber features/gemspec.feature:60 # Scenario: run a gem in the gemspec via path
I vendor my gems to vendor/ruby and I'm the only one at work that does this. everyone else uses gemsets that I'm aware of and they can run the tests fine. I should also mention that I use rbenv and not rvm for my ruby version management although I don't see how that would be the problem.
first:
bundle exec appraisal install
=> Note: Run with --travis to generate Travis CI configuration.
=> ....
but then:
bundle exec appraisal install --travis
=> ERROR: "appraisal install" was called with arguments ["--travis"]
=> Usage: "appraisal install"
I want to use only actionpack
from master, but it is not rails/actionpack.git
, this is rails/rails.git
and rails/actionpack
bundler has git syntax below:
git 'git://github.com/rails/rails.git' do
gem 'railties'
gem 'action_pack'
gem 'active_model'
end
http://gembundler.com/v1.3/git.html
Now I use gem 'rails', github: 'rails'
instead of I hope.
I'm trying to test a gem that I'm building under at lease two ruby versions, 1.8.7 and 2.1.x, when I switch to ruby 1.8.7 I could do bundle install successfully but when I do
$ appraisal ruby-1.8.7-p352 rspec
I get a SyntaxError
/Users/fcastellanos/.rvm/gems/ruby-1.8.7-p352/gems/appraisal-1.0.3/lib/appraisal/file.rb:1:in `require': /Users/fcastellanos/.rvm/gems/ruby-1.8.7-p352/gems/appraisal-1.0.3/lib/appraisal/appraisal.rb:68: syntax error, unexpected ':', expecting ')' (SyntaxError)
Command.new(command, env: env).run
^
Am I doing something wrong or ruby 1.8.7 is not supported?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.