Building gem throws IOError - ruby

Trying to build a gem like so.
gem build my-awesome-theme.gemspec
And for some unknown reason it's throwing the following error.
/Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package/tar_writer.rb:249:in `write': closed stream (IOError)
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package/tar_writer.rb:249:in `close'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package/tar_writer.rb:87:in `ensure in new'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package/tar_writer.rb:87:in `new'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package.rb:231:in `block in build'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package.rb:230:in `open'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package.rb:230:in `build'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package.rb:111:in `build'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/commands/build_command.rb:48:in `execute'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/command.rb:305:in `invoke_with_build_args'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/command_manager.rb:167:in `process_args'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/command_manager.rb:137:in `run'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/gem_runner.rb:54:in `run'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/bin/gem:21:in `<main>'
Have tried complete rebuild of the ruby environment using RVM, and fresh clone of the gem source from GitHub but the problem persists.
Running Mac OSX, RVM and Ruby 2.3.1
Any help greatly received. :)

Thanks to some help on the #ruby-lang IRC channel I managed to track this issue to an outdated version of rubygems, bumped it from 2.2 to 2.6 and problem appears to have gone away.

Related

Ruby: Gem dbd-pg(0.3.9) not working with Ruby 2.7

I'm trying to migrate very old script to ruby 2.7, gem seems to be installed correctly but its throwing out error i am assuming that error is because the script is expecting PG gem version to be 0.9.0 but for some reason on ruby 2.7 this is version is not getting installed and its installing 1.2.3 and dbd-pg calls pg gem so that might be causing this issue.
here is the trace:
Trace: C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/pg/database.rb:81:in `rescue in initialize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/pg/database.rb:40:in `initialize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/Pg.rb:157:in `new'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/Pg.rb:157:in `connect'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbi-0.4.4/lib/dbi/handles/driver.rb:33:in `connect'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbi-0.4.4/lib/dbi.rb:148:in `connect'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:212:in `check_database_exists'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:222:in `check_already_set_up'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:71:in `set_up_databases'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:404:in `block in <main>'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:386:in `each'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:386:in `<main>'.
PS: I never worked on Ruby so any input is welcome. This is first time we are working with ruby and we are not much familiar with the errors or call stacks.
Thanks in advance

"uninitialized constant Cucumber::Rb_Support (NameError)" when running Cucumber for Ruby & Watir

After installing Ruby, Cucumber and Watir using gem I get the following error:
uninitialized constant Cucumber::Rb_Support (NameError)
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/constantize.rb:41:in `constantize_name'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/constantize.rb:13:in `block in constantize'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/constantize.rb:12:in `each'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/constantize.rb:12:in `constantize'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:87:in `load_programming_language'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:242:in `programming_language_for'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:226:in `load_file'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:97:in `block in load_files!'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:96:in `each'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:96:in `load_files!'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime.rb:242:in `load_step_definitions'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime.rb:65:in `run!'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/cli/main.rb:38:in `execute!'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/bin/cucumber:9:in `<top (required)>'
W:/Programme/Ruby193/bin/cucumber:23:in `load'
W:/Programme/Ruby193/bin/cucumber:23:in `<main>'**
Anyone got any idea why this is not working?
I copied the exact example from the github page.
I finally found a solution myself.
If anyone runs into this problem it is most likely caused by Ruby versions that are not compatible with Gherkin/Cucumber and/or Watir.
Although there are newer version of Ruby, the only versions that worked on my Windows 7 (Win64) machine were a combination of:
Ruby: rubyinstaller-2.0.0-p645.exe
DevKit: DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
Then I followed the installation instructions on http://www.spritecloud.com/2015/04/complete-setup-guide-for-ruby-cucumber-and-watir-on-windows/
And I used the example on https://github.com/spriteCloud/cucumber-watir-example which worked.
Following this did not create any errors and the example worked.
Good luck!

Compass watch - only writes once

