Bundle : Install gem from private github repository - ruby-on-rails-3

I have got trouble to bundle gems from git private repositories :
gem 'test', :git => 'git://github.com/my_account/test.git'
myapp_folder$ bundle --verbose
Fetching git://github.com/my_account/test.git
fatal: The remote end hung up unexpectedly
Git error: command `git clone 'git://github.com/my_account/test.git' "/Library/Ruby/Gems/1.8/cache/bundler/git/test-7b1f0bd821d503c9d6d421d89c56850dad44c15a" --bare --no-hardlinks` in directory /Users/.../myapp_forlder has failed.
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:583:in `git'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:652:in `cache'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:550:in `specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:356:in `converge_locked_specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:345:in `each'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:345:in `converge_locked_specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:143:in `resolve'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:90:in `specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:85:in `resolve_remotely!'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:43:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:8:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/cli.rb:220:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `send'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor.rb:263:in `dispatch'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/base.rb:386:in `start'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/bin/bundle:13
/usr/bin/bundle:19:in `load'
/usr/bin/bundle:19
It work perfectly with push/pull/whatever the private clone it-self.
It work perfectly with bundling my public github repository.
I'm on Mac OS with bundle v 1.0.18
I also try to make some git clone my_private_repo, and it's asking me my account password. Is it normal or it should look at my ssh config and look I already have rights to access.
May be it is the point, but I don't know, how to dig further in this issue.

Use the "SSH" or "HTTP" URLs to your private repo. For example:
# HTTP (I've found this to be more reliable)
gem 'test', :git => 'https://my_account#github.com/my_account/test.git'
# SSH
gem 'test', :git => 'git#github.com:my_account/test.git'
Don't guess them, though. You can get them by going to your github repo page... there are three options at the top.
It's normal to enter a password if it asks.

add this in your ~/.gitconfig
[url "https://"]
insteadOf =git://

Related

Got CompatibilityError while installing pods objective C [duplicate]

I've been trying to use cocoapods and install them into my project but its giving me this error while trying to install it in the project location. its kinda confusing ?
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.37.2/lib/cocoapods/command.rb:127: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.37.2/lib/cocoapods-core/standard_error.rb:88:in `message': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:367:in `handle_exception'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:315:in `rescue in run'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:303:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.37.2/lib/cocoapods/command.rb:46:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.37.2/bin/pod:44:in `<top (required)>'
from /usr/bin/pod:23:in `load'
from /usr/bin/pod:23:in `<main>'
replace this character " ‘ " with this " ' " in your podfile and try to install again.
it's happen to me when I copy pod line from somewhere else (like Evernote), some text editors automatically change this character. Usually it's like this :
pod 'AFNetworking', '~> 2.0'
but when I take from other editor, it could be like this :
pod ‘AFNetworking‘, ‘~> 2.0‘
Follow this steps:
1.open terminal.
2.pod setup // it's take some time to download podfiles
3.pod list //(optional)to see the list of pod
4.cd Desktop//(your project path)
5.cd CoacPods (your project name)
6.vim podfile
7.pod install
Check this out chmod go-w /opt/local/bin at a shell prompt (depending on permissions you may need to sudo to do that).

Cocoa Pods 'No such file or Directory' Error

I have an IOS project that uses cocoapods. After switching computers and updating the OS on the new computer I am getting the following error when I try running "pod update"
Robbys-iMac-454:ios-v2 robbykmyers$ pod update
Update all pods
Analyzing dependencies
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `open': No such file or directory - /Users/robbykmyers/.cocoapods/repos (Errno::ENOENT)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `foreach'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `children'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/sources_manager.rb:63:in `all'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:130:in `repo_information'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:34:in `report'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:58:in `report_error'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:300:in `handle_exception'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:274:in `rescue in run'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:264:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:45:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/bin/pod:43:in `<top (required)>'
from /usr/bin/pod:23:in `load'
from /usr/bin/pod:23:in `<main>'
Does anyone know how to solve this?
Delete the folder ~/.cocoapods/ with rm -rf ~/.cocoapods
Enter pod setup command in Terminal.
This process will take time as this command clones the CocoaPods Specs repository into ~/.cocoapods/ on your computer.
It sometimes occurs when using a wrong apostrophe character in a Podfile or in a Podspec
Those apostrophes are default when using standard TextEdit app on OS X. I prefer Sublime Text to avoid such errors
https://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/
rm -fr ~/Library/Caches/CocoaPods && \
gem update --system && \
gem update && \
gem cleanup && \
pod setup

Installing/Running Thin Webserver on Rails 3

Having an issue running the "Thin" web server. It looks like installation was successful but when I run "thin start" It appears as though Thin starts to initialize but then cannot find some resources it needs.
Below, is the audit trail from my terminal session. Can someone offer a hand with this? According to the Thin docs, installation was done correctly. Thanks
Rails 3.2.12
ruby 1.9.3
root#pgateway:/var/www/testapp# gem install thin
Fetching: eventmachine-1.0.0.gem (100%)
Building native extensions. This could take a while...
Fetching: daemons-1.1.9.gem (100%)
Fetching: thin-1.5.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed eventmachine-1.0.0
Successfully installed daemons-1.1.9
Successfully installed thin-1.5.0
3 gems installed
root#pgateway:/var/www/testapp# thin start
>> Using rack adapter
>> Thin web server (v1.5.0 codename Knife)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/backends /tcp_server.rb:16:in `connect': cannot load such file -- thin/connection (LoadError)
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/backends/base.rb:55:in `block in start'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `call'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/backends/base.rb:63:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/server.rb:159:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/controllers/controller.rb:86:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/runner.rb:187:in `run_command'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/runner.rb:152:in `run!'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/bin/thin:6:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p385/bin/thin:19:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p385/bin/thin:19:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `<main>'
You seem to install thin separate from rails
Add it to your gemfile and you should be fine
If you want to use a gem, it must be in your Gemfile. You can solve your problem as follows:
Add the following line to your Gemfile: gem 'thin'
Update your current app's environment: bundle install
Then start server
Try to execute the following command:
cd to/your/rails/app
echo 'gem "thin"' >> Gemfile
thin start
this content from https://github.com/macournoyer/thin/issues/115

