BlueFrogGaming / icuke

Integration testing for iPhone applications with Cucumber
MIT License
20 stars 3 forks source link

ext/Rakefile can't perform git commands during install #2

Open rbeiter opened 13 years ago

rbeiter commented 13 years ago

I am running into trouble building and installing iCuke off of your branch. After cloning (with or without --recursive or init/updating the submodules) I'm receiving this on the install step:

cd .. && git submodule init (in /Users/user/.rvm/gems/ruby-1.9.2-p180@icuketest/gems/iCuke-0.6.3/ext) fatal: Not a git repository (or any of the parent directories): .git rake aborted!

If I either add the contents of .git to the gemspec's files array or add the files contained in ext/WaxSim (after pulling the submodule) to s.files and comment out the git lines in the Rakefile all is well and I'm up and running but without either of those two work-arounds, I wasn't able to install the gem after building.

Randy

eraserhd commented 13 years ago

The "git submodule init" command needs to be run within the cloned directory. I think you are running it in the parent directory, which is what is causing the problem. It also doesn't need to be run (but is safe to run) if you've cloned with --recursive option.

The gemspec file should be generated automatically once the files are there.

rbeiter commented 13 years ago

I suspect I may be building the gem wrong - what is the recommended way? I've been doing gem build then gem install. If I try to do 'rake', I end up with an rspec error looking for a non-existant spec file spec/rake/spectask. What version of rspec is required?

eraserhd commented 13 years ago

rspec 1.3.0 is required. I'll bundler into the mix so that this becomes explicit.

'rake gemspec' will update the gemspec, but since we're using Jeweler, the best way to build the gem would be to do 'rake build', then you can install the gem with 'gem install pkg/icuke-*.gem'

On Mon, Apr 18, 2011 at 9:25 AM, rbeiter < reply@reply.github.com>wrote:

I suspect I may be building the gem wrong - what is the recommended way? I've been doing gem build then gem install. If I try to do 'rake', I end up with an rspec error looking for a non-existant spec file spec/rake/spectask. What version of rspec is required?

Reply to this email directly or view it on GitHub: https://github.com/BlueFrogGaming/icuke/issues/2#comment_1020981

rbeiter commented 13 years ago

Just tried with a Gemfile specifying 1.3.0 - here's what I'm seeing.

I cloned the latest repo, using the --recursive opt. I see WaxSim in ext/WaxSim afterwards

I created the following Gemfile: source 'http://rubygems.org'

gem 'rspec', '1.3.0' gem 'jeweler' gem 'cucumber' gem 'rake' gem 'httparty' gem 'nokogiri' gem 'background_process'

I installed bundler and ran 'bundle install'

I did a 'rake build', no errors.

I did a 'gem install pkg/iCuke-*.gem' and get this:

Building native extensions. This could take a while... ERROR: Error installing pkg/iCuke-0.6.3.gem: ERROR: Failed to build gem native extension.

    "/Users/rbeiter/.rvm/rubies/ruby-1.9.2-p180/bin/ruby" -rubygems /Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.8.7/bin/rake RUBYARCHDIR=/Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@icuke20110418/gems/iCuke-0.6.3/lib RUBYLIBDIR=/Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@icuke20110418/gems/iCuke-0.6.3/lib

