School of hard knocks
In a previous post, I had mentioned that I hosting my gem(s) on RubyForge. Well, that didn't work out for me as couldn't get "git" to push to the repository. I've managed to get Heroku working, starting with a project on GitHub. But no luck with RubyForge. I had opened a support ticket some time ago & no response. So I will be moving my public projects to RubyGems.Rubygems has some tooling and documentation for Gem building. I installed the tooling and my development environment broke. Yes, likely my fault as I was lazy and ignored all of the "wax-on/wax-off" about setting up a Ruby environment.
Lesson #1: Use rvm (Ruby Version Manager). This tool installs ruby to your own private area so you don't mess up your system installation. Particularly good advice if you are on a Macintosh. For me, I'm running Fedora and I had to do the standalone install of rvm. It worked, although I had to properly modify the search path. rvm is truly private to you.
Lesson #2: Install gems locally, not into your system. When things are looking very confused and your development environment is messed up, I find it useful to delete my '~/.gem' directory and use bundle install to rebuild it.
Lesson #3: Use gem version numbers in your Gemfile. Things aren't as stable as one would like, so pinning things down is helpful.
Upgrading to Rails 4.0
I had followed this post: http://blog.barbershoplabs.com/blog/2013/02/27/upgrading-from-rails-32-to-rails-40The biggest culprit was in my config/application.rb file. require "active_resource/railtie" doesn't work and I just commented it out. Rake now works and I'm keeping my fingers crossed.
I'm now just cleaning up after the new set of error messages. Those seem obvious.
Update:
I generated a new Rails 4.0 project. I wrote a small ruby script to compare and modify my existing project based upon the new reference projects. It added missing directories and copied over any missing ruby files. For ruby files that existed in both and were different, I had the script invoke the merge tool "meld". The deltas weren't all that bad to merge.
#! /usr/bin/env ruby
require 'fileutils'
ref_dir = "reference/"
src_dir = "target_project/"
# okay, let's start with directories
l4 = Dir[ "#{ref_dir}**/**/**/**" ]
# puts l4
l4.each do |n|
result = File.stat( n)
if File.stat(n).directory? then
# Take off the front part
p = n[(ref_dir.length..-1)]
# puts "subpath #{p}"
d = File.join( src_dir, p)
if !File.directory?( d) then
puts "Directory #{d} does not exist, creating it"
`mkdir -p #{d}`
end
next
end
end
l4.each do |n|
result = File.stat( n)
if File.file?(n) then
# Take off the front part
p = n[(ref_dir.length..-1)]
# puts "subpath #{p}"
d = File.join( src_dir, p)
if !File.file?( d) then
puts "File #{d} does not exist, copying it over"
`cp #{n} #{d}`
end
next
end
end
l4.each do |n|
result = File.stat( n)
if File.file?(n) then
# Take off the front part
p = n[(ref_dir.length..-1)]
# puts "subpath #{p}"
d = File.join( src_dir, p)
if File.file?( d) then
if d.match( /\.rb$/) then
result = FileUtils.cmp( n, d)
if( !result) then
puts "Ruby file #{d} does not match"
r = `diff #{n} #{d}`
`meld #{n} #{d}`
end
end
end
next
end
end
No comments:
Post a Comment