Spork and Guard EADDRINUSE

I'm building a rails app and using Spork/Guard/Rspec for testing.
I'm on a mac (10.6.8) -- here are the gems I'm using:
gem "rspec-rails", "~> 2.12.1"
gem "guard-rspec", "~> 2.3.3"
gem "guard-spork", "~> 1.4.1"
gem "spork", "~> 0.9.2"
gem 'rb-fsevent', '~> 0.9.1', :require => false
gem "growl", "~> 1.0.3"
gem 'capybara', '1.1.2'
When I edit my routes file it should restart the spork server here's the line in my Guardfile:
guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' }, :foreman => true do
watch('config/routes.rb')
end
But recently I just started getting the following error when I add a new route:
Loading Spork.prefork block...
Rack::File headers parameter replaces cache_control after Rack 1.5.
Address already in use - bind(2) (Errno::EADDRINUSE)
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:861:in `initialize'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:861:in `open'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:861:in `open_server'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:759:in `block in open_server'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:757:in `each'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:757:in `open_server'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:1342:in `initialize'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:1624:in `new'
/Users/cyrus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/drb/drb.rb:1624:in `start_service'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/gems/spork-0.9.2/lib/spork/server.rb:29:in `listen'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/gems/spork-0.9.2/lib/spork/server.rb:20:in `run'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/gems/spork-0.9.2/lib/spork/runner.rb:75:in `run'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/gems/spork-0.9.2/lib/spork/runner.rb:10:in `run'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/gems/spork-0.9.2/bin/spork:10:in `<top (required)>'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/bin/spork:23:in `load'
/Users/cyrus/.rvm/gems/ruby-1.9.3-p125#h/bin/spork:23:in `<main>'
Usually when spork boots up I get the following:
Loading Spork.prefork block...
Rack::File headers parameter replaces cache_control after Rack 1.5.
Spork is ready and listening on 8989!
How do I avoid this error?
I came here suffering the same problem as the OP.
After going down the rabbit hole of the 'error is a bug' post, and examining the line of code where the failure occurred, I rebooted out of frustration. I realized after doing this that the lock on the port likely came from the fact that I had logged out of the previous desktop session, and that the Spork DRb server hangs RubyMine on closing, so maybe that is what leaves the port open.
Sure enough, I could now start the Spork server.
I add this so other people facing this problem can consider if it matches their situation.
By removing the :foreman => true in the Guardfile I was able to get rid of this problem. Right now I'm not making meaningful use of the values in my .env file in my tests so that should be fine, but I'm submitting an issue on Github.
Looks like this error is a bug: https://github.com/rails/rails/pull/8812

Could not find cache store adapter for memory_store

For some reason anytime I'm running a Rails 3.0.3 application with Ruby 1.8.7. It's been running fine and I haven't set any cache_store settings anywhere. Now anytime I try to run rake tasks or rails command I get this:
$:rails console production
/home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/cache.rb:65:in `lookup_store': Could not find cache store adapter for memory_store (no such file to load -- active_support/cache/memory_store) (RuntimeError)
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application/bootstrap.rb:48
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/core_ext/kernel/reporting.rb:22:in `with_warnings'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application/bootstrap.rb:48
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `send'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
from /home/marc_m3pt0/m3pt0.com/config/environment.rb:5
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:103:in `require_environment!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:22
from script/rails:6:in `require'
from script/rails:6
Any ideas on what I could be missing?
Thanks so much. My clients site is down right now so any help soon would be appreciated.
UPDATE
When I run rake tasks I get this:
Could not find cache store adapter for memory_store (no such file to load -- active_support/cache/memory_store)
I saw this error recently when a shared host moved an application to a new server. I ended up blowing away the application's bundle and reinstalling it, and it seemed to work.
I use Capistrano for deployment, so if you use something else, YMMV. If your application root is this:
/home/jeff/myapp/
with the following subdirectories:
/home/jeff/myapp/current
/home/jeff/myapp/releases
/home/jeff/myapp/shared
the gem bundle is here:
/home/jeff/myapp/shared/bundle
Then I did:
rm -rf /home/jeff/myapp/shared/bundle
then
cd /home/jeff/myapp
bundle install
Once I did this, it seemed to work for me.