cd .. && git submodule init (in /Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@icuke20110418/gems/iCuke-0.6.3/ext) fatal: Not a git repository (or any of the parent directories): .git rake aborted! Command failed with status (128): [cd .. && git submodule init...] /Users/rbeiter/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:993:in `block in sh' [...]

I'm not executing the 'git submodule' commands manually at all, the Rakefile is executing them upon install into the final gem install location. I think the reason it is having troubles is by that point, there is no valid git cloned repos anymore since the gemspec doesn't include .git files (nor would I expect it to). It seems like either the gemspec needs to be updated with the file paths within ext/WaxSim so those files are installed during 'gem install' (at which point the git commands in the ext Rakefile become obsolete) or we need to add the .git repos files so by the time the bits end up in the final gem location and the Rakefile gets run it will have the info it needs to clone WaxSim a second time?

Thank you for your help!

eraserhd commented 13 years ago

It does look like this method is broken. I worked on this today and found that it works one way with bundler, and if I revert a commit that added support for this, the other way with "gem install".

I will write up tests to ensure that both methods work in the future, but for now, I would bring iCuke into your project by adding it to your project's Gemfile:

source 'http://rubygems.org' gem "cucumber" gem "iCuke", :git => "git@github.com:BlueFrogGaming/icuke.git" gem "rake"

Then run "bundle install --path" (or just "bundle install" if you prefer).

On Mon, Apr 18, 2011 at 11:03 PM, rbeiter < reply@reply.github.com>wrote:

Just tried with a Gemfile specifying 1.3.0 - here's what I'm seeing.

I cloned the latest repo, using the --recursive opt. I see WaxSim in ext/WaxSim afterwards

I created the following Gemfile: source 'http://rubygems.org'

gem 'rspec', '1.3.0' gem 'jeweler' gem 'cucumber' gem 'rake' gem 'httparty' gem 'nokogiri' gem 'background_process'

I installed bundler and ran 'bundle install'

I did a 'rake build', no errors.

I did a 'gem install pkg/iCuke-*.gem' and get this:

Building native extensions. This could take a while... ERROR: Error installing pkg/iCuke-0.6.3.gem: ERROR: Failed to build gem native extension.

   "/Users/rbeiter/.rvm/rubies/ruby-1.9.2-p180/bin/ruby" -rubygems

/Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.8.7/bin/rake RUBYARCHDIR=/Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@icuke20110418/gems/iCuke-0.6.3/lib RUBYLIBDIR=/Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@icuke20110418 /gems/iCuke-0.6.3/lib cd .. && git submodule init (in /Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@icuke20110418 /gems/iCuke-0.6.3/ext) fatal: Not a git repository (or any of the parent directories): .git rake aborted! Command failed with status (128): [cd .. && git submodule init...] /Users/rbeiter/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:993:in `block in sh' [...]

I'm not executing the 'git submodule' commands manually at all, the Rakefile is executing them upon install into the final gem install location. I think the reason it is having troubles is by that point, there is no valid git cloned repos anymore since the gemspec doesn't include .git files (nor would I expect it to). It seems like either the gemspec needs to be updated with the file paths within ext/WaxSim so those files are installed during 'gem install' (at which point the git commands in the ext Rakefile become obsolete) or we need to add the .git repos files so by the time the bits end up in the final gem location and the Rakefile gets run it will have the info it needs to clone WaxSim a second time?

Thank you for your help!

Reply to this email directly or view it on GitHub: https://github.com/BlueFrogGaming/icuke/issues/2#comment_1024807

rbeiter commented 13 years ago

This gets closer, but the resulting icuke install is still not usable. I created a fresh gemset to help prevent contamination of the test. I believe this is the error I was getting originally when trying to use the pre-built gem and that's why I ended up building on my own. Using the Gemfile above:

Randy-Beiters-MacBook-Pro:temp-icuke20110419 rbeiter$ bundle install Fetching https://github.com/BlueFrogGaming/icuke.git remote: Counting objects: 1544, done. remote: Compressing objects: 100% (725/725), done. remote: Total 1544 (delta 817), reused 1403 (delta 731) Receiving objects: 100% (1544/1544), 930.97 KiB | 587 KiB/s, done. Resolving deltas: 100% (817/817), done. Fetching source index for http://rubygems.org/ Using rake (0.8.7) Installing background_process (1.2) Installing builder (3.0.0) Installing crack (0.1.8) Installing diff-lcs (1.1.2) Installing json (1.5.1) with native extensions Installing gherkin (2.3.6) with native extensions Installing term-ansicolor (1.0.5) Installing cucumber (0.10.2) Installing httparty (0.7.6) Installing nokogiri (1.4.4) with native extensions Using iCuke (0.6.3) from https://github.com/BlueFrogGaming/icuke.git (at master) with native extensions Using bundler (1.0.12) Your bundle is complete! Use bundle show [gemname] to see where a bundled gem is installed.

Randy-Beiters-MacBook-Pro:temp-icuke20110419 rbeiter$ icuke foo /Users/rbeiter/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:900:in report_activate_error': Could not find RubyGem iCuke (>= 0) (Gem::LoadError) from /Users/rbeiter/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:248:inactivate' from /Users/rbeiter/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1276:in gem' from /Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@icuke20110419/bin/icuke:18:in

'

Randy-Beiters-MacBook-Pro:temp-icuke20110419 rbeiter$ bundle show iCuke /Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@icuke20110419/bundler/gems/icuke-9ebe40439712

eraserhd commented 13 years ago

I'm guessing you'll need to use "bundle exec icuke foo". Also, if running cucumber tasks from a Rakefile, you will need to initialize bundler in the Rakefile. You can copy the code from the top of the current iCuke Rakefile itself.

I'm more and more realizing that iCuke falls down on the installation part, still. I will definitely get this stuff nailed down soon.

On Tue, Apr 19, 2011 at 10:20 PM, rbeiter < reply@reply.github.com>wrote:

This gets closer, but the resulting icuke install is still not usable. I created a fresh gemset to help prevent contamination of the test. I believe this is the error I was getting this originally when trying to use the pre-built gem and that's why I ended up building on my own. Using the Gemfile above:

Randy-Beiters-MacBook-Pro:temp-icuke20110419 rbeiter$ bundle install Fetching https://github.com/BlueFrogGaming/icuke.git remote: Counting objects: 1544, done. remote: Compressing objects: 100% (725/725), done. remote: Total 1544 (delta 817), reused 1403 (delta 731) Receiving objects: 100% (1544/1544), 930.97 KiB | 587 KiB/s, done. Resolving deltas: 100% (817/817), done. Fetching source index for http://rubygems.org/ Using rake (0.8.7) Installing background_process (1.2) Installing builder (3.0.0) Installing crack (0.1.8) Installing diff-lcs (1.1.2) Installing json (1.5.1) with native extensions Installing gherkin (2.3.6) with native extensions Installing term-ansicolor (1.0.5) Installing cucumber (0.10.2) Installing httparty (0.7.6) Installing nokogiri (1.4.4) with native extensions Using iCuke (0.6.3) from https://github.com/BlueFrogGaming/icuke.git (at master) with native extensions Using bundler (1.0.12) Your bundle is complete! Use bundle show [gemname] to see where a bundled gem is installed.

Randy-Beiters-MacBook-Pro:temp-icuke20110419 rbeiter$ icuke foo /Users/rbeiter/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:900:in report_activate_error': Could not find RubyGem iCuke (>= 0) (Gem::LoadError) from /Users/rbeiter/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:248:in activate' from /Users/rbeiter/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1276:in gem' from /Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@icuke20110419/bin/icuke:18:in

'

Randy-Beiters-MacBook-Pro:temp-icuke20110419 rbeiter$ bundle show iCuke /Users/rbeiter/.rvm/gems/ruby-1.9.2-p180@icuke20110419 /bundler/gems/icuke-9ebe40439712

Reply to this email directly or view it on GitHub: https://github.com/BlueFrogGaming/icuke/issues/2#comment_1030449

rbeiter commented 13 years ago

"bundle exec icuke foo" worked, as does "bundle exec cucumber" afterwards, so thats a clean path through (if a bit verbose :))

If you'd like me to test any other paths, please let me know. Likewise if there's anything I can help with given my very early understanding of ruby gem distribution, let me know. I did get iCuke working previously using the gemspec hack I mentioned above and am loving it but wanted to assist in nailing down the "right" way to install it for others to follow. iCuke is a great way to test iOS apps and I'd like to see it grow.