Create a gist now

Instantly share code, notes, and snippets.

Using upgradinate to upgrade from Ruby 1.8.7(REE) to 1.9.3.
gem 'fast_rake'
gem 'nokogiri-diff'
gem 'rcov', '~> 0.9.11' # RUBY 187
# RUBY 193 gem 'simplecov'
# RUBY 193 gem 'ehrenmurdick-git-pair'
# RUBY 193 gem 'debugger'
gem 'net-ping'
platform :ruby_18 do # These are problematic in ruby 1.9 # RUBY 187
gem 'system_timer' # Remove this from guardfile when we upgrade (in favor of native timer) # RUBY 187
gem 'ruby-debug' # RUBY 187
end # RUBY 187
platform :ruby_19 do # RUBY 187
gem 'ruby-debug19' # RUBY 187
end # RUBY 187
end
group :deployment do
gem 'lp_on_rails', :require => nil
end
#!/usr/bin/env ruby
# USAGE:
# - Run upgradinate from source project
# - cd into new project
# - run build fix breakages
# - backport them into source project
# - Rinse/Repeat
Dir.glob("#{File.dirname(__FILE__)}/lib/*", &method(:load))
@atlas = '/Users/dev/projects/atlas/atlas'
@atlas193 = '/Users/dev/projects/atlas/atlas193'
@babushka = '/Users/dev/.babushka/deps'
@babushka193 = '/Users/dev/.babushka/deps193'
def usage
puts <<-USAGE
upgradinate.rb upgrades Atlas, Christo, API and Krishna code to run on
Ruby 1.9.3.
NOTE: this script upgradinates files under:
#{@atlas193}
#{@babushka193}
usage: ruby script/upgradinate/ree.rb [--help]
USAGE
end
def quality_check(path)
if system("grep '# RUBY' #{path}/* -ilR --exclude-dir=#{@atlas193}/script/upgradinate --exclude-dir=#{@atlas193}/target/reports --exclude-dir=#{@atlas193}/tmp")
raise 'The above files have not been Upgradinated!'
end
end
def upgradinate
puts "Removing #{@atlas193}"
`rm -fr #{@atlas193}`
puts "Copying #{@atlas} to #{@atlas193}"
`cp -r #{@atlas}/ #{@atlas193}/`
`cp -r #{@babushka}/ #{@babushka193}/`
puts "removing coverage records, so that we don't fail based on that"
`find #{@atlas193} -name ".last_run.json" | xargs rm`
puts 'Upgradinating files in atlas193 directory'
upgradinate_files [
"#{@atlas193}/Gemfile",
"#{@atlas193}/app/controllers/ui/admin/place_inventory_controller.rb",
"#{@atlas193}/app/controllers/ui/merge_pois_controller.rb",
"#{@atlas193}/app/models/content_section.rb",
"#{@atlas193}/app/models/export/file_path.rb",
"#{@atlas193}/app/models/export/export_report.rb",
"#{@atlas193}/app/models/odt_author_pack_export.rb",
"#{@atlas193}/app/models/odt_metadata.rb",
"#{@atlas193}/app/models/product.rb",
"#{@atlas193}/app/models/report/csv_report.rb",
"#{@atlas193}/app/views/api/books/index.xml.erb",
"#{@atlas193}/config/application.rb",
"#{@atlas193}/config/database.yml",
"#{@atlas193}/config/roodi.yml",
"#{@atlas193}/lib/atlas_poi_linker.rb",
"#{@atlas193}/lib/core_ext/string.rb",
"#{@atlas193}/lib/generators/import_place_shapes/import_place_shapes_generator.rb",
"#{@atlas193}/lib/poi_csv_export.rb",
"#{@atlas193}/lib/tasks/fast.rake",
"#{@atlas193}/lib/tasks/rspec.rake",
"#{@atlas193}/rubyversion",
"#{@atlas193}/script/upgradinate/lib/file-helper.rb",
"#{@atlas193}/spec/controllers/ui/admin/place_inventory_controller_spec.rb",
"#{@atlas193}/spec/lib/atlas_poi_linker_spec.rb",
"#{@atlas193}/spec/lib/core_ext/string_spec.rb",
"#{@atlas193}/spec/lib/poi_csv_export_spec.rb",
"#{@atlas193}/spec/spec_helper.rb",
"#{@atlas193}/lib/acml/fragment_parser.rb",
"#{@atlas193}/spec/lib/acml/migrator_behaviour.rb",
"#{@babushka193}/apache.rb",
"#{@babushka193}/bootstrap.sh",
"#{@babushka193}/gems.rb",
"#{@babushka193}/ruby_versions.rb",
"#{@babushka193}/rvm.rb",
"#{@babushka193}/textmate.rb",
]
FileUtils.rm_f [
"#{@atlas193}/config/initializers/undefine_deprecated_object_methods.rb"
]
quality_check @atlas193
quality_check @babushka193
puts 'Done'
end
if ARGV.include?('--help') || ARGV.include?('-h') || ARGV.include?('/?')
usage
else
upgradinate
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment