Rails 3.1 plugin gem, dummy test app, rspec

Create the plugin without test-unit and specify the path for the dummy application: rails plugin new foobar –skip-test-unit –dummy-path=spec/dummy Add rspec-rails as a development dependency to the gemspec file (foobar.gemspec): Gem::Specification.new do |s| . . . s.add_development_dependency “rspec-rails” end Run bundle install Create a symlink from the dummy app to the plugin spec directory and … Read more

What is the modern way to structure a ruby gem?

Some posts that I have found useful: http://chneukirchen.github.com/rps/ http://tomayko.com/writings/require-rubygems-antipattern http://yehudakatz.com/2009/07/24/rubygems-good-practice/ http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices Edit (2012-01-10): An excellent all-around guide to gem best practices is RubyGems Guides. I would highly recommend starting here now. To summarize the key points: Use the basic lib/gem.rb and lib/gem/ structure for code. Put any executables in bin, any data files in data … Read more

Writing a Ruby extension in Go (golang)

Go 1.5 added support for building shared libraries that are callable from C (and thus from Ruby via FFI). This makes the process easier than in pre-1.5 releases (when it was necessary to write the C glue layer), and the Go runtime is now usable, making this actually useful in real life (goroutines and memory … Read more

Rails: How can I remove default version of bundler?

For those who use rbenv, let say by accidentally you have two default versions $ gem list | grep bundler bundler (default: 2.1.4, default: 1.17.2) Check your gem installation path $ gem environment RubyGems Environment: . . – INSTALLATION DIRECTORY: /home/yohanes/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0 . Go to the specifications/default directory and look for bundlers gemspec $ cd /home/yohanes/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/specifications/default … Read more

How to Remove/Disable Sign Up From Devise

The easiest way is just removing :registerable devise module from the default list defined into your Model (the class name used for the application’s users, usually User). class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable … end So you’ll have it like this: class User < ActiveRecord::Base devise :database_authenticatable, :recoverable, :rememberable, :trackable, … Read more

pod init cause RuntimeError – [Xcodeproj] Unknown object version

I’ve got very similar error: RuntimeError – [Xcodeproj] Unknown object version (56). It turns out the cocopapods doesn’t know how to work with Xcode 14 project version properly and it complains instead. To solve the issue, open Xcode project on the right side utility panel and change the project version to Xcode 13.0 – compatible … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)