Sha256: ec97fea58a2532b49248e4f44a9aa95bfff08a05ac39e6a711753a282a8643f0
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
namespace :uuids do desc "Installs the uuids gem inside a Rails application" task install: %w(install:migrations) do sh "rake db:migrate SCOPE=uuids" end desc "Uninstalls and removes the uuids gem from a Rails application" task :uninstall do sh "rake db:rollback SCOPE=uuids" remove_gem sh "bundle" end def remove_gem say "Removing the 'uuids' gem" do GEMFILE = /gem\s+["|']uuids["|']/ GEMSPEC = /_dependency\s+["|']uuids["|']/ remove_from_file "Gemfile", GEMFILE Dir["*.gemspec"].each { |file| remove_from_file file, GEMSPEC } end end def remove_from_file(name, regex) say_with_time name do temp = File.read(name).split("\n").reject { |line| line[regex] }.join "\n" File.write name, temp end end def say(name) print "== #{ name } #{ "=" * (75 - name.count) }\n" yield print "\n" end def say_with_time(name) start = seconds print "-- remove from #{ name }\n" yield print " -> #{ seconds - start }s\n" end def seconds Time.now.to_f.round(4) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
uuids-1.0.0.pre.rc1 | lib/tasks/uuids_tasks.rake |