rubygems

How to skip require in ruby?

房东的猫 提交于 2020-01-04 11:12:32
问题 Can I conditionally skip requiring a file in Ruby? begin require 'aws-sdk' rescue LoadError puts "aws-sdk gem not found" end namespace :db do desc "import local postgres database to heroku. user and database name is hardcoded" task :import_to_heroku => [:environment, "db:dump_for_heroku"] do # code using aws-sdk gem end end In the above code, can I ask Ruby not to read after rescue LoadError I can wrap the whole code in an conditional but that is inelegant. I tried next and return . EDIT:

Rails Engage! Error (Can't mass-assign protected attributes: user)

瘦欲@ 提交于 2020-01-04 09:39:06
问题 I'm working on installing Engage! I followed the installation instructions found here: http://engagecsm.com/readme Installation steps I did: Add Engage! to the application's Gemfile: gem 'engagecsm'. Install it: bundle install. Run the generator: rails generate engage User. Run the migrations: rake db:migrate. Now, I can go to localhost:3000/engage This is what shows up: Now, when I hit "Create Topic", nothing happens on the site. I look at my rails server console and I see this: (Easier to

SSL error with Rubygems (unable to connect)

大憨熊 提交于 2020-01-04 06:57:08
问题 I've installed a fresh version of ruby 2.3.3 via RVM and I'm attempting to install rails ( gem install rails ) however, when I do I receive the following error: ERROR: Could not find a valid gem 'rails' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/specs.4.8.gz) I have followed the instructions on the SSL cert page on rubygem to no avail. Every cert I can find within

Minimagick error during upload “composite -compose Over -gravity North”

霸气de小男生 提交于 2020-01-04 05:46:31
问题 I am trying to upload an image by gem "carrierwave", "~> 1.1.0" and gem "mini_magick", "~> 4.7.0" to upload image. I am getting this error. I am using this code to upload image. MiniMagick::Tool::Convert.new do |i| i.size "#{image_width.ceil}x#{watermarked_image_height.ceil}" i.gravity "center" i.xc "white" i << temp_image_path end @_watermarked_image = MiniMagick::Image.open(temp_image_path) @_watermarked_image = @_watermarked_image.composite(source_image, "jpg") do |c| c.compose "Over" c

Heroku push hanging on “fetching gem metadata from rubygems” with no errors or trace of any kind

末鹿安然 提交于 2020-01-04 05:26:15
问题 My deployment is stuck on fetching gem metadata from rubygems every time I deploy. It worked this morning, had problems this afternoon and now it's not working again. We tried from somewhere else and from other computers with the same result. It works fine locally I can update from rubygems without a problem. Visual: Delta compression using up to 4 threads. Compressing objects: 100% (9/9), done. Writing objects: 100% (9/9), 764 bytes, done. Total 9 (delta 7), reused 0 (delta 0) -----> Heroku

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. Archlinux

為{幸葍}努か 提交于 2020-01-04 05:25:13
问题 I'm trying to run jekyll locally on my laptop. I followed the guide of Github to do that, https://help.github.com/articles/using-jekyll-with-pages Unfortunaly I'm stuck when I have typed $bundle install I get the following error: Fetching gem metadata from https://rubygems.org/.........Failed to load /etc/gemrc due to permissions problem. Resolving dependencies... Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb checking for main() in -lc... ***

Upgrading Bundler Version on Heroku

橙三吉。 提交于 2020-01-04 04:40:09
问题 I need an updated version of bundler on my heroku application (cedar 14) and I haven't seen any reason why I can't do this. I'm stuck at 1.6.6 which is a couple months old and I need the most up to date version. I need to specify a source: option for one of my gems and the older version of bundler doesn't allow this. Additionally, running heroku run gem update bundler successfully updates but 'heroku run bundle -v' yields 1.6.6. Why? 回答1: You can modify the bundler version used by specifying

What's the best way to list a non-ruby dependency of a gem?

走远了吗. 提交于 2020-01-04 04:31:05
问题 I am writing a ruby gem that I would like to use an open source program distributed as python. I don't have the time to port the python program to ruby, and I want to manage the external dependency as automatically as possible. I'm thinking of using the Gem.pre_install hook to automatically easy_install the python package I'm interested in. http://rubygems.rubyforge.org/rubygems-update/Gem.html#method-c-pre_install I'd appreciate suggestions of better ways, or support of pre_install, if it's

Gem repository not found when installing rails

谁说我不能喝 提交于 2020-01-04 02:53:31
问题 I have Ruby 1.8.7 and Ruby 1.9.2 installed on my Windows Machine. In my console when I do ruby -v it gives me Ruby 1.8.7 Now when I try gem install rails -v 2.3.8 I get this error ERROR: http://gems.rubyforge.org/ does not appear to be a repository ERROR: could not find gem rails locally or in a repository My RubyGems version show 1.3.5 so I tried to update it gem update --system I get this error Updating RubyGems ERROR: http://gems.rubyforge.org/ does not appear to be a repository ERROR:

Add a VPC node to ELB programmatically

安稳与你 提交于 2020-01-04 02:41:11
问题 The following code is intended to add a newly deployed EC2 instance in a VPC to a load balancer. (This is pretty obviously test/dummy code, but the general workflow is the same in a real system) require 'yaml' gem 'aws-sdk','1.6.0' require 'aws-sdk' AWS.config({ :access_key_id => KEY, :secret_access_key => SECRET_KEY }) ec2 = AWS::EC2.new elb = AWS::ELB.new i = ec2.instances["i-abcd1234"] elb.load_balancers["lb-name"].instances.register(i) When I run this code, I get this error: AWS::ELB: