Can't start new application RoR, using Cygwin on Windows - ruby-on-rails-3

I've been following this tutorial. When i started the new app in chapter 3 i came across and issue with gem json. i thought i should abbandon the app and start again. Now i can't even start a new app. Here's the error i get.
$ rails new sample_app2
/usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find json (~> 1.4) amongst [actionmailer-3.2.2, actionpack-3.2.2, activemodel-3.2.2, activerecord-3.2.2, activeresource-3.2.2, activesupport-3.2.2, addressable-2.2.7, arel-3.0.2, builder-3.0.0, bundler-1.1.3, bundler-1.1.2, coffee-rails-3.2.2, coffee-script-2.2.0, coffee-script-source-1.2.0, diff-lcs-1.1.3, erubis-2.7.0, execjs-1.3.0, heroku-2.22.0, heroku-2.21.3, hike-1.2.1, i18n-0.6.0, journey-1.0.3, jquery-rails-2.0.1, json_pure-1.6.6, launchy-2.1.0, mail-2.4.4, mime-types-1.18, multi_json-1.2.0, multi_json-1.1.0, netrc-0.7.1, polyglot-0.3.3, rack-1.4.1, rack-cache-1.2, rack-ssl-1.3.2, rack-test-0.6.1, rails-3.2.2, railties-3.2.2, rake-0.9.2.2, rdoc-3.12, rest-client-1.6.7, rspec-2.9.0, rspec-core-2.9.0, rspec-expectations-2.9.0, rspec-mocks-2.9.0, rspec-rails-2.9.0, rubyzip-0.9.6.1, sass-3.1.15, sass-rails-3.2.5, sprockets-2.3.1, sprockets-2.1.2, sqlite3-1.3.5, sqlite3-ruby-1.3.3, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, tzinfo-0.3.32, uglifier-1.2.3] (Gem::LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:772:in `activate_dependencies'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:761:in `each'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:761:in `activate_dependencies'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:745:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:775:in `activate_dependencies'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:761:in `each'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:761:in `activate_dependencies'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:745:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:1211:in `gem'
from /usr/bin/rails:18
I've noticed previous recommendations to install DevKit, but I'm not sure if that is the right move with Cygwin???

Ruby installer worked so much better for me. Cygwin just provided so many problems. It may have been mainly user error, but everywhere I turned I ran into brick walls.
Here's a great tutorial (with downloads) on installing Ruby on Rails including sqlite, bundler, git and devkit
http://railsinstaller.org/

Related

Failing to synchronize to repository in Tooltwist Designer

When trying to synchronize changes to the repository, I am receiving the following error:
[designer#ip-address ~]$ ruby /home/designer/server/extension-projects/tooltwist/config/bin/syncWithGit.rb /home/designer/server/webdesign-projects/webdesign list
M navpoints/project.xml
M properties.xml
?? widgets/project_pages/training/7a12a84b6942f195f71bec5d5d8c68caec753293/
/home/designer/server/extension-projects/tooltwist/config/bin/syncWithGit.rb:28:in `block in main_list': undefined method `each' for #<String:0x00000002345128> (NoMethodError)
from /home/designer/server/extension-projects/tooltwist/config/bin/syncWithGit.rb:21:in `chdir'
from /home/designer/server/extension-projects/tooltwist/config/bin/syncWithGit.rb:21:in `main_list'
from /home/designer/server/extension-projects/tooltwist/config/bin/syncWithGit.rb:455:in `block in <main>'
from /home/designer/server/extension-projects/tooltwist/config/bin/lib_trollop.rb:740:in `with_standard_exception_handling'
from /home/designer/server/extension-projects/tooltwist/config/bin/syncWithGit.rb:448:in `<main>'
I am getting this error on a newly deployed tooltwist designer in AWS.
This problem will is caused by the version of Ruby you are using. In Ruby 1.9 the function String:each was replaced with String:each_line (See str.each in Ruby isn't working).
You have a choice:
Downgrade to Ruby 1.8
Edit /home/designer/server/extension-projects/tooltwist/config/bin/syncWithGit.rb and replace each with each_line.
Upgrade to ToolTwist v8.3 and use the ToolTwist command line interface to run your Designer. See step 4 in https://github.com/tooltwist/documentation/wiki/Deploying-with-the-v8.3-Controller.

`inflate': buffer error (Zlib::BufError) on doing `bundle install`

I am trying to do a bundle install, but I'm getting the following error:
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/util.rb:40:in `inflate': buffer error (Zlib::BufError)
from /home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/util.rb:40:in `inflate'
from /home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems.rb:536:in `inflate'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:93:in `fetch_spec'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/remote_specification.rb:46:in `_remote_specification'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/remote_specification.rb:51:in `method_missing'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:95:in `block (2 levels) in unmet_dependency_names'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:94:in `map'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:94:in `block in unmet_dependency_names'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:93:in `map'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:93:in `unmet_dependency_names'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:240:in `remote_specs'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:163:in `fetch_specs'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:67:in `specs'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:192:in `block (2 levels) in index'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `each'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `block in index'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:9:in `build'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:185:in `index'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:179:in `resolve'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:109:in `resolve_remotely!'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/installer.rb:83:in `run'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/bin/bundle:23:in `load'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/bin/bundle:23:in `<main>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#voylla/bin/ruby_noexec_wrapper:14:in `eval'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#voylla/bin/ruby_noexec_wrapper:14:in `<main>'
I tried the following:
gem update --sysytem
But still I'm getting the same error. Please can someone help!. Thanks
SOLUTION
Found out what is causing the problem. In the case we are are using geminabox and the for what ever reason the railties-4.1.6.gemspec.rz was corrupted. Don't know how it happened but it was. So what we did was removed the railties-4.1.6
rm shared/gems/proxy/quick/Marshal.4.8/railties-4.1.6.gemspec.rz
after that the system bundled like normal. If you are having the same problem you are going to have to find a way to watch the network calls and see which one of the GET events it is stopping on.
EXTRA READING does not fix bug only suppresses it in some cases
The reason this worked was because the new version used a different version of railties by happen chance. It only gave the impression that this fixed the problem.
Here is some extra info on this bug. But it doesn't total explain why this is happening.
cannot install ruby gems - zlib error
Now they have removed or fixed this code in the v2.0.0-p451 but the ruby-2.1.0 has yet to merge the patches I have yet to go back threw all the code and check each and every version but here is how you can check.
What you are looking for is this file. lib/rubygems/util.rb in there is a method called inflate this method is responsible for unzipping the gem file. However there is some sort of bug with it where it is being called on things that can't be unzipped.
This is a stable version and you wont find lib/rubygems/util.rb v2.0.0-p481. So this is difficult to find but by looking at the source code you can figure out which ones have this bug and which ones don't.
If you are using rvm use this commands to install the correct version
rvm install ruby-2.0.0-p481
To see all know ruby version avaliable you can run this command below.
$ rvm list known
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p547]
[ruby-]2.0.0-p451
[ruby-]2.0.0[-p481]
[ruby-]2.1.1
[ruby-]2.1[.2]
[ruby-]2.1-head
ruby-head
...
By changing to that patch version you will should be ok. I have also found this bug using ruby-2.0.0-p247 as well.
The above code would suggest that you have the bug as well. However it is strange because the github repo says that it was not introduced until Nov 18, 2013.
https://github.com/ruby/ruby/commit/a7fa4d5d9aab150ad4b0c3f3217fe444df69f527.
Anyway I know there is a lot of information here but this bug is tricky. It seams to only effect some version of ruby but because of organization of the code it is hard to tell some times if it is in your version. Best way is to just check to see if you have the util.rb file and if you do then change versions.

