say that the product is already activated first

This commit is contained in:
Laurent Sansonetti
2012-04-03 20:45:26 +02:00
parent 896a80bfb9
commit f3191e00a1

View File

@@ -48,6 +48,10 @@ class ActivateCommand < Command
self.help = 'Activate the software license'
def self.run(args)
if File.exist?(LicensePath)
die "Product is already activated. Delete the license file `#{LicensePath}' if you want to activate a new license."
end
if args.size != 1
die "Usage: motion activate <license-key>"
end
@@ -57,10 +61,6 @@ class ActivateCommand < Command
die "Given license key `#{license_key}' seems invalid. It should be a string of 40 hexadecimal characters. Check the mail you received after the order, or contact us if you need any help: info@hipbyte.com"
end
if File.exist?(LicensePath)
die "Product is already activated. Delete the license file `#{LicensePath}' if you want to activate a new license."
end
need_root
File.open(LicensePath, 'w') { |io| io.write license_key }
puts "Product activated. Thanks for purchasing RubyMotion :-)"