I've been running compass and sass for a while now, however updated my system this afternoon:
mac osX 10.10.2 (14C1514)
Ruby version: ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Sass version: Sass 3.4.13 (Selective Steve)
Compass version: 1.0.3
And all of a sudden compass stopped working, it would watch the files but and do the first write, but then after that it wouldn't see any more changes.
After looking around online i found:
compass watch --p
might help me, it seemed to work and was running fine 'ish' but build times were really slow.
Andys-mac:scss andy$ compass watch --p
>>> Compass is watching for changes. Press Ctrl-C to Stop.
modified layout/_header.scss
write /Users/andy/Sites/projectname/httpdocs/library/css/style.css
When i break from this it throws me the error as follows:
E, [2015-03-20T15:13:26.627204 #1102] ERROR -- : Actor crashed!
Celluloid::DeadActorError: attempted to call a dead actor
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/proxies/sync_proxy.rb:23:in `method_missing'
/Library/Ruby/Gems/2.0.0/gems/listen-2.9.0/lib/listen/file.rb:9:in `change'
/Library/Ruby/Gems/2.0.0/gems/listen-2.9.0/lib/listen/change.rb:40:in `change'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `public_send'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `dispatch'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:63:in `dispatch'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in `block in invoke'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in `block in task'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'
E, [2015-03-20T15:13:26.628055 #1102] ERROR -- : Actor crashed!
Celluloid::DeadActorError: attempted to call a dead actor
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/proxies/sync_proxy.rb:23:in `method_missing'
/Library/Ruby/Gems/2.0.0/gems/listen-2.9.0/lib/listen/file.rb:9:in `change'
/Library/Ruby/Gems/2.0.0/gems/listen-2.9.0/lib/listen/change.rb:40:in `change'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `public_send'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `dispatch'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:63:in `dispatch'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in `block in invoke'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in `block in task'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
/Library/Ruby/Gems/2.0.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'
Im lost i've tried uninstalling compass - sass, updating ruby system im at the end of my whit please help me. If i've missed anything that people might know to help fix it, i'll gladly share.
Thanks so much.
Okay, so i found that celluloid was causing a data leak or something along those lines.
I tried a few things to sort this:
sudo gem update `gem list | cut -d ' ' -f 1`
Updating all the gems didn't work but that might work for some people. I ended up running:
sudo gem uninstall --all
To remove all gems that might be causing a problem, i then reinstalled the compass gem and sass gem. 2 hours of routing and that was the fix. Hope this helps people in the future.
I ended up uninstalling all versions of celluloid
sudo gem uninstall celluloid
Then I reinstalled celluloid
sudo gem install celluloid
And it started working again.

Jekyll - Error Running 'Jekyll Serve'

EDIT: Found the answer (see my answer below!). It involves using version 1.4.2 instead of 1.4.3, so if anyone has any ideas on getting 1.4.3 working, that could be helpful as well. Thanks!
EDIT 2: Thanks to a comment below, it seems that 1.4.3 does have a problem when running on windows. https://github.com/jekyll/jekyll/issues/1948
I have just setup jekyll on my windows 7 computer. I have ruby installed along with the dev pack.
I have run gem install jekyll and that completed with success. I have created a new site as per the jekyll documentation.
The problem I am experiencing happens when I try to run jekyll serve. Please find below the error output.
PS C:\jekyll\test-site> jekyll serve --trace
Configuration file: C:/jekyll/test-site/_config.yml
Source: C:/jekyll/test-site
Destination: C:/jekyll/test-site/_site
Generating... C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': Invalid argument - C:/jekyll/test-site/_site/C: (Errno::EINVAL)
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:205:in `each'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/convertible.rb:168:in `write'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:259:in `block in write'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:397:in `block (2 levels) in each_site_file'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:396:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:396:in `block in each_site_file'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:395:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:395:in `each_site_file'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:259:in `write'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:41:in `process'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/command.rb:18:in `process_site'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/commands/build.rb:23:in `build'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/commands/build.rb:7:in `process'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/bin/jekyll:97:in `block (2 levels) in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/command.rb:155:in `run'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/runner.rb:402:in `run_active_command'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/runner.rb:78:in `run!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/delegates.rb:11:in `run!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>
I have looked around but am a novice with ruby, so I have no idea what to look for or how to find the error here. Any help would be much appriciated.
Thanks,
Joe
Answering my own question, I managed to find a solution.
This appears to be a problem with Jekyll version 1.4.3. To fix the issue I uninstalled jekyll and installed version 1.4.2.
gem uninstall jekyll
gem install jekyll --version "=1.4.2"
Doing this and everything should work fine if you have the same issue as me on windows.
I guess this is because version 1.4.3 is new (released on 13th) and is unstable on windows.
Just came across the same issue with Jekyll's plugin "Category Archive Generator" (https://github.com/shigeya/jekyll-category-archive-plugin)
Most likely you have a plugin - in the _plugins folder - which is using the File.join() method. e.g. File.join('/', dest, #dir, #category_dir_name, 'index.html')
Modify this by deleting the first element leaving you with File.join(dest, #dir, #category_dir_name, 'index.html')
I had the same problem on Ubuntu Precise 12.04. The issue was that I had ruby1.8 installed. I also had ruby1.9.1 installed. I removed ruby1.8, and then Jekyll installed fine.

Ruby Koans not compatible with Ruby 2.0.0?

After successfully upgrading to Ruby 2.0.0's stable release (yay!) I decided to continue on my Koans Path to Enlightenment. However, when running the rake command within the koans folder, as I normally do, I receive this error:
rake
cd koans
/Users/jordanthornquest/.rvm/rubies/ruby-2.0.0-p0/bin/ruby path_to_enlightenment.rb
/Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:399:in `rescue in meditate': uninitialized constant EdgeCase::Sensei::AssertionError (NameError)
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:407:in `meditate'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:470:in `block in walk'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:481:in `block (3 levels) in each_step'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:479:in `each'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:479:in `block (2 levels) in each_step'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:478:in `each'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:478:in `each_with_index'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:478:in `block in each_step'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:476:in `catch'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:476:in `each_step'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:469:in `walk'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:491:in `block in <top (required)>'
rake aborted!
Command failed with status (1): [/Users/jordanthornquest/.rvm/rubies/ruby-2...]
/Users/jordanthornquest/programming/ruby-koans/Rakefile:90:in `block in <top (required)>'
/Users/jordanthornquest/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
/Users/jordanthornquest/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => default => walk_the_path
I also installed a fresh new Koans batch from GitHub today, as well, to assure that that wasn't my problem. Neither worked for me! It still runs great with 1.9.3. It may be worth noting that I also installed Ruby 2.0 via RVM. I made sure to update to the latest RVM before doing so.
What seems to be the problem?
There is a pull request to fix this, but it has not been accepted yet: https://github.com/neo/ruby_koans/pull/84
For now, you can edit line 149 of src/edgecase.rb to be:
in_ruby_version("1.9", "2.0") do

Resources