Client timeout on AWS Couchbase cluster after upgrading to Ruby 1.9.3

After we upgrade to Rails 3.2.8 with Ruby 1.9.3 (from 1.8.7), our Couchbase client could no longer access our AWS cluster (Couchbase 1.8 Community Edition).
1.9.3p194 :011 > c = Couchbase.new("http://ec2-184-169-237-63.us-west-1.compute.amazonaws.com:8091")
=> #<Couchbase::Bucket:0x007fe12d9e6c98 "http://ec2-184-169-237-63.us-west-1.compute.amazonaws.com:8091/pools/default/buckets/default/" default_format=:document, default_flags=0x0, quiet=false, connected=true, timeout=2500000>
1.9.3p194 :012 > c.get("hello")
Couchbase::Error::Timeout: failed to get value (key="hello", error=0x16)
from (irb):12:in `get'
from (irb):12
from /Users/playmeshinc/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
from /Users/playmeshinc/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
from /Users/playmeshinc/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
On the admin panel, we cannot even see any request reaching the server.
However, if we use the memcache protocol on port 11211, everything works well. If we try the same code and same call on our local couchbase cluster (OSX), things works just fine.
Any idea what might have happened? Is that because the Ruby Couchbase client is not compatible with AWS or Ruby 1.9.3?
Actually I figured out, that's because moxi client on AWS would return internal ips which are not accessible to external machines, that's why it timed out when I was testing from outside.
Gem is definitely compatible with EC2 and 1.9.3. What version of couchbase gem are you using? and what version of libcouchbase? Sounds like the culprit might be rvm or something else. I recommend trying to gem uninstall, and reinstall. Also make sure libcouchbase is up to date.

as_paperclip_bridge initialization error in rails3

I'm trying to use both of PaperClip and ActiveScaffold with help of as_paperclip_bridge in a rails3.0.5 project.
However, following initialization error is occurred when I launch the project.
=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/Users/ken/Documents/NetBeansProjects/fcheck/vendor/plugins/as_paperclip_bridge/init.rb:10: undefined method bridge' for ActiveScaffold:Module (NoMethodError)
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/plugin.rb:81
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:ininstance_exec'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in run'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:inrun_initializers'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in each'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:inrun_initializers'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in initialize!'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:insend'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in method_missing'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config/environment.rb:7
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:inrequire'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in require'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:inload_dependency'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in new_constants_in'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:inload_dependency'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in require'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:3
from C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:ininstance_eval'
from C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in initialize'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:1:innew'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:1
The code in as_paperclip_bridge\init.rb is attempting to call a module method 'ActiveScaffold.bridge' but it coun't be found.
Even though, same code is working without error in rails2.3.8 project.
We can see a big difference of rails initialization code between version 2 and 3.
On rails 2.3.8, plugins are loaded in 'load_plugins' method which is called after 'load_gems' method in initializer.rb. However, rails3 doesn't have initializer.rb and the loading process seems to be totally different.
I also have tried to remove AS gem and install both of AS plugin with as_paperclip_bridge plugin. But, the error haven't disappeared.
Could someone explain why the error is occurring?!
Anyway, I really hope to get any solution or workaround.
Thanks,
Kenichi
Self reply.
I had realized that as_paperclip_bridge was not required for latest ActiveScaffold implementation. (It's including the bridge)
Please make sure to install ImageMagick and RMagick gem to use PaperClip for image files. Or, you may also think 'as_paperclip_bridge should be there'
Thank you,
Kenichi

Bundle install Jquery-rails taking too long to respond from gemcutter

Hi guys the gem jquery-rails(0.2.7) cant seem to be installed on my machine saying there are too many connections and it times out, I know this is not actualy programming but it is a fundamental for any ROR programmer esp in rails 3, so i'm actually looking for any1 who might have came across this error and resolved it. The error is as follows.
/usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:365:in request': too many connection resets (http://production.cf.rubygems.org/gems/libxml-ruby-1.1.4.gem) (Gem::RemoteFetcher::FetchError)
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:289:inopen_uri_or_path'
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:298:in open_uri_or_path'
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:172:infetch_path'
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:110:in download'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:253:indownload_gem_from_uri'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:76:in fetch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:45:inrun'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:ineach'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:44:in run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:8:ininstall'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:insend'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:ininvoke_task'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in dispatch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:instart'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
Thanks in advance
~D
This is a connection issue. Try running the command again will install the gem.